google_cloud_redis_cluster_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate gtype;
25extern crate lazy_static;
26extern crate location;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Request for [CreateCluster][CloudRedis.CreateCluster].
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct CreateClusterRequest {
45    /// Required. The resource name of the cluster location using the form:
46    /// `projects/{project_id}/locations/{location_id}`
47    /// where `location_id` refers to a GCP region.
48    pub parent: std::string::String,
49
50    /// Required. The logical name of the Redis cluster in the customer project
51    /// with the following restrictions:
52    ///
53    /// * Must contain only lowercase letters, numbers, and hyphens.
54    /// * Must start with a letter.
55    /// * Must be between 1-63 characters.
56    /// * Must end with a number or a letter.
57    /// * Must be unique within the customer project / location
58    pub cluster_id: std::string::String,
59
60    /// Required. The cluster that is to be created.
61    pub cluster: std::option::Option<crate::model::Cluster>,
62
63    /// Idempotent request UUID.
64    pub request_id: std::string::String,
65
66    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
67}
68
69impl CreateClusterRequest {
70    pub fn new() -> Self {
71        std::default::Default::default()
72    }
73
74    /// Sets the value of [parent][crate::model::CreateClusterRequest::parent].
75    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
76        self.parent = v.into();
77        self
78    }
79
80    /// Sets the value of [cluster_id][crate::model::CreateClusterRequest::cluster_id].
81    pub fn set_cluster_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
82        self.cluster_id = v.into();
83        self
84    }
85
86    /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
87    pub fn set_cluster<T>(mut self, v: T) -> Self
88    where
89        T: std::convert::Into<crate::model::Cluster>,
90    {
91        self.cluster = std::option::Option::Some(v.into());
92        self
93    }
94
95    /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
96    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
97    where
98        T: std::convert::Into<crate::model::Cluster>,
99    {
100        self.cluster = v.map(|x| x.into());
101        self
102    }
103
104    /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
105    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
106        self.request_id = v.into();
107        self
108    }
109}
110
111impl wkt::message::Message for CreateClusterRequest {
112    fn typename() -> &'static str {
113        "type.googleapis.com/google.cloud.redis.cluster.v1.CreateClusterRequest"
114    }
115}
116
117/// Request for [ListClusters][CloudRedis.ListClusters].
118#[derive(Clone, Default, PartialEq)]
119#[non_exhaustive]
120pub struct ListClustersRequest {
121    /// Required. The resource name of the cluster location using the form:
122    /// `projects/{project_id}/locations/{location_id}`
123    /// where `location_id` refers to a GCP region.
124    pub parent: std::string::String,
125
126    /// The maximum number of items to return.
127    ///
128    /// If not specified, a default value of 1000 will be used by the service.
129    /// Regardless of the page_size value, the response may include a partial list
130    /// and a caller should only rely on response's
131    /// [`next_page_token`][google.cloud.redis.cluster.v1.ListClustersResponse.next_page_token]
132    /// to determine if there are more clusters left to be queried.
133    ///
134    /// [google.cloud.redis.cluster.v1.ListClustersResponse.next_page_token]: crate::model::ListClustersResponse::next_page_token
135    pub page_size: i32,
136
137    /// The `next_page_token` value returned from a previous
138    /// [ListClusters][CloudRedis.ListClusters] request, if any.
139    pub page_token: std::string::String,
140
141    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
142}
143
144impl ListClustersRequest {
145    pub fn new() -> Self {
146        std::default::Default::default()
147    }
148
149    /// Sets the value of [parent][crate::model::ListClustersRequest::parent].
150    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
151        self.parent = v.into();
152        self
153    }
154
155    /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
156    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
157        self.page_size = v.into();
158        self
159    }
160
161    /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
162    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
163        self.page_token = v.into();
164        self
165    }
166}
167
168impl wkt::message::Message for ListClustersRequest {
169    fn typename() -> &'static str {
170        "type.googleapis.com/google.cloud.redis.cluster.v1.ListClustersRequest"
171    }
172}
173
174/// Response for [ListClusters][CloudRedis.ListClusters].
175#[derive(Clone, Default, PartialEq)]
176#[non_exhaustive]
177pub struct ListClustersResponse {
178    /// A list of Redis clusters in the project in the specified location,
179    /// or across all locations.
180    ///
181    /// If the `location_id` in the parent field of the request is "-", all regions
182    /// available to the project are queried, and the results aggregated.
183    /// If in such an aggregated query a location is unavailable, a placeholder
184    /// Redis entry is included in the response with the `name` field set to a
185    /// value of the form
186    /// `projects/{project_id}/locations/{location_id}/clusters/`- and the
187    /// `status` field set to ERROR and `status_message` field set to "location not
188    /// available for ListClusters".
189    pub clusters: std::vec::Vec<crate::model::Cluster>,
190
191    /// Token to retrieve the next page of results, or empty if there are no more
192    /// results in the list.
193    pub next_page_token: std::string::String,
194
195    /// Locations that could not be reached.
196    pub unreachable: std::vec::Vec<std::string::String>,
197
198    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
199}
200
201impl ListClustersResponse {
202    pub fn new() -> Self {
203        std::default::Default::default()
204    }
205
206    /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
207    pub fn set_clusters<T, V>(mut self, v: T) -> Self
208    where
209        T: std::iter::IntoIterator<Item = V>,
210        V: std::convert::Into<crate::model::Cluster>,
211    {
212        use std::iter::Iterator;
213        self.clusters = v.into_iter().map(|i| i.into()).collect();
214        self
215    }
216
217    /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
218    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
219        self.next_page_token = v.into();
220        self
221    }
222
223    /// Sets the value of [unreachable][crate::model::ListClustersResponse::unreachable].
224    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
225    where
226        T: std::iter::IntoIterator<Item = V>,
227        V: std::convert::Into<std::string::String>,
228    {
229        use std::iter::Iterator;
230        self.unreachable = v.into_iter().map(|i| i.into()).collect();
231        self
232    }
233}
234
235impl wkt::message::Message for ListClustersResponse {
236    fn typename() -> &'static str {
237        "type.googleapis.com/google.cloud.redis.cluster.v1.ListClustersResponse"
238    }
239}
240
241#[doc(hidden)]
242impl gax::paginator::internal::PageableResponse for ListClustersResponse {
243    type PageItem = crate::model::Cluster;
244
245    fn items(self) -> std::vec::Vec<Self::PageItem> {
246        self.clusters
247    }
248
249    fn next_page_token(&self) -> std::string::String {
250        use std::clone::Clone;
251        self.next_page_token.clone()
252    }
253}
254
255/// Request for [UpdateCluster][CloudRedis.UpdateCluster].
256#[derive(Clone, Default, PartialEq)]
257#[non_exhaustive]
258pub struct UpdateClusterRequest {
259    /// Required. Mask of fields to update. At least one path must be supplied in
260    /// this field. The elements of the repeated paths field may only include these
261    /// fields from [Cluster][google.cloud.redis.cluster.v1.Cluster]:
262    ///
263    /// * `size_gb`
264    /// * `replica_count`
265    ///
266    /// [google.cloud.redis.cluster.v1.Cluster]: crate::model::Cluster
267    pub update_mask: std::option::Option<wkt::FieldMask>,
268
269    /// Required. Update description.
270    /// Only fields specified in update_mask are updated.
271    pub cluster: std::option::Option<crate::model::Cluster>,
272
273    /// Idempotent request UUID.
274    pub request_id: std::string::String,
275
276    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
277}
278
279impl UpdateClusterRequest {
280    pub fn new() -> Self {
281        std::default::Default::default()
282    }
283
284    /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
285    pub fn set_update_mask<T>(mut self, v: T) -> Self
286    where
287        T: std::convert::Into<wkt::FieldMask>,
288    {
289        self.update_mask = std::option::Option::Some(v.into());
290        self
291    }
292
293    /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
294    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
295    where
296        T: std::convert::Into<wkt::FieldMask>,
297    {
298        self.update_mask = v.map(|x| x.into());
299        self
300    }
301
302    /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
303    pub fn set_cluster<T>(mut self, v: T) -> Self
304    where
305        T: std::convert::Into<crate::model::Cluster>,
306    {
307        self.cluster = std::option::Option::Some(v.into());
308        self
309    }
310
311    /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
312    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
313    where
314        T: std::convert::Into<crate::model::Cluster>,
315    {
316        self.cluster = v.map(|x| x.into());
317        self
318    }
319
320    /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
321    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
322        self.request_id = v.into();
323        self
324    }
325}
326
327impl wkt::message::Message for UpdateClusterRequest {
328    fn typename() -> &'static str {
329        "type.googleapis.com/google.cloud.redis.cluster.v1.UpdateClusterRequest"
330    }
331}
332
333/// Request for [GetCluster][CloudRedis.GetCluster].
334#[derive(Clone, Default, PartialEq)]
335#[non_exhaustive]
336pub struct GetClusterRequest {
337    /// Required. Redis cluster resource name using the form:
338    /// `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
339    /// where `location_id` refers to a GCP region.
340    pub name: std::string::String,
341
342    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
343}
344
345impl GetClusterRequest {
346    pub fn new() -> Self {
347        std::default::Default::default()
348    }
349
350    /// Sets the value of [name][crate::model::GetClusterRequest::name].
351    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
352        self.name = v.into();
353        self
354    }
355}
356
357impl wkt::message::Message for GetClusterRequest {
358    fn typename() -> &'static str {
359        "type.googleapis.com/google.cloud.redis.cluster.v1.GetClusterRequest"
360    }
361}
362
363/// Request for [DeleteCluster][CloudRedis.DeleteCluster].
364#[derive(Clone, Default, PartialEq)]
365#[non_exhaustive]
366pub struct DeleteClusterRequest {
367    /// Required. Redis cluster resource name using the form:
368    /// `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
369    /// where `location_id` refers to a GCP region.
370    pub name: std::string::String,
371
372    /// Idempotent request UUID.
373    pub request_id: std::string::String,
374
375    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
376}
377
378impl DeleteClusterRequest {
379    pub fn new() -> Self {
380        std::default::Default::default()
381    }
382
383    /// Sets the value of [name][crate::model::DeleteClusterRequest::name].
384    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
385        self.name = v.into();
386        self
387    }
388
389    /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
390    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
391        self.request_id = v.into();
392        self
393    }
394}
395
396impl wkt::message::Message for DeleteClusterRequest {
397    fn typename() -> &'static str {
398        "type.googleapis.com/google.cloud.redis.cluster.v1.DeleteClusterRequest"
399    }
400}
401
402/// Request for
403/// [GetClusterCertificateAuthorityRequest][CloudRedis.GetClusterCertificateAuthorityRequest].
404#[derive(Clone, Default, PartialEq)]
405#[non_exhaustive]
406pub struct GetClusterCertificateAuthorityRequest {
407    /// Required. Redis cluster certificate authority resource name using the form:
408    /// `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority`
409    /// where `location_id` refers to a GCP region.
410    pub name: std::string::String,
411
412    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
413}
414
415impl GetClusterCertificateAuthorityRequest {
416    pub fn new() -> Self {
417        std::default::Default::default()
418    }
419
420    /// Sets the value of [name][crate::model::GetClusterCertificateAuthorityRequest::name].
421    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
422        self.name = v.into();
423        self
424    }
425}
426
427impl wkt::message::Message for GetClusterCertificateAuthorityRequest {
428    fn typename() -> &'static str {
429        "type.googleapis.com/google.cloud.redis.cluster.v1.GetClusterCertificateAuthorityRequest"
430    }
431}
432
433/// Request for [ListBackupCollections]
434#[derive(Clone, Default, PartialEq)]
435#[non_exhaustive]
436pub struct ListBackupCollectionsRequest {
437    /// Required. The resource name of the backupCollection location using the
438    /// form:
439    /// `projects/{project_id}/locations/{location_id}`
440    /// where `location_id` refers to a GCP region.
441    pub parent: std::string::String,
442
443    /// Optional. The maximum number of items to return.
444    ///
445    /// If not specified, a default value of 1000 will be used by the service.
446    /// Regardless of the page_size value, the response may include a partial list
447    /// and a caller should only rely on response's
448    /// [`next_page_token`][google.cloud.redis.cluster.v1.ListBackupCollectionsResponse.next_page_token]
449    /// to determine if there are more clusters left to be queried.
450    ///
451    /// [google.cloud.redis.cluster.v1.ListBackupCollectionsResponse.next_page_token]: crate::model::ListBackupCollectionsResponse::next_page_token
452    pub page_size: i32,
453
454    /// Optional. The `next_page_token` value returned from a previous
455    /// [ListBackupCollections] request, if any.
456    pub page_token: std::string::String,
457
458    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
459}
460
461impl ListBackupCollectionsRequest {
462    pub fn new() -> Self {
463        std::default::Default::default()
464    }
465
466    /// Sets the value of [parent][crate::model::ListBackupCollectionsRequest::parent].
467    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
468        self.parent = v.into();
469        self
470    }
471
472    /// Sets the value of [page_size][crate::model::ListBackupCollectionsRequest::page_size].
473    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
474        self.page_size = v.into();
475        self
476    }
477
478    /// Sets the value of [page_token][crate::model::ListBackupCollectionsRequest::page_token].
479    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
480        self.page_token = v.into();
481        self
482    }
483}
484
485impl wkt::message::Message for ListBackupCollectionsRequest {
486    fn typename() -> &'static str {
487        "type.googleapis.com/google.cloud.redis.cluster.v1.ListBackupCollectionsRequest"
488    }
489}
490
491/// Response for [ListBackupCollections].
492#[derive(Clone, Default, PartialEq)]
493#[non_exhaustive]
494pub struct ListBackupCollectionsResponse {
495    /// A list of backupCollections in the project.
496    ///
497    /// If the `location_id` in the parent field of the request is "-", all regions
498    /// available to the project are queried, and the results aggregated.
499    /// If in such an aggregated query a location is unavailable, a placeholder
500    /// backupCollection entry is included in the response with the `name` field
501    /// set to a value of the form
502    /// `projects/{project_id}/locations/{location_id}/backupCollections/`- and the
503    /// `status` field set to ERROR and `status_message` field set to "location not
504    /// available for ListBackupCollections".
505    pub backup_collections: std::vec::Vec<crate::model::BackupCollection>,
506
507    /// Token to retrieve the next page of results, or empty if there are no more
508    /// results in the list.
509    pub next_page_token: std::string::String,
510
511    /// Locations that could not be reached.
512    pub unreachable: std::vec::Vec<std::string::String>,
513
514    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
515}
516
517impl ListBackupCollectionsResponse {
518    pub fn new() -> Self {
519        std::default::Default::default()
520    }
521
522    /// Sets the value of [backup_collections][crate::model::ListBackupCollectionsResponse::backup_collections].
523    pub fn set_backup_collections<T, V>(mut self, v: T) -> Self
524    where
525        T: std::iter::IntoIterator<Item = V>,
526        V: std::convert::Into<crate::model::BackupCollection>,
527    {
528        use std::iter::Iterator;
529        self.backup_collections = v.into_iter().map(|i| i.into()).collect();
530        self
531    }
532
533    /// Sets the value of [next_page_token][crate::model::ListBackupCollectionsResponse::next_page_token].
534    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
535        self.next_page_token = v.into();
536        self
537    }
538
539    /// Sets the value of [unreachable][crate::model::ListBackupCollectionsResponse::unreachable].
540    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
541    where
542        T: std::iter::IntoIterator<Item = V>,
543        V: std::convert::Into<std::string::String>,
544    {
545        use std::iter::Iterator;
546        self.unreachable = v.into_iter().map(|i| i.into()).collect();
547        self
548    }
549}
550
551impl wkt::message::Message for ListBackupCollectionsResponse {
552    fn typename() -> &'static str {
553        "type.googleapis.com/google.cloud.redis.cluster.v1.ListBackupCollectionsResponse"
554    }
555}
556
557#[doc(hidden)]
558impl gax::paginator::internal::PageableResponse for ListBackupCollectionsResponse {
559    type PageItem = crate::model::BackupCollection;
560
561    fn items(self) -> std::vec::Vec<Self::PageItem> {
562        self.backup_collections
563    }
564
565    fn next_page_token(&self) -> std::string::String {
566        use std::clone::Clone;
567        self.next_page_token.clone()
568    }
569}
570
571/// Request for [GetBackupCollection].
572#[derive(Clone, Default, PartialEq)]
573#[non_exhaustive]
574pub struct GetBackupCollectionRequest {
575    /// Required. Redis backupCollection resource name using the form:
576    /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
577    /// where `location_id` refers to a GCP region.
578    pub name: std::string::String,
579
580    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
581}
582
583impl GetBackupCollectionRequest {
584    pub fn new() -> Self {
585        std::default::Default::default()
586    }
587
588    /// Sets the value of [name][crate::model::GetBackupCollectionRequest::name].
589    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
590        self.name = v.into();
591        self
592    }
593}
594
595impl wkt::message::Message for GetBackupCollectionRequest {
596    fn typename() -> &'static str {
597        "type.googleapis.com/google.cloud.redis.cluster.v1.GetBackupCollectionRequest"
598    }
599}
600
601/// Request for [ListBackups].
602#[derive(Clone, Default, PartialEq)]
603#[non_exhaustive]
604pub struct ListBackupsRequest {
605    /// Required. The resource name of the backupCollection using the form:
606    /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
607    pub parent: std::string::String,
608
609    /// Optional. The maximum number of items to return.
610    ///
611    /// If not specified, a default value of 1000 will be used by the service.
612    /// Regardless of the page_size value, the response may include a partial list
613    /// and a caller should only rely on response's
614    /// [`next_page_token`][google.cloud.redis.cluster.v1.ListBackupsResponse.next_page_token]
615    /// to determine if there are more clusters left to be queried.
616    ///
617    /// [google.cloud.redis.cluster.v1.ListBackupsResponse.next_page_token]: crate::model::ListBackupsResponse::next_page_token
618    pub page_size: i32,
619
620    /// Optional. The `next_page_token` value returned from a previous
621    /// [ListBackupCollections] request, if any.
622    pub page_token: std::string::String,
623
624    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
625}
626
627impl ListBackupsRequest {
628    pub fn new() -> Self {
629        std::default::Default::default()
630    }
631
632    /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
633    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
634        self.parent = v.into();
635        self
636    }
637
638    /// Sets the value of [page_size][crate::model::ListBackupsRequest::page_size].
639    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
640        self.page_size = v.into();
641        self
642    }
643
644    /// Sets the value of [page_token][crate::model::ListBackupsRequest::page_token].
645    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
646        self.page_token = v.into();
647        self
648    }
649}
650
651impl wkt::message::Message for ListBackupsRequest {
652    fn typename() -> &'static str {
653        "type.googleapis.com/google.cloud.redis.cluster.v1.ListBackupsRequest"
654    }
655}
656
657/// Response for [ListBackups].
658#[derive(Clone, Default, PartialEq)]
659#[non_exhaustive]
660pub struct ListBackupsResponse {
661    /// A list of backups in the project.
662    pub backups: std::vec::Vec<crate::model::Backup>,
663
664    /// Token to retrieve the next page of results, or empty if there are no more
665    /// results in the list.
666    pub next_page_token: std::string::String,
667
668    /// Backups that could not be reached.
669    pub unreachable: std::vec::Vec<std::string::String>,
670
671    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
672}
673
674impl ListBackupsResponse {
675    pub fn new() -> Self {
676        std::default::Default::default()
677    }
678
679    /// Sets the value of [backups][crate::model::ListBackupsResponse::backups].
680    pub fn set_backups<T, V>(mut self, v: T) -> Self
681    where
682        T: std::iter::IntoIterator<Item = V>,
683        V: std::convert::Into<crate::model::Backup>,
684    {
685        use std::iter::Iterator;
686        self.backups = v.into_iter().map(|i| i.into()).collect();
687        self
688    }
689
690    /// Sets the value of [next_page_token][crate::model::ListBackupsResponse::next_page_token].
691    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
692        self.next_page_token = v.into();
693        self
694    }
695
696    /// Sets the value of [unreachable][crate::model::ListBackupsResponse::unreachable].
697    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
698    where
699        T: std::iter::IntoIterator<Item = V>,
700        V: std::convert::Into<std::string::String>,
701    {
702        use std::iter::Iterator;
703        self.unreachable = v.into_iter().map(|i| i.into()).collect();
704        self
705    }
706}
707
708impl wkt::message::Message for ListBackupsResponse {
709    fn typename() -> &'static str {
710        "type.googleapis.com/google.cloud.redis.cluster.v1.ListBackupsResponse"
711    }
712}
713
714#[doc(hidden)]
715impl gax::paginator::internal::PageableResponse for ListBackupsResponse {
716    type PageItem = crate::model::Backup;
717
718    fn items(self) -> std::vec::Vec<Self::PageItem> {
719        self.backups
720    }
721
722    fn next_page_token(&self) -> std::string::String {
723        use std::clone::Clone;
724        self.next_page_token.clone()
725    }
726}
727
728/// Request for [GetBackup].
729#[derive(Clone, Default, PartialEq)]
730#[non_exhaustive]
731pub struct GetBackupRequest {
732    /// Required. Redis backup resource name using the form:
733    /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
734    pub name: std::string::String,
735
736    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
737}
738
739impl GetBackupRequest {
740    pub fn new() -> Self {
741        std::default::Default::default()
742    }
743
744    /// Sets the value of [name][crate::model::GetBackupRequest::name].
745    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
746        self.name = v.into();
747        self
748    }
749}
750
751impl wkt::message::Message for GetBackupRequest {
752    fn typename() -> &'static str {
753        "type.googleapis.com/google.cloud.redis.cluster.v1.GetBackupRequest"
754    }
755}
756
757/// Request for [DeleteBackup].
758#[derive(Clone, Default, PartialEq)]
759#[non_exhaustive]
760pub struct DeleteBackupRequest {
761    /// Required. Redis backup resource name using the form:
762    /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
763    pub name: std::string::String,
764
765    /// Optional. Idempotent request UUID.
766    pub request_id: std::string::String,
767
768    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
769}
770
771impl DeleteBackupRequest {
772    pub fn new() -> Self {
773        std::default::Default::default()
774    }
775
776    /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
777    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
778        self.name = v.into();
779        self
780    }
781
782    /// Sets the value of [request_id][crate::model::DeleteBackupRequest::request_id].
783    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
784        self.request_id = v.into();
785        self
786    }
787}
788
789impl wkt::message::Message for DeleteBackupRequest {
790    fn typename() -> &'static str {
791        "type.googleapis.com/google.cloud.redis.cluster.v1.DeleteBackupRequest"
792    }
793}
794
795/// Request for [ExportBackup].
796#[derive(Clone, Default, PartialEq)]
797#[non_exhaustive]
798pub struct ExportBackupRequest {
799    /// Required. Redis backup resource name using the form:
800    /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
801    pub name: std::string::String,
802
803    /// Required. Specify destination to export a backup.
804    pub destination: std::option::Option<crate::model::export_backup_request::Destination>,
805
806    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
807}
808
809impl ExportBackupRequest {
810    pub fn new() -> Self {
811        std::default::Default::default()
812    }
813
814    /// Sets the value of [name][crate::model::ExportBackupRequest::name].
815    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
816        self.name = v.into();
817        self
818    }
819
820    /// Sets the value of [destination][crate::model::ExportBackupRequest::destination].
821    ///
822    /// Note that all the setters affecting `destination` are mutually
823    /// exclusive.
824    pub fn set_destination<
825        T: std::convert::Into<std::option::Option<crate::model::export_backup_request::Destination>>,
826    >(
827        mut self,
828        v: T,
829    ) -> Self {
830        self.destination = v.into();
831        self
832    }
833
834    /// The value of [destination][crate::model::ExportBackupRequest::destination]
835    /// if it holds a `GcsBucket`, `None` if the field is not set or
836    /// holds a different branch.
837    pub fn gcs_bucket(&self) -> std::option::Option<&std::string::String> {
838        #[allow(unreachable_patterns)]
839        self.destination.as_ref().and_then(|v| match v {
840            crate::model::export_backup_request::Destination::GcsBucket(v) => {
841                std::option::Option::Some(v)
842            }
843            _ => std::option::Option::None,
844        })
845    }
846
847    /// Sets the value of [destination][crate::model::ExportBackupRequest::destination]
848    /// to hold a `GcsBucket`.
849    ///
850    /// Note that all the setters affecting `destination` are
851    /// mutually exclusive.
852    pub fn set_gcs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
853        self.destination = std::option::Option::Some(
854            crate::model::export_backup_request::Destination::GcsBucket(v.into()),
855        );
856        self
857    }
858}
859
860impl wkt::message::Message for ExportBackupRequest {
861    fn typename() -> &'static str {
862        "type.googleapis.com/google.cloud.redis.cluster.v1.ExportBackupRequest"
863    }
864}
865
866/// Defines additional types related to [ExportBackupRequest].
867pub mod export_backup_request {
868    #[allow(unused_imports)]
869    use super::*;
870
871    /// Required. Specify destination to export a backup.
872    #[derive(Clone, Debug, PartialEq)]
873    #[non_exhaustive]
874    pub enum Destination {
875        /// Google Cloud Storage bucket, like "my-bucket".
876        GcsBucket(std::string::String),
877    }
878}
879
880/// Request for [BackupCluster].
881#[derive(Clone, Default, PartialEq)]
882#[non_exhaustive]
883pub struct BackupClusterRequest {
884    /// Required. Redis cluster resource name using the form:
885    /// `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
886    /// where `location_id` refers to a GCP region.
887    pub name: std::string::String,
888
889    /// Optional. TTL for the backup to expire. Value range is 1 day to 100 years.
890    /// If not specified, the default value is 100 years.
891    pub ttl: std::option::Option<wkt::Duration>,
892
893    /// Optional. The id of the backup to be created. If not specified, the
894    /// default value ([YYYYMMDDHHMMSS]_[Shortened Cluster UID] is used.
895    pub backup_id: std::option::Option<std::string::String>,
896
897    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
898}
899
900impl BackupClusterRequest {
901    pub fn new() -> Self {
902        std::default::Default::default()
903    }
904
905    /// Sets the value of [name][crate::model::BackupClusterRequest::name].
906    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
907        self.name = v.into();
908        self
909    }
910
911    /// Sets the value of [ttl][crate::model::BackupClusterRequest::ttl].
912    pub fn set_ttl<T>(mut self, v: T) -> Self
913    where
914        T: std::convert::Into<wkt::Duration>,
915    {
916        self.ttl = std::option::Option::Some(v.into());
917        self
918    }
919
920    /// Sets or clears the value of [ttl][crate::model::BackupClusterRequest::ttl].
921    pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
922    where
923        T: std::convert::Into<wkt::Duration>,
924    {
925        self.ttl = v.map(|x| x.into());
926        self
927    }
928
929    /// Sets the value of [backup_id][crate::model::BackupClusterRequest::backup_id].
930    pub fn set_backup_id<T>(mut self, v: T) -> Self
931    where
932        T: std::convert::Into<std::string::String>,
933    {
934        self.backup_id = std::option::Option::Some(v.into());
935        self
936    }
937
938    /// Sets or clears the value of [backup_id][crate::model::BackupClusterRequest::backup_id].
939    pub fn set_or_clear_backup_id<T>(mut self, v: std::option::Option<T>) -> Self
940    where
941        T: std::convert::Into<std::string::String>,
942    {
943        self.backup_id = v.map(|x| x.into());
944        self
945    }
946}
947
948impl wkt::message::Message for BackupClusterRequest {
949    fn typename() -> &'static str {
950        "type.googleapis.com/google.cloud.redis.cluster.v1.BackupClusterRequest"
951    }
952}
953
954/// A cluster instance.
955#[derive(Clone, Default, PartialEq)]
956#[non_exhaustive]
957pub struct Cluster {
958    /// Required. Identifier. Unique name of the resource in this scope including
959    /// project and location using the form:
960    /// `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
961    pub name: std::string::String,
962
963    /// Output only. The timestamp associated with the cluster creation request.
964    pub create_time: std::option::Option<wkt::Timestamp>,
965
966    /// Output only. The current state of this cluster.
967    /// Can be CREATING, READY, UPDATING, DELETING and SUSPENDED
968    pub state: crate::model::cluster::State,
969
970    /// Output only. System assigned, unique identifier for the cluster.
971    pub uid: std::string::String,
972
973    /// Optional. The number of replica nodes per shard.
974    pub replica_count: std::option::Option<i32>,
975
976    /// Optional. The authorization mode of the Redis cluster.
977    /// If not provided, auth feature is disabled for the cluster.
978    pub authorization_mode: crate::model::AuthorizationMode,
979
980    /// Optional. The in-transit encryption for the Redis cluster.
981    /// If not provided, encryption  is disabled for the cluster.
982    pub transit_encryption_mode: crate::model::TransitEncryptionMode,
983
984    /// Output only. Redis memory size in GB for the entire cluster rounded up to
985    /// the next integer.
986    pub size_gb: std::option::Option<i32>,
987
988    /// Optional. Number of shards for the Redis cluster.
989    pub shard_count: std::option::Option<i32>,
990
991    /// Optional. Each PscConfig configures the consumer network where IPs will
992    /// be designated to the cluster for client access through Private Service
993    /// Connect Automation. Currently, only one PscConfig is supported.
994    pub psc_configs: std::vec::Vec<crate::model::PscConfig>,
995
996    /// Output only. Endpoints created on each given network, for Redis clients to
997    /// connect to the cluster. Currently only one discovery endpoint is supported.
998    pub discovery_endpoints: std::vec::Vec<crate::model::DiscoveryEndpoint>,
999
1000    /// Output only. The list of PSC connections that are auto-created through
1001    /// service connectivity automation.
1002    pub psc_connections: std::vec::Vec<crate::model::PscConnection>,
1003
1004    /// Output only. Additional information about the current state of the cluster.
1005    pub state_info: std::option::Option<crate::model::cluster::StateInfo>,
1006
1007    /// Optional. The type of a redis node in the cluster. NodeType determines the
1008    /// underlying machine-type of a redis node.
1009    pub node_type: crate::model::NodeType,
1010
1011    /// Optional. Persistence config (RDB, AOF) for the cluster.
1012    pub persistence_config: std::option::Option<crate::model::ClusterPersistenceConfig>,
1013
1014    /// Optional. Key/Value pairs of customer overrides for mutable Redis Configs
1015    pub redis_configs: std::collections::HashMap<std::string::String, std::string::String>,
1016
1017    /// Output only. Precise value of redis memory size in GB for the entire
1018    /// cluster.
1019    pub precise_size_gb: std::option::Option<f64>,
1020
1021    /// Optional. This config will be used to determine how the customer wants us
1022    /// to distribute cluster resources within the region.
1023    pub zone_distribution_config: std::option::Option<crate::model::ZoneDistributionConfig>,
1024
1025    /// Optional. Cross cluster replication config.
1026    pub cross_cluster_replication_config:
1027        std::option::Option<crate::model::CrossClusterReplicationConfig>,
1028
1029    /// Optional. The delete operation will fail when the value is set to true.
1030    pub deletion_protection_enabled: std::option::Option<bool>,
1031
1032    /// Optional. ClusterMaintenancePolicy determines when to allow or deny
1033    /// updates.
1034    pub maintenance_policy: std::option::Option<crate::model::ClusterMaintenancePolicy>,
1035
1036    /// Output only. ClusterMaintenanceSchedule Output only Published maintenance
1037    /// schedule.
1038    pub maintenance_schedule: std::option::Option<crate::model::ClusterMaintenanceSchedule>,
1039
1040    /// Output only. Service attachment details to configure Psc connections
1041    pub psc_service_attachments: std::vec::Vec<crate::model::PscServiceAttachment>,
1042
1043    /// Optional. A list of cluster enpoints.
1044    pub cluster_endpoints: std::vec::Vec<crate::model::ClusterEndpoint>,
1045
1046    /// Optional. Output only. The backup collection full resource name. Example:
1047    /// projects/{project}/locations/{location}/backupCollections/{collection}
1048    pub backup_collection: std::option::Option<std::string::String>,
1049
1050    /// Optional. The KMS key used to encrypt the at-rest data of the cluster.
1051    pub kms_key: std::option::Option<std::string::String>,
1052
1053    /// Optional. The automated backup config for the cluster.
1054    pub automated_backup_config: std::option::Option<crate::model::AutomatedBackupConfig>,
1055
1056    /// Output only. Encryption information of the data at rest of the cluster.
1057    pub encryption_info: std::option::Option<crate::model::EncryptionInfo>,
1058
1059    /// The source to import from.
1060    pub import_sources: std::option::Option<crate::model::cluster::ImportSources>,
1061
1062    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1063}
1064
1065impl Cluster {
1066    pub fn new() -> Self {
1067        std::default::Default::default()
1068    }
1069
1070    /// Sets the value of [name][crate::model::Cluster::name].
1071    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1072        self.name = v.into();
1073        self
1074    }
1075
1076    /// Sets the value of [create_time][crate::model::Cluster::create_time].
1077    pub fn set_create_time<T>(mut self, v: T) -> Self
1078    where
1079        T: std::convert::Into<wkt::Timestamp>,
1080    {
1081        self.create_time = std::option::Option::Some(v.into());
1082        self
1083    }
1084
1085    /// Sets or clears the value of [create_time][crate::model::Cluster::create_time].
1086    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1087    where
1088        T: std::convert::Into<wkt::Timestamp>,
1089    {
1090        self.create_time = v.map(|x| x.into());
1091        self
1092    }
1093
1094    /// Sets the value of [state][crate::model::Cluster::state].
1095    pub fn set_state<T: std::convert::Into<crate::model::cluster::State>>(mut self, v: T) -> Self {
1096        self.state = v.into();
1097        self
1098    }
1099
1100    /// Sets the value of [uid][crate::model::Cluster::uid].
1101    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1102        self.uid = v.into();
1103        self
1104    }
1105
1106    /// Sets the value of [replica_count][crate::model::Cluster::replica_count].
1107    pub fn set_replica_count<T>(mut self, v: T) -> Self
1108    where
1109        T: std::convert::Into<i32>,
1110    {
1111        self.replica_count = std::option::Option::Some(v.into());
1112        self
1113    }
1114
1115    /// Sets or clears the value of [replica_count][crate::model::Cluster::replica_count].
1116    pub fn set_or_clear_replica_count<T>(mut self, v: std::option::Option<T>) -> Self
1117    where
1118        T: std::convert::Into<i32>,
1119    {
1120        self.replica_count = v.map(|x| x.into());
1121        self
1122    }
1123
1124    /// Sets the value of [authorization_mode][crate::model::Cluster::authorization_mode].
1125    pub fn set_authorization_mode<T: std::convert::Into<crate::model::AuthorizationMode>>(
1126        mut self,
1127        v: T,
1128    ) -> Self {
1129        self.authorization_mode = v.into();
1130        self
1131    }
1132
1133    /// Sets the value of [transit_encryption_mode][crate::model::Cluster::transit_encryption_mode].
1134    pub fn set_transit_encryption_mode<
1135        T: std::convert::Into<crate::model::TransitEncryptionMode>,
1136    >(
1137        mut self,
1138        v: T,
1139    ) -> Self {
1140        self.transit_encryption_mode = v.into();
1141        self
1142    }
1143
1144    /// Sets the value of [size_gb][crate::model::Cluster::size_gb].
1145    pub fn set_size_gb<T>(mut self, v: T) -> Self
1146    where
1147        T: std::convert::Into<i32>,
1148    {
1149        self.size_gb = std::option::Option::Some(v.into());
1150        self
1151    }
1152
1153    /// Sets or clears the value of [size_gb][crate::model::Cluster::size_gb].
1154    pub fn set_or_clear_size_gb<T>(mut self, v: std::option::Option<T>) -> Self
1155    where
1156        T: std::convert::Into<i32>,
1157    {
1158        self.size_gb = v.map(|x| x.into());
1159        self
1160    }
1161
1162    /// Sets the value of [shard_count][crate::model::Cluster::shard_count].
1163    pub fn set_shard_count<T>(mut self, v: T) -> Self
1164    where
1165        T: std::convert::Into<i32>,
1166    {
1167        self.shard_count = std::option::Option::Some(v.into());
1168        self
1169    }
1170
1171    /// Sets or clears the value of [shard_count][crate::model::Cluster::shard_count].
1172    pub fn set_or_clear_shard_count<T>(mut self, v: std::option::Option<T>) -> Self
1173    where
1174        T: std::convert::Into<i32>,
1175    {
1176        self.shard_count = v.map(|x| x.into());
1177        self
1178    }
1179
1180    /// Sets the value of [psc_configs][crate::model::Cluster::psc_configs].
1181    pub fn set_psc_configs<T, V>(mut self, v: T) -> Self
1182    where
1183        T: std::iter::IntoIterator<Item = V>,
1184        V: std::convert::Into<crate::model::PscConfig>,
1185    {
1186        use std::iter::Iterator;
1187        self.psc_configs = v.into_iter().map(|i| i.into()).collect();
1188        self
1189    }
1190
1191    /// Sets the value of [discovery_endpoints][crate::model::Cluster::discovery_endpoints].
1192    pub fn set_discovery_endpoints<T, V>(mut self, v: T) -> Self
1193    where
1194        T: std::iter::IntoIterator<Item = V>,
1195        V: std::convert::Into<crate::model::DiscoveryEndpoint>,
1196    {
1197        use std::iter::Iterator;
1198        self.discovery_endpoints = v.into_iter().map(|i| i.into()).collect();
1199        self
1200    }
1201
1202    /// Sets the value of [psc_connections][crate::model::Cluster::psc_connections].
1203    pub fn set_psc_connections<T, V>(mut self, v: T) -> Self
1204    where
1205        T: std::iter::IntoIterator<Item = V>,
1206        V: std::convert::Into<crate::model::PscConnection>,
1207    {
1208        use std::iter::Iterator;
1209        self.psc_connections = v.into_iter().map(|i| i.into()).collect();
1210        self
1211    }
1212
1213    /// Sets the value of [state_info][crate::model::Cluster::state_info].
1214    pub fn set_state_info<T>(mut self, v: T) -> Self
1215    where
1216        T: std::convert::Into<crate::model::cluster::StateInfo>,
1217    {
1218        self.state_info = std::option::Option::Some(v.into());
1219        self
1220    }
1221
1222    /// Sets or clears the value of [state_info][crate::model::Cluster::state_info].
1223    pub fn set_or_clear_state_info<T>(mut self, v: std::option::Option<T>) -> Self
1224    where
1225        T: std::convert::Into<crate::model::cluster::StateInfo>,
1226    {
1227        self.state_info = v.map(|x| x.into());
1228        self
1229    }
1230
1231    /// Sets the value of [node_type][crate::model::Cluster::node_type].
1232    pub fn set_node_type<T: std::convert::Into<crate::model::NodeType>>(mut self, v: T) -> Self {
1233        self.node_type = v.into();
1234        self
1235    }
1236
1237    /// Sets the value of [persistence_config][crate::model::Cluster::persistence_config].
1238    pub fn set_persistence_config<T>(mut self, v: T) -> Self
1239    where
1240        T: std::convert::Into<crate::model::ClusterPersistenceConfig>,
1241    {
1242        self.persistence_config = std::option::Option::Some(v.into());
1243        self
1244    }
1245
1246    /// Sets or clears the value of [persistence_config][crate::model::Cluster::persistence_config].
1247    pub fn set_or_clear_persistence_config<T>(mut self, v: std::option::Option<T>) -> Self
1248    where
1249        T: std::convert::Into<crate::model::ClusterPersistenceConfig>,
1250    {
1251        self.persistence_config = v.map(|x| x.into());
1252        self
1253    }
1254
1255    /// Sets the value of [redis_configs][crate::model::Cluster::redis_configs].
1256    pub fn set_redis_configs<T, K, V>(mut self, v: T) -> Self
1257    where
1258        T: std::iter::IntoIterator<Item = (K, V)>,
1259        K: std::convert::Into<std::string::String>,
1260        V: std::convert::Into<std::string::String>,
1261    {
1262        use std::iter::Iterator;
1263        self.redis_configs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1264        self
1265    }
1266
1267    /// Sets the value of [precise_size_gb][crate::model::Cluster::precise_size_gb].
1268    pub fn set_precise_size_gb<T>(mut self, v: T) -> Self
1269    where
1270        T: std::convert::Into<f64>,
1271    {
1272        self.precise_size_gb = std::option::Option::Some(v.into());
1273        self
1274    }
1275
1276    /// Sets or clears the value of [precise_size_gb][crate::model::Cluster::precise_size_gb].
1277    pub fn set_or_clear_precise_size_gb<T>(mut self, v: std::option::Option<T>) -> Self
1278    where
1279        T: std::convert::Into<f64>,
1280    {
1281        self.precise_size_gb = v.map(|x| x.into());
1282        self
1283    }
1284
1285    /// Sets the value of [zone_distribution_config][crate::model::Cluster::zone_distribution_config].
1286    pub fn set_zone_distribution_config<T>(mut self, v: T) -> Self
1287    where
1288        T: std::convert::Into<crate::model::ZoneDistributionConfig>,
1289    {
1290        self.zone_distribution_config = std::option::Option::Some(v.into());
1291        self
1292    }
1293
1294    /// Sets or clears the value of [zone_distribution_config][crate::model::Cluster::zone_distribution_config].
1295    pub fn set_or_clear_zone_distribution_config<T>(mut self, v: std::option::Option<T>) -> Self
1296    where
1297        T: std::convert::Into<crate::model::ZoneDistributionConfig>,
1298    {
1299        self.zone_distribution_config = v.map(|x| x.into());
1300        self
1301    }
1302
1303    /// Sets the value of [cross_cluster_replication_config][crate::model::Cluster::cross_cluster_replication_config].
1304    pub fn set_cross_cluster_replication_config<T>(mut self, v: T) -> Self
1305    where
1306        T: std::convert::Into<crate::model::CrossClusterReplicationConfig>,
1307    {
1308        self.cross_cluster_replication_config = std::option::Option::Some(v.into());
1309        self
1310    }
1311
1312    /// Sets or clears the value of [cross_cluster_replication_config][crate::model::Cluster::cross_cluster_replication_config].
1313    pub fn set_or_clear_cross_cluster_replication_config<T>(
1314        mut self,
1315        v: std::option::Option<T>,
1316    ) -> Self
1317    where
1318        T: std::convert::Into<crate::model::CrossClusterReplicationConfig>,
1319    {
1320        self.cross_cluster_replication_config = v.map(|x| x.into());
1321        self
1322    }
1323
1324    /// Sets the value of [deletion_protection_enabled][crate::model::Cluster::deletion_protection_enabled].
1325    pub fn set_deletion_protection_enabled<T>(mut self, v: T) -> Self
1326    where
1327        T: std::convert::Into<bool>,
1328    {
1329        self.deletion_protection_enabled = std::option::Option::Some(v.into());
1330        self
1331    }
1332
1333    /// Sets or clears the value of [deletion_protection_enabled][crate::model::Cluster::deletion_protection_enabled].
1334    pub fn set_or_clear_deletion_protection_enabled<T>(mut self, v: std::option::Option<T>) -> Self
1335    where
1336        T: std::convert::Into<bool>,
1337    {
1338        self.deletion_protection_enabled = v.map(|x| x.into());
1339        self
1340    }
1341
1342    /// Sets the value of [maintenance_policy][crate::model::Cluster::maintenance_policy].
1343    pub fn set_maintenance_policy<T>(mut self, v: T) -> Self
1344    where
1345        T: std::convert::Into<crate::model::ClusterMaintenancePolicy>,
1346    {
1347        self.maintenance_policy = std::option::Option::Some(v.into());
1348        self
1349    }
1350
1351    /// Sets or clears the value of [maintenance_policy][crate::model::Cluster::maintenance_policy].
1352    pub fn set_or_clear_maintenance_policy<T>(mut self, v: std::option::Option<T>) -> Self
1353    where
1354        T: std::convert::Into<crate::model::ClusterMaintenancePolicy>,
1355    {
1356        self.maintenance_policy = v.map(|x| x.into());
1357        self
1358    }
1359
1360    /// Sets the value of [maintenance_schedule][crate::model::Cluster::maintenance_schedule].
1361    pub fn set_maintenance_schedule<T>(mut self, v: T) -> Self
1362    where
1363        T: std::convert::Into<crate::model::ClusterMaintenanceSchedule>,
1364    {
1365        self.maintenance_schedule = std::option::Option::Some(v.into());
1366        self
1367    }
1368
1369    /// Sets or clears the value of [maintenance_schedule][crate::model::Cluster::maintenance_schedule].
1370    pub fn set_or_clear_maintenance_schedule<T>(mut self, v: std::option::Option<T>) -> Self
1371    where
1372        T: std::convert::Into<crate::model::ClusterMaintenanceSchedule>,
1373    {
1374        self.maintenance_schedule = v.map(|x| x.into());
1375        self
1376    }
1377
1378    /// Sets the value of [psc_service_attachments][crate::model::Cluster::psc_service_attachments].
1379    pub fn set_psc_service_attachments<T, V>(mut self, v: T) -> Self
1380    where
1381        T: std::iter::IntoIterator<Item = V>,
1382        V: std::convert::Into<crate::model::PscServiceAttachment>,
1383    {
1384        use std::iter::Iterator;
1385        self.psc_service_attachments = v.into_iter().map(|i| i.into()).collect();
1386        self
1387    }
1388
1389    /// Sets the value of [cluster_endpoints][crate::model::Cluster::cluster_endpoints].
1390    pub fn set_cluster_endpoints<T, V>(mut self, v: T) -> Self
1391    where
1392        T: std::iter::IntoIterator<Item = V>,
1393        V: std::convert::Into<crate::model::ClusterEndpoint>,
1394    {
1395        use std::iter::Iterator;
1396        self.cluster_endpoints = v.into_iter().map(|i| i.into()).collect();
1397        self
1398    }
1399
1400    /// Sets the value of [backup_collection][crate::model::Cluster::backup_collection].
1401    pub fn set_backup_collection<T>(mut self, v: T) -> Self
1402    where
1403        T: std::convert::Into<std::string::String>,
1404    {
1405        self.backup_collection = std::option::Option::Some(v.into());
1406        self
1407    }
1408
1409    /// Sets or clears the value of [backup_collection][crate::model::Cluster::backup_collection].
1410    pub fn set_or_clear_backup_collection<T>(mut self, v: std::option::Option<T>) -> Self
1411    where
1412        T: std::convert::Into<std::string::String>,
1413    {
1414        self.backup_collection = v.map(|x| x.into());
1415        self
1416    }
1417
1418    /// Sets the value of [kms_key][crate::model::Cluster::kms_key].
1419    pub fn set_kms_key<T>(mut self, v: T) -> Self
1420    where
1421        T: std::convert::Into<std::string::String>,
1422    {
1423        self.kms_key = std::option::Option::Some(v.into());
1424        self
1425    }
1426
1427    /// Sets or clears the value of [kms_key][crate::model::Cluster::kms_key].
1428    pub fn set_or_clear_kms_key<T>(mut self, v: std::option::Option<T>) -> Self
1429    where
1430        T: std::convert::Into<std::string::String>,
1431    {
1432        self.kms_key = v.map(|x| x.into());
1433        self
1434    }
1435
1436    /// Sets the value of [automated_backup_config][crate::model::Cluster::automated_backup_config].
1437    pub fn set_automated_backup_config<T>(mut self, v: T) -> Self
1438    where
1439        T: std::convert::Into<crate::model::AutomatedBackupConfig>,
1440    {
1441        self.automated_backup_config = std::option::Option::Some(v.into());
1442        self
1443    }
1444
1445    /// Sets or clears the value of [automated_backup_config][crate::model::Cluster::automated_backup_config].
1446    pub fn set_or_clear_automated_backup_config<T>(mut self, v: std::option::Option<T>) -> Self
1447    where
1448        T: std::convert::Into<crate::model::AutomatedBackupConfig>,
1449    {
1450        self.automated_backup_config = v.map(|x| x.into());
1451        self
1452    }
1453
1454    /// Sets the value of [encryption_info][crate::model::Cluster::encryption_info].
1455    pub fn set_encryption_info<T>(mut self, v: T) -> Self
1456    where
1457        T: std::convert::Into<crate::model::EncryptionInfo>,
1458    {
1459        self.encryption_info = std::option::Option::Some(v.into());
1460        self
1461    }
1462
1463    /// Sets or clears the value of [encryption_info][crate::model::Cluster::encryption_info].
1464    pub fn set_or_clear_encryption_info<T>(mut self, v: std::option::Option<T>) -> Self
1465    where
1466        T: std::convert::Into<crate::model::EncryptionInfo>,
1467    {
1468        self.encryption_info = v.map(|x| x.into());
1469        self
1470    }
1471
1472    /// Sets the value of [import_sources][crate::model::Cluster::import_sources].
1473    ///
1474    /// Note that all the setters affecting `import_sources` are mutually
1475    /// exclusive.
1476    pub fn set_import_sources<
1477        T: std::convert::Into<std::option::Option<crate::model::cluster::ImportSources>>,
1478    >(
1479        mut self,
1480        v: T,
1481    ) -> Self {
1482        self.import_sources = v.into();
1483        self
1484    }
1485
1486    /// The value of [import_sources][crate::model::Cluster::import_sources]
1487    /// if it holds a `GcsSource`, `None` if the field is not set or
1488    /// holds a different branch.
1489    pub fn gcs_source(
1490        &self,
1491    ) -> std::option::Option<&std::boxed::Box<crate::model::cluster::GcsBackupSource>> {
1492        #[allow(unreachable_patterns)]
1493        self.import_sources.as_ref().and_then(|v| match v {
1494            crate::model::cluster::ImportSources::GcsSource(v) => std::option::Option::Some(v),
1495            _ => std::option::Option::None,
1496        })
1497    }
1498
1499    /// Sets the value of [import_sources][crate::model::Cluster::import_sources]
1500    /// to hold a `GcsSource`.
1501    ///
1502    /// Note that all the setters affecting `import_sources` are
1503    /// mutually exclusive.
1504    pub fn set_gcs_source<
1505        T: std::convert::Into<std::boxed::Box<crate::model::cluster::GcsBackupSource>>,
1506    >(
1507        mut self,
1508        v: T,
1509    ) -> Self {
1510        self.import_sources =
1511            std::option::Option::Some(crate::model::cluster::ImportSources::GcsSource(v.into()));
1512        self
1513    }
1514
1515    /// The value of [import_sources][crate::model::Cluster::import_sources]
1516    /// if it holds a `ManagedBackupSource`, `None` if the field is not set or
1517    /// holds a different branch.
1518    pub fn managed_backup_source(
1519        &self,
1520    ) -> std::option::Option<&std::boxed::Box<crate::model::cluster::ManagedBackupSource>> {
1521        #[allow(unreachable_patterns)]
1522        self.import_sources.as_ref().and_then(|v| match v {
1523            crate::model::cluster::ImportSources::ManagedBackupSource(v) => {
1524                std::option::Option::Some(v)
1525            }
1526            _ => std::option::Option::None,
1527        })
1528    }
1529
1530    /// Sets the value of [import_sources][crate::model::Cluster::import_sources]
1531    /// to hold a `ManagedBackupSource`.
1532    ///
1533    /// Note that all the setters affecting `import_sources` are
1534    /// mutually exclusive.
1535    pub fn set_managed_backup_source<
1536        T: std::convert::Into<std::boxed::Box<crate::model::cluster::ManagedBackupSource>>,
1537    >(
1538        mut self,
1539        v: T,
1540    ) -> Self {
1541        self.import_sources = std::option::Option::Some(
1542            crate::model::cluster::ImportSources::ManagedBackupSource(v.into()),
1543        );
1544        self
1545    }
1546}
1547
1548impl wkt::message::Message for Cluster {
1549    fn typename() -> &'static str {
1550        "type.googleapis.com/google.cloud.redis.cluster.v1.Cluster"
1551    }
1552}
1553
1554/// Defines additional types related to [Cluster].
1555pub mod cluster {
1556    #[allow(unused_imports)]
1557    use super::*;
1558
1559    /// Represents additional information about the state of the cluster.
1560    #[derive(Clone, Default, PartialEq)]
1561    #[non_exhaustive]
1562    pub struct StateInfo {
1563        pub info: std::option::Option<crate::model::cluster::state_info::Info>,
1564
1565        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1566    }
1567
1568    impl StateInfo {
1569        pub fn new() -> Self {
1570            std::default::Default::default()
1571        }
1572
1573        /// Sets the value of [info][crate::model::cluster::StateInfo::info].
1574        ///
1575        /// Note that all the setters affecting `info` are mutually
1576        /// exclusive.
1577        pub fn set_info<
1578            T: std::convert::Into<std::option::Option<crate::model::cluster::state_info::Info>>,
1579        >(
1580            mut self,
1581            v: T,
1582        ) -> Self {
1583            self.info = v.into();
1584            self
1585        }
1586
1587        /// The value of [info][crate::model::cluster::StateInfo::info]
1588        /// if it holds a `UpdateInfo`, `None` if the field is not set or
1589        /// holds a different branch.
1590        pub fn update_info(
1591            &self,
1592        ) -> std::option::Option<&std::boxed::Box<crate::model::cluster::state_info::UpdateInfo>>
1593        {
1594            #[allow(unreachable_patterns)]
1595            self.info.as_ref().and_then(|v| match v {
1596                crate::model::cluster::state_info::Info::UpdateInfo(v) => {
1597                    std::option::Option::Some(v)
1598                }
1599                _ => std::option::Option::None,
1600            })
1601        }
1602
1603        /// Sets the value of [info][crate::model::cluster::StateInfo::info]
1604        /// to hold a `UpdateInfo`.
1605        ///
1606        /// Note that all the setters affecting `info` are
1607        /// mutually exclusive.
1608        pub fn set_update_info<
1609            T: std::convert::Into<std::boxed::Box<crate::model::cluster::state_info::UpdateInfo>>,
1610        >(
1611            mut self,
1612            v: T,
1613        ) -> Self {
1614            self.info = std::option::Option::Some(
1615                crate::model::cluster::state_info::Info::UpdateInfo(v.into()),
1616            );
1617            self
1618        }
1619    }
1620
1621    impl wkt::message::Message for StateInfo {
1622        fn typename() -> &'static str {
1623            "type.googleapis.com/google.cloud.redis.cluster.v1.Cluster.StateInfo"
1624        }
1625    }
1626
1627    /// Defines additional types related to [StateInfo].
1628    pub mod state_info {
1629        #[allow(unused_imports)]
1630        use super::*;
1631
1632        /// Represents information about an updating cluster.
1633        #[derive(Clone, Default, PartialEq)]
1634        #[non_exhaustive]
1635        pub struct UpdateInfo {
1636            /// Target number of shards for redis cluster
1637            pub target_shard_count: std::option::Option<i32>,
1638
1639            /// Target number of replica nodes per shard.
1640            pub target_replica_count: std::option::Option<i32>,
1641
1642            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1643        }
1644
1645        impl UpdateInfo {
1646            pub fn new() -> Self {
1647                std::default::Default::default()
1648            }
1649
1650            /// Sets the value of [target_shard_count][crate::model::cluster::state_info::UpdateInfo::target_shard_count].
1651            pub fn set_target_shard_count<T>(mut self, v: T) -> Self
1652            where
1653                T: std::convert::Into<i32>,
1654            {
1655                self.target_shard_count = std::option::Option::Some(v.into());
1656                self
1657            }
1658
1659            /// Sets or clears the value of [target_shard_count][crate::model::cluster::state_info::UpdateInfo::target_shard_count].
1660            pub fn set_or_clear_target_shard_count<T>(mut self, v: std::option::Option<T>) -> Self
1661            where
1662                T: std::convert::Into<i32>,
1663            {
1664                self.target_shard_count = v.map(|x| x.into());
1665                self
1666            }
1667
1668            /// Sets the value of [target_replica_count][crate::model::cluster::state_info::UpdateInfo::target_replica_count].
1669            pub fn set_target_replica_count<T>(mut self, v: T) -> Self
1670            where
1671                T: std::convert::Into<i32>,
1672            {
1673                self.target_replica_count = std::option::Option::Some(v.into());
1674                self
1675            }
1676
1677            /// Sets or clears the value of [target_replica_count][crate::model::cluster::state_info::UpdateInfo::target_replica_count].
1678            pub fn set_or_clear_target_replica_count<T>(mut self, v: std::option::Option<T>) -> Self
1679            where
1680                T: std::convert::Into<i32>,
1681            {
1682                self.target_replica_count = v.map(|x| x.into());
1683                self
1684            }
1685        }
1686
1687        impl wkt::message::Message for UpdateInfo {
1688            fn typename() -> &'static str {
1689                "type.googleapis.com/google.cloud.redis.cluster.v1.Cluster.StateInfo.UpdateInfo"
1690            }
1691        }
1692
1693        #[derive(Clone, Debug, PartialEq)]
1694        #[non_exhaustive]
1695        pub enum Info {
1696            /// Describes ongoing update on the cluster when cluster state is UPDATING.
1697            UpdateInfo(std::boxed::Box<crate::model::cluster::state_info::UpdateInfo>),
1698        }
1699    }
1700
1701    /// Backups stored in Cloud Storage buckets.
1702    /// The Cloud Storage buckets need to be the same region as the clusters.
1703    #[derive(Clone, Default, PartialEq)]
1704    #[non_exhaustive]
1705    pub struct GcsBackupSource {
1706        /// Optional. URIs of the GCS objects to import.
1707        /// Example: gs://bucket1/object1, gs://bucket2/folder2/object2
1708        pub uris: std::vec::Vec<std::string::String>,
1709
1710        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1711    }
1712
1713    impl GcsBackupSource {
1714        pub fn new() -> Self {
1715            std::default::Default::default()
1716        }
1717
1718        /// Sets the value of [uris][crate::model::cluster::GcsBackupSource::uris].
1719        pub fn set_uris<T, V>(mut self, v: T) -> Self
1720        where
1721            T: std::iter::IntoIterator<Item = V>,
1722            V: std::convert::Into<std::string::String>,
1723        {
1724            use std::iter::Iterator;
1725            self.uris = v.into_iter().map(|i| i.into()).collect();
1726            self
1727        }
1728    }
1729
1730    impl wkt::message::Message for GcsBackupSource {
1731        fn typename() -> &'static str {
1732            "type.googleapis.com/google.cloud.redis.cluster.v1.Cluster.GcsBackupSource"
1733        }
1734    }
1735
1736    /// Backups that generated and managed by memorystore.
1737    #[derive(Clone, Default, PartialEq)]
1738    #[non_exhaustive]
1739    pub struct ManagedBackupSource {
1740        /// Optional. Example:
1741        /// //redis.googleapis.com/projects/{project}/locations/{location}/backupCollections/{collection}/backups/{backup}
1742        /// A shorter version (without the prefix) of the backup name is also
1743        /// supported, like
1744        /// projects/{project}/locations/{location}/backupCollections/{collection}/backups/{backup_id}
1745        /// In this case, it assumes the backup is under redis.googleapis.com.
1746        pub backup: std::string::String,
1747
1748        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1749    }
1750
1751    impl ManagedBackupSource {
1752        pub fn new() -> Self {
1753            std::default::Default::default()
1754        }
1755
1756        /// Sets the value of [backup][crate::model::cluster::ManagedBackupSource::backup].
1757        pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1758            self.backup = v.into();
1759            self
1760        }
1761    }
1762
1763    impl wkt::message::Message for ManagedBackupSource {
1764        fn typename() -> &'static str {
1765            "type.googleapis.com/google.cloud.redis.cluster.v1.Cluster.ManagedBackupSource"
1766        }
1767    }
1768
1769    /// Represents the different states of a Redis cluster.
1770    ///
1771    /// # Working with unknown values
1772    ///
1773    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1774    /// additional enum variants at any time. Adding new variants is not considered
1775    /// a breaking change. Applications should write their code in anticipation of:
1776    ///
1777    /// - New values appearing in future releases of the client library, **and**
1778    /// - New values received dynamically, without application changes.
1779    ///
1780    /// Please consult the [Working with enums] section in the user guide for some
1781    /// guidelines.
1782    ///
1783    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1784    #[derive(Clone, Debug, PartialEq)]
1785    #[non_exhaustive]
1786    pub enum State {
1787        /// Not set.
1788        Unspecified,
1789        /// Redis cluster is being created.
1790        Creating,
1791        /// Redis cluster has been created and is fully usable.
1792        Active,
1793        /// Redis cluster configuration is being updated.
1794        Updating,
1795        /// Redis cluster is being deleted.
1796        Deleting,
1797        /// If set, the enum was initialized with an unknown value.
1798        ///
1799        /// Applications can examine the value using [State::value] or
1800        /// [State::name].
1801        UnknownValue(state::UnknownValue),
1802    }
1803
1804    #[doc(hidden)]
1805    pub mod state {
1806        #[allow(unused_imports)]
1807        use super::*;
1808        #[derive(Clone, Debug, PartialEq)]
1809        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1810    }
1811
1812    impl State {
1813        /// Gets the enum value.
1814        ///
1815        /// Returns `None` if the enum contains an unknown value deserialized from
1816        /// the string representation of enums.
1817        pub fn value(&self) -> std::option::Option<i32> {
1818            match self {
1819                Self::Unspecified => std::option::Option::Some(0),
1820                Self::Creating => std::option::Option::Some(1),
1821                Self::Active => std::option::Option::Some(2),
1822                Self::Updating => std::option::Option::Some(3),
1823                Self::Deleting => std::option::Option::Some(4),
1824                Self::UnknownValue(u) => u.0.value(),
1825            }
1826        }
1827
1828        /// Gets the enum value as a string.
1829        ///
1830        /// Returns `None` if the enum contains an unknown value deserialized from
1831        /// the integer representation of enums.
1832        pub fn name(&self) -> std::option::Option<&str> {
1833            match self {
1834                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1835                Self::Creating => std::option::Option::Some("CREATING"),
1836                Self::Active => std::option::Option::Some("ACTIVE"),
1837                Self::Updating => std::option::Option::Some("UPDATING"),
1838                Self::Deleting => std::option::Option::Some("DELETING"),
1839                Self::UnknownValue(u) => u.0.name(),
1840            }
1841        }
1842    }
1843
1844    impl std::default::Default for State {
1845        fn default() -> Self {
1846            use std::convert::From;
1847            Self::from(0)
1848        }
1849    }
1850
1851    impl std::fmt::Display for State {
1852        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1853            wkt::internal::display_enum(f, self.name(), self.value())
1854        }
1855    }
1856
1857    impl std::convert::From<i32> for State {
1858        fn from(value: i32) -> Self {
1859            match value {
1860                0 => Self::Unspecified,
1861                1 => Self::Creating,
1862                2 => Self::Active,
1863                3 => Self::Updating,
1864                4 => Self::Deleting,
1865                _ => Self::UnknownValue(state::UnknownValue(
1866                    wkt::internal::UnknownEnumValue::Integer(value),
1867                )),
1868            }
1869        }
1870    }
1871
1872    impl std::convert::From<&str> for State {
1873        fn from(value: &str) -> Self {
1874            use std::string::ToString;
1875            match value {
1876                "STATE_UNSPECIFIED" => Self::Unspecified,
1877                "CREATING" => Self::Creating,
1878                "ACTIVE" => Self::Active,
1879                "UPDATING" => Self::Updating,
1880                "DELETING" => Self::Deleting,
1881                _ => Self::UnknownValue(state::UnknownValue(
1882                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1883                )),
1884            }
1885        }
1886    }
1887
1888    impl serde::ser::Serialize for State {
1889        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1890        where
1891            S: serde::Serializer,
1892        {
1893            match self {
1894                Self::Unspecified => serializer.serialize_i32(0),
1895                Self::Creating => serializer.serialize_i32(1),
1896                Self::Active => serializer.serialize_i32(2),
1897                Self::Updating => serializer.serialize_i32(3),
1898                Self::Deleting => serializer.serialize_i32(4),
1899                Self::UnknownValue(u) => u.0.serialize(serializer),
1900            }
1901        }
1902    }
1903
1904    impl<'de> serde::de::Deserialize<'de> for State {
1905        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1906        where
1907            D: serde::Deserializer<'de>,
1908        {
1909            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1910                ".google.cloud.redis.cluster.v1.Cluster.State",
1911            ))
1912        }
1913    }
1914
1915    /// The source to import from.
1916    #[derive(Clone, Debug, PartialEq)]
1917    #[non_exhaustive]
1918    pub enum ImportSources {
1919        /// Optional. Backups stored in Cloud Storage buckets.
1920        /// The Cloud Storage buckets need to be the same region as the clusters.
1921        /// Read permission is required to import from the provided Cloud Storage
1922        /// objects.
1923        GcsSource(std::boxed::Box<crate::model::cluster::GcsBackupSource>),
1924        /// Optional. Backups generated and managed by memorystore service.
1925        ManagedBackupSource(std::boxed::Box<crate::model::cluster::ManagedBackupSource>),
1926    }
1927}
1928
1929/// The automated backup config for a cluster.
1930#[derive(Clone, Default, PartialEq)]
1931#[non_exhaustive]
1932pub struct AutomatedBackupConfig {
1933    /// Optional. The automated backup mode. If the mode is disabled, the other
1934    /// fields will be ignored.
1935    pub automated_backup_mode: crate::model::automated_backup_config::AutomatedBackupMode,
1936
1937    /// Optional. How long to keep automated backups before the backups are
1938    /// deleted. The value should be between 1 day and 365 days. If not specified,
1939    /// the default value is 35 days.
1940    pub retention: std::option::Option<wkt::Duration>,
1941
1942    /// The schedule of automated backups.
1943    pub schedule: std::option::Option<crate::model::automated_backup_config::Schedule>,
1944
1945    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1946}
1947
1948impl AutomatedBackupConfig {
1949    pub fn new() -> Self {
1950        std::default::Default::default()
1951    }
1952
1953    /// Sets the value of [automated_backup_mode][crate::model::AutomatedBackupConfig::automated_backup_mode].
1954    pub fn set_automated_backup_mode<
1955        T: std::convert::Into<crate::model::automated_backup_config::AutomatedBackupMode>,
1956    >(
1957        mut self,
1958        v: T,
1959    ) -> Self {
1960        self.automated_backup_mode = v.into();
1961        self
1962    }
1963
1964    /// Sets the value of [retention][crate::model::AutomatedBackupConfig::retention].
1965    pub fn set_retention<T>(mut self, v: T) -> Self
1966    where
1967        T: std::convert::Into<wkt::Duration>,
1968    {
1969        self.retention = std::option::Option::Some(v.into());
1970        self
1971    }
1972
1973    /// Sets or clears the value of [retention][crate::model::AutomatedBackupConfig::retention].
1974    pub fn set_or_clear_retention<T>(mut self, v: std::option::Option<T>) -> Self
1975    where
1976        T: std::convert::Into<wkt::Duration>,
1977    {
1978        self.retention = v.map(|x| x.into());
1979        self
1980    }
1981
1982    /// Sets the value of [schedule][crate::model::AutomatedBackupConfig::schedule].
1983    ///
1984    /// Note that all the setters affecting `schedule` are mutually
1985    /// exclusive.
1986    pub fn set_schedule<
1987        T: std::convert::Into<std::option::Option<crate::model::automated_backup_config::Schedule>>,
1988    >(
1989        mut self,
1990        v: T,
1991    ) -> Self {
1992        self.schedule = v.into();
1993        self
1994    }
1995
1996    /// The value of [schedule][crate::model::AutomatedBackupConfig::schedule]
1997    /// if it holds a `FixedFrequencySchedule`, `None` if the field is not set or
1998    /// holds a different branch.
1999    pub fn fixed_frequency_schedule(
2000        &self,
2001    ) -> std::option::Option<
2002        &std::boxed::Box<crate::model::automated_backup_config::FixedFrequencySchedule>,
2003    > {
2004        #[allow(unreachable_patterns)]
2005        self.schedule.as_ref().and_then(|v| match v {
2006            crate::model::automated_backup_config::Schedule::FixedFrequencySchedule(v) => {
2007                std::option::Option::Some(v)
2008            }
2009            _ => std::option::Option::None,
2010        })
2011    }
2012
2013    /// Sets the value of [schedule][crate::model::AutomatedBackupConfig::schedule]
2014    /// to hold a `FixedFrequencySchedule`.
2015    ///
2016    /// Note that all the setters affecting `schedule` are
2017    /// mutually exclusive.
2018    pub fn set_fixed_frequency_schedule<
2019        T: std::convert::Into<
2020                std::boxed::Box<crate::model::automated_backup_config::FixedFrequencySchedule>,
2021            >,
2022    >(
2023        mut self,
2024        v: T,
2025    ) -> Self {
2026        self.schedule = std::option::Option::Some(
2027            crate::model::automated_backup_config::Schedule::FixedFrequencySchedule(v.into()),
2028        );
2029        self
2030    }
2031}
2032
2033impl wkt::message::Message for AutomatedBackupConfig {
2034    fn typename() -> &'static str {
2035        "type.googleapis.com/google.cloud.redis.cluster.v1.AutomatedBackupConfig"
2036    }
2037}
2038
2039/// Defines additional types related to [AutomatedBackupConfig].
2040pub mod automated_backup_config {
2041    #[allow(unused_imports)]
2042    use super::*;
2043
2044    /// This schedule allows the backup to be triggered at a fixed frequency
2045    /// (currently only daily is supported).
2046    #[derive(Clone, Default, PartialEq)]
2047    #[non_exhaustive]
2048    pub struct FixedFrequencySchedule {
2049        /// Required. The start time of every automated backup in UTC. It must be set
2050        /// to the start of an hour. This field is required.
2051        pub start_time: std::option::Option<gtype::model::TimeOfDay>,
2052
2053        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2054    }
2055
2056    impl FixedFrequencySchedule {
2057        pub fn new() -> Self {
2058            std::default::Default::default()
2059        }
2060
2061        /// Sets the value of [start_time][crate::model::automated_backup_config::FixedFrequencySchedule::start_time].
2062        pub fn set_start_time<T>(mut self, v: T) -> Self
2063        where
2064            T: std::convert::Into<gtype::model::TimeOfDay>,
2065        {
2066            self.start_time = std::option::Option::Some(v.into());
2067            self
2068        }
2069
2070        /// Sets or clears the value of [start_time][crate::model::automated_backup_config::FixedFrequencySchedule::start_time].
2071        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2072        where
2073            T: std::convert::Into<gtype::model::TimeOfDay>,
2074        {
2075            self.start_time = v.map(|x| x.into());
2076            self
2077        }
2078    }
2079
2080    impl wkt::message::Message for FixedFrequencySchedule {
2081        fn typename() -> &'static str {
2082            "type.googleapis.com/google.cloud.redis.cluster.v1.AutomatedBackupConfig.FixedFrequencySchedule"
2083        }
2084    }
2085
2086    /// The automated backup mode.
2087    ///
2088    /// # Working with unknown values
2089    ///
2090    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2091    /// additional enum variants at any time. Adding new variants is not considered
2092    /// a breaking change. Applications should write their code in anticipation of:
2093    ///
2094    /// - New values appearing in future releases of the client library, **and**
2095    /// - New values received dynamically, without application changes.
2096    ///
2097    /// Please consult the [Working with enums] section in the user guide for some
2098    /// guidelines.
2099    ///
2100    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2101    #[derive(Clone, Debug, PartialEq)]
2102    #[non_exhaustive]
2103    pub enum AutomatedBackupMode {
2104        /// Default value. Automated backup config is not specified.
2105        Unspecified,
2106        /// Automated backup config disabled.
2107        Disabled,
2108        /// Automated backup config enabled.
2109        Enabled,
2110        /// If set, the enum was initialized with an unknown value.
2111        ///
2112        /// Applications can examine the value using [AutomatedBackupMode::value] or
2113        /// [AutomatedBackupMode::name].
2114        UnknownValue(automated_backup_mode::UnknownValue),
2115    }
2116
2117    #[doc(hidden)]
2118    pub mod automated_backup_mode {
2119        #[allow(unused_imports)]
2120        use super::*;
2121        #[derive(Clone, Debug, PartialEq)]
2122        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2123    }
2124
2125    impl AutomatedBackupMode {
2126        /// Gets the enum value.
2127        ///
2128        /// Returns `None` if the enum contains an unknown value deserialized from
2129        /// the string representation of enums.
2130        pub fn value(&self) -> std::option::Option<i32> {
2131            match self {
2132                Self::Unspecified => std::option::Option::Some(0),
2133                Self::Disabled => std::option::Option::Some(1),
2134                Self::Enabled => std::option::Option::Some(2),
2135                Self::UnknownValue(u) => u.0.value(),
2136            }
2137        }
2138
2139        /// Gets the enum value as a string.
2140        ///
2141        /// Returns `None` if the enum contains an unknown value deserialized from
2142        /// the integer representation of enums.
2143        pub fn name(&self) -> std::option::Option<&str> {
2144            match self {
2145                Self::Unspecified => std::option::Option::Some("AUTOMATED_BACKUP_MODE_UNSPECIFIED"),
2146                Self::Disabled => std::option::Option::Some("DISABLED"),
2147                Self::Enabled => std::option::Option::Some("ENABLED"),
2148                Self::UnknownValue(u) => u.0.name(),
2149            }
2150        }
2151    }
2152
2153    impl std::default::Default for AutomatedBackupMode {
2154        fn default() -> Self {
2155            use std::convert::From;
2156            Self::from(0)
2157        }
2158    }
2159
2160    impl std::fmt::Display for AutomatedBackupMode {
2161        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2162            wkt::internal::display_enum(f, self.name(), self.value())
2163        }
2164    }
2165
2166    impl std::convert::From<i32> for AutomatedBackupMode {
2167        fn from(value: i32) -> Self {
2168            match value {
2169                0 => Self::Unspecified,
2170                1 => Self::Disabled,
2171                2 => Self::Enabled,
2172                _ => Self::UnknownValue(automated_backup_mode::UnknownValue(
2173                    wkt::internal::UnknownEnumValue::Integer(value),
2174                )),
2175            }
2176        }
2177    }
2178
2179    impl std::convert::From<&str> for AutomatedBackupMode {
2180        fn from(value: &str) -> Self {
2181            use std::string::ToString;
2182            match value {
2183                "AUTOMATED_BACKUP_MODE_UNSPECIFIED" => Self::Unspecified,
2184                "DISABLED" => Self::Disabled,
2185                "ENABLED" => Self::Enabled,
2186                _ => Self::UnknownValue(automated_backup_mode::UnknownValue(
2187                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2188                )),
2189            }
2190        }
2191    }
2192
2193    impl serde::ser::Serialize for AutomatedBackupMode {
2194        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2195        where
2196            S: serde::Serializer,
2197        {
2198            match self {
2199                Self::Unspecified => serializer.serialize_i32(0),
2200                Self::Disabled => serializer.serialize_i32(1),
2201                Self::Enabled => serializer.serialize_i32(2),
2202                Self::UnknownValue(u) => u.0.serialize(serializer),
2203            }
2204        }
2205    }
2206
2207    impl<'de> serde::de::Deserialize<'de> for AutomatedBackupMode {
2208        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2209        where
2210            D: serde::Deserializer<'de>,
2211        {
2212            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AutomatedBackupMode>::new(
2213                ".google.cloud.redis.cluster.v1.AutomatedBackupConfig.AutomatedBackupMode",
2214            ))
2215        }
2216    }
2217
2218    /// The schedule of automated backups.
2219    #[derive(Clone, Debug, PartialEq)]
2220    #[non_exhaustive]
2221    pub enum Schedule {
2222        /// Optional. Trigger automated backups at a fixed frequency.
2223        FixedFrequencySchedule(
2224            std::boxed::Box<crate::model::automated_backup_config::FixedFrequencySchedule>,
2225        ),
2226    }
2227}
2228
2229/// BackupCollection of a cluster.
2230#[derive(Clone, Default, PartialEq)]
2231#[non_exhaustive]
2232pub struct BackupCollection {
2233    /// Identifier. Full resource path of the backup collection.
2234    pub name: std::string::String,
2235
2236    /// Output only. The cluster uid of the backup collection.
2237    pub cluster_uid: std::string::String,
2238
2239    /// Output only. The full resource path of the cluster the backup collection
2240    /// belongs to. Example:
2241    /// projects/{project}/locations/{location}/clusters/{cluster}
2242    pub cluster: std::string::String,
2243
2244    /// Output only. The KMS key used to encrypt the backups under this backup
2245    /// collection.
2246    pub kms_key: std::string::String,
2247
2248    /// Output only. System assigned unique identifier of the backup collection.
2249    pub uid: std::string::String,
2250
2251    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2252}
2253
2254impl BackupCollection {
2255    pub fn new() -> Self {
2256        std::default::Default::default()
2257    }
2258
2259    /// Sets the value of [name][crate::model::BackupCollection::name].
2260    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2261        self.name = v.into();
2262        self
2263    }
2264
2265    /// Sets the value of [cluster_uid][crate::model::BackupCollection::cluster_uid].
2266    pub fn set_cluster_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2267        self.cluster_uid = v.into();
2268        self
2269    }
2270
2271    /// Sets the value of [cluster][crate::model::BackupCollection::cluster].
2272    pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2273        self.cluster = v.into();
2274        self
2275    }
2276
2277    /// Sets the value of [kms_key][crate::model::BackupCollection::kms_key].
2278    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2279        self.kms_key = v.into();
2280        self
2281    }
2282
2283    /// Sets the value of [uid][crate::model::BackupCollection::uid].
2284    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2285        self.uid = v.into();
2286        self
2287    }
2288}
2289
2290impl wkt::message::Message for BackupCollection {
2291    fn typename() -> &'static str {
2292        "type.googleapis.com/google.cloud.redis.cluster.v1.BackupCollection"
2293    }
2294}
2295
2296/// Backup of a cluster.
2297#[derive(Clone, Default, PartialEq)]
2298#[non_exhaustive]
2299pub struct Backup {
2300    /// Identifier. Full resource path of the backup. the last part of the name is
2301    /// the backup id with the following format: [YYYYMMDDHHMMSS]_[Shorted Cluster
2302    /// UID] OR customer specified while backup cluster. Example:
2303    /// 20240515123000_1234
2304    pub name: std::string::String,
2305
2306    /// Output only. The time when the backup was created.
2307    pub create_time: std::option::Option<wkt::Timestamp>,
2308
2309    /// Output only. Cluster resource path of this backup.
2310    pub cluster: std::string::String,
2311
2312    /// Output only. Cluster uid of this backup.
2313    pub cluster_uid: std::string::String,
2314
2315    /// Output only. Total size of the backup in bytes.
2316    pub total_size_bytes: i64,
2317
2318    /// Output only. The time when the backup will expire.
2319    pub expire_time: std::option::Option<wkt::Timestamp>,
2320
2321    /// Output only. redis-7.2, valkey-7.5
2322    pub engine_version: std::string::String,
2323
2324    /// Output only. List of backup files of the backup.
2325    pub backup_files: std::vec::Vec<crate::model::BackupFile>,
2326
2327    /// Output only. Node type of the cluster.
2328    pub node_type: crate::model::NodeType,
2329
2330    /// Output only. Number of replicas for the cluster.
2331    pub replica_count: i32,
2332
2333    /// Output only. Number of shards for the cluster.
2334    pub shard_count: i32,
2335
2336    /// Output only. Type of the backup.
2337    pub backup_type: crate::model::backup::BackupType,
2338
2339    /// Output only. State of the backup.
2340    pub state: crate::model::backup::State,
2341
2342    /// Output only. Encryption information of the backup.
2343    pub encryption_info: std::option::Option<crate::model::EncryptionInfo>,
2344
2345    /// Output only. System assigned unique identifier of the backup.
2346    pub uid: std::string::String,
2347
2348    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2349}
2350
2351impl Backup {
2352    pub fn new() -> Self {
2353        std::default::Default::default()
2354    }
2355
2356    /// Sets the value of [name][crate::model::Backup::name].
2357    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2358        self.name = v.into();
2359        self
2360    }
2361
2362    /// Sets the value of [create_time][crate::model::Backup::create_time].
2363    pub fn set_create_time<T>(mut self, v: T) -> Self
2364    where
2365        T: std::convert::Into<wkt::Timestamp>,
2366    {
2367        self.create_time = std::option::Option::Some(v.into());
2368        self
2369    }
2370
2371    /// Sets or clears the value of [create_time][crate::model::Backup::create_time].
2372    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2373    where
2374        T: std::convert::Into<wkt::Timestamp>,
2375    {
2376        self.create_time = v.map(|x| x.into());
2377        self
2378    }
2379
2380    /// Sets the value of [cluster][crate::model::Backup::cluster].
2381    pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2382        self.cluster = v.into();
2383        self
2384    }
2385
2386    /// Sets the value of [cluster_uid][crate::model::Backup::cluster_uid].
2387    pub fn set_cluster_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2388        self.cluster_uid = v.into();
2389        self
2390    }
2391
2392    /// Sets the value of [total_size_bytes][crate::model::Backup::total_size_bytes].
2393    pub fn set_total_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2394        self.total_size_bytes = v.into();
2395        self
2396    }
2397
2398    /// Sets the value of [expire_time][crate::model::Backup::expire_time].
2399    pub fn set_expire_time<T>(mut self, v: T) -> Self
2400    where
2401        T: std::convert::Into<wkt::Timestamp>,
2402    {
2403        self.expire_time = std::option::Option::Some(v.into());
2404        self
2405    }
2406
2407    /// Sets or clears the value of [expire_time][crate::model::Backup::expire_time].
2408    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2409    where
2410        T: std::convert::Into<wkt::Timestamp>,
2411    {
2412        self.expire_time = v.map(|x| x.into());
2413        self
2414    }
2415
2416    /// Sets the value of [engine_version][crate::model::Backup::engine_version].
2417    pub fn set_engine_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2418        self.engine_version = v.into();
2419        self
2420    }
2421
2422    /// Sets the value of [backup_files][crate::model::Backup::backup_files].
2423    pub fn set_backup_files<T, V>(mut self, v: T) -> Self
2424    where
2425        T: std::iter::IntoIterator<Item = V>,
2426        V: std::convert::Into<crate::model::BackupFile>,
2427    {
2428        use std::iter::Iterator;
2429        self.backup_files = v.into_iter().map(|i| i.into()).collect();
2430        self
2431    }
2432
2433    /// Sets the value of [node_type][crate::model::Backup::node_type].
2434    pub fn set_node_type<T: std::convert::Into<crate::model::NodeType>>(mut self, v: T) -> Self {
2435        self.node_type = v.into();
2436        self
2437    }
2438
2439    /// Sets the value of [replica_count][crate::model::Backup::replica_count].
2440    pub fn set_replica_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2441        self.replica_count = v.into();
2442        self
2443    }
2444
2445    /// Sets the value of [shard_count][crate::model::Backup::shard_count].
2446    pub fn set_shard_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2447        self.shard_count = v.into();
2448        self
2449    }
2450
2451    /// Sets the value of [backup_type][crate::model::Backup::backup_type].
2452    pub fn set_backup_type<T: std::convert::Into<crate::model::backup::BackupType>>(
2453        mut self,
2454        v: T,
2455    ) -> Self {
2456        self.backup_type = v.into();
2457        self
2458    }
2459
2460    /// Sets the value of [state][crate::model::Backup::state].
2461    pub fn set_state<T: std::convert::Into<crate::model::backup::State>>(mut self, v: T) -> Self {
2462        self.state = v.into();
2463        self
2464    }
2465
2466    /// Sets the value of [encryption_info][crate::model::Backup::encryption_info].
2467    pub fn set_encryption_info<T>(mut self, v: T) -> Self
2468    where
2469        T: std::convert::Into<crate::model::EncryptionInfo>,
2470    {
2471        self.encryption_info = std::option::Option::Some(v.into());
2472        self
2473    }
2474
2475    /// Sets or clears the value of [encryption_info][crate::model::Backup::encryption_info].
2476    pub fn set_or_clear_encryption_info<T>(mut self, v: std::option::Option<T>) -> Self
2477    where
2478        T: std::convert::Into<crate::model::EncryptionInfo>,
2479    {
2480        self.encryption_info = v.map(|x| x.into());
2481        self
2482    }
2483
2484    /// Sets the value of [uid][crate::model::Backup::uid].
2485    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2486        self.uid = v.into();
2487        self
2488    }
2489}
2490
2491impl wkt::message::Message for Backup {
2492    fn typename() -> &'static str {
2493        "type.googleapis.com/google.cloud.redis.cluster.v1.Backup"
2494    }
2495}
2496
2497/// Defines additional types related to [Backup].
2498pub mod backup {
2499    #[allow(unused_imports)]
2500    use super::*;
2501
2502    /// Type of the backup.
2503    ///
2504    /// # Working with unknown values
2505    ///
2506    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2507    /// additional enum variants at any time. Adding new variants is not considered
2508    /// a breaking change. Applications should write their code in anticipation of:
2509    ///
2510    /// - New values appearing in future releases of the client library, **and**
2511    /// - New values received dynamically, without application changes.
2512    ///
2513    /// Please consult the [Working with enums] section in the user guide for some
2514    /// guidelines.
2515    ///
2516    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2517    #[derive(Clone, Debug, PartialEq)]
2518    #[non_exhaustive]
2519    pub enum BackupType {
2520        /// The default value, not set.
2521        Unspecified,
2522        /// On-demand backup.
2523        OnDemand,
2524        /// Automated backup.
2525        Automated,
2526        /// If set, the enum was initialized with an unknown value.
2527        ///
2528        /// Applications can examine the value using [BackupType::value] or
2529        /// [BackupType::name].
2530        UnknownValue(backup_type::UnknownValue),
2531    }
2532
2533    #[doc(hidden)]
2534    pub mod backup_type {
2535        #[allow(unused_imports)]
2536        use super::*;
2537        #[derive(Clone, Debug, PartialEq)]
2538        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2539    }
2540
2541    impl BackupType {
2542        /// Gets the enum value.
2543        ///
2544        /// Returns `None` if the enum contains an unknown value deserialized from
2545        /// the string representation of enums.
2546        pub fn value(&self) -> std::option::Option<i32> {
2547            match self {
2548                Self::Unspecified => std::option::Option::Some(0),
2549                Self::OnDemand => std::option::Option::Some(1),
2550                Self::Automated => std::option::Option::Some(2),
2551                Self::UnknownValue(u) => u.0.value(),
2552            }
2553        }
2554
2555        /// Gets the enum value as a string.
2556        ///
2557        /// Returns `None` if the enum contains an unknown value deserialized from
2558        /// the integer representation of enums.
2559        pub fn name(&self) -> std::option::Option<&str> {
2560            match self {
2561                Self::Unspecified => std::option::Option::Some("BACKUP_TYPE_UNSPECIFIED"),
2562                Self::OnDemand => std::option::Option::Some("ON_DEMAND"),
2563                Self::Automated => std::option::Option::Some("AUTOMATED"),
2564                Self::UnknownValue(u) => u.0.name(),
2565            }
2566        }
2567    }
2568
2569    impl std::default::Default for BackupType {
2570        fn default() -> Self {
2571            use std::convert::From;
2572            Self::from(0)
2573        }
2574    }
2575
2576    impl std::fmt::Display for BackupType {
2577        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2578            wkt::internal::display_enum(f, self.name(), self.value())
2579        }
2580    }
2581
2582    impl std::convert::From<i32> for BackupType {
2583        fn from(value: i32) -> Self {
2584            match value {
2585                0 => Self::Unspecified,
2586                1 => Self::OnDemand,
2587                2 => Self::Automated,
2588                _ => Self::UnknownValue(backup_type::UnknownValue(
2589                    wkt::internal::UnknownEnumValue::Integer(value),
2590                )),
2591            }
2592        }
2593    }
2594
2595    impl std::convert::From<&str> for BackupType {
2596        fn from(value: &str) -> Self {
2597            use std::string::ToString;
2598            match value {
2599                "BACKUP_TYPE_UNSPECIFIED" => Self::Unspecified,
2600                "ON_DEMAND" => Self::OnDemand,
2601                "AUTOMATED" => Self::Automated,
2602                _ => Self::UnknownValue(backup_type::UnknownValue(
2603                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2604                )),
2605            }
2606        }
2607    }
2608
2609    impl serde::ser::Serialize for BackupType {
2610        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2611        where
2612            S: serde::Serializer,
2613        {
2614            match self {
2615                Self::Unspecified => serializer.serialize_i32(0),
2616                Self::OnDemand => serializer.serialize_i32(1),
2617                Self::Automated => serializer.serialize_i32(2),
2618                Self::UnknownValue(u) => u.0.serialize(serializer),
2619            }
2620        }
2621    }
2622
2623    impl<'de> serde::de::Deserialize<'de> for BackupType {
2624        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2625        where
2626            D: serde::Deserializer<'de>,
2627        {
2628            deserializer.deserialize_any(wkt::internal::EnumVisitor::<BackupType>::new(
2629                ".google.cloud.redis.cluster.v1.Backup.BackupType",
2630            ))
2631        }
2632    }
2633
2634    /// State of the backup.
2635    ///
2636    /// # Working with unknown values
2637    ///
2638    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2639    /// additional enum variants at any time. Adding new variants is not considered
2640    /// a breaking change. Applications should write their code in anticipation of:
2641    ///
2642    /// - New values appearing in future releases of the client library, **and**
2643    /// - New values received dynamically, without application changes.
2644    ///
2645    /// Please consult the [Working with enums] section in the user guide for some
2646    /// guidelines.
2647    ///
2648    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2649    #[derive(Clone, Debug, PartialEq)]
2650    #[non_exhaustive]
2651    pub enum State {
2652        /// The default value, not set.
2653        Unspecified,
2654        /// The backup is being created.
2655        Creating,
2656        /// The backup is active to be used.
2657        Active,
2658        /// The backup is being deleted.
2659        Deleting,
2660        /// The backup is currently suspended due to reasons like project deletion,
2661        /// billing account closure, etc.
2662        Suspended,
2663        /// If set, the enum was initialized with an unknown value.
2664        ///
2665        /// Applications can examine the value using [State::value] or
2666        /// [State::name].
2667        UnknownValue(state::UnknownValue),
2668    }
2669
2670    #[doc(hidden)]
2671    pub mod state {
2672        #[allow(unused_imports)]
2673        use super::*;
2674        #[derive(Clone, Debug, PartialEq)]
2675        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2676    }
2677
2678    impl State {
2679        /// Gets the enum value.
2680        ///
2681        /// Returns `None` if the enum contains an unknown value deserialized from
2682        /// the string representation of enums.
2683        pub fn value(&self) -> std::option::Option<i32> {
2684            match self {
2685                Self::Unspecified => std::option::Option::Some(0),
2686                Self::Creating => std::option::Option::Some(1),
2687                Self::Active => std::option::Option::Some(2),
2688                Self::Deleting => std::option::Option::Some(3),
2689                Self::Suspended => std::option::Option::Some(4),
2690                Self::UnknownValue(u) => u.0.value(),
2691            }
2692        }
2693
2694        /// Gets the enum value as a string.
2695        ///
2696        /// Returns `None` if the enum contains an unknown value deserialized from
2697        /// the integer representation of enums.
2698        pub fn name(&self) -> std::option::Option<&str> {
2699            match self {
2700                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2701                Self::Creating => std::option::Option::Some("CREATING"),
2702                Self::Active => std::option::Option::Some("ACTIVE"),
2703                Self::Deleting => std::option::Option::Some("DELETING"),
2704                Self::Suspended => std::option::Option::Some("SUSPENDED"),
2705                Self::UnknownValue(u) => u.0.name(),
2706            }
2707        }
2708    }
2709
2710    impl std::default::Default for State {
2711        fn default() -> Self {
2712            use std::convert::From;
2713            Self::from(0)
2714        }
2715    }
2716
2717    impl std::fmt::Display for State {
2718        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2719            wkt::internal::display_enum(f, self.name(), self.value())
2720        }
2721    }
2722
2723    impl std::convert::From<i32> for State {
2724        fn from(value: i32) -> Self {
2725            match value {
2726                0 => Self::Unspecified,
2727                1 => Self::Creating,
2728                2 => Self::Active,
2729                3 => Self::Deleting,
2730                4 => Self::Suspended,
2731                _ => Self::UnknownValue(state::UnknownValue(
2732                    wkt::internal::UnknownEnumValue::Integer(value),
2733                )),
2734            }
2735        }
2736    }
2737
2738    impl std::convert::From<&str> for State {
2739        fn from(value: &str) -> Self {
2740            use std::string::ToString;
2741            match value {
2742                "STATE_UNSPECIFIED" => Self::Unspecified,
2743                "CREATING" => Self::Creating,
2744                "ACTIVE" => Self::Active,
2745                "DELETING" => Self::Deleting,
2746                "SUSPENDED" => Self::Suspended,
2747                _ => Self::UnknownValue(state::UnknownValue(
2748                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2749                )),
2750            }
2751        }
2752    }
2753
2754    impl serde::ser::Serialize for State {
2755        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2756        where
2757            S: serde::Serializer,
2758        {
2759            match self {
2760                Self::Unspecified => serializer.serialize_i32(0),
2761                Self::Creating => serializer.serialize_i32(1),
2762                Self::Active => serializer.serialize_i32(2),
2763                Self::Deleting => serializer.serialize_i32(3),
2764                Self::Suspended => serializer.serialize_i32(4),
2765                Self::UnknownValue(u) => u.0.serialize(serializer),
2766            }
2767        }
2768    }
2769
2770    impl<'de> serde::de::Deserialize<'de> for State {
2771        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2772        where
2773            D: serde::Deserializer<'de>,
2774        {
2775            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2776                ".google.cloud.redis.cluster.v1.Backup.State",
2777            ))
2778        }
2779    }
2780}
2781
2782/// Backup is consisted of multiple backup files.
2783#[derive(Clone, Default, PartialEq)]
2784#[non_exhaustive]
2785pub struct BackupFile {
2786    /// Output only. e.g: \<shard-id\>.rdb
2787    pub file_name: std::string::String,
2788
2789    /// Output only. Size of the backup file in bytes.
2790    pub size_bytes: i64,
2791
2792    /// Output only. The time when the backup file was created.
2793    pub create_time: std::option::Option<wkt::Timestamp>,
2794
2795    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2796}
2797
2798impl BackupFile {
2799    pub fn new() -> Self {
2800        std::default::Default::default()
2801    }
2802
2803    /// Sets the value of [file_name][crate::model::BackupFile::file_name].
2804    pub fn set_file_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2805        self.file_name = v.into();
2806        self
2807    }
2808
2809    /// Sets the value of [size_bytes][crate::model::BackupFile::size_bytes].
2810    pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2811        self.size_bytes = v.into();
2812        self
2813    }
2814
2815    /// Sets the value of [create_time][crate::model::BackupFile::create_time].
2816    pub fn set_create_time<T>(mut self, v: T) -> Self
2817    where
2818        T: std::convert::Into<wkt::Timestamp>,
2819    {
2820        self.create_time = std::option::Option::Some(v.into());
2821        self
2822    }
2823
2824    /// Sets or clears the value of [create_time][crate::model::BackupFile::create_time].
2825    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2826    where
2827        T: std::convert::Into<wkt::Timestamp>,
2828    {
2829        self.create_time = v.map(|x| x.into());
2830        self
2831    }
2832}
2833
2834impl wkt::message::Message for BackupFile {
2835    fn typename() -> &'static str {
2836        "type.googleapis.com/google.cloud.redis.cluster.v1.BackupFile"
2837    }
2838}
2839
2840/// Configuration of a service attachment of the cluster, for creating PSC
2841/// connections.
2842#[derive(Clone, Default, PartialEq)]
2843#[non_exhaustive]
2844pub struct PscServiceAttachment {
2845    /// Output only. Service attachment URI which your self-created PscConnection
2846    /// should use as target
2847    pub service_attachment: std::string::String,
2848
2849    /// Output only. Type of a PSC connection targeting this service attachment.
2850    pub connection_type: crate::model::ConnectionType,
2851
2852    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2853}
2854
2855impl PscServiceAttachment {
2856    pub fn new() -> Self {
2857        std::default::Default::default()
2858    }
2859
2860    /// Sets the value of [service_attachment][crate::model::PscServiceAttachment::service_attachment].
2861    pub fn set_service_attachment<T: std::convert::Into<std::string::String>>(
2862        mut self,
2863        v: T,
2864    ) -> Self {
2865        self.service_attachment = v.into();
2866        self
2867    }
2868
2869    /// Sets the value of [connection_type][crate::model::PscServiceAttachment::connection_type].
2870    pub fn set_connection_type<T: std::convert::Into<crate::model::ConnectionType>>(
2871        mut self,
2872        v: T,
2873    ) -> Self {
2874        self.connection_type = v.into();
2875        self
2876    }
2877}
2878
2879impl wkt::message::Message for PscServiceAttachment {
2880    fn typename() -> &'static str {
2881        "type.googleapis.com/google.cloud.redis.cluster.v1.PscServiceAttachment"
2882    }
2883}
2884
2885/// Cross cluster replication config.
2886#[derive(Clone, Default, PartialEq)]
2887#[non_exhaustive]
2888pub struct CrossClusterReplicationConfig {
2889    /// The role of the cluster in cross cluster replication.
2890    pub cluster_role: crate::model::cross_cluster_replication_config::ClusterRole,
2891
2892    /// Details of the primary cluster that is used as the replication source for
2893    /// this secondary cluster.
2894    ///
2895    /// This field is only set for a secondary cluster.
2896    pub primary_cluster:
2897        std::option::Option<crate::model::cross_cluster_replication_config::RemoteCluster>,
2898
2899    /// List of secondary clusters that are replicating from this primary cluster.
2900    ///
2901    /// This field is only set for a primary cluster.
2902    pub secondary_clusters:
2903        std::vec::Vec<crate::model::cross_cluster_replication_config::RemoteCluster>,
2904
2905    /// Output only. The last time cross cluster replication config was updated.
2906    pub update_time: std::option::Option<wkt::Timestamp>,
2907
2908    /// Output only. An output only view of all the member clusters participating
2909    /// in the cross cluster replication. This view will be provided by every
2910    /// member cluster irrespective of its cluster role(primary or secondary).
2911    ///
2912    /// A primary cluster can provide information about all the secondary clusters
2913    /// replicating from it. However, a secondary cluster only knows about the
2914    /// primary cluster from which it is replicating. However, for scenarios, where
2915    /// the primary cluster is unavailable(e.g. regional outage), a GetCluster
2916    /// request can be sent to any other member cluster and this field will list
2917    /// all the member clusters participating in cross cluster replication.
2918    pub membership: std::option::Option<crate::model::cross_cluster_replication_config::Membership>,
2919
2920    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2921}
2922
2923impl CrossClusterReplicationConfig {
2924    pub fn new() -> Self {
2925        std::default::Default::default()
2926    }
2927
2928    /// Sets the value of [cluster_role][crate::model::CrossClusterReplicationConfig::cluster_role].
2929    pub fn set_cluster_role<
2930        T: std::convert::Into<crate::model::cross_cluster_replication_config::ClusterRole>,
2931    >(
2932        mut self,
2933        v: T,
2934    ) -> Self {
2935        self.cluster_role = v.into();
2936        self
2937    }
2938
2939    /// Sets the value of [primary_cluster][crate::model::CrossClusterReplicationConfig::primary_cluster].
2940    pub fn set_primary_cluster<T>(mut self, v: T) -> Self
2941    where
2942        T: std::convert::Into<crate::model::cross_cluster_replication_config::RemoteCluster>,
2943    {
2944        self.primary_cluster = std::option::Option::Some(v.into());
2945        self
2946    }
2947
2948    /// Sets or clears the value of [primary_cluster][crate::model::CrossClusterReplicationConfig::primary_cluster].
2949    pub fn set_or_clear_primary_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2950    where
2951        T: std::convert::Into<crate::model::cross_cluster_replication_config::RemoteCluster>,
2952    {
2953        self.primary_cluster = v.map(|x| x.into());
2954        self
2955    }
2956
2957    /// Sets the value of [secondary_clusters][crate::model::CrossClusterReplicationConfig::secondary_clusters].
2958    pub fn set_secondary_clusters<T, V>(mut self, v: T) -> Self
2959    where
2960        T: std::iter::IntoIterator<Item = V>,
2961        V: std::convert::Into<crate::model::cross_cluster_replication_config::RemoteCluster>,
2962    {
2963        use std::iter::Iterator;
2964        self.secondary_clusters = v.into_iter().map(|i| i.into()).collect();
2965        self
2966    }
2967
2968    /// Sets the value of [update_time][crate::model::CrossClusterReplicationConfig::update_time].
2969    pub fn set_update_time<T>(mut self, v: T) -> Self
2970    where
2971        T: std::convert::Into<wkt::Timestamp>,
2972    {
2973        self.update_time = std::option::Option::Some(v.into());
2974        self
2975    }
2976
2977    /// Sets or clears the value of [update_time][crate::model::CrossClusterReplicationConfig::update_time].
2978    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2979    where
2980        T: std::convert::Into<wkt::Timestamp>,
2981    {
2982        self.update_time = v.map(|x| x.into());
2983        self
2984    }
2985
2986    /// Sets the value of [membership][crate::model::CrossClusterReplicationConfig::membership].
2987    pub fn set_membership<T>(mut self, v: T) -> Self
2988    where
2989        T: std::convert::Into<crate::model::cross_cluster_replication_config::Membership>,
2990    {
2991        self.membership = std::option::Option::Some(v.into());
2992        self
2993    }
2994
2995    /// Sets or clears the value of [membership][crate::model::CrossClusterReplicationConfig::membership].
2996    pub fn set_or_clear_membership<T>(mut self, v: std::option::Option<T>) -> Self
2997    where
2998        T: std::convert::Into<crate::model::cross_cluster_replication_config::Membership>,
2999    {
3000        self.membership = v.map(|x| x.into());
3001        self
3002    }
3003}
3004
3005impl wkt::message::Message for CrossClusterReplicationConfig {
3006    fn typename() -> &'static str {
3007        "type.googleapis.com/google.cloud.redis.cluster.v1.CrossClusterReplicationConfig"
3008    }
3009}
3010
3011/// Defines additional types related to [CrossClusterReplicationConfig].
3012pub mod cross_cluster_replication_config {
3013    #[allow(unused_imports)]
3014    use super::*;
3015
3016    /// Details of the remote cluster associated with this cluster in a cross
3017    /// cluster replication setup.
3018    #[derive(Clone, Default, PartialEq)]
3019    #[non_exhaustive]
3020    pub struct RemoteCluster {
3021        /// The full resource path of the remote cluster in
3022        /// the format: projects/\<project\>/locations/\<region\>/clusters/\<cluster-id\>
3023        pub cluster: std::string::String,
3024
3025        /// Output only. The unique identifier of the remote cluster.
3026        pub uid: std::string::String,
3027
3028        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3029    }
3030
3031    impl RemoteCluster {
3032        pub fn new() -> Self {
3033            std::default::Default::default()
3034        }
3035
3036        /// Sets the value of [cluster][crate::model::cross_cluster_replication_config::RemoteCluster::cluster].
3037        pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3038            self.cluster = v.into();
3039            self
3040        }
3041
3042        /// Sets the value of [uid][crate::model::cross_cluster_replication_config::RemoteCluster::uid].
3043        pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3044            self.uid = v.into();
3045            self
3046        }
3047    }
3048
3049    impl wkt::message::Message for RemoteCluster {
3050        fn typename() -> &'static str {
3051            "type.googleapis.com/google.cloud.redis.cluster.v1.CrossClusterReplicationConfig.RemoteCluster"
3052        }
3053    }
3054
3055    /// An output only view of all the member clusters participating in the cross
3056    /// cluster replication.
3057    #[derive(Clone, Default, PartialEq)]
3058    #[non_exhaustive]
3059    pub struct Membership {
3060        /// Output only. The primary cluster that acts as the source of replication
3061        /// for the secondary clusters.
3062        pub primary_cluster:
3063            std::option::Option<crate::model::cross_cluster_replication_config::RemoteCluster>,
3064
3065        /// Output only. The list of secondary clusters replicating from the primary
3066        /// cluster.
3067        pub secondary_clusters:
3068            std::vec::Vec<crate::model::cross_cluster_replication_config::RemoteCluster>,
3069
3070        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3071    }
3072
3073    impl Membership {
3074        pub fn new() -> Self {
3075            std::default::Default::default()
3076        }
3077
3078        /// Sets the value of [primary_cluster][crate::model::cross_cluster_replication_config::Membership::primary_cluster].
3079        pub fn set_primary_cluster<T>(mut self, v: T) -> Self
3080        where
3081            T: std::convert::Into<crate::model::cross_cluster_replication_config::RemoteCluster>,
3082        {
3083            self.primary_cluster = std::option::Option::Some(v.into());
3084            self
3085        }
3086
3087        /// Sets or clears the value of [primary_cluster][crate::model::cross_cluster_replication_config::Membership::primary_cluster].
3088        pub fn set_or_clear_primary_cluster<T>(mut self, v: std::option::Option<T>) -> Self
3089        where
3090            T: std::convert::Into<crate::model::cross_cluster_replication_config::RemoteCluster>,
3091        {
3092            self.primary_cluster = v.map(|x| x.into());
3093            self
3094        }
3095
3096        /// Sets the value of [secondary_clusters][crate::model::cross_cluster_replication_config::Membership::secondary_clusters].
3097        pub fn set_secondary_clusters<T, V>(mut self, v: T) -> Self
3098        where
3099            T: std::iter::IntoIterator<Item = V>,
3100            V: std::convert::Into<crate::model::cross_cluster_replication_config::RemoteCluster>,
3101        {
3102            use std::iter::Iterator;
3103            self.secondary_clusters = v.into_iter().map(|i| i.into()).collect();
3104            self
3105        }
3106    }
3107
3108    impl wkt::message::Message for Membership {
3109        fn typename() -> &'static str {
3110            "type.googleapis.com/google.cloud.redis.cluster.v1.CrossClusterReplicationConfig.Membership"
3111        }
3112    }
3113
3114    /// The role of the cluster in cross cluster replication.
3115    ///
3116    /// # Working with unknown values
3117    ///
3118    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3119    /// additional enum variants at any time. Adding new variants is not considered
3120    /// a breaking change. Applications should write their code in anticipation of:
3121    ///
3122    /// - New values appearing in future releases of the client library, **and**
3123    /// - New values received dynamically, without application changes.
3124    ///
3125    /// Please consult the [Working with enums] section in the user guide for some
3126    /// guidelines.
3127    ///
3128    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3129    #[derive(Clone, Debug, PartialEq)]
3130    #[non_exhaustive]
3131    pub enum ClusterRole {
3132        /// Cluster role is not set.
3133        /// The behavior is equivalent to NONE.
3134        Unspecified,
3135        /// This cluster does not participate in cross cluster replication. It is an
3136        /// independent cluster and does not replicate to or from any other clusters.
3137        None,
3138        /// A cluster that allows both reads and writes. Any data written to this
3139        /// cluster is also replicated to the attached secondary clusters.
3140        Primary,
3141        /// A cluster that allows only reads and replicates data from a primary
3142        /// cluster.
3143        Secondary,
3144        /// If set, the enum was initialized with an unknown value.
3145        ///
3146        /// Applications can examine the value using [ClusterRole::value] or
3147        /// [ClusterRole::name].
3148        UnknownValue(cluster_role::UnknownValue),
3149    }
3150
3151    #[doc(hidden)]
3152    pub mod cluster_role {
3153        #[allow(unused_imports)]
3154        use super::*;
3155        #[derive(Clone, Debug, PartialEq)]
3156        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3157    }
3158
3159    impl ClusterRole {
3160        /// Gets the enum value.
3161        ///
3162        /// Returns `None` if the enum contains an unknown value deserialized from
3163        /// the string representation of enums.
3164        pub fn value(&self) -> std::option::Option<i32> {
3165            match self {
3166                Self::Unspecified => std::option::Option::Some(0),
3167                Self::None => std::option::Option::Some(1),
3168                Self::Primary => std::option::Option::Some(2),
3169                Self::Secondary => std::option::Option::Some(3),
3170                Self::UnknownValue(u) => u.0.value(),
3171            }
3172        }
3173
3174        /// Gets the enum value as a string.
3175        ///
3176        /// Returns `None` if the enum contains an unknown value deserialized from
3177        /// the integer representation of enums.
3178        pub fn name(&self) -> std::option::Option<&str> {
3179            match self {
3180                Self::Unspecified => std::option::Option::Some("CLUSTER_ROLE_UNSPECIFIED"),
3181                Self::None => std::option::Option::Some("NONE"),
3182                Self::Primary => std::option::Option::Some("PRIMARY"),
3183                Self::Secondary => std::option::Option::Some("SECONDARY"),
3184                Self::UnknownValue(u) => u.0.name(),
3185            }
3186        }
3187    }
3188
3189    impl std::default::Default for ClusterRole {
3190        fn default() -> Self {
3191            use std::convert::From;
3192            Self::from(0)
3193        }
3194    }
3195
3196    impl std::fmt::Display for ClusterRole {
3197        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3198            wkt::internal::display_enum(f, self.name(), self.value())
3199        }
3200    }
3201
3202    impl std::convert::From<i32> for ClusterRole {
3203        fn from(value: i32) -> Self {
3204            match value {
3205                0 => Self::Unspecified,
3206                1 => Self::None,
3207                2 => Self::Primary,
3208                3 => Self::Secondary,
3209                _ => Self::UnknownValue(cluster_role::UnknownValue(
3210                    wkt::internal::UnknownEnumValue::Integer(value),
3211                )),
3212            }
3213        }
3214    }
3215
3216    impl std::convert::From<&str> for ClusterRole {
3217        fn from(value: &str) -> Self {
3218            use std::string::ToString;
3219            match value {
3220                "CLUSTER_ROLE_UNSPECIFIED" => Self::Unspecified,
3221                "NONE" => Self::None,
3222                "PRIMARY" => Self::Primary,
3223                "SECONDARY" => Self::Secondary,
3224                _ => Self::UnknownValue(cluster_role::UnknownValue(
3225                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3226                )),
3227            }
3228        }
3229    }
3230
3231    impl serde::ser::Serialize for ClusterRole {
3232        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3233        where
3234            S: serde::Serializer,
3235        {
3236            match self {
3237                Self::Unspecified => serializer.serialize_i32(0),
3238                Self::None => serializer.serialize_i32(1),
3239                Self::Primary => serializer.serialize_i32(2),
3240                Self::Secondary => serializer.serialize_i32(3),
3241                Self::UnknownValue(u) => u.0.serialize(serializer),
3242            }
3243        }
3244    }
3245
3246    impl<'de> serde::de::Deserialize<'de> for ClusterRole {
3247        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3248        where
3249            D: serde::Deserializer<'de>,
3250        {
3251            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterRole>::new(
3252                ".google.cloud.redis.cluster.v1.CrossClusterReplicationConfig.ClusterRole",
3253            ))
3254        }
3255    }
3256}
3257
3258/// Maintenance policy per cluster.
3259#[derive(Clone, Default, PartialEq)]
3260#[non_exhaustive]
3261pub struct ClusterMaintenancePolicy {
3262    /// Output only. The time when the policy was created i.e. Maintenance Window
3263    /// or Deny Period was assigned.
3264    pub create_time: std::option::Option<wkt::Timestamp>,
3265
3266    /// Output only. The time when the policy was updated i.e. Maintenance Window
3267    /// or Deny Period was updated.
3268    pub update_time: std::option::Option<wkt::Timestamp>,
3269
3270    /// Optional. Maintenance window that is applied to resources covered by this
3271    /// policy. Minimum 1. For the current version, the maximum number of
3272    /// weekly_maintenance_window is expected to be one.
3273    pub weekly_maintenance_window: std::vec::Vec<crate::model::ClusterWeeklyMaintenanceWindow>,
3274
3275    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3276}
3277
3278impl ClusterMaintenancePolicy {
3279    pub fn new() -> Self {
3280        std::default::Default::default()
3281    }
3282
3283    /// Sets the value of [create_time][crate::model::ClusterMaintenancePolicy::create_time].
3284    pub fn set_create_time<T>(mut self, v: T) -> Self
3285    where
3286        T: std::convert::Into<wkt::Timestamp>,
3287    {
3288        self.create_time = std::option::Option::Some(v.into());
3289        self
3290    }
3291
3292    /// Sets or clears the value of [create_time][crate::model::ClusterMaintenancePolicy::create_time].
3293    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3294    where
3295        T: std::convert::Into<wkt::Timestamp>,
3296    {
3297        self.create_time = v.map(|x| x.into());
3298        self
3299    }
3300
3301    /// Sets the value of [update_time][crate::model::ClusterMaintenancePolicy::update_time].
3302    pub fn set_update_time<T>(mut self, v: T) -> Self
3303    where
3304        T: std::convert::Into<wkt::Timestamp>,
3305    {
3306        self.update_time = std::option::Option::Some(v.into());
3307        self
3308    }
3309
3310    /// Sets or clears the value of [update_time][crate::model::ClusterMaintenancePolicy::update_time].
3311    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3312    where
3313        T: std::convert::Into<wkt::Timestamp>,
3314    {
3315        self.update_time = v.map(|x| x.into());
3316        self
3317    }
3318
3319    /// Sets the value of [weekly_maintenance_window][crate::model::ClusterMaintenancePolicy::weekly_maintenance_window].
3320    pub fn set_weekly_maintenance_window<T, V>(mut self, v: T) -> Self
3321    where
3322        T: std::iter::IntoIterator<Item = V>,
3323        V: std::convert::Into<crate::model::ClusterWeeklyMaintenanceWindow>,
3324    {
3325        use std::iter::Iterator;
3326        self.weekly_maintenance_window = v.into_iter().map(|i| i.into()).collect();
3327        self
3328    }
3329}
3330
3331impl wkt::message::Message for ClusterMaintenancePolicy {
3332    fn typename() -> &'static str {
3333        "type.googleapis.com/google.cloud.redis.cluster.v1.ClusterMaintenancePolicy"
3334    }
3335}
3336
3337/// Time window specified for weekly operations.
3338#[derive(Clone, Default, PartialEq)]
3339#[non_exhaustive]
3340pub struct ClusterWeeklyMaintenanceWindow {
3341    /// Allows to define schedule that runs specified day of the week.
3342    pub day: gtype::model::DayOfWeek,
3343
3344    /// Start time of the window in UTC.
3345    pub start_time: std::option::Option<gtype::model::TimeOfDay>,
3346
3347    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3348}
3349
3350impl ClusterWeeklyMaintenanceWindow {
3351    pub fn new() -> Self {
3352        std::default::Default::default()
3353    }
3354
3355    /// Sets the value of [day][crate::model::ClusterWeeklyMaintenanceWindow::day].
3356    pub fn set_day<T: std::convert::Into<gtype::model::DayOfWeek>>(mut self, v: T) -> Self {
3357        self.day = v.into();
3358        self
3359    }
3360
3361    /// Sets the value of [start_time][crate::model::ClusterWeeklyMaintenanceWindow::start_time].
3362    pub fn set_start_time<T>(mut self, v: T) -> Self
3363    where
3364        T: std::convert::Into<gtype::model::TimeOfDay>,
3365    {
3366        self.start_time = std::option::Option::Some(v.into());
3367        self
3368    }
3369
3370    /// Sets or clears the value of [start_time][crate::model::ClusterWeeklyMaintenanceWindow::start_time].
3371    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3372    where
3373        T: std::convert::Into<gtype::model::TimeOfDay>,
3374    {
3375        self.start_time = v.map(|x| x.into());
3376        self
3377    }
3378}
3379
3380impl wkt::message::Message for ClusterWeeklyMaintenanceWindow {
3381    fn typename() -> &'static str {
3382        "type.googleapis.com/google.cloud.redis.cluster.v1.ClusterWeeklyMaintenanceWindow"
3383    }
3384}
3385
3386/// Upcoming maitenance schedule.
3387#[derive(Clone, Default, PartialEq)]
3388#[non_exhaustive]
3389pub struct ClusterMaintenanceSchedule {
3390    /// Output only. The start time of any upcoming scheduled maintenance for this
3391    /// instance.
3392    pub start_time: std::option::Option<wkt::Timestamp>,
3393
3394    /// Output only. The end time of any upcoming scheduled maintenance for this
3395    /// instance.
3396    pub end_time: std::option::Option<wkt::Timestamp>,
3397
3398    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3399}
3400
3401impl ClusterMaintenanceSchedule {
3402    pub fn new() -> Self {
3403        std::default::Default::default()
3404    }
3405
3406    /// Sets the value of [start_time][crate::model::ClusterMaintenanceSchedule::start_time].
3407    pub fn set_start_time<T>(mut self, v: T) -> Self
3408    where
3409        T: std::convert::Into<wkt::Timestamp>,
3410    {
3411        self.start_time = std::option::Option::Some(v.into());
3412        self
3413    }
3414
3415    /// Sets or clears the value of [start_time][crate::model::ClusterMaintenanceSchedule::start_time].
3416    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3417    where
3418        T: std::convert::Into<wkt::Timestamp>,
3419    {
3420        self.start_time = v.map(|x| x.into());
3421        self
3422    }
3423
3424    /// Sets the value of [end_time][crate::model::ClusterMaintenanceSchedule::end_time].
3425    pub fn set_end_time<T>(mut self, v: T) -> Self
3426    where
3427        T: std::convert::Into<wkt::Timestamp>,
3428    {
3429        self.end_time = std::option::Option::Some(v.into());
3430        self
3431    }
3432
3433    /// Sets or clears the value of [end_time][crate::model::ClusterMaintenanceSchedule::end_time].
3434    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3435    where
3436        T: std::convert::Into<wkt::Timestamp>,
3437    {
3438        self.end_time = v.map(|x| x.into());
3439        self
3440    }
3441}
3442
3443impl wkt::message::Message for ClusterMaintenanceSchedule {
3444    fn typename() -> &'static str {
3445        "type.googleapis.com/google.cloud.redis.cluster.v1.ClusterMaintenanceSchedule"
3446    }
3447}
3448
3449#[derive(Clone, Default, PartialEq)]
3450#[non_exhaustive]
3451pub struct PscConfig {
3452    /// Required. The network where the IP address of the discovery endpoint will
3453    /// be reserved, in the form of
3454    /// projects/{network_project}/global/networks/{network_id}.
3455    pub network: std::string::String,
3456
3457    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3458}
3459
3460impl PscConfig {
3461    pub fn new() -> Self {
3462        std::default::Default::default()
3463    }
3464
3465    /// Sets the value of [network][crate::model::PscConfig::network].
3466    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3467        self.network = v.into();
3468        self
3469    }
3470}
3471
3472impl wkt::message::Message for PscConfig {
3473    fn typename() -> &'static str {
3474        "type.googleapis.com/google.cloud.redis.cluster.v1.PscConfig"
3475    }
3476}
3477
3478/// Endpoints on each network, for Redis clients to connect to the cluster.
3479#[derive(Clone, Default, PartialEq)]
3480#[non_exhaustive]
3481pub struct DiscoveryEndpoint {
3482    /// Output only. Address of the exposed Redis endpoint used by clients to
3483    /// connect to the service. The address could be either IP or hostname.
3484    pub address: std::string::String,
3485
3486    /// Output only. The port number of the exposed Redis endpoint.
3487    pub port: i32,
3488
3489    /// Output only. Customer configuration for where the endpoint is created and
3490    /// accessed from.
3491    pub psc_config: std::option::Option<crate::model::PscConfig>,
3492
3493    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3494}
3495
3496impl DiscoveryEndpoint {
3497    pub fn new() -> Self {
3498        std::default::Default::default()
3499    }
3500
3501    /// Sets the value of [address][crate::model::DiscoveryEndpoint::address].
3502    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3503        self.address = v.into();
3504        self
3505    }
3506
3507    /// Sets the value of [port][crate::model::DiscoveryEndpoint::port].
3508    pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3509        self.port = v.into();
3510        self
3511    }
3512
3513    /// Sets the value of [psc_config][crate::model::DiscoveryEndpoint::psc_config].
3514    pub fn set_psc_config<T>(mut self, v: T) -> Self
3515    where
3516        T: std::convert::Into<crate::model::PscConfig>,
3517    {
3518        self.psc_config = std::option::Option::Some(v.into());
3519        self
3520    }
3521
3522    /// Sets or clears the value of [psc_config][crate::model::DiscoveryEndpoint::psc_config].
3523    pub fn set_or_clear_psc_config<T>(mut self, v: std::option::Option<T>) -> Self
3524    where
3525        T: std::convert::Into<crate::model::PscConfig>,
3526    {
3527        self.psc_config = v.map(|x| x.into());
3528        self
3529    }
3530}
3531
3532impl wkt::message::Message for DiscoveryEndpoint {
3533    fn typename() -> &'static str {
3534        "type.googleapis.com/google.cloud.redis.cluster.v1.DiscoveryEndpoint"
3535    }
3536}
3537
3538/// Details of consumer resources in a PSC connection.
3539#[derive(Clone, Default, PartialEq)]
3540#[non_exhaustive]
3541pub struct PscConnection {
3542    /// Required. The PSC connection id of the forwarding rule connected to the
3543    /// service attachment.
3544    pub psc_connection_id: std::string::String,
3545
3546    /// Required. The IP allocated on the consumer network for the PSC forwarding
3547    /// rule.
3548    pub address: std::string::String,
3549
3550    /// Required. The URI of the consumer side forwarding rule.
3551    /// Example:
3552    /// projects/{projectNumOrId}/regions/us-east1/forwardingRules/{resourceId}.
3553    pub forwarding_rule: std::string::String,
3554
3555    /// Optional. Project ID of the consumer project where the forwarding rule is
3556    /// created in.
3557    pub project_id: std::string::String,
3558
3559    /// Required. The consumer network where the IP address resides, in the form of
3560    /// projects/{project_id}/global/networks/{network_id}.
3561    pub network: std::string::String,
3562
3563    /// Required. The service attachment which is the target of the PSC connection,
3564    /// in the form of
3565    /// projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
3566    pub service_attachment: std::string::String,
3567
3568    /// Output only. The status of the PSC connection.
3569    /// Please note that this value is updated periodically.
3570    /// To get the latest status of a PSC connection, follow
3571    /// <https://cloud.google.com/vpc/docs/configure-private-service-connect-services#endpoint-details>.
3572    pub psc_connection_status: crate::model::PscConnectionStatus,
3573
3574    /// Output only. Type of the PSC connection.
3575    pub connection_type: crate::model::ConnectionType,
3576
3577    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3578}
3579
3580impl PscConnection {
3581    pub fn new() -> Self {
3582        std::default::Default::default()
3583    }
3584
3585    /// Sets the value of [psc_connection_id][crate::model::PscConnection::psc_connection_id].
3586    pub fn set_psc_connection_id<T: std::convert::Into<std::string::String>>(
3587        mut self,
3588        v: T,
3589    ) -> Self {
3590        self.psc_connection_id = v.into();
3591        self
3592    }
3593
3594    /// Sets the value of [address][crate::model::PscConnection::address].
3595    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3596        self.address = v.into();
3597        self
3598    }
3599
3600    /// Sets the value of [forwarding_rule][crate::model::PscConnection::forwarding_rule].
3601    pub fn set_forwarding_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3602        self.forwarding_rule = v.into();
3603        self
3604    }
3605
3606    /// Sets the value of [project_id][crate::model::PscConnection::project_id].
3607    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3608        self.project_id = v.into();
3609        self
3610    }
3611
3612    /// Sets the value of [network][crate::model::PscConnection::network].
3613    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3614        self.network = v.into();
3615        self
3616    }
3617
3618    /// Sets the value of [service_attachment][crate::model::PscConnection::service_attachment].
3619    pub fn set_service_attachment<T: std::convert::Into<std::string::String>>(
3620        mut self,
3621        v: T,
3622    ) -> Self {
3623        self.service_attachment = v.into();
3624        self
3625    }
3626
3627    /// Sets the value of [psc_connection_status][crate::model::PscConnection::psc_connection_status].
3628    pub fn set_psc_connection_status<T: std::convert::Into<crate::model::PscConnectionStatus>>(
3629        mut self,
3630        v: T,
3631    ) -> Self {
3632        self.psc_connection_status = v.into();
3633        self
3634    }
3635
3636    /// Sets the value of [connection_type][crate::model::PscConnection::connection_type].
3637    pub fn set_connection_type<T: std::convert::Into<crate::model::ConnectionType>>(
3638        mut self,
3639        v: T,
3640    ) -> Self {
3641        self.connection_type = v.into();
3642        self
3643    }
3644}
3645
3646impl wkt::message::Message for PscConnection {
3647    fn typename() -> &'static str {
3648        "type.googleapis.com/google.cloud.redis.cluster.v1.PscConnection"
3649    }
3650}
3651
3652/// ClusterEndpoint consists of PSC connections that are created
3653/// as a group in each VPC network for accessing the cluster. In each group,
3654/// there shall be one connection for each service attachment in the cluster.
3655#[derive(Clone, Default, PartialEq)]
3656#[non_exhaustive]
3657pub struct ClusterEndpoint {
3658    /// A group of PSC connections. They are created in the same VPC network, one
3659    /// for each service attachment in the cluster.
3660    pub connections: std::vec::Vec<crate::model::ConnectionDetail>,
3661
3662    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3663}
3664
3665impl ClusterEndpoint {
3666    pub fn new() -> Self {
3667        std::default::Default::default()
3668    }
3669
3670    /// Sets the value of [connections][crate::model::ClusterEndpoint::connections].
3671    pub fn set_connections<T, V>(mut self, v: T) -> Self
3672    where
3673        T: std::iter::IntoIterator<Item = V>,
3674        V: std::convert::Into<crate::model::ConnectionDetail>,
3675    {
3676        use std::iter::Iterator;
3677        self.connections = v.into_iter().map(|i| i.into()).collect();
3678        self
3679    }
3680}
3681
3682impl wkt::message::Message for ClusterEndpoint {
3683    fn typename() -> &'static str {
3684        "type.googleapis.com/google.cloud.redis.cluster.v1.ClusterEndpoint"
3685    }
3686}
3687
3688/// Detailed information of each PSC connection.
3689#[derive(Clone, Default, PartialEq)]
3690#[non_exhaustive]
3691pub struct ConnectionDetail {
3692    /// A PSC connection to a cluster could either be created through Service
3693    /// Connectivity Automation (auto-registered connection) during the cluster
3694    /// creation, or it could be created by customer themselves (user-registered
3695    /// connection).
3696    pub connection: std::option::Option<crate::model::connection_detail::Connection>,
3697
3698    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3699}
3700
3701impl ConnectionDetail {
3702    pub fn new() -> Self {
3703        std::default::Default::default()
3704    }
3705
3706    /// Sets the value of [connection][crate::model::ConnectionDetail::connection].
3707    ///
3708    /// Note that all the setters affecting `connection` are mutually
3709    /// exclusive.
3710    pub fn set_connection<
3711        T: std::convert::Into<std::option::Option<crate::model::connection_detail::Connection>>,
3712    >(
3713        mut self,
3714        v: T,
3715    ) -> Self {
3716        self.connection = v.into();
3717        self
3718    }
3719
3720    /// The value of [connection][crate::model::ConnectionDetail::connection]
3721    /// if it holds a `PscAutoConnection`, `None` if the field is not set or
3722    /// holds a different branch.
3723    pub fn psc_auto_connection(
3724        &self,
3725    ) -> std::option::Option<&std::boxed::Box<crate::model::PscAutoConnection>> {
3726        #[allow(unreachable_patterns)]
3727        self.connection.as_ref().and_then(|v| match v {
3728            crate::model::connection_detail::Connection::PscAutoConnection(v) => {
3729                std::option::Option::Some(v)
3730            }
3731            _ => std::option::Option::None,
3732        })
3733    }
3734
3735    /// Sets the value of [connection][crate::model::ConnectionDetail::connection]
3736    /// to hold a `PscAutoConnection`.
3737    ///
3738    /// Note that all the setters affecting `connection` are
3739    /// mutually exclusive.
3740    pub fn set_psc_auto_connection<
3741        T: std::convert::Into<std::boxed::Box<crate::model::PscAutoConnection>>,
3742    >(
3743        mut self,
3744        v: T,
3745    ) -> Self {
3746        self.connection = std::option::Option::Some(
3747            crate::model::connection_detail::Connection::PscAutoConnection(v.into()),
3748        );
3749        self
3750    }
3751
3752    /// The value of [connection][crate::model::ConnectionDetail::connection]
3753    /// if it holds a `PscConnection`, `None` if the field is not set or
3754    /// holds a different branch.
3755    pub fn psc_connection(
3756        &self,
3757    ) -> std::option::Option<&std::boxed::Box<crate::model::PscConnection>> {
3758        #[allow(unreachable_patterns)]
3759        self.connection.as_ref().and_then(|v| match v {
3760            crate::model::connection_detail::Connection::PscConnection(v) => {
3761                std::option::Option::Some(v)
3762            }
3763            _ => std::option::Option::None,
3764        })
3765    }
3766
3767    /// Sets the value of [connection][crate::model::ConnectionDetail::connection]
3768    /// to hold a `PscConnection`.
3769    ///
3770    /// Note that all the setters affecting `connection` are
3771    /// mutually exclusive.
3772    pub fn set_psc_connection<
3773        T: std::convert::Into<std::boxed::Box<crate::model::PscConnection>>,
3774    >(
3775        mut self,
3776        v: T,
3777    ) -> Self {
3778        self.connection = std::option::Option::Some(
3779            crate::model::connection_detail::Connection::PscConnection(v.into()),
3780        );
3781        self
3782    }
3783}
3784
3785impl wkt::message::Message for ConnectionDetail {
3786    fn typename() -> &'static str {
3787        "type.googleapis.com/google.cloud.redis.cluster.v1.ConnectionDetail"
3788    }
3789}
3790
3791/// Defines additional types related to [ConnectionDetail].
3792pub mod connection_detail {
3793    #[allow(unused_imports)]
3794    use super::*;
3795
3796    /// A PSC connection to a cluster could either be created through Service
3797    /// Connectivity Automation (auto-registered connection) during the cluster
3798    /// creation, or it could be created by customer themselves (user-registered
3799    /// connection).
3800    #[derive(Clone, Debug, PartialEq)]
3801    #[non_exhaustive]
3802    pub enum Connection {
3803        /// Detailed information of a PSC connection that is created through
3804        /// service connectivity automation.
3805        PscAutoConnection(std::boxed::Box<crate::model::PscAutoConnection>),
3806        /// Detailed information of a PSC connection that is created by the customer
3807        /// who owns the cluster.
3808        PscConnection(std::boxed::Box<crate::model::PscConnection>),
3809    }
3810}
3811
3812/// Details of consumer resources in a PSC connection that is created through
3813/// Service Connectivity Automation.
3814#[derive(Clone, Default, PartialEq)]
3815#[non_exhaustive]
3816pub struct PscAutoConnection {
3817    /// Output only. The PSC connection id of the forwarding rule connected to the
3818    /// service attachment.
3819    pub psc_connection_id: std::string::String,
3820
3821    /// Output only. The IP allocated on the consumer network for the PSC
3822    /// forwarding rule.
3823    pub address: std::string::String,
3824
3825    /// Output only. The URI of the consumer side forwarding rule.
3826    /// Example:
3827    /// projects/{projectNumOrId}/regions/us-east1/forwardingRules/{resourceId}.
3828    pub forwarding_rule: std::string::String,
3829
3830    /// Required. The consumer project_id where the forwarding rule is created
3831    /// from.
3832    pub project_id: std::string::String,
3833
3834    /// Required. The consumer network where the IP address resides, in the form of
3835    /// projects/{project_id}/global/networks/{network_id}.
3836    pub network: std::string::String,
3837
3838    /// Output only. The service attachment which is the target of the PSC
3839    /// connection, in the form of
3840    /// projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
3841    pub service_attachment: std::string::String,
3842
3843    /// Output only. The status of the PSC connection.
3844    /// Please note that this value is updated periodically.
3845    /// Please use Private Service Connect APIs for the latest status.
3846    pub psc_connection_status: crate::model::PscConnectionStatus,
3847
3848    /// Output only. Type of the PSC connection.
3849    pub connection_type: crate::model::ConnectionType,
3850
3851    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3852}
3853
3854impl PscAutoConnection {
3855    pub fn new() -> Self {
3856        std::default::Default::default()
3857    }
3858
3859    /// Sets the value of [psc_connection_id][crate::model::PscAutoConnection::psc_connection_id].
3860    pub fn set_psc_connection_id<T: std::convert::Into<std::string::String>>(
3861        mut self,
3862        v: T,
3863    ) -> Self {
3864        self.psc_connection_id = v.into();
3865        self
3866    }
3867
3868    /// Sets the value of [address][crate::model::PscAutoConnection::address].
3869    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3870        self.address = v.into();
3871        self
3872    }
3873
3874    /// Sets the value of [forwarding_rule][crate::model::PscAutoConnection::forwarding_rule].
3875    pub fn set_forwarding_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3876        self.forwarding_rule = v.into();
3877        self
3878    }
3879
3880    /// Sets the value of [project_id][crate::model::PscAutoConnection::project_id].
3881    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3882        self.project_id = v.into();
3883        self
3884    }
3885
3886    /// Sets the value of [network][crate::model::PscAutoConnection::network].
3887    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3888        self.network = v.into();
3889        self
3890    }
3891
3892    /// Sets the value of [service_attachment][crate::model::PscAutoConnection::service_attachment].
3893    pub fn set_service_attachment<T: std::convert::Into<std::string::String>>(
3894        mut self,
3895        v: T,
3896    ) -> Self {
3897        self.service_attachment = v.into();
3898        self
3899    }
3900
3901    /// Sets the value of [psc_connection_status][crate::model::PscAutoConnection::psc_connection_status].
3902    pub fn set_psc_connection_status<T: std::convert::Into<crate::model::PscConnectionStatus>>(
3903        mut self,
3904        v: T,
3905    ) -> Self {
3906        self.psc_connection_status = v.into();
3907        self
3908    }
3909
3910    /// Sets the value of [connection_type][crate::model::PscAutoConnection::connection_type].
3911    pub fn set_connection_type<T: std::convert::Into<crate::model::ConnectionType>>(
3912        mut self,
3913        v: T,
3914    ) -> Self {
3915        self.connection_type = v.into();
3916        self
3917    }
3918}
3919
3920impl wkt::message::Message for PscAutoConnection {
3921    fn typename() -> &'static str {
3922        "type.googleapis.com/google.cloud.redis.cluster.v1.PscAutoConnection"
3923    }
3924}
3925
3926/// Pre-defined metadata fields.
3927#[derive(Clone, Default, PartialEq)]
3928#[non_exhaustive]
3929pub struct OperationMetadata {
3930    /// Output only. The time the operation was created.
3931    pub create_time: std::option::Option<wkt::Timestamp>,
3932
3933    /// Output only. The time the operation finished running.
3934    pub end_time: std::option::Option<wkt::Timestamp>,
3935
3936    /// Output only. Server-defined resource path for the target of the operation.
3937    pub target: std::string::String,
3938
3939    /// Output only. Name of the verb executed by the operation.
3940    pub verb: std::string::String,
3941
3942    /// Output only. Human-readable status of the operation, if any.
3943    pub status_message: std::string::String,
3944
3945    /// Output only. Identifies whether the user has requested cancellation
3946    /// of the operation. Operations that have successfully been cancelled
3947    /// have [Operation.error][] value with a
3948    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
3949    /// `Code.CANCELLED`.
3950    ///
3951    /// [google.rpc.Status.code]: rpc::model::Status::code
3952    pub requested_cancellation: bool,
3953
3954    /// Output only. API version used to start the operation.
3955    pub api_version: std::string::String,
3956
3957    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3958}
3959
3960impl OperationMetadata {
3961    pub fn new() -> Self {
3962        std::default::Default::default()
3963    }
3964
3965    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
3966    pub fn set_create_time<T>(mut self, v: T) -> Self
3967    where
3968        T: std::convert::Into<wkt::Timestamp>,
3969    {
3970        self.create_time = std::option::Option::Some(v.into());
3971        self
3972    }
3973
3974    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
3975    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3976    where
3977        T: std::convert::Into<wkt::Timestamp>,
3978    {
3979        self.create_time = v.map(|x| x.into());
3980        self
3981    }
3982
3983    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
3984    pub fn set_end_time<T>(mut self, v: T) -> Self
3985    where
3986        T: std::convert::Into<wkt::Timestamp>,
3987    {
3988        self.end_time = std::option::Option::Some(v.into());
3989        self
3990    }
3991
3992    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
3993    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3994    where
3995        T: std::convert::Into<wkt::Timestamp>,
3996    {
3997        self.end_time = v.map(|x| x.into());
3998        self
3999    }
4000
4001    /// Sets the value of [target][crate::model::OperationMetadata::target].
4002    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4003        self.target = v.into();
4004        self
4005    }
4006
4007    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
4008    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4009        self.verb = v.into();
4010        self
4011    }
4012
4013    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
4014    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4015        self.status_message = v.into();
4016        self
4017    }
4018
4019    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
4020    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4021        self.requested_cancellation = v.into();
4022        self
4023    }
4024
4025    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
4026    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4027        self.api_version = v.into();
4028        self
4029    }
4030}
4031
4032impl wkt::message::Message for OperationMetadata {
4033    fn typename() -> &'static str {
4034        "type.googleapis.com/google.cloud.redis.cluster.v1.OperationMetadata"
4035    }
4036}
4037
4038/// Redis cluster certificate authority
4039#[derive(Clone, Default, PartialEq)]
4040#[non_exhaustive]
4041pub struct CertificateAuthority {
4042    /// Identifier. Unique name of the resource in this scope including project,
4043    /// location and cluster using the form:
4044    /// `projects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority`
4045    pub name: std::string::String,
4046
4047    /// server ca information
4048    pub server_ca: std::option::Option<crate::model::certificate_authority::ServerCa>,
4049
4050    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4051}
4052
4053impl CertificateAuthority {
4054    pub fn new() -> Self {
4055        std::default::Default::default()
4056    }
4057
4058    /// Sets the value of [name][crate::model::CertificateAuthority::name].
4059    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4060        self.name = v.into();
4061        self
4062    }
4063
4064    /// Sets the value of [server_ca][crate::model::CertificateAuthority::server_ca].
4065    ///
4066    /// Note that all the setters affecting `server_ca` are mutually
4067    /// exclusive.
4068    pub fn set_server_ca<
4069        T: std::convert::Into<std::option::Option<crate::model::certificate_authority::ServerCa>>,
4070    >(
4071        mut self,
4072        v: T,
4073    ) -> Self {
4074        self.server_ca = v.into();
4075        self
4076    }
4077
4078    /// The value of [server_ca][crate::model::CertificateAuthority::server_ca]
4079    /// if it holds a `ManagedServerCa`, `None` if the field is not set or
4080    /// holds a different branch.
4081    pub fn managed_server_ca(
4082        &self,
4083    ) -> std::option::Option<
4084        &std::boxed::Box<crate::model::certificate_authority::ManagedCertificateAuthority>,
4085    > {
4086        #[allow(unreachable_patterns)]
4087        self.server_ca.as_ref().and_then(|v| match v {
4088            crate::model::certificate_authority::ServerCa::ManagedServerCa(v) => {
4089                std::option::Option::Some(v)
4090            }
4091            _ => std::option::Option::None,
4092        })
4093    }
4094
4095    /// Sets the value of [server_ca][crate::model::CertificateAuthority::server_ca]
4096    /// to hold a `ManagedServerCa`.
4097    ///
4098    /// Note that all the setters affecting `server_ca` are
4099    /// mutually exclusive.
4100    pub fn set_managed_server_ca<
4101        T: std::convert::Into<
4102                std::boxed::Box<crate::model::certificate_authority::ManagedCertificateAuthority>,
4103            >,
4104    >(
4105        mut self,
4106        v: T,
4107    ) -> Self {
4108        self.server_ca = std::option::Option::Some(
4109            crate::model::certificate_authority::ServerCa::ManagedServerCa(v.into()),
4110        );
4111        self
4112    }
4113}
4114
4115impl wkt::message::Message for CertificateAuthority {
4116    fn typename() -> &'static str {
4117        "type.googleapis.com/google.cloud.redis.cluster.v1.CertificateAuthority"
4118    }
4119}
4120
4121/// Defines additional types related to [CertificateAuthority].
4122pub mod certificate_authority {
4123    #[allow(unused_imports)]
4124    use super::*;
4125
4126    #[derive(Clone, Default, PartialEq)]
4127    #[non_exhaustive]
4128    pub struct ManagedCertificateAuthority {
4129        /// The PEM encoded CA certificate chains for redis managed
4130        /// server authentication
4131        pub ca_certs: std::vec::Vec<
4132            crate::model::certificate_authority::managed_certificate_authority::CertChain,
4133        >,
4134
4135        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4136    }
4137
4138    impl ManagedCertificateAuthority {
4139        pub fn new() -> Self {
4140            std::default::Default::default()
4141        }
4142
4143        /// Sets the value of [ca_certs][crate::model::certificate_authority::ManagedCertificateAuthority::ca_certs].
4144        pub fn set_ca_certs<T, V>(mut self, v: T) -> Self
4145        where
4146            T: std::iter::IntoIterator<Item = V>,
4147            V: std::convert::Into<
4148                    crate::model::certificate_authority::managed_certificate_authority::CertChain,
4149                >,
4150        {
4151            use std::iter::Iterator;
4152            self.ca_certs = v.into_iter().map(|i| i.into()).collect();
4153            self
4154        }
4155    }
4156
4157    impl wkt::message::Message for ManagedCertificateAuthority {
4158        fn typename() -> &'static str {
4159            "type.googleapis.com/google.cloud.redis.cluster.v1.CertificateAuthority.ManagedCertificateAuthority"
4160        }
4161    }
4162
4163    /// Defines additional types related to [ManagedCertificateAuthority].
4164    pub mod managed_certificate_authority {
4165        #[allow(unused_imports)]
4166        use super::*;
4167
4168        #[derive(Clone, Default, PartialEq)]
4169        #[non_exhaustive]
4170        pub struct CertChain {
4171            /// The certificates that form the CA chain, from leaf to root order.
4172            pub certificates: std::vec::Vec<std::string::String>,
4173
4174            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4175        }
4176
4177        impl CertChain {
4178            pub fn new() -> Self {
4179                std::default::Default::default()
4180            }
4181
4182            /// Sets the value of [certificates][crate::model::certificate_authority::managed_certificate_authority::CertChain::certificates].
4183            pub fn set_certificates<T, V>(mut self, v: T) -> Self
4184            where
4185                T: std::iter::IntoIterator<Item = V>,
4186                V: std::convert::Into<std::string::String>,
4187            {
4188                use std::iter::Iterator;
4189                self.certificates = v.into_iter().map(|i| i.into()).collect();
4190                self
4191            }
4192        }
4193
4194        impl wkt::message::Message for CertChain {
4195            fn typename() -> &'static str {
4196                "type.googleapis.com/google.cloud.redis.cluster.v1.CertificateAuthority.ManagedCertificateAuthority.CertChain"
4197            }
4198        }
4199    }
4200
4201    /// server ca information
4202    #[derive(Clone, Debug, PartialEq)]
4203    #[non_exhaustive]
4204    pub enum ServerCa {
4205        ManagedServerCa(
4206            std::boxed::Box<crate::model::certificate_authority::ManagedCertificateAuthority>,
4207        ),
4208    }
4209}
4210
4211/// Configuration of the persistence functionality.
4212#[derive(Clone, Default, PartialEq)]
4213#[non_exhaustive]
4214pub struct ClusterPersistenceConfig {
4215    /// Optional. The mode of persistence.
4216    pub mode: crate::model::cluster_persistence_config::PersistenceMode,
4217
4218    /// Optional. RDB configuration. This field will be ignored if mode is not RDB.
4219    pub rdb_config: std::option::Option<crate::model::cluster_persistence_config::RDBConfig>,
4220
4221    /// Optional. AOF configuration. This field will be ignored if mode is not AOF.
4222    pub aof_config: std::option::Option<crate::model::cluster_persistence_config::AOFConfig>,
4223
4224    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4225}
4226
4227impl ClusterPersistenceConfig {
4228    pub fn new() -> Self {
4229        std::default::Default::default()
4230    }
4231
4232    /// Sets the value of [mode][crate::model::ClusterPersistenceConfig::mode].
4233    pub fn set_mode<
4234        T: std::convert::Into<crate::model::cluster_persistence_config::PersistenceMode>,
4235    >(
4236        mut self,
4237        v: T,
4238    ) -> Self {
4239        self.mode = v.into();
4240        self
4241    }
4242
4243    /// Sets the value of [rdb_config][crate::model::ClusterPersistenceConfig::rdb_config].
4244    pub fn set_rdb_config<T>(mut self, v: T) -> Self
4245    where
4246        T: std::convert::Into<crate::model::cluster_persistence_config::RDBConfig>,
4247    {
4248        self.rdb_config = std::option::Option::Some(v.into());
4249        self
4250    }
4251
4252    /// Sets or clears the value of [rdb_config][crate::model::ClusterPersistenceConfig::rdb_config].
4253    pub fn set_or_clear_rdb_config<T>(mut self, v: std::option::Option<T>) -> Self
4254    where
4255        T: std::convert::Into<crate::model::cluster_persistence_config::RDBConfig>,
4256    {
4257        self.rdb_config = v.map(|x| x.into());
4258        self
4259    }
4260
4261    /// Sets the value of [aof_config][crate::model::ClusterPersistenceConfig::aof_config].
4262    pub fn set_aof_config<T>(mut self, v: T) -> Self
4263    where
4264        T: std::convert::Into<crate::model::cluster_persistence_config::AOFConfig>,
4265    {
4266        self.aof_config = std::option::Option::Some(v.into());
4267        self
4268    }
4269
4270    /// Sets or clears the value of [aof_config][crate::model::ClusterPersistenceConfig::aof_config].
4271    pub fn set_or_clear_aof_config<T>(mut self, v: std::option::Option<T>) -> Self
4272    where
4273        T: std::convert::Into<crate::model::cluster_persistence_config::AOFConfig>,
4274    {
4275        self.aof_config = v.map(|x| x.into());
4276        self
4277    }
4278}
4279
4280impl wkt::message::Message for ClusterPersistenceConfig {
4281    fn typename() -> &'static str {
4282        "type.googleapis.com/google.cloud.redis.cluster.v1.ClusterPersistenceConfig"
4283    }
4284}
4285
4286/// Defines additional types related to [ClusterPersistenceConfig].
4287pub mod cluster_persistence_config {
4288    #[allow(unused_imports)]
4289    use super::*;
4290
4291    /// Configuration of the RDB based persistence.
4292    #[derive(Clone, Default, PartialEq)]
4293    #[non_exhaustive]
4294    pub struct RDBConfig {
4295        /// Optional. Period between RDB snapshots.
4296        pub rdb_snapshot_period:
4297            crate::model::cluster_persistence_config::rdb_config::SnapshotPeriod,
4298
4299        /// Optional. The time that the first snapshot was/will be attempted, and to
4300        /// which future snapshots will be aligned. If not provided, the current time
4301        /// will be used.
4302        pub rdb_snapshot_start_time: std::option::Option<wkt::Timestamp>,
4303
4304        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4305    }
4306
4307    impl RDBConfig {
4308        pub fn new() -> Self {
4309            std::default::Default::default()
4310        }
4311
4312        /// Sets the value of [rdb_snapshot_period][crate::model::cluster_persistence_config::RDBConfig::rdb_snapshot_period].
4313        pub fn set_rdb_snapshot_period<
4314            T: std::convert::Into<
4315                    crate::model::cluster_persistence_config::rdb_config::SnapshotPeriod,
4316                >,
4317        >(
4318            mut self,
4319            v: T,
4320        ) -> Self {
4321            self.rdb_snapshot_period = v.into();
4322            self
4323        }
4324
4325        /// Sets the value of [rdb_snapshot_start_time][crate::model::cluster_persistence_config::RDBConfig::rdb_snapshot_start_time].
4326        pub fn set_rdb_snapshot_start_time<T>(mut self, v: T) -> Self
4327        where
4328            T: std::convert::Into<wkt::Timestamp>,
4329        {
4330            self.rdb_snapshot_start_time = std::option::Option::Some(v.into());
4331            self
4332        }
4333
4334        /// Sets or clears the value of [rdb_snapshot_start_time][crate::model::cluster_persistence_config::RDBConfig::rdb_snapshot_start_time].
4335        pub fn set_or_clear_rdb_snapshot_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4336        where
4337            T: std::convert::Into<wkt::Timestamp>,
4338        {
4339            self.rdb_snapshot_start_time = v.map(|x| x.into());
4340            self
4341        }
4342    }
4343
4344    impl wkt::message::Message for RDBConfig {
4345        fn typename() -> &'static str {
4346            "type.googleapis.com/google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig"
4347        }
4348    }
4349
4350    /// Defines additional types related to [RDBConfig].
4351    pub mod rdb_config {
4352        #[allow(unused_imports)]
4353        use super::*;
4354
4355        /// Available snapshot periods.
4356        ///
4357        /// # Working with unknown values
4358        ///
4359        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4360        /// additional enum variants at any time. Adding new variants is not considered
4361        /// a breaking change. Applications should write their code in anticipation of:
4362        ///
4363        /// - New values appearing in future releases of the client library, **and**
4364        /// - New values received dynamically, without application changes.
4365        ///
4366        /// Please consult the [Working with enums] section in the user guide for some
4367        /// guidelines.
4368        ///
4369        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4370        #[derive(Clone, Debug, PartialEq)]
4371        #[non_exhaustive]
4372        pub enum SnapshotPeriod {
4373            /// Not set.
4374            Unspecified,
4375            /// One hour.
4376            OneHour,
4377            /// Six hours.
4378            SixHours,
4379            /// Twelve hours.
4380            TwelveHours,
4381            /// Twenty four hours.
4382            TwentyFourHours,
4383            /// If set, the enum was initialized with an unknown value.
4384            ///
4385            /// Applications can examine the value using [SnapshotPeriod::value] or
4386            /// [SnapshotPeriod::name].
4387            UnknownValue(snapshot_period::UnknownValue),
4388        }
4389
4390        #[doc(hidden)]
4391        pub mod snapshot_period {
4392            #[allow(unused_imports)]
4393            use super::*;
4394            #[derive(Clone, Debug, PartialEq)]
4395            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4396        }
4397
4398        impl SnapshotPeriod {
4399            /// Gets the enum value.
4400            ///
4401            /// Returns `None` if the enum contains an unknown value deserialized from
4402            /// the string representation of enums.
4403            pub fn value(&self) -> std::option::Option<i32> {
4404                match self {
4405                    Self::Unspecified => std::option::Option::Some(0),
4406                    Self::OneHour => std::option::Option::Some(1),
4407                    Self::SixHours => std::option::Option::Some(2),
4408                    Self::TwelveHours => std::option::Option::Some(3),
4409                    Self::TwentyFourHours => std::option::Option::Some(4),
4410                    Self::UnknownValue(u) => u.0.value(),
4411                }
4412            }
4413
4414            /// Gets the enum value as a string.
4415            ///
4416            /// Returns `None` if the enum contains an unknown value deserialized from
4417            /// the integer representation of enums.
4418            pub fn name(&self) -> std::option::Option<&str> {
4419                match self {
4420                    Self::Unspecified => std::option::Option::Some("SNAPSHOT_PERIOD_UNSPECIFIED"),
4421                    Self::OneHour => std::option::Option::Some("ONE_HOUR"),
4422                    Self::SixHours => std::option::Option::Some("SIX_HOURS"),
4423                    Self::TwelveHours => std::option::Option::Some("TWELVE_HOURS"),
4424                    Self::TwentyFourHours => std::option::Option::Some("TWENTY_FOUR_HOURS"),
4425                    Self::UnknownValue(u) => u.0.name(),
4426                }
4427            }
4428        }
4429
4430        impl std::default::Default for SnapshotPeriod {
4431            fn default() -> Self {
4432                use std::convert::From;
4433                Self::from(0)
4434            }
4435        }
4436
4437        impl std::fmt::Display for SnapshotPeriod {
4438            fn fmt(
4439                &self,
4440                f: &mut std::fmt::Formatter<'_>,
4441            ) -> std::result::Result<(), std::fmt::Error> {
4442                wkt::internal::display_enum(f, self.name(), self.value())
4443            }
4444        }
4445
4446        impl std::convert::From<i32> for SnapshotPeriod {
4447            fn from(value: i32) -> Self {
4448                match value {
4449                    0 => Self::Unspecified,
4450                    1 => Self::OneHour,
4451                    2 => Self::SixHours,
4452                    3 => Self::TwelveHours,
4453                    4 => Self::TwentyFourHours,
4454                    _ => Self::UnknownValue(snapshot_period::UnknownValue(
4455                        wkt::internal::UnknownEnumValue::Integer(value),
4456                    )),
4457                }
4458            }
4459        }
4460
4461        impl std::convert::From<&str> for SnapshotPeriod {
4462            fn from(value: &str) -> Self {
4463                use std::string::ToString;
4464                match value {
4465                    "SNAPSHOT_PERIOD_UNSPECIFIED" => Self::Unspecified,
4466                    "ONE_HOUR" => Self::OneHour,
4467                    "SIX_HOURS" => Self::SixHours,
4468                    "TWELVE_HOURS" => Self::TwelveHours,
4469                    "TWENTY_FOUR_HOURS" => Self::TwentyFourHours,
4470                    _ => Self::UnknownValue(snapshot_period::UnknownValue(
4471                        wkt::internal::UnknownEnumValue::String(value.to_string()),
4472                    )),
4473                }
4474            }
4475        }
4476
4477        impl serde::ser::Serialize for SnapshotPeriod {
4478            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4479            where
4480                S: serde::Serializer,
4481            {
4482                match self {
4483                    Self::Unspecified => serializer.serialize_i32(0),
4484                    Self::OneHour => serializer.serialize_i32(1),
4485                    Self::SixHours => serializer.serialize_i32(2),
4486                    Self::TwelveHours => serializer.serialize_i32(3),
4487                    Self::TwentyFourHours => serializer.serialize_i32(4),
4488                    Self::UnknownValue(u) => u.0.serialize(serializer),
4489                }
4490            }
4491        }
4492
4493        impl<'de> serde::de::Deserialize<'de> for SnapshotPeriod {
4494            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4495            where
4496                D: serde::Deserializer<'de>,
4497            {
4498                deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotPeriod>::new(
4499                    ".google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig.SnapshotPeriod"))
4500            }
4501        }
4502    }
4503
4504    /// Configuration of the AOF based persistence.
4505    #[derive(Clone, Default, PartialEq)]
4506    #[non_exhaustive]
4507    pub struct AOFConfig {
4508        /// Optional. fsync configuration.
4509        pub append_fsync: crate::model::cluster_persistence_config::aof_config::AppendFsync,
4510
4511        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4512    }
4513
4514    impl AOFConfig {
4515        pub fn new() -> Self {
4516            std::default::Default::default()
4517        }
4518
4519        /// Sets the value of [append_fsync][crate::model::cluster_persistence_config::AOFConfig::append_fsync].
4520        pub fn set_append_fsync<
4521            T: std::convert::Into<crate::model::cluster_persistence_config::aof_config::AppendFsync>,
4522        >(
4523            mut self,
4524            v: T,
4525        ) -> Self {
4526            self.append_fsync = v.into();
4527            self
4528        }
4529    }
4530
4531    impl wkt::message::Message for AOFConfig {
4532        fn typename() -> &'static str {
4533            "type.googleapis.com/google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig"
4534        }
4535    }
4536
4537    /// Defines additional types related to [AOFConfig].
4538    pub mod aof_config {
4539        #[allow(unused_imports)]
4540        use super::*;
4541
4542        /// Available fsync modes.
4543        ///
4544        /// # Working with unknown values
4545        ///
4546        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4547        /// additional enum variants at any time. Adding new variants is not considered
4548        /// a breaking change. Applications should write their code in anticipation of:
4549        ///
4550        /// - New values appearing in future releases of the client library, **and**
4551        /// - New values received dynamically, without application changes.
4552        ///
4553        /// Please consult the [Working with enums] section in the user guide for some
4554        /// guidelines.
4555        ///
4556        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4557        #[derive(Clone, Debug, PartialEq)]
4558        #[non_exhaustive]
4559        pub enum AppendFsync {
4560            /// Not set. Default: EVERYSEC
4561            Unspecified,
4562            /// Never fsync. Normally Linux will flush data every 30 seconds with this
4563            /// configuration, but it's up to the kernel's exact tuning.
4564            No,
4565            /// fsync every second. Fast enough, and you may lose 1 second of data if
4566            /// there is a disaster
4567            Everysec,
4568            /// fsync every time new write commands are appended to the AOF. It has the
4569            /// best data loss protection at the cost of performance
4570            Always,
4571            /// If set, the enum was initialized with an unknown value.
4572            ///
4573            /// Applications can examine the value using [AppendFsync::value] or
4574            /// [AppendFsync::name].
4575            UnknownValue(append_fsync::UnknownValue),
4576        }
4577
4578        #[doc(hidden)]
4579        pub mod append_fsync {
4580            #[allow(unused_imports)]
4581            use super::*;
4582            #[derive(Clone, Debug, PartialEq)]
4583            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4584        }
4585
4586        impl AppendFsync {
4587            /// Gets the enum value.
4588            ///
4589            /// Returns `None` if the enum contains an unknown value deserialized from
4590            /// the string representation of enums.
4591            pub fn value(&self) -> std::option::Option<i32> {
4592                match self {
4593                    Self::Unspecified => std::option::Option::Some(0),
4594                    Self::No => std::option::Option::Some(1),
4595                    Self::Everysec => std::option::Option::Some(2),
4596                    Self::Always => std::option::Option::Some(3),
4597                    Self::UnknownValue(u) => u.0.value(),
4598                }
4599            }
4600
4601            /// Gets the enum value as a string.
4602            ///
4603            /// Returns `None` if the enum contains an unknown value deserialized from
4604            /// the integer representation of enums.
4605            pub fn name(&self) -> std::option::Option<&str> {
4606                match self {
4607                    Self::Unspecified => std::option::Option::Some("APPEND_FSYNC_UNSPECIFIED"),
4608                    Self::No => std::option::Option::Some("NO"),
4609                    Self::Everysec => std::option::Option::Some("EVERYSEC"),
4610                    Self::Always => std::option::Option::Some("ALWAYS"),
4611                    Self::UnknownValue(u) => u.0.name(),
4612                }
4613            }
4614        }
4615
4616        impl std::default::Default for AppendFsync {
4617            fn default() -> Self {
4618                use std::convert::From;
4619                Self::from(0)
4620            }
4621        }
4622
4623        impl std::fmt::Display for AppendFsync {
4624            fn fmt(
4625                &self,
4626                f: &mut std::fmt::Formatter<'_>,
4627            ) -> std::result::Result<(), std::fmt::Error> {
4628                wkt::internal::display_enum(f, self.name(), self.value())
4629            }
4630        }
4631
4632        impl std::convert::From<i32> for AppendFsync {
4633            fn from(value: i32) -> Self {
4634                match value {
4635                    0 => Self::Unspecified,
4636                    1 => Self::No,
4637                    2 => Self::Everysec,
4638                    3 => Self::Always,
4639                    _ => Self::UnknownValue(append_fsync::UnknownValue(
4640                        wkt::internal::UnknownEnumValue::Integer(value),
4641                    )),
4642                }
4643            }
4644        }
4645
4646        impl std::convert::From<&str> for AppendFsync {
4647            fn from(value: &str) -> Self {
4648                use std::string::ToString;
4649                match value {
4650                    "APPEND_FSYNC_UNSPECIFIED" => Self::Unspecified,
4651                    "NO" => Self::No,
4652                    "EVERYSEC" => Self::Everysec,
4653                    "ALWAYS" => Self::Always,
4654                    _ => Self::UnknownValue(append_fsync::UnknownValue(
4655                        wkt::internal::UnknownEnumValue::String(value.to_string()),
4656                    )),
4657                }
4658            }
4659        }
4660
4661        impl serde::ser::Serialize for AppendFsync {
4662            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4663            where
4664                S: serde::Serializer,
4665            {
4666                match self {
4667                    Self::Unspecified => serializer.serialize_i32(0),
4668                    Self::No => serializer.serialize_i32(1),
4669                    Self::Everysec => serializer.serialize_i32(2),
4670                    Self::Always => serializer.serialize_i32(3),
4671                    Self::UnknownValue(u) => u.0.serialize(serializer),
4672                }
4673            }
4674        }
4675
4676        impl<'de> serde::de::Deserialize<'de> for AppendFsync {
4677            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4678            where
4679                D: serde::Deserializer<'de>,
4680            {
4681                deserializer.deserialize_any(wkt::internal::EnumVisitor::<AppendFsync>::new(
4682                    ".google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig.AppendFsync",
4683                ))
4684            }
4685        }
4686    }
4687
4688    /// Available persistence modes.
4689    ///
4690    /// # Working with unknown values
4691    ///
4692    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4693    /// additional enum variants at any time. Adding new variants is not considered
4694    /// a breaking change. Applications should write their code in anticipation of:
4695    ///
4696    /// - New values appearing in future releases of the client library, **and**
4697    /// - New values received dynamically, without application changes.
4698    ///
4699    /// Please consult the [Working with enums] section in the user guide for some
4700    /// guidelines.
4701    ///
4702    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4703    #[derive(Clone, Debug, PartialEq)]
4704    #[non_exhaustive]
4705    pub enum PersistenceMode {
4706        /// Not set.
4707        Unspecified,
4708        /// Persistence is disabled, and any snapshot data is deleted.
4709        Disabled,
4710        /// RDB based persistence is enabled.
4711        Rdb,
4712        /// AOF based persistence is enabled.
4713        Aof,
4714        /// If set, the enum was initialized with an unknown value.
4715        ///
4716        /// Applications can examine the value using [PersistenceMode::value] or
4717        /// [PersistenceMode::name].
4718        UnknownValue(persistence_mode::UnknownValue),
4719    }
4720
4721    #[doc(hidden)]
4722    pub mod persistence_mode {
4723        #[allow(unused_imports)]
4724        use super::*;
4725        #[derive(Clone, Debug, PartialEq)]
4726        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4727    }
4728
4729    impl PersistenceMode {
4730        /// Gets the enum value.
4731        ///
4732        /// Returns `None` if the enum contains an unknown value deserialized from
4733        /// the string representation of enums.
4734        pub fn value(&self) -> std::option::Option<i32> {
4735            match self {
4736                Self::Unspecified => std::option::Option::Some(0),
4737                Self::Disabled => std::option::Option::Some(1),
4738                Self::Rdb => std::option::Option::Some(2),
4739                Self::Aof => std::option::Option::Some(3),
4740                Self::UnknownValue(u) => u.0.value(),
4741            }
4742        }
4743
4744        /// Gets the enum value as a string.
4745        ///
4746        /// Returns `None` if the enum contains an unknown value deserialized from
4747        /// the integer representation of enums.
4748        pub fn name(&self) -> std::option::Option<&str> {
4749            match self {
4750                Self::Unspecified => std::option::Option::Some("PERSISTENCE_MODE_UNSPECIFIED"),
4751                Self::Disabled => std::option::Option::Some("DISABLED"),
4752                Self::Rdb => std::option::Option::Some("RDB"),
4753                Self::Aof => std::option::Option::Some("AOF"),
4754                Self::UnknownValue(u) => u.0.name(),
4755            }
4756        }
4757    }
4758
4759    impl std::default::Default for PersistenceMode {
4760        fn default() -> Self {
4761            use std::convert::From;
4762            Self::from(0)
4763        }
4764    }
4765
4766    impl std::fmt::Display for PersistenceMode {
4767        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4768            wkt::internal::display_enum(f, self.name(), self.value())
4769        }
4770    }
4771
4772    impl std::convert::From<i32> for PersistenceMode {
4773        fn from(value: i32) -> Self {
4774            match value {
4775                0 => Self::Unspecified,
4776                1 => Self::Disabled,
4777                2 => Self::Rdb,
4778                3 => Self::Aof,
4779                _ => Self::UnknownValue(persistence_mode::UnknownValue(
4780                    wkt::internal::UnknownEnumValue::Integer(value),
4781                )),
4782            }
4783        }
4784    }
4785
4786    impl std::convert::From<&str> for PersistenceMode {
4787        fn from(value: &str) -> Self {
4788            use std::string::ToString;
4789            match value {
4790                "PERSISTENCE_MODE_UNSPECIFIED" => Self::Unspecified,
4791                "DISABLED" => Self::Disabled,
4792                "RDB" => Self::Rdb,
4793                "AOF" => Self::Aof,
4794                _ => Self::UnknownValue(persistence_mode::UnknownValue(
4795                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4796                )),
4797            }
4798        }
4799    }
4800
4801    impl serde::ser::Serialize for PersistenceMode {
4802        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4803        where
4804            S: serde::Serializer,
4805        {
4806            match self {
4807                Self::Unspecified => serializer.serialize_i32(0),
4808                Self::Disabled => serializer.serialize_i32(1),
4809                Self::Rdb => serializer.serialize_i32(2),
4810                Self::Aof => serializer.serialize_i32(3),
4811                Self::UnknownValue(u) => u.0.serialize(serializer),
4812            }
4813        }
4814    }
4815
4816    impl<'de> serde::de::Deserialize<'de> for PersistenceMode {
4817        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4818        where
4819            D: serde::Deserializer<'de>,
4820        {
4821            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PersistenceMode>::new(
4822                ".google.cloud.redis.cluster.v1.ClusterPersistenceConfig.PersistenceMode",
4823            ))
4824        }
4825    }
4826}
4827
4828/// Zone distribution config for allocation of cluster resources.
4829#[derive(Clone, Default, PartialEq)]
4830#[non_exhaustive]
4831pub struct ZoneDistributionConfig {
4832    /// Optional. The mode of zone distribution. Defaults to MULTI_ZONE, when not
4833    /// specified.
4834    pub mode: crate::model::zone_distribution_config::ZoneDistributionMode,
4835
4836    /// Optional. When SINGLE ZONE distribution is selected, zone field would be
4837    /// used to allocate all resources in that zone. This is not applicable to
4838    /// MULTI_ZONE, and would be ignored for MULTI_ZONE clusters.
4839    pub zone: std::string::String,
4840
4841    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4842}
4843
4844impl ZoneDistributionConfig {
4845    pub fn new() -> Self {
4846        std::default::Default::default()
4847    }
4848
4849    /// Sets the value of [mode][crate::model::ZoneDistributionConfig::mode].
4850    pub fn set_mode<
4851        T: std::convert::Into<crate::model::zone_distribution_config::ZoneDistributionMode>,
4852    >(
4853        mut self,
4854        v: T,
4855    ) -> Self {
4856        self.mode = v.into();
4857        self
4858    }
4859
4860    /// Sets the value of [zone][crate::model::ZoneDistributionConfig::zone].
4861    pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4862        self.zone = v.into();
4863        self
4864    }
4865}
4866
4867impl wkt::message::Message for ZoneDistributionConfig {
4868    fn typename() -> &'static str {
4869        "type.googleapis.com/google.cloud.redis.cluster.v1.ZoneDistributionConfig"
4870    }
4871}
4872
4873/// Defines additional types related to [ZoneDistributionConfig].
4874pub mod zone_distribution_config {
4875    #[allow(unused_imports)]
4876    use super::*;
4877
4878    /// Defines various modes of zone distribution.
4879    ///
4880    /// # Working with unknown values
4881    ///
4882    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4883    /// additional enum variants at any time. Adding new variants is not considered
4884    /// a breaking change. Applications should write their code in anticipation of:
4885    ///
4886    /// - New values appearing in future releases of the client library, **and**
4887    /// - New values received dynamically, without application changes.
4888    ///
4889    /// Please consult the [Working with enums] section in the user guide for some
4890    /// guidelines.
4891    ///
4892    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4893    #[derive(Clone, Debug, PartialEq)]
4894    #[non_exhaustive]
4895    pub enum ZoneDistributionMode {
4896        /// Not Set. Default: MULTI_ZONE
4897        Unspecified,
4898        /// Distribute all resources across 3 zones picked at random, within the
4899        /// region.
4900        MultiZone,
4901        /// Distribute all resources in a single zone. The zone field must be
4902        /// specified, when this mode is selected.
4903        SingleZone,
4904        /// If set, the enum was initialized with an unknown value.
4905        ///
4906        /// Applications can examine the value using [ZoneDistributionMode::value] or
4907        /// [ZoneDistributionMode::name].
4908        UnknownValue(zone_distribution_mode::UnknownValue),
4909    }
4910
4911    #[doc(hidden)]
4912    pub mod zone_distribution_mode {
4913        #[allow(unused_imports)]
4914        use super::*;
4915        #[derive(Clone, Debug, PartialEq)]
4916        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4917    }
4918
4919    impl ZoneDistributionMode {
4920        /// Gets the enum value.
4921        ///
4922        /// Returns `None` if the enum contains an unknown value deserialized from
4923        /// the string representation of enums.
4924        pub fn value(&self) -> std::option::Option<i32> {
4925            match self {
4926                Self::Unspecified => std::option::Option::Some(0),
4927                Self::MultiZone => std::option::Option::Some(1),
4928                Self::SingleZone => std::option::Option::Some(2),
4929                Self::UnknownValue(u) => u.0.value(),
4930            }
4931        }
4932
4933        /// Gets the enum value as a string.
4934        ///
4935        /// Returns `None` if the enum contains an unknown value deserialized from
4936        /// the integer representation of enums.
4937        pub fn name(&self) -> std::option::Option<&str> {
4938            match self {
4939                Self::Unspecified => {
4940                    std::option::Option::Some("ZONE_DISTRIBUTION_MODE_UNSPECIFIED")
4941                }
4942                Self::MultiZone => std::option::Option::Some("MULTI_ZONE"),
4943                Self::SingleZone => std::option::Option::Some("SINGLE_ZONE"),
4944                Self::UnknownValue(u) => u.0.name(),
4945            }
4946        }
4947    }
4948
4949    impl std::default::Default for ZoneDistributionMode {
4950        fn default() -> Self {
4951            use std::convert::From;
4952            Self::from(0)
4953        }
4954    }
4955
4956    impl std::fmt::Display for ZoneDistributionMode {
4957        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4958            wkt::internal::display_enum(f, self.name(), self.value())
4959        }
4960    }
4961
4962    impl std::convert::From<i32> for ZoneDistributionMode {
4963        fn from(value: i32) -> Self {
4964            match value {
4965                0 => Self::Unspecified,
4966                1 => Self::MultiZone,
4967                2 => Self::SingleZone,
4968                _ => Self::UnknownValue(zone_distribution_mode::UnknownValue(
4969                    wkt::internal::UnknownEnumValue::Integer(value),
4970                )),
4971            }
4972        }
4973    }
4974
4975    impl std::convert::From<&str> for ZoneDistributionMode {
4976        fn from(value: &str) -> Self {
4977            use std::string::ToString;
4978            match value {
4979                "ZONE_DISTRIBUTION_MODE_UNSPECIFIED" => Self::Unspecified,
4980                "MULTI_ZONE" => Self::MultiZone,
4981                "SINGLE_ZONE" => Self::SingleZone,
4982                _ => Self::UnknownValue(zone_distribution_mode::UnknownValue(
4983                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4984                )),
4985            }
4986        }
4987    }
4988
4989    impl serde::ser::Serialize for ZoneDistributionMode {
4990        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4991        where
4992            S: serde::Serializer,
4993        {
4994            match self {
4995                Self::Unspecified => serializer.serialize_i32(0),
4996                Self::MultiZone => serializer.serialize_i32(1),
4997                Self::SingleZone => serializer.serialize_i32(2),
4998                Self::UnknownValue(u) => u.0.serialize(serializer),
4999            }
5000        }
5001    }
5002
5003    impl<'de> serde::de::Deserialize<'de> for ZoneDistributionMode {
5004        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5005        where
5006            D: serde::Deserializer<'de>,
5007        {
5008            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ZoneDistributionMode>::new(
5009                ".google.cloud.redis.cluster.v1.ZoneDistributionConfig.ZoneDistributionMode",
5010            ))
5011        }
5012    }
5013}
5014
5015/// Request for rescheduling a cluster maintenance.
5016#[derive(Clone, Default, PartialEq)]
5017#[non_exhaustive]
5018pub struct RescheduleClusterMaintenanceRequest {
5019    /// Required. Redis Cluster instance resource name using the form:
5020    /// `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
5021    /// where `location_id` refers to a GCP region.
5022    pub name: std::string::String,
5023
5024    /// Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as
5025    /// well.
5026    pub reschedule_type: crate::model::reschedule_cluster_maintenance_request::RescheduleType,
5027
5028    /// Optional. Timestamp when the maintenance shall be rescheduled to if
5029    /// reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
5030    /// example `2012-11-15T16:19:00.094Z`.
5031    pub schedule_time: std::option::Option<wkt::Timestamp>,
5032
5033    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5034}
5035
5036impl RescheduleClusterMaintenanceRequest {
5037    pub fn new() -> Self {
5038        std::default::Default::default()
5039    }
5040
5041    /// Sets the value of [name][crate::model::RescheduleClusterMaintenanceRequest::name].
5042    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5043        self.name = v.into();
5044        self
5045    }
5046
5047    /// Sets the value of [reschedule_type][crate::model::RescheduleClusterMaintenanceRequest::reschedule_type].
5048    pub fn set_reschedule_type<
5049        T: std::convert::Into<crate::model::reschedule_cluster_maintenance_request::RescheduleType>,
5050    >(
5051        mut self,
5052        v: T,
5053    ) -> Self {
5054        self.reschedule_type = v.into();
5055        self
5056    }
5057
5058    /// Sets the value of [schedule_time][crate::model::RescheduleClusterMaintenanceRequest::schedule_time].
5059    pub fn set_schedule_time<T>(mut self, v: T) -> Self
5060    where
5061        T: std::convert::Into<wkt::Timestamp>,
5062    {
5063        self.schedule_time = std::option::Option::Some(v.into());
5064        self
5065    }
5066
5067    /// Sets or clears the value of [schedule_time][crate::model::RescheduleClusterMaintenanceRequest::schedule_time].
5068    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
5069    where
5070        T: std::convert::Into<wkt::Timestamp>,
5071    {
5072        self.schedule_time = v.map(|x| x.into());
5073        self
5074    }
5075}
5076
5077impl wkt::message::Message for RescheduleClusterMaintenanceRequest {
5078    fn typename() -> &'static str {
5079        "type.googleapis.com/google.cloud.redis.cluster.v1.RescheduleClusterMaintenanceRequest"
5080    }
5081}
5082
5083/// Defines additional types related to [RescheduleClusterMaintenanceRequest].
5084pub mod reschedule_cluster_maintenance_request {
5085    #[allow(unused_imports)]
5086    use super::*;
5087
5088    /// Reschedule options.
5089    ///
5090    /// # Working with unknown values
5091    ///
5092    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5093    /// additional enum variants at any time. Adding new variants is not considered
5094    /// a breaking change. Applications should write their code in anticipation of:
5095    ///
5096    /// - New values appearing in future releases of the client library, **and**
5097    /// - New values received dynamically, without application changes.
5098    ///
5099    /// Please consult the [Working with enums] section in the user guide for some
5100    /// guidelines.
5101    ///
5102    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5103    #[derive(Clone, Debug, PartialEq)]
5104    #[non_exhaustive]
5105    pub enum RescheduleType {
5106        /// Not set.
5107        Unspecified,
5108        /// If the user wants to schedule the maintenance to happen now.
5109        Immediate,
5110        /// If the user wants to reschedule the maintenance to a specific time.
5111        SpecificTime,
5112        /// If set, the enum was initialized with an unknown value.
5113        ///
5114        /// Applications can examine the value using [RescheduleType::value] or
5115        /// [RescheduleType::name].
5116        UnknownValue(reschedule_type::UnknownValue),
5117    }
5118
5119    #[doc(hidden)]
5120    pub mod reschedule_type {
5121        #[allow(unused_imports)]
5122        use super::*;
5123        #[derive(Clone, Debug, PartialEq)]
5124        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5125    }
5126
5127    impl RescheduleType {
5128        /// Gets the enum value.
5129        ///
5130        /// Returns `None` if the enum contains an unknown value deserialized from
5131        /// the string representation of enums.
5132        pub fn value(&self) -> std::option::Option<i32> {
5133            match self {
5134                Self::Unspecified => std::option::Option::Some(0),
5135                Self::Immediate => std::option::Option::Some(1),
5136                Self::SpecificTime => std::option::Option::Some(3),
5137                Self::UnknownValue(u) => u.0.value(),
5138            }
5139        }
5140
5141        /// Gets the enum value as a string.
5142        ///
5143        /// Returns `None` if the enum contains an unknown value deserialized from
5144        /// the integer representation of enums.
5145        pub fn name(&self) -> std::option::Option<&str> {
5146            match self {
5147                Self::Unspecified => std::option::Option::Some("RESCHEDULE_TYPE_UNSPECIFIED"),
5148                Self::Immediate => std::option::Option::Some("IMMEDIATE"),
5149                Self::SpecificTime => std::option::Option::Some("SPECIFIC_TIME"),
5150                Self::UnknownValue(u) => u.0.name(),
5151            }
5152        }
5153    }
5154
5155    impl std::default::Default for RescheduleType {
5156        fn default() -> Self {
5157            use std::convert::From;
5158            Self::from(0)
5159        }
5160    }
5161
5162    impl std::fmt::Display for RescheduleType {
5163        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5164            wkt::internal::display_enum(f, self.name(), self.value())
5165        }
5166    }
5167
5168    impl std::convert::From<i32> for RescheduleType {
5169        fn from(value: i32) -> Self {
5170            match value {
5171                0 => Self::Unspecified,
5172                1 => Self::Immediate,
5173                3 => Self::SpecificTime,
5174                _ => Self::UnknownValue(reschedule_type::UnknownValue(
5175                    wkt::internal::UnknownEnumValue::Integer(value),
5176                )),
5177            }
5178        }
5179    }
5180
5181    impl std::convert::From<&str> for RescheduleType {
5182        fn from(value: &str) -> Self {
5183            use std::string::ToString;
5184            match value {
5185                "RESCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
5186                "IMMEDIATE" => Self::Immediate,
5187                "SPECIFIC_TIME" => Self::SpecificTime,
5188                _ => Self::UnknownValue(reschedule_type::UnknownValue(
5189                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5190                )),
5191            }
5192        }
5193    }
5194
5195    impl serde::ser::Serialize for RescheduleType {
5196        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5197        where
5198            S: serde::Serializer,
5199        {
5200            match self {
5201                Self::Unspecified => serializer.serialize_i32(0),
5202                Self::Immediate => serializer.serialize_i32(1),
5203                Self::SpecificTime => serializer.serialize_i32(3),
5204                Self::UnknownValue(u) => u.0.serialize(serializer),
5205            }
5206        }
5207    }
5208
5209    impl<'de> serde::de::Deserialize<'de> for RescheduleType {
5210        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5211        where
5212            D: serde::Deserializer<'de>,
5213        {
5214            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RescheduleType>::new(
5215                ".google.cloud.redis.cluster.v1.RescheduleClusterMaintenanceRequest.RescheduleType",
5216            ))
5217        }
5218    }
5219}
5220
5221/// EncryptionInfo describes the encryption information of a cluster or a backup.
5222#[derive(Clone, Default, PartialEq)]
5223#[non_exhaustive]
5224pub struct EncryptionInfo {
5225    /// Output only. Type of encryption.
5226    pub encryption_type: crate::model::encryption_info::Type,
5227
5228    /// Output only. KMS key versions that are being used to protect the data
5229    /// at-rest.
5230    pub kms_key_versions: std::vec::Vec<std::string::String>,
5231
5232    /// Output only. The state of the primary version of the KMS key perceived by
5233    /// the system. This field is not populated in backups.
5234    pub kms_key_primary_state: crate::model::encryption_info::KmsKeyState,
5235
5236    /// Output only. The most recent time when the encryption info was updated.
5237    pub last_update_time: std::option::Option<wkt::Timestamp>,
5238
5239    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5240}
5241
5242impl EncryptionInfo {
5243    pub fn new() -> Self {
5244        std::default::Default::default()
5245    }
5246
5247    /// Sets the value of [encryption_type][crate::model::EncryptionInfo::encryption_type].
5248    pub fn set_encryption_type<T: std::convert::Into<crate::model::encryption_info::Type>>(
5249        mut self,
5250        v: T,
5251    ) -> Self {
5252        self.encryption_type = v.into();
5253        self
5254    }
5255
5256    /// Sets the value of [kms_key_versions][crate::model::EncryptionInfo::kms_key_versions].
5257    pub fn set_kms_key_versions<T, V>(mut self, v: T) -> Self
5258    where
5259        T: std::iter::IntoIterator<Item = V>,
5260        V: std::convert::Into<std::string::String>,
5261    {
5262        use std::iter::Iterator;
5263        self.kms_key_versions = v.into_iter().map(|i| i.into()).collect();
5264        self
5265    }
5266
5267    /// Sets the value of [kms_key_primary_state][crate::model::EncryptionInfo::kms_key_primary_state].
5268    pub fn set_kms_key_primary_state<
5269        T: std::convert::Into<crate::model::encryption_info::KmsKeyState>,
5270    >(
5271        mut self,
5272        v: T,
5273    ) -> Self {
5274        self.kms_key_primary_state = v.into();
5275        self
5276    }
5277
5278    /// Sets the value of [last_update_time][crate::model::EncryptionInfo::last_update_time].
5279    pub fn set_last_update_time<T>(mut self, v: T) -> Self
5280    where
5281        T: std::convert::Into<wkt::Timestamp>,
5282    {
5283        self.last_update_time = std::option::Option::Some(v.into());
5284        self
5285    }
5286
5287    /// Sets or clears the value of [last_update_time][crate::model::EncryptionInfo::last_update_time].
5288    pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5289    where
5290        T: std::convert::Into<wkt::Timestamp>,
5291    {
5292        self.last_update_time = v.map(|x| x.into());
5293        self
5294    }
5295}
5296
5297impl wkt::message::Message for EncryptionInfo {
5298    fn typename() -> &'static str {
5299        "type.googleapis.com/google.cloud.redis.cluster.v1.EncryptionInfo"
5300    }
5301}
5302
5303/// Defines additional types related to [EncryptionInfo].
5304pub mod encryption_info {
5305    #[allow(unused_imports)]
5306    use super::*;
5307
5308    /// Possible encryption types.
5309    ///
5310    /// # Working with unknown values
5311    ///
5312    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5313    /// additional enum variants at any time. Adding new variants is not considered
5314    /// a breaking change. Applications should write their code in anticipation of:
5315    ///
5316    /// - New values appearing in future releases of the client library, **and**
5317    /// - New values received dynamically, without application changes.
5318    ///
5319    /// Please consult the [Working with enums] section in the user guide for some
5320    /// guidelines.
5321    ///
5322    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5323    #[derive(Clone, Debug, PartialEq)]
5324    #[non_exhaustive]
5325    pub enum Type {
5326        /// Encryption type not specified. Defaults to GOOGLE_DEFAULT_ENCRYPTION.
5327        Unspecified,
5328        /// The data is encrypted at rest with a key that is fully managed by Google.
5329        /// No key version will be populated. This is the default state.
5330        GoogleDefaultEncryption,
5331        /// The data is encrypted at rest with a key that is managed by the customer.
5332        /// KMS key versions will be populated.
5333        CustomerManagedEncryption,
5334        /// If set, the enum was initialized with an unknown value.
5335        ///
5336        /// Applications can examine the value using [Type::value] or
5337        /// [Type::name].
5338        UnknownValue(r#type::UnknownValue),
5339    }
5340
5341    #[doc(hidden)]
5342    pub mod r#type {
5343        #[allow(unused_imports)]
5344        use super::*;
5345        #[derive(Clone, Debug, PartialEq)]
5346        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5347    }
5348
5349    impl Type {
5350        /// Gets the enum value.
5351        ///
5352        /// Returns `None` if the enum contains an unknown value deserialized from
5353        /// the string representation of enums.
5354        pub fn value(&self) -> std::option::Option<i32> {
5355            match self {
5356                Self::Unspecified => std::option::Option::Some(0),
5357                Self::GoogleDefaultEncryption => std::option::Option::Some(1),
5358                Self::CustomerManagedEncryption => std::option::Option::Some(2),
5359                Self::UnknownValue(u) => u.0.value(),
5360            }
5361        }
5362
5363        /// Gets the enum value as a string.
5364        ///
5365        /// Returns `None` if the enum contains an unknown value deserialized from
5366        /// the integer representation of enums.
5367        pub fn name(&self) -> std::option::Option<&str> {
5368            match self {
5369                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
5370                Self::GoogleDefaultEncryption => {
5371                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
5372                }
5373                Self::CustomerManagedEncryption => {
5374                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
5375                }
5376                Self::UnknownValue(u) => u.0.name(),
5377            }
5378        }
5379    }
5380
5381    impl std::default::Default for Type {
5382        fn default() -> Self {
5383            use std::convert::From;
5384            Self::from(0)
5385        }
5386    }
5387
5388    impl std::fmt::Display for Type {
5389        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5390            wkt::internal::display_enum(f, self.name(), self.value())
5391        }
5392    }
5393
5394    impl std::convert::From<i32> for Type {
5395        fn from(value: i32) -> Self {
5396            match value {
5397                0 => Self::Unspecified,
5398                1 => Self::GoogleDefaultEncryption,
5399                2 => Self::CustomerManagedEncryption,
5400                _ => Self::UnknownValue(r#type::UnknownValue(
5401                    wkt::internal::UnknownEnumValue::Integer(value),
5402                )),
5403            }
5404        }
5405    }
5406
5407    impl std::convert::From<&str> for Type {
5408        fn from(value: &str) -> Self {
5409            use std::string::ToString;
5410            match value {
5411                "TYPE_UNSPECIFIED" => Self::Unspecified,
5412                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
5413                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
5414                _ => Self::UnknownValue(r#type::UnknownValue(
5415                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5416                )),
5417            }
5418        }
5419    }
5420
5421    impl serde::ser::Serialize for Type {
5422        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5423        where
5424            S: serde::Serializer,
5425        {
5426            match self {
5427                Self::Unspecified => serializer.serialize_i32(0),
5428                Self::GoogleDefaultEncryption => serializer.serialize_i32(1),
5429                Self::CustomerManagedEncryption => serializer.serialize_i32(2),
5430                Self::UnknownValue(u) => u.0.serialize(serializer),
5431            }
5432        }
5433    }
5434
5435    impl<'de> serde::de::Deserialize<'de> for Type {
5436        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5437        where
5438            D: serde::Deserializer<'de>,
5439        {
5440            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
5441                ".google.cloud.redis.cluster.v1.EncryptionInfo.Type",
5442            ))
5443        }
5444    }
5445
5446    /// The state of the KMS key perceived by the system. Refer to the public
5447    /// documentation for the impact of each state.
5448    ///
5449    /// # Working with unknown values
5450    ///
5451    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5452    /// additional enum variants at any time. Adding new variants is not considered
5453    /// a breaking change. Applications should write their code in anticipation of:
5454    ///
5455    /// - New values appearing in future releases of the client library, **and**
5456    /// - New values received dynamically, without application changes.
5457    ///
5458    /// Please consult the [Working with enums] section in the user guide for some
5459    /// guidelines.
5460    ///
5461    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5462    #[derive(Clone, Debug, PartialEq)]
5463    #[non_exhaustive]
5464    pub enum KmsKeyState {
5465        /// The default value. This value is unused.
5466        Unspecified,
5467        /// The KMS key is enabled and correctly configured.
5468        Enabled,
5469        /// Permission denied on the KMS key.
5470        PermissionDenied,
5471        /// The KMS key is disabled.
5472        Disabled,
5473        /// The KMS key is destroyed.
5474        Destroyed,
5475        /// The KMS key is scheduled to be destroyed.
5476        DestroyScheduled,
5477        /// The EKM key is unreachable.
5478        EkmKeyUnreachableDetected,
5479        /// Billing is disabled for the project.
5480        BillingDisabled,
5481        /// All other unknown failures.
5482        UnknownFailure,
5483        /// If set, the enum was initialized with an unknown value.
5484        ///
5485        /// Applications can examine the value using [KmsKeyState::value] or
5486        /// [KmsKeyState::name].
5487        UnknownValue(kms_key_state::UnknownValue),
5488    }
5489
5490    #[doc(hidden)]
5491    pub mod kms_key_state {
5492        #[allow(unused_imports)]
5493        use super::*;
5494        #[derive(Clone, Debug, PartialEq)]
5495        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5496    }
5497
5498    impl KmsKeyState {
5499        /// Gets the enum value.
5500        ///
5501        /// Returns `None` if the enum contains an unknown value deserialized from
5502        /// the string representation of enums.
5503        pub fn value(&self) -> std::option::Option<i32> {
5504            match self {
5505                Self::Unspecified => std::option::Option::Some(0),
5506                Self::Enabled => std::option::Option::Some(1),
5507                Self::PermissionDenied => std::option::Option::Some(2),
5508                Self::Disabled => std::option::Option::Some(3),
5509                Self::Destroyed => std::option::Option::Some(4),
5510                Self::DestroyScheduled => std::option::Option::Some(5),
5511                Self::EkmKeyUnreachableDetected => std::option::Option::Some(6),
5512                Self::BillingDisabled => std::option::Option::Some(7),
5513                Self::UnknownFailure => std::option::Option::Some(8),
5514                Self::UnknownValue(u) => u.0.value(),
5515            }
5516        }
5517
5518        /// Gets the enum value as a string.
5519        ///
5520        /// Returns `None` if the enum contains an unknown value deserialized from
5521        /// the integer representation of enums.
5522        pub fn name(&self) -> std::option::Option<&str> {
5523            match self {
5524                Self::Unspecified => std::option::Option::Some("KMS_KEY_STATE_UNSPECIFIED"),
5525                Self::Enabled => std::option::Option::Some("ENABLED"),
5526                Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
5527                Self::Disabled => std::option::Option::Some("DISABLED"),
5528                Self::Destroyed => std::option::Option::Some("DESTROYED"),
5529                Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
5530                Self::EkmKeyUnreachableDetected => {
5531                    std::option::Option::Some("EKM_KEY_UNREACHABLE_DETECTED")
5532                }
5533                Self::BillingDisabled => std::option::Option::Some("BILLING_DISABLED"),
5534                Self::UnknownFailure => std::option::Option::Some("UNKNOWN_FAILURE"),
5535                Self::UnknownValue(u) => u.0.name(),
5536            }
5537        }
5538    }
5539
5540    impl std::default::Default for KmsKeyState {
5541        fn default() -> Self {
5542            use std::convert::From;
5543            Self::from(0)
5544        }
5545    }
5546
5547    impl std::fmt::Display for KmsKeyState {
5548        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5549            wkt::internal::display_enum(f, self.name(), self.value())
5550        }
5551    }
5552
5553    impl std::convert::From<i32> for KmsKeyState {
5554        fn from(value: i32) -> Self {
5555            match value {
5556                0 => Self::Unspecified,
5557                1 => Self::Enabled,
5558                2 => Self::PermissionDenied,
5559                3 => Self::Disabled,
5560                4 => Self::Destroyed,
5561                5 => Self::DestroyScheduled,
5562                6 => Self::EkmKeyUnreachableDetected,
5563                7 => Self::BillingDisabled,
5564                8 => Self::UnknownFailure,
5565                _ => Self::UnknownValue(kms_key_state::UnknownValue(
5566                    wkt::internal::UnknownEnumValue::Integer(value),
5567                )),
5568            }
5569        }
5570    }
5571
5572    impl std::convert::From<&str> for KmsKeyState {
5573        fn from(value: &str) -> Self {
5574            use std::string::ToString;
5575            match value {
5576                "KMS_KEY_STATE_UNSPECIFIED" => Self::Unspecified,
5577                "ENABLED" => Self::Enabled,
5578                "PERMISSION_DENIED" => Self::PermissionDenied,
5579                "DISABLED" => Self::Disabled,
5580                "DESTROYED" => Self::Destroyed,
5581                "DESTROY_SCHEDULED" => Self::DestroyScheduled,
5582                "EKM_KEY_UNREACHABLE_DETECTED" => Self::EkmKeyUnreachableDetected,
5583                "BILLING_DISABLED" => Self::BillingDisabled,
5584                "UNKNOWN_FAILURE" => Self::UnknownFailure,
5585                _ => Self::UnknownValue(kms_key_state::UnknownValue(
5586                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5587                )),
5588            }
5589        }
5590    }
5591
5592    impl serde::ser::Serialize for KmsKeyState {
5593        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5594        where
5595            S: serde::Serializer,
5596        {
5597            match self {
5598                Self::Unspecified => serializer.serialize_i32(0),
5599                Self::Enabled => serializer.serialize_i32(1),
5600                Self::PermissionDenied => serializer.serialize_i32(2),
5601                Self::Disabled => serializer.serialize_i32(3),
5602                Self::Destroyed => serializer.serialize_i32(4),
5603                Self::DestroyScheduled => serializer.serialize_i32(5),
5604                Self::EkmKeyUnreachableDetected => serializer.serialize_i32(6),
5605                Self::BillingDisabled => serializer.serialize_i32(7),
5606                Self::UnknownFailure => serializer.serialize_i32(8),
5607                Self::UnknownValue(u) => u.0.serialize(serializer),
5608            }
5609        }
5610    }
5611
5612    impl<'de> serde::de::Deserialize<'de> for KmsKeyState {
5613        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5614        where
5615            D: serde::Deserializer<'de>,
5616        {
5617            deserializer.deserialize_any(wkt::internal::EnumVisitor::<KmsKeyState>::new(
5618                ".google.cloud.redis.cluster.v1.EncryptionInfo.KmsKeyState",
5619            ))
5620        }
5621    }
5622}
5623
5624/// Status of the PSC connection.
5625///
5626/// # Working with unknown values
5627///
5628/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5629/// additional enum variants at any time. Adding new variants is not considered
5630/// a breaking change. Applications should write their code in anticipation of:
5631///
5632/// - New values appearing in future releases of the client library, **and**
5633/// - New values received dynamically, without application changes.
5634///
5635/// Please consult the [Working with enums] section in the user guide for some
5636/// guidelines.
5637///
5638/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5639#[derive(Clone, Debug, PartialEq)]
5640#[non_exhaustive]
5641pub enum PscConnectionStatus {
5642    /// PSC connection status is not specified.
5643    Unspecified,
5644    /// The connection is active
5645    Active,
5646    /// Connection not found
5647    NotFound,
5648    /// If set, the enum was initialized with an unknown value.
5649    ///
5650    /// Applications can examine the value using [PscConnectionStatus::value] or
5651    /// [PscConnectionStatus::name].
5652    UnknownValue(psc_connection_status::UnknownValue),
5653}
5654
5655#[doc(hidden)]
5656pub mod psc_connection_status {
5657    #[allow(unused_imports)]
5658    use super::*;
5659    #[derive(Clone, Debug, PartialEq)]
5660    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5661}
5662
5663impl PscConnectionStatus {
5664    /// Gets the enum value.
5665    ///
5666    /// Returns `None` if the enum contains an unknown value deserialized from
5667    /// the string representation of enums.
5668    pub fn value(&self) -> std::option::Option<i32> {
5669        match self {
5670            Self::Unspecified => std::option::Option::Some(0),
5671            Self::Active => std::option::Option::Some(1),
5672            Self::NotFound => std::option::Option::Some(2),
5673            Self::UnknownValue(u) => u.0.value(),
5674        }
5675    }
5676
5677    /// Gets the enum value as a string.
5678    ///
5679    /// Returns `None` if the enum contains an unknown value deserialized from
5680    /// the integer representation of enums.
5681    pub fn name(&self) -> std::option::Option<&str> {
5682        match self {
5683            Self::Unspecified => std::option::Option::Some("PSC_CONNECTION_STATUS_UNSPECIFIED"),
5684            Self::Active => std::option::Option::Some("PSC_CONNECTION_STATUS_ACTIVE"),
5685            Self::NotFound => std::option::Option::Some("PSC_CONNECTION_STATUS_NOT_FOUND"),
5686            Self::UnknownValue(u) => u.0.name(),
5687        }
5688    }
5689}
5690
5691impl std::default::Default for PscConnectionStatus {
5692    fn default() -> Self {
5693        use std::convert::From;
5694        Self::from(0)
5695    }
5696}
5697
5698impl std::fmt::Display for PscConnectionStatus {
5699    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5700        wkt::internal::display_enum(f, self.name(), self.value())
5701    }
5702}
5703
5704impl std::convert::From<i32> for PscConnectionStatus {
5705    fn from(value: i32) -> Self {
5706        match value {
5707            0 => Self::Unspecified,
5708            1 => Self::Active,
5709            2 => Self::NotFound,
5710            _ => Self::UnknownValue(psc_connection_status::UnknownValue(
5711                wkt::internal::UnknownEnumValue::Integer(value),
5712            )),
5713        }
5714    }
5715}
5716
5717impl std::convert::From<&str> for PscConnectionStatus {
5718    fn from(value: &str) -> Self {
5719        use std::string::ToString;
5720        match value {
5721            "PSC_CONNECTION_STATUS_UNSPECIFIED" => Self::Unspecified,
5722            "PSC_CONNECTION_STATUS_ACTIVE" => Self::Active,
5723            "PSC_CONNECTION_STATUS_NOT_FOUND" => Self::NotFound,
5724            _ => Self::UnknownValue(psc_connection_status::UnknownValue(
5725                wkt::internal::UnknownEnumValue::String(value.to_string()),
5726            )),
5727        }
5728    }
5729}
5730
5731impl serde::ser::Serialize for PscConnectionStatus {
5732    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5733    where
5734        S: serde::Serializer,
5735    {
5736        match self {
5737            Self::Unspecified => serializer.serialize_i32(0),
5738            Self::Active => serializer.serialize_i32(1),
5739            Self::NotFound => serializer.serialize_i32(2),
5740            Self::UnknownValue(u) => u.0.serialize(serializer),
5741        }
5742    }
5743}
5744
5745impl<'de> serde::de::Deserialize<'de> for PscConnectionStatus {
5746    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5747    where
5748        D: serde::Deserializer<'de>,
5749    {
5750        deserializer.deserialize_any(wkt::internal::EnumVisitor::<PscConnectionStatus>::new(
5751            ".google.cloud.redis.cluster.v1.PscConnectionStatus",
5752        ))
5753    }
5754}
5755
5756/// Available authorization mode of a Redis cluster.
5757///
5758/// # Working with unknown values
5759///
5760/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5761/// additional enum variants at any time. Adding new variants is not considered
5762/// a breaking change. Applications should write their code in anticipation of:
5763///
5764/// - New values appearing in future releases of the client library, **and**
5765/// - New values received dynamically, without application changes.
5766///
5767/// Please consult the [Working with enums] section in the user guide for some
5768/// guidelines.
5769///
5770/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5771#[derive(Clone, Debug, PartialEq)]
5772#[non_exhaustive]
5773pub enum AuthorizationMode {
5774    /// Not set.
5775    AuthModeUnspecified,
5776    /// IAM basic authorization mode
5777    AuthModeIamAuth,
5778    /// Authorization disabled mode
5779    AuthModeDisabled,
5780    /// If set, the enum was initialized with an unknown value.
5781    ///
5782    /// Applications can examine the value using [AuthorizationMode::value] or
5783    /// [AuthorizationMode::name].
5784    UnknownValue(authorization_mode::UnknownValue),
5785}
5786
5787#[doc(hidden)]
5788pub mod authorization_mode {
5789    #[allow(unused_imports)]
5790    use super::*;
5791    #[derive(Clone, Debug, PartialEq)]
5792    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5793}
5794
5795impl AuthorizationMode {
5796    /// Gets the enum value.
5797    ///
5798    /// Returns `None` if the enum contains an unknown value deserialized from
5799    /// the string representation of enums.
5800    pub fn value(&self) -> std::option::Option<i32> {
5801        match self {
5802            Self::AuthModeUnspecified => std::option::Option::Some(0),
5803            Self::AuthModeIamAuth => std::option::Option::Some(1),
5804            Self::AuthModeDisabled => std::option::Option::Some(2),
5805            Self::UnknownValue(u) => u.0.value(),
5806        }
5807    }
5808
5809    /// Gets the enum value as a string.
5810    ///
5811    /// Returns `None` if the enum contains an unknown value deserialized from
5812    /// the integer representation of enums.
5813    pub fn name(&self) -> std::option::Option<&str> {
5814        match self {
5815            Self::AuthModeUnspecified => std::option::Option::Some("AUTH_MODE_UNSPECIFIED"),
5816            Self::AuthModeIamAuth => std::option::Option::Some("AUTH_MODE_IAM_AUTH"),
5817            Self::AuthModeDisabled => std::option::Option::Some("AUTH_MODE_DISABLED"),
5818            Self::UnknownValue(u) => u.0.name(),
5819        }
5820    }
5821}
5822
5823impl std::default::Default for AuthorizationMode {
5824    fn default() -> Self {
5825        use std::convert::From;
5826        Self::from(0)
5827    }
5828}
5829
5830impl std::fmt::Display for AuthorizationMode {
5831    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5832        wkt::internal::display_enum(f, self.name(), self.value())
5833    }
5834}
5835
5836impl std::convert::From<i32> for AuthorizationMode {
5837    fn from(value: i32) -> Self {
5838        match value {
5839            0 => Self::AuthModeUnspecified,
5840            1 => Self::AuthModeIamAuth,
5841            2 => Self::AuthModeDisabled,
5842            _ => Self::UnknownValue(authorization_mode::UnknownValue(
5843                wkt::internal::UnknownEnumValue::Integer(value),
5844            )),
5845        }
5846    }
5847}
5848
5849impl std::convert::From<&str> for AuthorizationMode {
5850    fn from(value: &str) -> Self {
5851        use std::string::ToString;
5852        match value {
5853            "AUTH_MODE_UNSPECIFIED" => Self::AuthModeUnspecified,
5854            "AUTH_MODE_IAM_AUTH" => Self::AuthModeIamAuth,
5855            "AUTH_MODE_DISABLED" => Self::AuthModeDisabled,
5856            _ => Self::UnknownValue(authorization_mode::UnknownValue(
5857                wkt::internal::UnknownEnumValue::String(value.to_string()),
5858            )),
5859        }
5860    }
5861}
5862
5863impl serde::ser::Serialize for AuthorizationMode {
5864    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5865    where
5866        S: serde::Serializer,
5867    {
5868        match self {
5869            Self::AuthModeUnspecified => serializer.serialize_i32(0),
5870            Self::AuthModeIamAuth => serializer.serialize_i32(1),
5871            Self::AuthModeDisabled => serializer.serialize_i32(2),
5872            Self::UnknownValue(u) => u.0.serialize(serializer),
5873        }
5874    }
5875}
5876
5877impl<'de> serde::de::Deserialize<'de> for AuthorizationMode {
5878    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5879    where
5880        D: serde::Deserializer<'de>,
5881    {
5882        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthorizationMode>::new(
5883            ".google.cloud.redis.cluster.v1.AuthorizationMode",
5884        ))
5885    }
5886}
5887
5888/// NodeType of a redis cluster node,
5889///
5890/// # Working with unknown values
5891///
5892/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5893/// additional enum variants at any time. Adding new variants is not considered
5894/// a breaking change. Applications should write their code in anticipation of:
5895///
5896/// - New values appearing in future releases of the client library, **and**
5897/// - New values received dynamically, without application changes.
5898///
5899/// Please consult the [Working with enums] section in the user guide for some
5900/// guidelines.
5901///
5902/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5903#[derive(Clone, Debug, PartialEq)]
5904#[non_exhaustive]
5905pub enum NodeType {
5906    /// Node type unspecified
5907    Unspecified,
5908    /// Redis shared core nano node_type.
5909    RedisSharedCoreNano,
5910    /// Redis highmem medium node_type.
5911    RedisHighmemMedium,
5912    /// Redis highmem xlarge node_type.
5913    RedisHighmemXlarge,
5914    /// Redis standard small node_type.
5915    RedisStandardSmall,
5916    /// If set, the enum was initialized with an unknown value.
5917    ///
5918    /// Applications can examine the value using [NodeType::value] or
5919    /// [NodeType::name].
5920    UnknownValue(node_type::UnknownValue),
5921}
5922
5923#[doc(hidden)]
5924pub mod node_type {
5925    #[allow(unused_imports)]
5926    use super::*;
5927    #[derive(Clone, Debug, PartialEq)]
5928    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5929}
5930
5931impl NodeType {
5932    /// Gets the enum value.
5933    ///
5934    /// Returns `None` if the enum contains an unknown value deserialized from
5935    /// the string representation of enums.
5936    pub fn value(&self) -> std::option::Option<i32> {
5937        match self {
5938            Self::Unspecified => std::option::Option::Some(0),
5939            Self::RedisSharedCoreNano => std::option::Option::Some(1),
5940            Self::RedisHighmemMedium => std::option::Option::Some(2),
5941            Self::RedisHighmemXlarge => std::option::Option::Some(3),
5942            Self::RedisStandardSmall => std::option::Option::Some(4),
5943            Self::UnknownValue(u) => u.0.value(),
5944        }
5945    }
5946
5947    /// Gets the enum value as a string.
5948    ///
5949    /// Returns `None` if the enum contains an unknown value deserialized from
5950    /// the integer representation of enums.
5951    pub fn name(&self) -> std::option::Option<&str> {
5952        match self {
5953            Self::Unspecified => std::option::Option::Some("NODE_TYPE_UNSPECIFIED"),
5954            Self::RedisSharedCoreNano => std::option::Option::Some("REDIS_SHARED_CORE_NANO"),
5955            Self::RedisHighmemMedium => std::option::Option::Some("REDIS_HIGHMEM_MEDIUM"),
5956            Self::RedisHighmemXlarge => std::option::Option::Some("REDIS_HIGHMEM_XLARGE"),
5957            Self::RedisStandardSmall => std::option::Option::Some("REDIS_STANDARD_SMALL"),
5958            Self::UnknownValue(u) => u.0.name(),
5959        }
5960    }
5961}
5962
5963impl std::default::Default for NodeType {
5964    fn default() -> Self {
5965        use std::convert::From;
5966        Self::from(0)
5967    }
5968}
5969
5970impl std::fmt::Display for NodeType {
5971    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5972        wkt::internal::display_enum(f, self.name(), self.value())
5973    }
5974}
5975
5976impl std::convert::From<i32> for NodeType {
5977    fn from(value: i32) -> Self {
5978        match value {
5979            0 => Self::Unspecified,
5980            1 => Self::RedisSharedCoreNano,
5981            2 => Self::RedisHighmemMedium,
5982            3 => Self::RedisHighmemXlarge,
5983            4 => Self::RedisStandardSmall,
5984            _ => Self::UnknownValue(node_type::UnknownValue(
5985                wkt::internal::UnknownEnumValue::Integer(value),
5986            )),
5987        }
5988    }
5989}
5990
5991impl std::convert::From<&str> for NodeType {
5992    fn from(value: &str) -> Self {
5993        use std::string::ToString;
5994        match value {
5995            "NODE_TYPE_UNSPECIFIED" => Self::Unspecified,
5996            "REDIS_SHARED_CORE_NANO" => Self::RedisSharedCoreNano,
5997            "REDIS_HIGHMEM_MEDIUM" => Self::RedisHighmemMedium,
5998            "REDIS_HIGHMEM_XLARGE" => Self::RedisHighmemXlarge,
5999            "REDIS_STANDARD_SMALL" => Self::RedisStandardSmall,
6000            _ => Self::UnknownValue(node_type::UnknownValue(
6001                wkt::internal::UnknownEnumValue::String(value.to_string()),
6002            )),
6003        }
6004    }
6005}
6006
6007impl serde::ser::Serialize for NodeType {
6008    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6009    where
6010        S: serde::Serializer,
6011    {
6012        match self {
6013            Self::Unspecified => serializer.serialize_i32(0),
6014            Self::RedisSharedCoreNano => serializer.serialize_i32(1),
6015            Self::RedisHighmemMedium => serializer.serialize_i32(2),
6016            Self::RedisHighmemXlarge => serializer.serialize_i32(3),
6017            Self::RedisStandardSmall => serializer.serialize_i32(4),
6018            Self::UnknownValue(u) => u.0.serialize(serializer),
6019        }
6020    }
6021}
6022
6023impl<'de> serde::de::Deserialize<'de> for NodeType {
6024    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6025    where
6026        D: serde::Deserializer<'de>,
6027    {
6028        deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeType>::new(
6029            ".google.cloud.redis.cluster.v1.NodeType",
6030        ))
6031    }
6032}
6033
6034/// Available mode of in-transit encryption.
6035///
6036/// # Working with unknown values
6037///
6038/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6039/// additional enum variants at any time. Adding new variants is not considered
6040/// a breaking change. Applications should write their code in anticipation of:
6041///
6042/// - New values appearing in future releases of the client library, **and**
6043/// - New values received dynamically, without application changes.
6044///
6045/// Please consult the [Working with enums] section in the user guide for some
6046/// guidelines.
6047///
6048/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6049#[derive(Clone, Debug, PartialEq)]
6050#[non_exhaustive]
6051pub enum TransitEncryptionMode {
6052    /// In-transit encryption not set.
6053    Unspecified,
6054    /// In-transit encryption disabled.
6055    Disabled,
6056    /// Use server managed encryption for in-transit encryption.
6057    ServerAuthentication,
6058    /// If set, the enum was initialized with an unknown value.
6059    ///
6060    /// Applications can examine the value using [TransitEncryptionMode::value] or
6061    /// [TransitEncryptionMode::name].
6062    UnknownValue(transit_encryption_mode::UnknownValue),
6063}
6064
6065#[doc(hidden)]
6066pub mod transit_encryption_mode {
6067    #[allow(unused_imports)]
6068    use super::*;
6069    #[derive(Clone, Debug, PartialEq)]
6070    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6071}
6072
6073impl TransitEncryptionMode {
6074    /// Gets the enum value.
6075    ///
6076    /// Returns `None` if the enum contains an unknown value deserialized from
6077    /// the string representation of enums.
6078    pub fn value(&self) -> std::option::Option<i32> {
6079        match self {
6080            Self::Unspecified => std::option::Option::Some(0),
6081            Self::Disabled => std::option::Option::Some(1),
6082            Self::ServerAuthentication => std::option::Option::Some(2),
6083            Self::UnknownValue(u) => u.0.value(),
6084        }
6085    }
6086
6087    /// Gets the enum value as a string.
6088    ///
6089    /// Returns `None` if the enum contains an unknown value deserialized from
6090    /// the integer representation of enums.
6091    pub fn name(&self) -> std::option::Option<&str> {
6092        match self {
6093            Self::Unspecified => std::option::Option::Some("TRANSIT_ENCRYPTION_MODE_UNSPECIFIED"),
6094            Self::Disabled => std::option::Option::Some("TRANSIT_ENCRYPTION_MODE_DISABLED"),
6095            Self::ServerAuthentication => {
6096                std::option::Option::Some("TRANSIT_ENCRYPTION_MODE_SERVER_AUTHENTICATION")
6097            }
6098            Self::UnknownValue(u) => u.0.name(),
6099        }
6100    }
6101}
6102
6103impl std::default::Default for TransitEncryptionMode {
6104    fn default() -> Self {
6105        use std::convert::From;
6106        Self::from(0)
6107    }
6108}
6109
6110impl std::fmt::Display for TransitEncryptionMode {
6111    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6112        wkt::internal::display_enum(f, self.name(), self.value())
6113    }
6114}
6115
6116impl std::convert::From<i32> for TransitEncryptionMode {
6117    fn from(value: i32) -> Self {
6118        match value {
6119            0 => Self::Unspecified,
6120            1 => Self::Disabled,
6121            2 => Self::ServerAuthentication,
6122            _ => Self::UnknownValue(transit_encryption_mode::UnknownValue(
6123                wkt::internal::UnknownEnumValue::Integer(value),
6124            )),
6125        }
6126    }
6127}
6128
6129impl std::convert::From<&str> for TransitEncryptionMode {
6130    fn from(value: &str) -> Self {
6131        use std::string::ToString;
6132        match value {
6133            "TRANSIT_ENCRYPTION_MODE_UNSPECIFIED" => Self::Unspecified,
6134            "TRANSIT_ENCRYPTION_MODE_DISABLED" => Self::Disabled,
6135            "TRANSIT_ENCRYPTION_MODE_SERVER_AUTHENTICATION" => Self::ServerAuthentication,
6136            _ => Self::UnknownValue(transit_encryption_mode::UnknownValue(
6137                wkt::internal::UnknownEnumValue::String(value.to_string()),
6138            )),
6139        }
6140    }
6141}
6142
6143impl serde::ser::Serialize for TransitEncryptionMode {
6144    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6145    where
6146        S: serde::Serializer,
6147    {
6148        match self {
6149            Self::Unspecified => serializer.serialize_i32(0),
6150            Self::Disabled => serializer.serialize_i32(1),
6151            Self::ServerAuthentication => serializer.serialize_i32(2),
6152            Self::UnknownValue(u) => u.0.serialize(serializer),
6153        }
6154    }
6155}
6156
6157impl<'de> serde::de::Deserialize<'de> for TransitEncryptionMode {
6158    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6159    where
6160        D: serde::Deserializer<'de>,
6161    {
6162        deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransitEncryptionMode>::new(
6163            ".google.cloud.redis.cluster.v1.TransitEncryptionMode",
6164        ))
6165    }
6166}
6167
6168/// Type of a PSC connection, for cluster access purpose.
6169///
6170/// # Working with unknown values
6171///
6172/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6173/// additional enum variants at any time. Adding new variants is not considered
6174/// a breaking change. Applications should write their code in anticipation of:
6175///
6176/// - New values appearing in future releases of the client library, **and**
6177/// - New values received dynamically, without application changes.
6178///
6179/// Please consult the [Working with enums] section in the user guide for some
6180/// guidelines.
6181///
6182/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6183#[derive(Clone, Debug, PartialEq)]
6184#[non_exhaustive]
6185pub enum ConnectionType {
6186    /// Cluster endpoint Type is not set
6187    Unspecified,
6188    /// Cluster endpoint that will be used as for cluster topology discovery.
6189    Discovery,
6190    /// Cluster endpoint that will be used as primary endpoint to access primary.
6191    Primary,
6192    /// Cluster endpoint that will be used as reader endpoint to access replicas.
6193    Reader,
6194    /// If set, the enum was initialized with an unknown value.
6195    ///
6196    /// Applications can examine the value using [ConnectionType::value] or
6197    /// [ConnectionType::name].
6198    UnknownValue(connection_type::UnknownValue),
6199}
6200
6201#[doc(hidden)]
6202pub mod connection_type {
6203    #[allow(unused_imports)]
6204    use super::*;
6205    #[derive(Clone, Debug, PartialEq)]
6206    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6207}
6208
6209impl ConnectionType {
6210    /// Gets the enum value.
6211    ///
6212    /// Returns `None` if the enum contains an unknown value deserialized from
6213    /// the string representation of enums.
6214    pub fn value(&self) -> std::option::Option<i32> {
6215        match self {
6216            Self::Unspecified => std::option::Option::Some(0),
6217            Self::Discovery => std::option::Option::Some(1),
6218            Self::Primary => std::option::Option::Some(2),
6219            Self::Reader => std::option::Option::Some(3),
6220            Self::UnknownValue(u) => u.0.value(),
6221        }
6222    }
6223
6224    /// Gets the enum value as a string.
6225    ///
6226    /// Returns `None` if the enum contains an unknown value deserialized from
6227    /// the integer representation of enums.
6228    pub fn name(&self) -> std::option::Option<&str> {
6229        match self {
6230            Self::Unspecified => std::option::Option::Some("CONNECTION_TYPE_UNSPECIFIED"),
6231            Self::Discovery => std::option::Option::Some("CONNECTION_TYPE_DISCOVERY"),
6232            Self::Primary => std::option::Option::Some("CONNECTION_TYPE_PRIMARY"),
6233            Self::Reader => std::option::Option::Some("CONNECTION_TYPE_READER"),
6234            Self::UnknownValue(u) => u.0.name(),
6235        }
6236    }
6237}
6238
6239impl std::default::Default for ConnectionType {
6240    fn default() -> Self {
6241        use std::convert::From;
6242        Self::from(0)
6243    }
6244}
6245
6246impl std::fmt::Display for ConnectionType {
6247    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6248        wkt::internal::display_enum(f, self.name(), self.value())
6249    }
6250}
6251
6252impl std::convert::From<i32> for ConnectionType {
6253    fn from(value: i32) -> Self {
6254        match value {
6255            0 => Self::Unspecified,
6256            1 => Self::Discovery,
6257            2 => Self::Primary,
6258            3 => Self::Reader,
6259            _ => Self::UnknownValue(connection_type::UnknownValue(
6260                wkt::internal::UnknownEnumValue::Integer(value),
6261            )),
6262        }
6263    }
6264}
6265
6266impl std::convert::From<&str> for ConnectionType {
6267    fn from(value: &str) -> Self {
6268        use std::string::ToString;
6269        match value {
6270            "CONNECTION_TYPE_UNSPECIFIED" => Self::Unspecified,
6271            "CONNECTION_TYPE_DISCOVERY" => Self::Discovery,
6272            "CONNECTION_TYPE_PRIMARY" => Self::Primary,
6273            "CONNECTION_TYPE_READER" => Self::Reader,
6274            _ => Self::UnknownValue(connection_type::UnknownValue(
6275                wkt::internal::UnknownEnumValue::String(value.to_string()),
6276            )),
6277        }
6278    }
6279}
6280
6281impl serde::ser::Serialize for ConnectionType {
6282    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6283    where
6284        S: serde::Serializer,
6285    {
6286        match self {
6287            Self::Unspecified => serializer.serialize_i32(0),
6288            Self::Discovery => serializer.serialize_i32(1),
6289            Self::Primary => serializer.serialize_i32(2),
6290            Self::Reader => serializer.serialize_i32(3),
6291            Self::UnknownValue(u) => u.0.serialize(serializer),
6292        }
6293    }
6294}
6295
6296impl<'de> serde::de::Deserialize<'de> for ConnectionType {
6297    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6298    where
6299        D: serde::Deserializer<'de>,
6300    {
6301        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConnectionType>::new(
6302            ".google.cloud.redis.cluster.v1.ConnectionType",
6303        ))
6304    }
6305}