google_cloud_memcache_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate gtype;
25extern crate lazy_static;
26extern crate location;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// A Memorystore for Memcached instance
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct Instance {
45    /// Required. Unique name of the resource in this scope including project and
46    /// location using the form:
47    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
48    ///
49    /// Note: Memcached instances are managed and addressed at the regional level
50    /// so `location_id` here refers to a Google Cloud region; however, users may
51    /// choose which zones Memcached nodes should be provisioned in within an
52    /// instance. Refer to [zones][google.cloud.memcache.v1.Instance.zones] field for more details.
53    ///
54    /// [google.cloud.memcache.v1.Instance.zones]: crate::model::Instance::zones
55    pub name: std::string::String,
56
57    /// User provided name for the instance, which is only used for display
58    /// purposes. Cannot be more than 80 characters.
59    pub display_name: std::string::String,
60
61    /// Resource labels to represent user-provided metadata.
62    /// Refer to cloud documentation on labels for more details.
63    /// <https://cloud.google.com/compute/docs/labeling-resources>
64    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
65
66    /// The full name of the Google Compute Engine
67    /// [network](/compute/docs/networks-and-firewalls#networks) to which the
68    /// instance is connected. If left unspecified, the `default` network
69    /// will be used.
70    pub authorized_network: std::string::String,
71
72    /// Zones in which Memcached nodes should be provisioned.
73    /// Memcached nodes will be equally distributed across these zones. If not
74    /// provided, the service will by default create nodes in all zones in the
75    /// region for the instance.
76    pub zones: std::vec::Vec<std::string::String>,
77
78    /// Required. Number of nodes in the Memcached instance.
79    pub node_count: i32,
80
81    /// Required. Configuration for Memcached nodes.
82    pub node_config: std::option::Option<crate::model::instance::NodeConfig>,
83
84    /// The major version of Memcached software.
85    /// If not provided, latest supported version will be used. Currently the
86    /// latest supported major version is `MEMCACHE_1_5`.
87    /// The minor version will be automatically determined by our system based on
88    /// the latest supported minor version.
89    pub memcache_version: crate::model::MemcacheVersion,
90
91    /// User defined parameters to apply to the memcached process
92    /// on each node.
93    pub parameters: std::option::Option<crate::model::MemcacheParameters>,
94
95    /// Output only. List of Memcached nodes.
96    /// Refer to [Node][google.cloud.memcache.v1.Instance.Node] message for more details.
97    ///
98    /// [google.cloud.memcache.v1.Instance.Node]: crate::model::instance::Node
99    pub memcache_nodes: std::vec::Vec<crate::model::instance::Node>,
100
101    /// Output only. The time the instance was created.
102    pub create_time: std::option::Option<wkt::Timestamp>,
103
104    /// Output only. The time the instance was updated.
105    pub update_time: std::option::Option<wkt::Timestamp>,
106
107    /// Output only. The state of this Memcached instance.
108    pub state: crate::model::instance::State,
109
110    /// Output only. The full version of memcached server running on this instance.
111    /// System automatically determines the full memcached version for an instance
112    /// based on the input MemcacheVersion.
113    /// The full version format will be "memcached-1.5.16".
114    pub memcache_full_version: std::string::String,
115
116    /// List of messages that describe the current state of the Memcached instance.
117    pub instance_messages: std::vec::Vec<crate::model::instance::InstanceMessage>,
118
119    /// Output only. Endpoint for the Discovery API.
120    pub discovery_endpoint: std::string::String,
121
122    /// The maintenance policy for the instance. If not provided,
123    /// the maintenance event will be performed based on Memorystore
124    /// internal rollout schedule.
125    pub maintenance_policy: std::option::Option<crate::model::MaintenancePolicy>,
126
127    /// Output only. Published maintenance schedule.
128    pub maintenance_schedule: std::option::Option<crate::model::MaintenanceSchedule>,
129
130    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
131}
132
133impl Instance {
134    pub fn new() -> Self {
135        std::default::Default::default()
136    }
137
138    /// Sets the value of [name][crate::model::Instance::name].
139    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
140        self.name = v.into();
141        self
142    }
143
144    /// Sets the value of [display_name][crate::model::Instance::display_name].
145    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
146        self.display_name = v.into();
147        self
148    }
149
150    /// Sets the value of [labels][crate::model::Instance::labels].
151    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
152    where
153        T: std::iter::IntoIterator<Item = (K, V)>,
154        K: std::convert::Into<std::string::String>,
155        V: std::convert::Into<std::string::String>,
156    {
157        use std::iter::Iterator;
158        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
159        self
160    }
161
162    /// Sets the value of [authorized_network][crate::model::Instance::authorized_network].
163    pub fn set_authorized_network<T: std::convert::Into<std::string::String>>(
164        mut self,
165        v: T,
166    ) -> Self {
167        self.authorized_network = v.into();
168        self
169    }
170
171    /// Sets the value of [zones][crate::model::Instance::zones].
172    pub fn set_zones<T, V>(mut self, v: T) -> Self
173    where
174        T: std::iter::IntoIterator<Item = V>,
175        V: std::convert::Into<std::string::String>,
176    {
177        use std::iter::Iterator;
178        self.zones = v.into_iter().map(|i| i.into()).collect();
179        self
180    }
181
182    /// Sets the value of [node_count][crate::model::Instance::node_count].
183    pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
184        self.node_count = v.into();
185        self
186    }
187
188    /// Sets the value of [node_config][crate::model::Instance::node_config].
189    pub fn set_node_config<T>(mut self, v: T) -> Self
190    where
191        T: std::convert::Into<crate::model::instance::NodeConfig>,
192    {
193        self.node_config = std::option::Option::Some(v.into());
194        self
195    }
196
197    /// Sets or clears the value of [node_config][crate::model::Instance::node_config].
198    pub fn set_or_clear_node_config<T>(mut self, v: std::option::Option<T>) -> Self
199    where
200        T: std::convert::Into<crate::model::instance::NodeConfig>,
201    {
202        self.node_config = v.map(|x| x.into());
203        self
204    }
205
206    /// Sets the value of [memcache_version][crate::model::Instance::memcache_version].
207    pub fn set_memcache_version<T: std::convert::Into<crate::model::MemcacheVersion>>(
208        mut self,
209        v: T,
210    ) -> Self {
211        self.memcache_version = v.into();
212        self
213    }
214
215    /// Sets the value of [parameters][crate::model::Instance::parameters].
216    pub fn set_parameters<T>(mut self, v: T) -> Self
217    where
218        T: std::convert::Into<crate::model::MemcacheParameters>,
219    {
220        self.parameters = std::option::Option::Some(v.into());
221        self
222    }
223
224    /// Sets or clears the value of [parameters][crate::model::Instance::parameters].
225    pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
226    where
227        T: std::convert::Into<crate::model::MemcacheParameters>,
228    {
229        self.parameters = v.map(|x| x.into());
230        self
231    }
232
233    /// Sets the value of [memcache_nodes][crate::model::Instance::memcache_nodes].
234    pub fn set_memcache_nodes<T, V>(mut self, v: T) -> Self
235    where
236        T: std::iter::IntoIterator<Item = V>,
237        V: std::convert::Into<crate::model::instance::Node>,
238    {
239        use std::iter::Iterator;
240        self.memcache_nodes = v.into_iter().map(|i| i.into()).collect();
241        self
242    }
243
244    /// Sets the value of [create_time][crate::model::Instance::create_time].
245    pub fn set_create_time<T>(mut self, v: T) -> Self
246    where
247        T: std::convert::Into<wkt::Timestamp>,
248    {
249        self.create_time = std::option::Option::Some(v.into());
250        self
251    }
252
253    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
254    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
255    where
256        T: std::convert::Into<wkt::Timestamp>,
257    {
258        self.create_time = v.map(|x| x.into());
259        self
260    }
261
262    /// Sets the value of [update_time][crate::model::Instance::update_time].
263    pub fn set_update_time<T>(mut self, v: T) -> Self
264    where
265        T: std::convert::Into<wkt::Timestamp>,
266    {
267        self.update_time = std::option::Option::Some(v.into());
268        self
269    }
270
271    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
272    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
273    where
274        T: std::convert::Into<wkt::Timestamp>,
275    {
276        self.update_time = v.map(|x| x.into());
277        self
278    }
279
280    /// Sets the value of [state][crate::model::Instance::state].
281    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
282        self.state = v.into();
283        self
284    }
285
286    /// Sets the value of [memcache_full_version][crate::model::Instance::memcache_full_version].
287    pub fn set_memcache_full_version<T: std::convert::Into<std::string::String>>(
288        mut self,
289        v: T,
290    ) -> Self {
291        self.memcache_full_version = v.into();
292        self
293    }
294
295    /// Sets the value of [instance_messages][crate::model::Instance::instance_messages].
296    pub fn set_instance_messages<T, V>(mut self, v: T) -> Self
297    where
298        T: std::iter::IntoIterator<Item = V>,
299        V: std::convert::Into<crate::model::instance::InstanceMessage>,
300    {
301        use std::iter::Iterator;
302        self.instance_messages = v.into_iter().map(|i| i.into()).collect();
303        self
304    }
305
306    /// Sets the value of [discovery_endpoint][crate::model::Instance::discovery_endpoint].
307    pub fn set_discovery_endpoint<T: std::convert::Into<std::string::String>>(
308        mut self,
309        v: T,
310    ) -> Self {
311        self.discovery_endpoint = v.into();
312        self
313    }
314
315    /// Sets the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
316    pub fn set_maintenance_policy<T>(mut self, v: T) -> Self
317    where
318        T: std::convert::Into<crate::model::MaintenancePolicy>,
319    {
320        self.maintenance_policy = std::option::Option::Some(v.into());
321        self
322    }
323
324    /// Sets or clears the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
325    pub fn set_or_clear_maintenance_policy<T>(mut self, v: std::option::Option<T>) -> Self
326    where
327        T: std::convert::Into<crate::model::MaintenancePolicy>,
328    {
329        self.maintenance_policy = v.map(|x| x.into());
330        self
331    }
332
333    /// Sets the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
334    pub fn set_maintenance_schedule<T>(mut self, v: T) -> Self
335    where
336        T: std::convert::Into<crate::model::MaintenanceSchedule>,
337    {
338        self.maintenance_schedule = std::option::Option::Some(v.into());
339        self
340    }
341
342    /// Sets or clears the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
343    pub fn set_or_clear_maintenance_schedule<T>(mut self, v: std::option::Option<T>) -> Self
344    where
345        T: std::convert::Into<crate::model::MaintenanceSchedule>,
346    {
347        self.maintenance_schedule = v.map(|x| x.into());
348        self
349    }
350}
351
352impl wkt::message::Message for Instance {
353    fn typename() -> &'static str {
354        "type.googleapis.com/google.cloud.memcache.v1.Instance"
355    }
356}
357
358/// Defines additional types related to [Instance].
359pub mod instance {
360    #[allow(unused_imports)]
361    use super::*;
362
363    /// Configuration for a Memcached Node.
364    #[derive(Clone, Default, PartialEq)]
365    #[non_exhaustive]
366    pub struct NodeConfig {
367        /// Required. Number of cpus per Memcached node.
368        pub cpu_count: i32,
369
370        /// Required. Memory size in MiB for each Memcached node.
371        pub memory_size_mb: i32,
372
373        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
374    }
375
376    impl NodeConfig {
377        pub fn new() -> Self {
378            std::default::Default::default()
379        }
380
381        /// Sets the value of [cpu_count][crate::model::instance::NodeConfig::cpu_count].
382        pub fn set_cpu_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
383            self.cpu_count = v.into();
384            self
385        }
386
387        /// Sets the value of [memory_size_mb][crate::model::instance::NodeConfig::memory_size_mb].
388        pub fn set_memory_size_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
389            self.memory_size_mb = v.into();
390            self
391        }
392    }
393
394    impl wkt::message::Message for NodeConfig {
395        fn typename() -> &'static str {
396            "type.googleapis.com/google.cloud.memcache.v1.Instance.NodeConfig"
397        }
398    }
399
400    #[derive(Clone, Default, PartialEq)]
401    #[non_exhaustive]
402    pub struct Node {
403        /// Output only. Identifier of the Memcached node. The node id does not
404        /// include project or location like the Memcached instance name.
405        pub node_id: std::string::String,
406
407        /// Output only. Location (GCP Zone) for the Memcached node.
408        pub zone: std::string::String,
409
410        /// Output only. Current state of the Memcached node.
411        pub state: crate::model::instance::node::State,
412
413        /// Output only. Hostname or IP address of the Memcached node used by the
414        /// clients to connect to the Memcached server on this node.
415        pub host: std::string::String,
416
417        /// Output only. The port number of the Memcached server on this node.
418        pub port: i32,
419
420        /// User defined parameters currently applied to the node.
421        pub parameters: std::option::Option<crate::model::MemcacheParameters>,
422
423        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
424    }
425
426    impl Node {
427        pub fn new() -> Self {
428            std::default::Default::default()
429        }
430
431        /// Sets the value of [node_id][crate::model::instance::Node::node_id].
432        pub fn set_node_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
433            self.node_id = v.into();
434            self
435        }
436
437        /// Sets the value of [zone][crate::model::instance::Node::zone].
438        pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
439            self.zone = v.into();
440            self
441        }
442
443        /// Sets the value of [state][crate::model::instance::Node::state].
444        pub fn set_state<T: std::convert::Into<crate::model::instance::node::State>>(
445            mut self,
446            v: T,
447        ) -> Self {
448            self.state = v.into();
449            self
450        }
451
452        /// Sets the value of [host][crate::model::instance::Node::host].
453        pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
454            self.host = v.into();
455            self
456        }
457
458        /// Sets the value of [port][crate::model::instance::Node::port].
459        pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
460            self.port = v.into();
461            self
462        }
463
464        /// Sets the value of [parameters][crate::model::instance::Node::parameters].
465        pub fn set_parameters<T>(mut self, v: T) -> Self
466        where
467            T: std::convert::Into<crate::model::MemcacheParameters>,
468        {
469            self.parameters = std::option::Option::Some(v.into());
470            self
471        }
472
473        /// Sets or clears the value of [parameters][crate::model::instance::Node::parameters].
474        pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
475        where
476            T: std::convert::Into<crate::model::MemcacheParameters>,
477        {
478            self.parameters = v.map(|x| x.into());
479            self
480        }
481    }
482
483    impl wkt::message::Message for Node {
484        fn typename() -> &'static str {
485            "type.googleapis.com/google.cloud.memcache.v1.Instance.Node"
486        }
487    }
488
489    /// Defines additional types related to [Node].
490    pub mod node {
491        #[allow(unused_imports)]
492        use super::*;
493
494        /// Different states of a Memcached node.
495        ///
496        /// # Working with unknown values
497        ///
498        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
499        /// additional enum variants at any time. Adding new variants is not considered
500        /// a breaking change. Applications should write their code in anticipation of:
501        ///
502        /// - New values appearing in future releases of the client library, **and**
503        /// - New values received dynamically, without application changes.
504        ///
505        /// Please consult the [Working with enums] section in the user guide for some
506        /// guidelines.
507        ///
508        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
509        #[derive(Clone, Debug, PartialEq)]
510        #[non_exhaustive]
511        pub enum State {
512            /// Node state is not set.
513            Unspecified,
514            /// Node is being created.
515            Creating,
516            /// Node has been created and ready to be used.
517            Ready,
518            /// Node is being deleted.
519            Deleting,
520            /// Node is being updated.
521            Updating,
522            /// If set, the enum was initialized with an unknown value.
523            ///
524            /// Applications can examine the value using [State::value] or
525            /// [State::name].
526            UnknownValue(state::UnknownValue),
527        }
528
529        #[doc(hidden)]
530        pub mod state {
531            #[allow(unused_imports)]
532            use super::*;
533            #[derive(Clone, Debug, PartialEq)]
534            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
535        }
536
537        impl State {
538            /// Gets the enum value.
539            ///
540            /// Returns `None` if the enum contains an unknown value deserialized from
541            /// the string representation of enums.
542            pub fn value(&self) -> std::option::Option<i32> {
543                match self {
544                    Self::Unspecified => std::option::Option::Some(0),
545                    Self::Creating => std::option::Option::Some(1),
546                    Self::Ready => std::option::Option::Some(2),
547                    Self::Deleting => std::option::Option::Some(3),
548                    Self::Updating => std::option::Option::Some(4),
549                    Self::UnknownValue(u) => u.0.value(),
550                }
551            }
552
553            /// Gets the enum value as a string.
554            ///
555            /// Returns `None` if the enum contains an unknown value deserialized from
556            /// the integer representation of enums.
557            pub fn name(&self) -> std::option::Option<&str> {
558                match self {
559                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
560                    Self::Creating => std::option::Option::Some("CREATING"),
561                    Self::Ready => std::option::Option::Some("READY"),
562                    Self::Deleting => std::option::Option::Some("DELETING"),
563                    Self::Updating => std::option::Option::Some("UPDATING"),
564                    Self::UnknownValue(u) => u.0.name(),
565                }
566            }
567        }
568
569        impl std::default::Default for State {
570            fn default() -> Self {
571                use std::convert::From;
572                Self::from(0)
573            }
574        }
575
576        impl std::fmt::Display for State {
577            fn fmt(
578                &self,
579                f: &mut std::fmt::Formatter<'_>,
580            ) -> std::result::Result<(), std::fmt::Error> {
581                wkt::internal::display_enum(f, self.name(), self.value())
582            }
583        }
584
585        impl std::convert::From<i32> for State {
586            fn from(value: i32) -> Self {
587                match value {
588                    0 => Self::Unspecified,
589                    1 => Self::Creating,
590                    2 => Self::Ready,
591                    3 => Self::Deleting,
592                    4 => Self::Updating,
593                    _ => Self::UnknownValue(state::UnknownValue(
594                        wkt::internal::UnknownEnumValue::Integer(value),
595                    )),
596                }
597            }
598        }
599
600        impl std::convert::From<&str> for State {
601            fn from(value: &str) -> Self {
602                use std::string::ToString;
603                match value {
604                    "STATE_UNSPECIFIED" => Self::Unspecified,
605                    "CREATING" => Self::Creating,
606                    "READY" => Self::Ready,
607                    "DELETING" => Self::Deleting,
608                    "UPDATING" => Self::Updating,
609                    _ => Self::UnknownValue(state::UnknownValue(
610                        wkt::internal::UnknownEnumValue::String(value.to_string()),
611                    )),
612                }
613            }
614        }
615
616        impl serde::ser::Serialize for State {
617            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
618            where
619                S: serde::Serializer,
620            {
621                match self {
622                    Self::Unspecified => serializer.serialize_i32(0),
623                    Self::Creating => serializer.serialize_i32(1),
624                    Self::Ready => serializer.serialize_i32(2),
625                    Self::Deleting => serializer.serialize_i32(3),
626                    Self::Updating => serializer.serialize_i32(4),
627                    Self::UnknownValue(u) => u.0.serialize(serializer),
628                }
629            }
630        }
631
632        impl<'de> serde::de::Deserialize<'de> for State {
633            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
634            where
635                D: serde::Deserializer<'de>,
636            {
637                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
638                    ".google.cloud.memcache.v1.Instance.Node.State",
639                ))
640            }
641        }
642    }
643
644    #[derive(Clone, Default, PartialEq)]
645    #[non_exhaustive]
646    pub struct InstanceMessage {
647        /// A code that correspond to one type of user-facing message.
648        pub code: crate::model::instance::instance_message::Code,
649
650        /// Message on memcached instance which will be exposed to users.
651        pub message: std::string::String,
652
653        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
654    }
655
656    impl InstanceMessage {
657        pub fn new() -> Self {
658            std::default::Default::default()
659        }
660
661        /// Sets the value of [code][crate::model::instance::InstanceMessage::code].
662        pub fn set_code<T: std::convert::Into<crate::model::instance::instance_message::Code>>(
663            mut self,
664            v: T,
665        ) -> Self {
666            self.code = v.into();
667            self
668        }
669
670        /// Sets the value of [message][crate::model::instance::InstanceMessage::message].
671        pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
672            self.message = v.into();
673            self
674        }
675    }
676
677    impl wkt::message::Message for InstanceMessage {
678        fn typename() -> &'static str {
679            "type.googleapis.com/google.cloud.memcache.v1.Instance.InstanceMessage"
680        }
681    }
682
683    /// Defines additional types related to [InstanceMessage].
684    pub mod instance_message {
685        #[allow(unused_imports)]
686        use super::*;
687
688        ///
689        /// # Working with unknown values
690        ///
691        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
692        /// additional enum variants at any time. Adding new variants is not considered
693        /// a breaking change. Applications should write their code in anticipation of:
694        ///
695        /// - New values appearing in future releases of the client library, **and**
696        /// - New values received dynamically, without application changes.
697        ///
698        /// Please consult the [Working with enums] section in the user guide for some
699        /// guidelines.
700        ///
701        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
702        #[derive(Clone, Debug, PartialEq)]
703        #[non_exhaustive]
704        pub enum Code {
705            /// Message Code not set.
706            Unspecified,
707            /// Memcached nodes are distributed unevenly.
708            ZoneDistributionUnbalanced,
709            /// If set, the enum was initialized with an unknown value.
710            ///
711            /// Applications can examine the value using [Code::value] or
712            /// [Code::name].
713            UnknownValue(code::UnknownValue),
714        }
715
716        #[doc(hidden)]
717        pub mod code {
718            #[allow(unused_imports)]
719            use super::*;
720            #[derive(Clone, Debug, PartialEq)]
721            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
722        }
723
724        impl Code {
725            /// Gets the enum value.
726            ///
727            /// Returns `None` if the enum contains an unknown value deserialized from
728            /// the string representation of enums.
729            pub fn value(&self) -> std::option::Option<i32> {
730                match self {
731                    Self::Unspecified => std::option::Option::Some(0),
732                    Self::ZoneDistributionUnbalanced => std::option::Option::Some(1),
733                    Self::UnknownValue(u) => u.0.value(),
734                }
735            }
736
737            /// Gets the enum value as a string.
738            ///
739            /// Returns `None` if the enum contains an unknown value deserialized from
740            /// the integer representation of enums.
741            pub fn name(&self) -> std::option::Option<&str> {
742                match self {
743                    Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
744                    Self::ZoneDistributionUnbalanced => {
745                        std::option::Option::Some("ZONE_DISTRIBUTION_UNBALANCED")
746                    }
747                    Self::UnknownValue(u) => u.0.name(),
748                }
749            }
750        }
751
752        impl std::default::Default for Code {
753            fn default() -> Self {
754                use std::convert::From;
755                Self::from(0)
756            }
757        }
758
759        impl std::fmt::Display for Code {
760            fn fmt(
761                &self,
762                f: &mut std::fmt::Formatter<'_>,
763            ) -> std::result::Result<(), std::fmt::Error> {
764                wkt::internal::display_enum(f, self.name(), self.value())
765            }
766        }
767
768        impl std::convert::From<i32> for Code {
769            fn from(value: i32) -> Self {
770                match value {
771                    0 => Self::Unspecified,
772                    1 => Self::ZoneDistributionUnbalanced,
773                    _ => Self::UnknownValue(code::UnknownValue(
774                        wkt::internal::UnknownEnumValue::Integer(value),
775                    )),
776                }
777            }
778        }
779
780        impl std::convert::From<&str> for Code {
781            fn from(value: &str) -> Self {
782                use std::string::ToString;
783                match value {
784                    "CODE_UNSPECIFIED" => Self::Unspecified,
785                    "ZONE_DISTRIBUTION_UNBALANCED" => Self::ZoneDistributionUnbalanced,
786                    _ => Self::UnknownValue(code::UnknownValue(
787                        wkt::internal::UnknownEnumValue::String(value.to_string()),
788                    )),
789                }
790            }
791        }
792
793        impl serde::ser::Serialize for Code {
794            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
795            where
796                S: serde::Serializer,
797            {
798                match self {
799                    Self::Unspecified => serializer.serialize_i32(0),
800                    Self::ZoneDistributionUnbalanced => serializer.serialize_i32(1),
801                    Self::UnknownValue(u) => u.0.serialize(serializer),
802                }
803            }
804        }
805
806        impl<'de> serde::de::Deserialize<'de> for Code {
807            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
808            where
809                D: serde::Deserializer<'de>,
810            {
811                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
812                    ".google.cloud.memcache.v1.Instance.InstanceMessage.Code",
813                ))
814            }
815        }
816    }
817
818    /// Different states of a Memcached instance.
819    ///
820    /// # Working with unknown values
821    ///
822    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
823    /// additional enum variants at any time. Adding new variants is not considered
824    /// a breaking change. Applications should write their code in anticipation of:
825    ///
826    /// - New values appearing in future releases of the client library, **and**
827    /// - New values received dynamically, without application changes.
828    ///
829    /// Please consult the [Working with enums] section in the user guide for some
830    /// guidelines.
831    ///
832    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
833    #[derive(Clone, Debug, PartialEq)]
834    #[non_exhaustive]
835    pub enum State {
836        /// State not set.
837        Unspecified,
838        /// Memcached instance is being created.
839        Creating,
840        /// Memcached instance has been created and ready to be used.
841        Ready,
842        /// Memcached instance is updating configuration such as maintenance policy
843        /// and schedule.
844        Updating,
845        /// Memcached instance is being deleted.
846        Deleting,
847        /// Memcached instance is going through maintenance, e.g. data plane rollout.
848        PerformingMaintenance,
849        /// If set, the enum was initialized with an unknown value.
850        ///
851        /// Applications can examine the value using [State::value] or
852        /// [State::name].
853        UnknownValue(state::UnknownValue),
854    }
855
856    #[doc(hidden)]
857    pub mod state {
858        #[allow(unused_imports)]
859        use super::*;
860        #[derive(Clone, Debug, PartialEq)]
861        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
862    }
863
864    impl State {
865        /// Gets the enum value.
866        ///
867        /// Returns `None` if the enum contains an unknown value deserialized from
868        /// the string representation of enums.
869        pub fn value(&self) -> std::option::Option<i32> {
870            match self {
871                Self::Unspecified => std::option::Option::Some(0),
872                Self::Creating => std::option::Option::Some(1),
873                Self::Ready => std::option::Option::Some(2),
874                Self::Updating => std::option::Option::Some(3),
875                Self::Deleting => std::option::Option::Some(4),
876                Self::PerformingMaintenance => std::option::Option::Some(5),
877                Self::UnknownValue(u) => u.0.value(),
878            }
879        }
880
881        /// Gets the enum value as a string.
882        ///
883        /// Returns `None` if the enum contains an unknown value deserialized from
884        /// the integer representation of enums.
885        pub fn name(&self) -> std::option::Option<&str> {
886            match self {
887                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
888                Self::Creating => std::option::Option::Some("CREATING"),
889                Self::Ready => std::option::Option::Some("READY"),
890                Self::Updating => std::option::Option::Some("UPDATING"),
891                Self::Deleting => std::option::Option::Some("DELETING"),
892                Self::PerformingMaintenance => std::option::Option::Some("PERFORMING_MAINTENANCE"),
893                Self::UnknownValue(u) => u.0.name(),
894            }
895        }
896    }
897
898    impl std::default::Default for State {
899        fn default() -> Self {
900            use std::convert::From;
901            Self::from(0)
902        }
903    }
904
905    impl std::fmt::Display for State {
906        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
907            wkt::internal::display_enum(f, self.name(), self.value())
908        }
909    }
910
911    impl std::convert::From<i32> for State {
912        fn from(value: i32) -> Self {
913            match value {
914                0 => Self::Unspecified,
915                1 => Self::Creating,
916                2 => Self::Ready,
917                3 => Self::Updating,
918                4 => Self::Deleting,
919                5 => Self::PerformingMaintenance,
920                _ => Self::UnknownValue(state::UnknownValue(
921                    wkt::internal::UnknownEnumValue::Integer(value),
922                )),
923            }
924        }
925    }
926
927    impl std::convert::From<&str> for State {
928        fn from(value: &str) -> Self {
929            use std::string::ToString;
930            match value {
931                "STATE_UNSPECIFIED" => Self::Unspecified,
932                "CREATING" => Self::Creating,
933                "READY" => Self::Ready,
934                "UPDATING" => Self::Updating,
935                "DELETING" => Self::Deleting,
936                "PERFORMING_MAINTENANCE" => Self::PerformingMaintenance,
937                _ => Self::UnknownValue(state::UnknownValue(
938                    wkt::internal::UnknownEnumValue::String(value.to_string()),
939                )),
940            }
941        }
942    }
943
944    impl serde::ser::Serialize for State {
945        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
946        where
947            S: serde::Serializer,
948        {
949            match self {
950                Self::Unspecified => serializer.serialize_i32(0),
951                Self::Creating => serializer.serialize_i32(1),
952                Self::Ready => serializer.serialize_i32(2),
953                Self::Updating => serializer.serialize_i32(3),
954                Self::Deleting => serializer.serialize_i32(4),
955                Self::PerformingMaintenance => serializer.serialize_i32(5),
956                Self::UnknownValue(u) => u.0.serialize(serializer),
957            }
958        }
959    }
960
961    impl<'de> serde::de::Deserialize<'de> for State {
962        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
963        where
964            D: serde::Deserializer<'de>,
965        {
966            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
967                ".google.cloud.memcache.v1.Instance.State",
968            ))
969        }
970    }
971}
972
973/// Maintenance policy per instance.
974#[derive(Clone, Default, PartialEq)]
975#[non_exhaustive]
976pub struct MaintenancePolicy {
977    /// Output only. The time when the policy was created.
978    pub create_time: std::option::Option<wkt::Timestamp>,
979
980    /// Output only. The time when the policy was updated.
981    pub update_time: std::option::Option<wkt::Timestamp>,
982
983    /// Description of what this policy is for. Create/Update methods
984    /// return INVALID_ARGUMENT if the length is greater than 512.
985    pub description: std::string::String,
986
987    /// Required. Maintenance window that is applied to resources covered by this
988    /// policy. Minimum 1. For the current version, the maximum number of
989    /// weekly_maintenance_windows is expected to be one.
990    pub weekly_maintenance_window: std::vec::Vec<crate::model::WeeklyMaintenanceWindow>,
991
992    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
993}
994
995impl MaintenancePolicy {
996    pub fn new() -> Self {
997        std::default::Default::default()
998    }
999
1000    /// Sets the value of [create_time][crate::model::MaintenancePolicy::create_time].
1001    pub fn set_create_time<T>(mut self, v: T) -> Self
1002    where
1003        T: std::convert::Into<wkt::Timestamp>,
1004    {
1005        self.create_time = std::option::Option::Some(v.into());
1006        self
1007    }
1008
1009    /// Sets or clears the value of [create_time][crate::model::MaintenancePolicy::create_time].
1010    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1011    where
1012        T: std::convert::Into<wkt::Timestamp>,
1013    {
1014        self.create_time = v.map(|x| x.into());
1015        self
1016    }
1017
1018    /// Sets the value of [update_time][crate::model::MaintenancePolicy::update_time].
1019    pub fn set_update_time<T>(mut self, v: T) -> Self
1020    where
1021        T: std::convert::Into<wkt::Timestamp>,
1022    {
1023        self.update_time = std::option::Option::Some(v.into());
1024        self
1025    }
1026
1027    /// Sets or clears the value of [update_time][crate::model::MaintenancePolicy::update_time].
1028    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1029    where
1030        T: std::convert::Into<wkt::Timestamp>,
1031    {
1032        self.update_time = v.map(|x| x.into());
1033        self
1034    }
1035
1036    /// Sets the value of [description][crate::model::MaintenancePolicy::description].
1037    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1038        self.description = v.into();
1039        self
1040    }
1041
1042    /// Sets the value of [weekly_maintenance_window][crate::model::MaintenancePolicy::weekly_maintenance_window].
1043    pub fn set_weekly_maintenance_window<T, V>(mut self, v: T) -> Self
1044    where
1045        T: std::iter::IntoIterator<Item = V>,
1046        V: std::convert::Into<crate::model::WeeklyMaintenanceWindow>,
1047    {
1048        use std::iter::Iterator;
1049        self.weekly_maintenance_window = v.into_iter().map(|i| i.into()).collect();
1050        self
1051    }
1052}
1053
1054impl wkt::message::Message for MaintenancePolicy {
1055    fn typename() -> &'static str {
1056        "type.googleapis.com/google.cloud.memcache.v1.MaintenancePolicy"
1057    }
1058}
1059
1060/// Time window specified for weekly operations.
1061#[derive(Clone, Default, PartialEq)]
1062#[non_exhaustive]
1063pub struct WeeklyMaintenanceWindow {
1064    /// Required. Allows to define schedule that runs specified day of the week.
1065    pub day: gtype::model::DayOfWeek,
1066
1067    /// Required. Start time of the window in UTC.
1068    pub start_time: std::option::Option<gtype::model::TimeOfDay>,
1069
1070    /// Required. Duration of the time window.
1071    pub duration: std::option::Option<wkt::Duration>,
1072
1073    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1074}
1075
1076impl WeeklyMaintenanceWindow {
1077    pub fn new() -> Self {
1078        std::default::Default::default()
1079    }
1080
1081    /// Sets the value of [day][crate::model::WeeklyMaintenanceWindow::day].
1082    pub fn set_day<T: std::convert::Into<gtype::model::DayOfWeek>>(mut self, v: T) -> Self {
1083        self.day = v.into();
1084        self
1085    }
1086
1087    /// Sets the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
1088    pub fn set_start_time<T>(mut self, v: T) -> Self
1089    where
1090        T: std::convert::Into<gtype::model::TimeOfDay>,
1091    {
1092        self.start_time = std::option::Option::Some(v.into());
1093        self
1094    }
1095
1096    /// Sets or clears the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
1097    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1098    where
1099        T: std::convert::Into<gtype::model::TimeOfDay>,
1100    {
1101        self.start_time = v.map(|x| x.into());
1102        self
1103    }
1104
1105    /// Sets the value of [duration][crate::model::WeeklyMaintenanceWindow::duration].
1106    pub fn set_duration<T>(mut self, v: T) -> Self
1107    where
1108        T: std::convert::Into<wkt::Duration>,
1109    {
1110        self.duration = std::option::Option::Some(v.into());
1111        self
1112    }
1113
1114    /// Sets or clears the value of [duration][crate::model::WeeklyMaintenanceWindow::duration].
1115    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
1116    where
1117        T: std::convert::Into<wkt::Duration>,
1118    {
1119        self.duration = v.map(|x| x.into());
1120        self
1121    }
1122}
1123
1124impl wkt::message::Message for WeeklyMaintenanceWindow {
1125    fn typename() -> &'static str {
1126        "type.googleapis.com/google.cloud.memcache.v1.WeeklyMaintenanceWindow"
1127    }
1128}
1129
1130/// Upcoming maintenance schedule.
1131#[derive(Clone, Default, PartialEq)]
1132#[non_exhaustive]
1133pub struct MaintenanceSchedule {
1134    /// Output only. The start time of any upcoming scheduled maintenance for this instance.
1135    pub start_time: std::option::Option<wkt::Timestamp>,
1136
1137    /// Output only. The end time of any upcoming scheduled maintenance for this instance.
1138    pub end_time: std::option::Option<wkt::Timestamp>,
1139
1140    /// Output only. The deadline that the maintenance schedule start time can not go beyond,
1141    /// including reschedule.
1142    pub schedule_deadline_time: std::option::Option<wkt::Timestamp>,
1143
1144    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1145}
1146
1147impl MaintenanceSchedule {
1148    pub fn new() -> Self {
1149        std::default::Default::default()
1150    }
1151
1152    /// Sets the value of [start_time][crate::model::MaintenanceSchedule::start_time].
1153    pub fn set_start_time<T>(mut self, v: T) -> Self
1154    where
1155        T: std::convert::Into<wkt::Timestamp>,
1156    {
1157        self.start_time = std::option::Option::Some(v.into());
1158        self
1159    }
1160
1161    /// Sets or clears the value of [start_time][crate::model::MaintenanceSchedule::start_time].
1162    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1163    where
1164        T: std::convert::Into<wkt::Timestamp>,
1165    {
1166        self.start_time = v.map(|x| x.into());
1167        self
1168    }
1169
1170    /// Sets the value of [end_time][crate::model::MaintenanceSchedule::end_time].
1171    pub fn set_end_time<T>(mut self, v: T) -> Self
1172    where
1173        T: std::convert::Into<wkt::Timestamp>,
1174    {
1175        self.end_time = std::option::Option::Some(v.into());
1176        self
1177    }
1178
1179    /// Sets or clears the value of [end_time][crate::model::MaintenanceSchedule::end_time].
1180    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1181    where
1182        T: std::convert::Into<wkt::Timestamp>,
1183    {
1184        self.end_time = v.map(|x| x.into());
1185        self
1186    }
1187
1188    /// Sets the value of [schedule_deadline_time][crate::model::MaintenanceSchedule::schedule_deadline_time].
1189    pub fn set_schedule_deadline_time<T>(mut self, v: T) -> Self
1190    where
1191        T: std::convert::Into<wkt::Timestamp>,
1192    {
1193        self.schedule_deadline_time = std::option::Option::Some(v.into());
1194        self
1195    }
1196
1197    /// Sets or clears the value of [schedule_deadline_time][crate::model::MaintenanceSchedule::schedule_deadline_time].
1198    pub fn set_or_clear_schedule_deadline_time<T>(mut self, v: std::option::Option<T>) -> Self
1199    where
1200        T: std::convert::Into<wkt::Timestamp>,
1201    {
1202        self.schedule_deadline_time = v.map(|x| x.into());
1203        self
1204    }
1205}
1206
1207impl wkt::message::Message for MaintenanceSchedule {
1208    fn typename() -> &'static str {
1209        "type.googleapis.com/google.cloud.memcache.v1.MaintenanceSchedule"
1210    }
1211}
1212
1213/// Request for [RescheduleMaintenance][google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance].
1214///
1215/// [google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance]: crate::client::CloudMemcache::reschedule_maintenance
1216#[derive(Clone, Default, PartialEq)]
1217#[non_exhaustive]
1218pub struct RescheduleMaintenanceRequest {
1219    /// Required. Memcache instance resource name using the form:
1220    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
1221    /// where `location_id` refers to a GCP region.
1222    pub instance: std::string::String,
1223
1224    /// Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
1225    pub reschedule_type: crate::model::reschedule_maintenance_request::RescheduleType,
1226
1227    /// Timestamp when the maintenance shall be rescheduled to if
1228    /// reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
1229    /// example `2012-11-15T16:19:00.094Z`.
1230    pub schedule_time: std::option::Option<wkt::Timestamp>,
1231
1232    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1233}
1234
1235impl RescheduleMaintenanceRequest {
1236    pub fn new() -> Self {
1237        std::default::Default::default()
1238    }
1239
1240    /// Sets the value of [instance][crate::model::RescheduleMaintenanceRequest::instance].
1241    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1242        self.instance = v.into();
1243        self
1244    }
1245
1246    /// Sets the value of [reschedule_type][crate::model::RescheduleMaintenanceRequest::reschedule_type].
1247    pub fn set_reschedule_type<
1248        T: std::convert::Into<crate::model::reschedule_maintenance_request::RescheduleType>,
1249    >(
1250        mut self,
1251        v: T,
1252    ) -> Self {
1253        self.reschedule_type = v.into();
1254        self
1255    }
1256
1257    /// Sets the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
1258    pub fn set_schedule_time<T>(mut self, v: T) -> Self
1259    where
1260        T: std::convert::Into<wkt::Timestamp>,
1261    {
1262        self.schedule_time = std::option::Option::Some(v.into());
1263        self
1264    }
1265
1266    /// Sets or clears the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
1267    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1268    where
1269        T: std::convert::Into<wkt::Timestamp>,
1270    {
1271        self.schedule_time = v.map(|x| x.into());
1272        self
1273    }
1274}
1275
1276impl wkt::message::Message for RescheduleMaintenanceRequest {
1277    fn typename() -> &'static str {
1278        "type.googleapis.com/google.cloud.memcache.v1.RescheduleMaintenanceRequest"
1279    }
1280}
1281
1282/// Defines additional types related to [RescheduleMaintenanceRequest].
1283pub mod reschedule_maintenance_request {
1284    #[allow(unused_imports)]
1285    use super::*;
1286
1287    /// Reschedule options.
1288    ///
1289    /// # Working with unknown values
1290    ///
1291    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1292    /// additional enum variants at any time. Adding new variants is not considered
1293    /// a breaking change. Applications should write their code in anticipation of:
1294    ///
1295    /// - New values appearing in future releases of the client library, **and**
1296    /// - New values received dynamically, without application changes.
1297    ///
1298    /// Please consult the [Working with enums] section in the user guide for some
1299    /// guidelines.
1300    ///
1301    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1302    #[derive(Clone, Debug, PartialEq)]
1303    #[non_exhaustive]
1304    pub enum RescheduleType {
1305        /// Not set.
1306        Unspecified,
1307        /// If the user wants to schedule the maintenance to happen now.
1308        Immediate,
1309        /// If the user wants to use the existing maintenance policy to find the
1310        /// next available window.
1311        NextAvailableWindow,
1312        /// If the user wants to reschedule the maintenance to a specific time.
1313        SpecificTime,
1314        /// If set, the enum was initialized with an unknown value.
1315        ///
1316        /// Applications can examine the value using [RescheduleType::value] or
1317        /// [RescheduleType::name].
1318        UnknownValue(reschedule_type::UnknownValue),
1319    }
1320
1321    #[doc(hidden)]
1322    pub mod reschedule_type {
1323        #[allow(unused_imports)]
1324        use super::*;
1325        #[derive(Clone, Debug, PartialEq)]
1326        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1327    }
1328
1329    impl RescheduleType {
1330        /// Gets the enum value.
1331        ///
1332        /// Returns `None` if the enum contains an unknown value deserialized from
1333        /// the string representation of enums.
1334        pub fn value(&self) -> std::option::Option<i32> {
1335            match self {
1336                Self::Unspecified => std::option::Option::Some(0),
1337                Self::Immediate => std::option::Option::Some(1),
1338                Self::NextAvailableWindow => std::option::Option::Some(2),
1339                Self::SpecificTime => std::option::Option::Some(3),
1340                Self::UnknownValue(u) => u.0.value(),
1341            }
1342        }
1343
1344        /// Gets the enum value as a string.
1345        ///
1346        /// Returns `None` if the enum contains an unknown value deserialized from
1347        /// the integer representation of enums.
1348        pub fn name(&self) -> std::option::Option<&str> {
1349            match self {
1350                Self::Unspecified => std::option::Option::Some("RESCHEDULE_TYPE_UNSPECIFIED"),
1351                Self::Immediate => std::option::Option::Some("IMMEDIATE"),
1352                Self::NextAvailableWindow => std::option::Option::Some("NEXT_AVAILABLE_WINDOW"),
1353                Self::SpecificTime => std::option::Option::Some("SPECIFIC_TIME"),
1354                Self::UnknownValue(u) => u.0.name(),
1355            }
1356        }
1357    }
1358
1359    impl std::default::Default for RescheduleType {
1360        fn default() -> Self {
1361            use std::convert::From;
1362            Self::from(0)
1363        }
1364    }
1365
1366    impl std::fmt::Display for RescheduleType {
1367        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1368            wkt::internal::display_enum(f, self.name(), self.value())
1369        }
1370    }
1371
1372    impl std::convert::From<i32> for RescheduleType {
1373        fn from(value: i32) -> Self {
1374            match value {
1375                0 => Self::Unspecified,
1376                1 => Self::Immediate,
1377                2 => Self::NextAvailableWindow,
1378                3 => Self::SpecificTime,
1379                _ => Self::UnknownValue(reschedule_type::UnknownValue(
1380                    wkt::internal::UnknownEnumValue::Integer(value),
1381                )),
1382            }
1383        }
1384    }
1385
1386    impl std::convert::From<&str> for RescheduleType {
1387        fn from(value: &str) -> Self {
1388            use std::string::ToString;
1389            match value {
1390                "RESCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
1391                "IMMEDIATE" => Self::Immediate,
1392                "NEXT_AVAILABLE_WINDOW" => Self::NextAvailableWindow,
1393                "SPECIFIC_TIME" => Self::SpecificTime,
1394                _ => Self::UnknownValue(reschedule_type::UnknownValue(
1395                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1396                )),
1397            }
1398        }
1399    }
1400
1401    impl serde::ser::Serialize for RescheduleType {
1402        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1403        where
1404            S: serde::Serializer,
1405        {
1406            match self {
1407                Self::Unspecified => serializer.serialize_i32(0),
1408                Self::Immediate => serializer.serialize_i32(1),
1409                Self::NextAvailableWindow => serializer.serialize_i32(2),
1410                Self::SpecificTime => serializer.serialize_i32(3),
1411                Self::UnknownValue(u) => u.0.serialize(serializer),
1412            }
1413        }
1414    }
1415
1416    impl<'de> serde::de::Deserialize<'de> for RescheduleType {
1417        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1418        where
1419            D: serde::Deserializer<'de>,
1420        {
1421            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RescheduleType>::new(
1422                ".google.cloud.memcache.v1.RescheduleMaintenanceRequest.RescheduleType",
1423            ))
1424        }
1425    }
1426}
1427
1428/// Request for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances].
1429///
1430/// [google.cloud.memcache.v1.CloudMemcache.ListInstances]: crate::client::CloudMemcache::list_instances
1431#[derive(Clone, Default, PartialEq)]
1432#[non_exhaustive]
1433pub struct ListInstancesRequest {
1434    /// Required. The resource name of the instance location using the form:
1435    /// `projects/{project_id}/locations/{location_id}`
1436    /// where `location_id` refers to a GCP region
1437    pub parent: std::string::String,
1438
1439    /// The maximum number of items to return.
1440    ///
1441    /// If not specified, a default value of 1000 will be used by the service.
1442    /// Regardless of the `page_size` value, the response may include a partial
1443    /// list and a caller should only rely on response's
1444    /// [`next_page_token`][google.cloud.memcache.v1.ListInstancesResponse.next_page_token]
1445    /// to determine if there are more instances left to be queried.
1446    ///
1447    /// [google.cloud.memcache.v1.ListInstancesResponse.next_page_token]: crate::model::ListInstancesResponse::next_page_token
1448    pub page_size: i32,
1449
1450    /// The `next_page_token` value returned from a previous List request, if any.
1451    pub page_token: std::string::String,
1452
1453    /// List filter. For example, exclude all Memcached instances with name as
1454    /// my-instance by specifying `"name != my-instance"`.
1455    pub filter: std::string::String,
1456
1457    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
1458    pub order_by: std::string::String,
1459
1460    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1461}
1462
1463impl ListInstancesRequest {
1464    pub fn new() -> Self {
1465        std::default::Default::default()
1466    }
1467
1468    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
1469    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1470        self.parent = v.into();
1471        self
1472    }
1473
1474    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
1475    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1476        self.page_size = v.into();
1477        self
1478    }
1479
1480    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
1481    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1482        self.page_token = v.into();
1483        self
1484    }
1485
1486    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
1487    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1488        self.filter = v.into();
1489        self
1490    }
1491
1492    /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
1493    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1494        self.order_by = v.into();
1495        self
1496    }
1497}
1498
1499impl wkt::message::Message for ListInstancesRequest {
1500    fn typename() -> &'static str {
1501        "type.googleapis.com/google.cloud.memcache.v1.ListInstancesRequest"
1502    }
1503}
1504
1505/// Response for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances].
1506///
1507/// [google.cloud.memcache.v1.CloudMemcache.ListInstances]: crate::client::CloudMemcache::list_instances
1508#[derive(Clone, Default, PartialEq)]
1509#[non_exhaustive]
1510pub struct ListInstancesResponse {
1511    /// A list of Memcached instances in the project in the specified location,
1512    /// or across all locations.
1513    ///
1514    /// If the `location_id` in the parent field of the request is "-", all regions
1515    /// available to the project are queried, and the results aggregated.
1516    pub instances: std::vec::Vec<crate::model::Instance>,
1517
1518    /// Token to retrieve the next page of results, or empty if there are no more
1519    /// results in the list.
1520    pub next_page_token: std::string::String,
1521
1522    /// Locations that could not be reached.
1523    pub unreachable: std::vec::Vec<std::string::String>,
1524
1525    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1526}
1527
1528impl ListInstancesResponse {
1529    pub fn new() -> Self {
1530        std::default::Default::default()
1531    }
1532
1533    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
1534    pub fn set_instances<T, V>(mut self, v: T) -> Self
1535    where
1536        T: std::iter::IntoIterator<Item = V>,
1537        V: std::convert::Into<crate::model::Instance>,
1538    {
1539        use std::iter::Iterator;
1540        self.instances = v.into_iter().map(|i| i.into()).collect();
1541        self
1542    }
1543
1544    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
1545    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1546        self.next_page_token = v.into();
1547        self
1548    }
1549
1550    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
1551    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1552    where
1553        T: std::iter::IntoIterator<Item = V>,
1554        V: std::convert::Into<std::string::String>,
1555    {
1556        use std::iter::Iterator;
1557        self.unreachable = v.into_iter().map(|i| i.into()).collect();
1558        self
1559    }
1560}
1561
1562impl wkt::message::Message for ListInstancesResponse {
1563    fn typename() -> &'static str {
1564        "type.googleapis.com/google.cloud.memcache.v1.ListInstancesResponse"
1565    }
1566}
1567
1568#[doc(hidden)]
1569impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
1570    type PageItem = crate::model::Instance;
1571
1572    fn items(self) -> std::vec::Vec<Self::PageItem> {
1573        self.instances
1574    }
1575
1576    fn next_page_token(&self) -> std::string::String {
1577        use std::clone::Clone;
1578        self.next_page_token.clone()
1579    }
1580}
1581
1582/// Request for [GetInstance][google.cloud.memcache.v1.CloudMemcache.GetInstance].
1583///
1584/// [google.cloud.memcache.v1.CloudMemcache.GetInstance]: crate::client::CloudMemcache::get_instance
1585#[derive(Clone, Default, PartialEq)]
1586#[non_exhaustive]
1587pub struct GetInstanceRequest {
1588    /// Required. Memcached instance resource name in the format:
1589    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
1590    /// where `location_id` refers to a GCP region
1591    pub name: std::string::String,
1592
1593    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1594}
1595
1596impl GetInstanceRequest {
1597    pub fn new() -> Self {
1598        std::default::Default::default()
1599    }
1600
1601    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
1602    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1603        self.name = v.into();
1604        self
1605    }
1606}
1607
1608impl wkt::message::Message for GetInstanceRequest {
1609    fn typename() -> &'static str {
1610        "type.googleapis.com/google.cloud.memcache.v1.GetInstanceRequest"
1611    }
1612}
1613
1614/// Request for [CreateInstance][google.cloud.memcache.v1.CloudMemcache.CreateInstance].
1615///
1616/// [google.cloud.memcache.v1.CloudMemcache.CreateInstance]: crate::client::CloudMemcache::create_instance
1617#[derive(Clone, Default, PartialEq)]
1618#[non_exhaustive]
1619pub struct CreateInstanceRequest {
1620    /// Required. The resource name of the instance location using the form:
1621    /// `projects/{project_id}/locations/{location_id}`
1622    /// where `location_id` refers to a GCP region
1623    pub parent: std::string::String,
1624
1625    /// Required. The logical name of the Memcached instance in the user
1626    /// project with the following restrictions:
1627    ///
1628    /// * Must contain only lowercase letters, numbers, and hyphens.
1629    /// * Must start with a letter.
1630    /// * Must be between 1-40 characters.
1631    /// * Must end with a number or a letter.
1632    /// * Must be unique within the user project / location.
1633    ///
1634    /// If any of the above are not met, the API raises an invalid argument error.
1635    pub instance_id: std::string::String,
1636
1637    /// Required. A Memcached Instance
1638    pub instance: std::option::Option<crate::model::Instance>,
1639
1640    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1641}
1642
1643impl CreateInstanceRequest {
1644    pub fn new() -> Self {
1645        std::default::Default::default()
1646    }
1647
1648    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
1649    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1650        self.parent = v.into();
1651        self
1652    }
1653
1654    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
1655    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1656        self.instance_id = v.into();
1657        self
1658    }
1659
1660    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
1661    pub fn set_instance<T>(mut self, v: T) -> Self
1662    where
1663        T: std::convert::Into<crate::model::Instance>,
1664    {
1665        self.instance = std::option::Option::Some(v.into());
1666        self
1667    }
1668
1669    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
1670    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1671    where
1672        T: std::convert::Into<crate::model::Instance>,
1673    {
1674        self.instance = v.map(|x| x.into());
1675        self
1676    }
1677}
1678
1679impl wkt::message::Message for CreateInstanceRequest {
1680    fn typename() -> &'static str {
1681        "type.googleapis.com/google.cloud.memcache.v1.CreateInstanceRequest"
1682    }
1683}
1684
1685/// Request for [UpdateInstance][google.cloud.memcache.v1.CloudMemcache.UpdateInstance].
1686///
1687/// [google.cloud.memcache.v1.CloudMemcache.UpdateInstance]: crate::client::CloudMemcache::update_instance
1688#[derive(Clone, Default, PartialEq)]
1689#[non_exhaustive]
1690pub struct UpdateInstanceRequest {
1691    /// Required. Mask of fields to update.
1692    ///
1693    /// * `displayName`
1694    pub update_mask: std::option::Option<wkt::FieldMask>,
1695
1696    /// Required. A Memcached Instance.
1697    /// Only fields specified in update_mask are updated.
1698    pub instance: std::option::Option<crate::model::Instance>,
1699
1700    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1701}
1702
1703impl UpdateInstanceRequest {
1704    pub fn new() -> Self {
1705        std::default::Default::default()
1706    }
1707
1708    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1709    pub fn set_update_mask<T>(mut self, v: T) -> Self
1710    where
1711        T: std::convert::Into<wkt::FieldMask>,
1712    {
1713        self.update_mask = std::option::Option::Some(v.into());
1714        self
1715    }
1716
1717    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1718    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1719    where
1720        T: std::convert::Into<wkt::FieldMask>,
1721    {
1722        self.update_mask = v.map(|x| x.into());
1723        self
1724    }
1725
1726    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
1727    pub fn set_instance<T>(mut self, v: T) -> Self
1728    where
1729        T: std::convert::Into<crate::model::Instance>,
1730    {
1731        self.instance = std::option::Option::Some(v.into());
1732        self
1733    }
1734
1735    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
1736    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1737    where
1738        T: std::convert::Into<crate::model::Instance>,
1739    {
1740        self.instance = v.map(|x| x.into());
1741        self
1742    }
1743}
1744
1745impl wkt::message::Message for UpdateInstanceRequest {
1746    fn typename() -> &'static str {
1747        "type.googleapis.com/google.cloud.memcache.v1.UpdateInstanceRequest"
1748    }
1749}
1750
1751/// Request for [DeleteInstance][google.cloud.memcache.v1.CloudMemcache.DeleteInstance].
1752///
1753/// [google.cloud.memcache.v1.CloudMemcache.DeleteInstance]: crate::client::CloudMemcache::delete_instance
1754#[derive(Clone, Default, PartialEq)]
1755#[non_exhaustive]
1756pub struct DeleteInstanceRequest {
1757    /// Required. Memcached instance resource name in the format:
1758    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
1759    /// where `location_id` refers to a GCP region
1760    pub name: std::string::String,
1761
1762    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1763}
1764
1765impl DeleteInstanceRequest {
1766    pub fn new() -> Self {
1767        std::default::Default::default()
1768    }
1769
1770    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
1771    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1772        self.name = v.into();
1773        self
1774    }
1775}
1776
1777impl wkt::message::Message for DeleteInstanceRequest {
1778    fn typename() -> &'static str {
1779        "type.googleapis.com/google.cloud.memcache.v1.DeleteInstanceRequest"
1780    }
1781}
1782
1783/// Request for [ApplyParameters][google.cloud.memcache.v1.CloudMemcache.ApplyParameters].
1784///
1785/// [google.cloud.memcache.v1.CloudMemcache.ApplyParameters]: crate::client::CloudMemcache::apply_parameters
1786#[derive(Clone, Default, PartialEq)]
1787#[non_exhaustive]
1788pub struct ApplyParametersRequest {
1789    /// Required. Resource name of the Memcached instance for which parameter group updates
1790    /// should be applied.
1791    pub name: std::string::String,
1792
1793    /// Nodes to which the instance-level parameter group is applied.
1794    pub node_ids: std::vec::Vec<std::string::String>,
1795
1796    /// Whether to apply instance-level parameter group to all nodes. If set to
1797    /// true, users are restricted from specifying individual nodes, and
1798    /// `ApplyParameters` updates all nodes within the instance.
1799    pub apply_all: bool,
1800
1801    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1802}
1803
1804impl ApplyParametersRequest {
1805    pub fn new() -> Self {
1806        std::default::Default::default()
1807    }
1808
1809    /// Sets the value of [name][crate::model::ApplyParametersRequest::name].
1810    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1811        self.name = v.into();
1812        self
1813    }
1814
1815    /// Sets the value of [node_ids][crate::model::ApplyParametersRequest::node_ids].
1816    pub fn set_node_ids<T, V>(mut self, v: T) -> Self
1817    where
1818        T: std::iter::IntoIterator<Item = V>,
1819        V: std::convert::Into<std::string::String>,
1820    {
1821        use std::iter::Iterator;
1822        self.node_ids = v.into_iter().map(|i| i.into()).collect();
1823        self
1824    }
1825
1826    /// Sets the value of [apply_all][crate::model::ApplyParametersRequest::apply_all].
1827    pub fn set_apply_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1828        self.apply_all = v.into();
1829        self
1830    }
1831}
1832
1833impl wkt::message::Message for ApplyParametersRequest {
1834    fn typename() -> &'static str {
1835        "type.googleapis.com/google.cloud.memcache.v1.ApplyParametersRequest"
1836    }
1837}
1838
1839/// Request for [UpdateParameters][google.cloud.memcache.v1.CloudMemcache.UpdateParameters].
1840///
1841/// [google.cloud.memcache.v1.CloudMemcache.UpdateParameters]: crate::client::CloudMemcache::update_parameters
1842#[derive(Clone, Default, PartialEq)]
1843#[non_exhaustive]
1844pub struct UpdateParametersRequest {
1845    /// Required. Resource name of the Memcached instance for which the parameters should be
1846    /// updated.
1847    pub name: std::string::String,
1848
1849    /// Required. Mask of fields to update.
1850    pub update_mask: std::option::Option<wkt::FieldMask>,
1851
1852    /// The parameters to apply to the instance.
1853    pub parameters: std::option::Option<crate::model::MemcacheParameters>,
1854
1855    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1856}
1857
1858impl UpdateParametersRequest {
1859    pub fn new() -> Self {
1860        std::default::Default::default()
1861    }
1862
1863    /// Sets the value of [name][crate::model::UpdateParametersRequest::name].
1864    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1865        self.name = v.into();
1866        self
1867    }
1868
1869    /// Sets the value of [update_mask][crate::model::UpdateParametersRequest::update_mask].
1870    pub fn set_update_mask<T>(mut self, v: T) -> Self
1871    where
1872        T: std::convert::Into<wkt::FieldMask>,
1873    {
1874        self.update_mask = std::option::Option::Some(v.into());
1875        self
1876    }
1877
1878    /// Sets or clears the value of [update_mask][crate::model::UpdateParametersRequest::update_mask].
1879    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1880    where
1881        T: std::convert::Into<wkt::FieldMask>,
1882    {
1883        self.update_mask = v.map(|x| x.into());
1884        self
1885    }
1886
1887    /// Sets the value of [parameters][crate::model::UpdateParametersRequest::parameters].
1888    pub fn set_parameters<T>(mut self, v: T) -> Self
1889    where
1890        T: std::convert::Into<crate::model::MemcacheParameters>,
1891    {
1892        self.parameters = std::option::Option::Some(v.into());
1893        self
1894    }
1895
1896    /// Sets or clears the value of [parameters][crate::model::UpdateParametersRequest::parameters].
1897    pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
1898    where
1899        T: std::convert::Into<crate::model::MemcacheParameters>,
1900    {
1901        self.parameters = v.map(|x| x.into());
1902        self
1903    }
1904}
1905
1906impl wkt::message::Message for UpdateParametersRequest {
1907    fn typename() -> &'static str {
1908        "type.googleapis.com/google.cloud.memcache.v1.UpdateParametersRequest"
1909    }
1910}
1911
1912#[derive(Clone, Default, PartialEq)]
1913#[non_exhaustive]
1914pub struct MemcacheParameters {
1915    /// Output only. The unique ID associated with this set of parameters. Users
1916    /// can use this id to determine if the parameters associated with the instance
1917    /// differ from the parameters associated with the nodes. A discrepancy between
1918    /// parameter ids can inform users that they may need to take action to apply
1919    /// parameters on nodes.
1920    pub id: std::string::String,
1921
1922    /// User defined set of parameters to use in the memcached process.
1923    pub params: std::collections::HashMap<std::string::String, std::string::String>,
1924
1925    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1926}
1927
1928impl MemcacheParameters {
1929    pub fn new() -> Self {
1930        std::default::Default::default()
1931    }
1932
1933    /// Sets the value of [id][crate::model::MemcacheParameters::id].
1934    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1935        self.id = v.into();
1936        self
1937    }
1938
1939    /// Sets the value of [params][crate::model::MemcacheParameters::params].
1940    pub fn set_params<T, K, V>(mut self, v: T) -> Self
1941    where
1942        T: std::iter::IntoIterator<Item = (K, V)>,
1943        K: std::convert::Into<std::string::String>,
1944        V: std::convert::Into<std::string::String>,
1945    {
1946        use std::iter::Iterator;
1947        self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1948        self
1949    }
1950}
1951
1952impl wkt::message::Message for MemcacheParameters {
1953    fn typename() -> &'static str {
1954        "type.googleapis.com/google.cloud.memcache.v1.MemcacheParameters"
1955    }
1956}
1957
1958/// Represents the metadata of a long-running operation.
1959#[derive(Clone, Default, PartialEq)]
1960#[non_exhaustive]
1961pub struct OperationMetadata {
1962    /// Output only. Time when the operation was created.
1963    pub create_time: std::option::Option<wkt::Timestamp>,
1964
1965    /// Output only. Time when the operation finished running.
1966    pub end_time: std::option::Option<wkt::Timestamp>,
1967
1968    /// Output only. Server-defined resource path for the target of the operation.
1969    pub target: std::string::String,
1970
1971    /// Output only. Name of the verb executed by the operation.
1972    pub verb: std::string::String,
1973
1974    /// Output only. Human-readable status of the operation, if any.
1975    pub status_detail: std::string::String,
1976
1977    /// Output only. Identifies whether the user has requested cancellation
1978    /// of the operation. Operations that have successfully been cancelled
1979    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
1980    /// corresponding to `Code.CANCELLED`.
1981    ///
1982    /// [google.rpc.Status.code]: rpc::model::Status::code
1983    pub cancel_requested: bool,
1984
1985    /// Output only. API version used to start the operation.
1986    pub api_version: std::string::String,
1987
1988    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1989}
1990
1991impl OperationMetadata {
1992    pub fn new() -> Self {
1993        std::default::Default::default()
1994    }
1995
1996    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
1997    pub fn set_create_time<T>(mut self, v: T) -> Self
1998    where
1999        T: std::convert::Into<wkt::Timestamp>,
2000    {
2001        self.create_time = std::option::Option::Some(v.into());
2002        self
2003    }
2004
2005    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
2006    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2007    where
2008        T: std::convert::Into<wkt::Timestamp>,
2009    {
2010        self.create_time = v.map(|x| x.into());
2011        self
2012    }
2013
2014    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
2015    pub fn set_end_time<T>(mut self, v: T) -> Self
2016    where
2017        T: std::convert::Into<wkt::Timestamp>,
2018    {
2019        self.end_time = std::option::Option::Some(v.into());
2020        self
2021    }
2022
2023    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
2024    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2025    where
2026        T: std::convert::Into<wkt::Timestamp>,
2027    {
2028        self.end_time = v.map(|x| x.into());
2029        self
2030    }
2031
2032    /// Sets the value of [target][crate::model::OperationMetadata::target].
2033    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2034        self.target = v.into();
2035        self
2036    }
2037
2038    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
2039    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2040        self.verb = v.into();
2041        self
2042    }
2043
2044    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
2045    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2046        self.status_detail = v.into();
2047        self
2048    }
2049
2050    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
2051    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2052        self.cancel_requested = v.into();
2053        self
2054    }
2055
2056    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
2057    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2058        self.api_version = v.into();
2059        self
2060    }
2061}
2062
2063impl wkt::message::Message for OperationMetadata {
2064    fn typename() -> &'static str {
2065        "type.googleapis.com/google.cloud.memcache.v1.OperationMetadata"
2066    }
2067}
2068
2069/// Metadata for the given [google.cloud.location.Location][google.cloud.location.Location].
2070///
2071/// [google.cloud.location.Location]: location::model::Location
2072#[derive(Clone, Default, PartialEq)]
2073#[non_exhaustive]
2074pub struct LocationMetadata {
2075    /// Output only. The set of available zones in the location. The map is keyed
2076    /// by the lowercase ID of each zone, as defined by GCE. These keys can be
2077    /// specified in the `zones` field when creating a Memcached instance.
2078    pub available_zones: std::collections::HashMap<std::string::String, crate::model::ZoneMetadata>,
2079
2080    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2081}
2082
2083impl LocationMetadata {
2084    pub fn new() -> Self {
2085        std::default::Default::default()
2086    }
2087
2088    /// Sets the value of [available_zones][crate::model::LocationMetadata::available_zones].
2089    pub fn set_available_zones<T, K, V>(mut self, v: T) -> Self
2090    where
2091        T: std::iter::IntoIterator<Item = (K, V)>,
2092        K: std::convert::Into<std::string::String>,
2093        V: std::convert::Into<crate::model::ZoneMetadata>,
2094    {
2095        use std::iter::Iterator;
2096        self.available_zones = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2097        self
2098    }
2099}
2100
2101impl wkt::message::Message for LocationMetadata {
2102    fn typename() -> &'static str {
2103        "type.googleapis.com/google.cloud.memcache.v1.LocationMetadata"
2104    }
2105}
2106
2107#[derive(Clone, Default, PartialEq)]
2108#[non_exhaustive]
2109pub struct ZoneMetadata {
2110    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2111}
2112
2113impl ZoneMetadata {
2114    pub fn new() -> Self {
2115        std::default::Default::default()
2116    }
2117}
2118
2119impl wkt::message::Message for ZoneMetadata {
2120    fn typename() -> &'static str {
2121        "type.googleapis.com/google.cloud.memcache.v1.ZoneMetadata"
2122    }
2123}
2124
2125/// Memcached versions supported by our service.
2126///
2127/// # Working with unknown values
2128///
2129/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2130/// additional enum variants at any time. Adding new variants is not considered
2131/// a breaking change. Applications should write their code in anticipation of:
2132///
2133/// - New values appearing in future releases of the client library, **and**
2134/// - New values received dynamically, without application changes.
2135///
2136/// Please consult the [Working with enums] section in the user guide for some
2137/// guidelines.
2138///
2139/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2140#[derive(Clone, Debug, PartialEq)]
2141#[non_exhaustive]
2142pub enum MemcacheVersion {
2143    Unspecified,
2144    /// Memcached 1.5 version.
2145    Memcache15,
2146    /// If set, the enum was initialized with an unknown value.
2147    ///
2148    /// Applications can examine the value using [MemcacheVersion::value] or
2149    /// [MemcacheVersion::name].
2150    UnknownValue(memcache_version::UnknownValue),
2151}
2152
2153#[doc(hidden)]
2154pub mod memcache_version {
2155    #[allow(unused_imports)]
2156    use super::*;
2157    #[derive(Clone, Debug, PartialEq)]
2158    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2159}
2160
2161impl MemcacheVersion {
2162    /// Gets the enum value.
2163    ///
2164    /// Returns `None` if the enum contains an unknown value deserialized from
2165    /// the string representation of enums.
2166    pub fn value(&self) -> std::option::Option<i32> {
2167        match self {
2168            Self::Unspecified => std::option::Option::Some(0),
2169            Self::Memcache15 => std::option::Option::Some(1),
2170            Self::UnknownValue(u) => u.0.value(),
2171        }
2172    }
2173
2174    /// Gets the enum value as a string.
2175    ///
2176    /// Returns `None` if the enum contains an unknown value deserialized from
2177    /// the integer representation of enums.
2178    pub fn name(&self) -> std::option::Option<&str> {
2179        match self {
2180            Self::Unspecified => std::option::Option::Some("MEMCACHE_VERSION_UNSPECIFIED"),
2181            Self::Memcache15 => std::option::Option::Some("MEMCACHE_1_5"),
2182            Self::UnknownValue(u) => u.0.name(),
2183        }
2184    }
2185}
2186
2187impl std::default::Default for MemcacheVersion {
2188    fn default() -> Self {
2189        use std::convert::From;
2190        Self::from(0)
2191    }
2192}
2193
2194impl std::fmt::Display for MemcacheVersion {
2195    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2196        wkt::internal::display_enum(f, self.name(), self.value())
2197    }
2198}
2199
2200impl std::convert::From<i32> for MemcacheVersion {
2201    fn from(value: i32) -> Self {
2202        match value {
2203            0 => Self::Unspecified,
2204            1 => Self::Memcache15,
2205            _ => Self::UnknownValue(memcache_version::UnknownValue(
2206                wkt::internal::UnknownEnumValue::Integer(value),
2207            )),
2208        }
2209    }
2210}
2211
2212impl std::convert::From<&str> for MemcacheVersion {
2213    fn from(value: &str) -> Self {
2214        use std::string::ToString;
2215        match value {
2216            "MEMCACHE_VERSION_UNSPECIFIED" => Self::Unspecified,
2217            "MEMCACHE_1_5" => Self::Memcache15,
2218            _ => Self::UnknownValue(memcache_version::UnknownValue(
2219                wkt::internal::UnknownEnumValue::String(value.to_string()),
2220            )),
2221        }
2222    }
2223}
2224
2225impl serde::ser::Serialize for MemcacheVersion {
2226    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2227    where
2228        S: serde::Serializer,
2229    {
2230        match self {
2231            Self::Unspecified => serializer.serialize_i32(0),
2232            Self::Memcache15 => serializer.serialize_i32(1),
2233            Self::UnknownValue(u) => u.0.serialize(serializer),
2234        }
2235    }
2236}
2237
2238impl<'de> serde::de::Deserialize<'de> for MemcacheVersion {
2239    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2240    where
2241        D: serde::Deserializer<'de>,
2242    {
2243        deserializer.deserialize_any(wkt::internal::EnumVisitor::<MemcacheVersion>::new(
2244            ".google.cloud.memcache.v1.MemcacheVersion",
2245        ))
2246    }
2247}