Skip to main content

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 gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_type;
28extern crate lazy_static;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// A Memorystore for Memcached instance
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct Instance {
44    /// Required. Unique name of the resource in this scope including project and
45    /// location using the form:
46    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
47    ///
48    /// Note: Memcached instances are managed and addressed at the regional level
49    /// so `location_id` here refers to a Google Cloud region; however, users may
50    /// choose which zones Memcached nodes should be provisioned in within an
51    /// instance. Refer to [zones][google.cloud.memcache.v1.Instance.zones] field for more details.
52    ///
53    /// [google.cloud.memcache.v1.Instance.zones]: crate::model::Instance::zones
54    pub name: std::string::String,
55
56    /// User provided name for the instance, which is only used for display
57    /// purposes. Cannot be more than 80 characters.
58    pub display_name: std::string::String,
59
60    /// Resource labels to represent user-provided metadata.
61    /// Refer to cloud documentation on labels for more details.
62    /// <https://cloud.google.com/compute/docs/labeling-resources>
63    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
64
65    /// The full name of the Google Compute Engine
66    /// [network](/compute/docs/networks-and-firewalls#networks) to which the
67    /// instance is connected. If left unspecified, the `default` network
68    /// will be used.
69    pub authorized_network: std::string::String,
70
71    /// Zones in which Memcached nodes should be provisioned.
72    /// Memcached nodes will be equally distributed across these zones. If not
73    /// provided, the service will by default create nodes in all zones in the
74    /// region for the instance.
75    pub zones: std::vec::Vec<std::string::String>,
76
77    /// Required. Number of nodes in the Memcached instance.
78    pub node_count: i32,
79
80    /// Required. Configuration for Memcached nodes.
81    pub node_config: std::option::Option<crate::model::instance::NodeConfig>,
82
83    /// The major version of Memcached software.
84    /// If not provided, latest supported version will be used. Currently the
85    /// latest supported major version is `MEMCACHE_1_5`.
86    /// The minor version will be automatically determined by our system based on
87    /// the latest supported minor version.
88    pub memcache_version: crate::model::MemcacheVersion,
89
90    /// User defined parameters to apply to the memcached process
91    /// on each node.
92    pub parameters: std::option::Option<crate::model::MemcacheParameters>,
93
94    /// Output only. List of Memcached nodes.
95    /// Refer to [Node][google.cloud.memcache.v1.Instance.Node] message for more details.
96    ///
97    /// [google.cloud.memcache.v1.Instance.Node]: crate::model::instance::Node
98    pub memcache_nodes: std::vec::Vec<crate::model::instance::Node>,
99
100    /// Output only. The time the instance was created.
101    pub create_time: std::option::Option<wkt::Timestamp>,
102
103    /// Output only. The time the instance was updated.
104    pub update_time: std::option::Option<wkt::Timestamp>,
105
106    /// Output only. The state of this Memcached instance.
107    pub state: crate::model::instance::State,
108
109    /// Output only. The full version of memcached server running on this instance.
110    /// System automatically determines the full memcached version for an instance
111    /// based on the input MemcacheVersion.
112    /// The full version format will be "memcached-1.5.16".
113    pub memcache_full_version: std::string::String,
114
115    /// List of messages that describe the current state of the Memcached instance.
116    pub instance_messages: std::vec::Vec<crate::model::instance::InstanceMessage>,
117
118    /// Output only. Endpoint for the Discovery API.
119    pub discovery_endpoint: std::string::String,
120
121    /// The maintenance policy for the instance. If not provided,
122    /// the maintenance event will be performed based on Memorystore
123    /// internal rollout schedule.
124    pub maintenance_policy: std::option::Option<crate::model::MaintenancePolicy>,
125
126    /// Output only. Published maintenance schedule.
127    pub maintenance_schedule: std::option::Option<crate::model::MaintenanceSchedule>,
128
129    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
130}
131
132impl Instance {
133    pub fn new() -> Self {
134        std::default::Default::default()
135    }
136
137    /// Sets the value of [name][crate::model::Instance::name].
138    ///
139    /// # Example
140    /// ```ignore,no_run
141    /// # use google_cloud_memcache_v1::model::Instance;
142    /// let x = Instance::new().set_name("example");
143    /// ```
144    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
145        self.name = v.into();
146        self
147    }
148
149    /// Sets the value of [display_name][crate::model::Instance::display_name].
150    ///
151    /// # Example
152    /// ```ignore,no_run
153    /// # use google_cloud_memcache_v1::model::Instance;
154    /// let x = Instance::new().set_display_name("example");
155    /// ```
156    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
157        self.display_name = v.into();
158        self
159    }
160
161    /// Sets the value of [labels][crate::model::Instance::labels].
162    ///
163    /// # Example
164    /// ```ignore,no_run
165    /// # use google_cloud_memcache_v1::model::Instance;
166    /// let x = Instance::new().set_labels([
167    ///     ("key0", "abc"),
168    ///     ("key1", "xyz"),
169    /// ]);
170    /// ```
171    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
172    where
173        T: std::iter::IntoIterator<Item = (K, V)>,
174        K: std::convert::Into<std::string::String>,
175        V: std::convert::Into<std::string::String>,
176    {
177        use std::iter::Iterator;
178        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
179        self
180    }
181
182    /// Sets the value of [authorized_network][crate::model::Instance::authorized_network].
183    ///
184    /// # Example
185    /// ```ignore,no_run
186    /// # use google_cloud_memcache_v1::model::Instance;
187    /// let x = Instance::new().set_authorized_network("example");
188    /// ```
189    pub fn set_authorized_network<T: std::convert::Into<std::string::String>>(
190        mut self,
191        v: T,
192    ) -> Self {
193        self.authorized_network = v.into();
194        self
195    }
196
197    /// Sets the value of [zones][crate::model::Instance::zones].
198    ///
199    /// # Example
200    /// ```ignore,no_run
201    /// # use google_cloud_memcache_v1::model::Instance;
202    /// let x = Instance::new().set_zones(["a", "b", "c"]);
203    /// ```
204    pub fn set_zones<T, V>(mut self, v: T) -> Self
205    where
206        T: std::iter::IntoIterator<Item = V>,
207        V: std::convert::Into<std::string::String>,
208    {
209        use std::iter::Iterator;
210        self.zones = v.into_iter().map(|i| i.into()).collect();
211        self
212    }
213
214    /// Sets the value of [node_count][crate::model::Instance::node_count].
215    ///
216    /// # Example
217    /// ```ignore,no_run
218    /// # use google_cloud_memcache_v1::model::Instance;
219    /// let x = Instance::new().set_node_count(42);
220    /// ```
221    pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
222        self.node_count = v.into();
223        self
224    }
225
226    /// Sets the value of [node_config][crate::model::Instance::node_config].
227    ///
228    /// # Example
229    /// ```ignore,no_run
230    /// # use google_cloud_memcache_v1::model::Instance;
231    /// use google_cloud_memcache_v1::model::instance::NodeConfig;
232    /// let x = Instance::new().set_node_config(NodeConfig::default()/* use setters */);
233    /// ```
234    pub fn set_node_config<T>(mut self, v: T) -> Self
235    where
236        T: std::convert::Into<crate::model::instance::NodeConfig>,
237    {
238        self.node_config = std::option::Option::Some(v.into());
239        self
240    }
241
242    /// Sets or clears the value of [node_config][crate::model::Instance::node_config].
243    ///
244    /// # Example
245    /// ```ignore,no_run
246    /// # use google_cloud_memcache_v1::model::Instance;
247    /// use google_cloud_memcache_v1::model::instance::NodeConfig;
248    /// let x = Instance::new().set_or_clear_node_config(Some(NodeConfig::default()/* use setters */));
249    /// let x = Instance::new().set_or_clear_node_config(None::<NodeConfig>);
250    /// ```
251    pub fn set_or_clear_node_config<T>(mut self, v: std::option::Option<T>) -> Self
252    where
253        T: std::convert::Into<crate::model::instance::NodeConfig>,
254    {
255        self.node_config = v.map(|x| x.into());
256        self
257    }
258
259    /// Sets the value of [memcache_version][crate::model::Instance::memcache_version].
260    ///
261    /// # Example
262    /// ```ignore,no_run
263    /// # use google_cloud_memcache_v1::model::Instance;
264    /// use google_cloud_memcache_v1::model::MemcacheVersion;
265    /// let x0 = Instance::new().set_memcache_version(MemcacheVersion::Memcache15);
266    /// ```
267    pub fn set_memcache_version<T: std::convert::Into<crate::model::MemcacheVersion>>(
268        mut self,
269        v: T,
270    ) -> Self {
271        self.memcache_version = v.into();
272        self
273    }
274
275    /// Sets the value of [parameters][crate::model::Instance::parameters].
276    ///
277    /// # Example
278    /// ```ignore,no_run
279    /// # use google_cloud_memcache_v1::model::Instance;
280    /// use google_cloud_memcache_v1::model::MemcacheParameters;
281    /// let x = Instance::new().set_parameters(MemcacheParameters::default()/* use setters */);
282    /// ```
283    pub fn set_parameters<T>(mut self, v: T) -> Self
284    where
285        T: std::convert::Into<crate::model::MemcacheParameters>,
286    {
287        self.parameters = std::option::Option::Some(v.into());
288        self
289    }
290
291    /// Sets or clears the value of [parameters][crate::model::Instance::parameters].
292    ///
293    /// # Example
294    /// ```ignore,no_run
295    /// # use google_cloud_memcache_v1::model::Instance;
296    /// use google_cloud_memcache_v1::model::MemcacheParameters;
297    /// let x = Instance::new().set_or_clear_parameters(Some(MemcacheParameters::default()/* use setters */));
298    /// let x = Instance::new().set_or_clear_parameters(None::<MemcacheParameters>);
299    /// ```
300    pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
301    where
302        T: std::convert::Into<crate::model::MemcacheParameters>,
303    {
304        self.parameters = v.map(|x| x.into());
305        self
306    }
307
308    /// Sets the value of [memcache_nodes][crate::model::Instance::memcache_nodes].
309    ///
310    /// # Example
311    /// ```ignore,no_run
312    /// # use google_cloud_memcache_v1::model::Instance;
313    /// use google_cloud_memcache_v1::model::instance::Node;
314    /// let x = Instance::new()
315    ///     .set_memcache_nodes([
316    ///         Node::default()/* use setters */,
317    ///         Node::default()/* use (different) setters */,
318    ///     ]);
319    /// ```
320    pub fn set_memcache_nodes<T, V>(mut self, v: T) -> Self
321    where
322        T: std::iter::IntoIterator<Item = V>,
323        V: std::convert::Into<crate::model::instance::Node>,
324    {
325        use std::iter::Iterator;
326        self.memcache_nodes = v.into_iter().map(|i| i.into()).collect();
327        self
328    }
329
330    /// Sets the value of [create_time][crate::model::Instance::create_time].
331    ///
332    /// # Example
333    /// ```ignore,no_run
334    /// # use google_cloud_memcache_v1::model::Instance;
335    /// use wkt::Timestamp;
336    /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
337    /// ```
338    pub fn set_create_time<T>(mut self, v: T) -> Self
339    where
340        T: std::convert::Into<wkt::Timestamp>,
341    {
342        self.create_time = std::option::Option::Some(v.into());
343        self
344    }
345
346    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
347    ///
348    /// # Example
349    /// ```ignore,no_run
350    /// # use google_cloud_memcache_v1::model::Instance;
351    /// use wkt::Timestamp;
352    /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
353    /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
354    /// ```
355    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
356    where
357        T: std::convert::Into<wkt::Timestamp>,
358    {
359        self.create_time = v.map(|x| x.into());
360        self
361    }
362
363    /// Sets the value of [update_time][crate::model::Instance::update_time].
364    ///
365    /// # Example
366    /// ```ignore,no_run
367    /// # use google_cloud_memcache_v1::model::Instance;
368    /// use wkt::Timestamp;
369    /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
370    /// ```
371    pub fn set_update_time<T>(mut self, v: T) -> Self
372    where
373        T: std::convert::Into<wkt::Timestamp>,
374    {
375        self.update_time = std::option::Option::Some(v.into());
376        self
377    }
378
379    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
380    ///
381    /// # Example
382    /// ```ignore,no_run
383    /// # use google_cloud_memcache_v1::model::Instance;
384    /// use wkt::Timestamp;
385    /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
386    /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
387    /// ```
388    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
389    where
390        T: std::convert::Into<wkt::Timestamp>,
391    {
392        self.update_time = v.map(|x| x.into());
393        self
394    }
395
396    /// Sets the value of [state][crate::model::Instance::state].
397    ///
398    /// # Example
399    /// ```ignore,no_run
400    /// # use google_cloud_memcache_v1::model::Instance;
401    /// use google_cloud_memcache_v1::model::instance::State;
402    /// let x0 = Instance::new().set_state(State::Creating);
403    /// let x1 = Instance::new().set_state(State::Ready);
404    /// let x2 = Instance::new().set_state(State::Updating);
405    /// ```
406    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
407        self.state = v.into();
408        self
409    }
410
411    /// Sets the value of [memcache_full_version][crate::model::Instance::memcache_full_version].
412    ///
413    /// # Example
414    /// ```ignore,no_run
415    /// # use google_cloud_memcache_v1::model::Instance;
416    /// let x = Instance::new().set_memcache_full_version("example");
417    /// ```
418    pub fn set_memcache_full_version<T: std::convert::Into<std::string::String>>(
419        mut self,
420        v: T,
421    ) -> Self {
422        self.memcache_full_version = v.into();
423        self
424    }
425
426    /// Sets the value of [instance_messages][crate::model::Instance::instance_messages].
427    ///
428    /// # Example
429    /// ```ignore,no_run
430    /// # use google_cloud_memcache_v1::model::Instance;
431    /// use google_cloud_memcache_v1::model::instance::InstanceMessage;
432    /// let x = Instance::new()
433    ///     .set_instance_messages([
434    ///         InstanceMessage::default()/* use setters */,
435    ///         InstanceMessage::default()/* use (different) setters */,
436    ///     ]);
437    /// ```
438    pub fn set_instance_messages<T, V>(mut self, v: T) -> Self
439    where
440        T: std::iter::IntoIterator<Item = V>,
441        V: std::convert::Into<crate::model::instance::InstanceMessage>,
442    {
443        use std::iter::Iterator;
444        self.instance_messages = v.into_iter().map(|i| i.into()).collect();
445        self
446    }
447
448    /// Sets the value of [discovery_endpoint][crate::model::Instance::discovery_endpoint].
449    ///
450    /// # Example
451    /// ```ignore,no_run
452    /// # use google_cloud_memcache_v1::model::Instance;
453    /// let x = Instance::new().set_discovery_endpoint("example");
454    /// ```
455    pub fn set_discovery_endpoint<T: std::convert::Into<std::string::String>>(
456        mut self,
457        v: T,
458    ) -> Self {
459        self.discovery_endpoint = v.into();
460        self
461    }
462
463    /// Sets the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
464    ///
465    /// # Example
466    /// ```ignore,no_run
467    /// # use google_cloud_memcache_v1::model::Instance;
468    /// use google_cloud_memcache_v1::model::MaintenancePolicy;
469    /// let x = Instance::new().set_maintenance_policy(MaintenancePolicy::default()/* use setters */);
470    /// ```
471    pub fn set_maintenance_policy<T>(mut self, v: T) -> Self
472    where
473        T: std::convert::Into<crate::model::MaintenancePolicy>,
474    {
475        self.maintenance_policy = std::option::Option::Some(v.into());
476        self
477    }
478
479    /// Sets or clears the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
480    ///
481    /// # Example
482    /// ```ignore,no_run
483    /// # use google_cloud_memcache_v1::model::Instance;
484    /// use google_cloud_memcache_v1::model::MaintenancePolicy;
485    /// let x = Instance::new().set_or_clear_maintenance_policy(Some(MaintenancePolicy::default()/* use setters */));
486    /// let x = Instance::new().set_or_clear_maintenance_policy(None::<MaintenancePolicy>);
487    /// ```
488    pub fn set_or_clear_maintenance_policy<T>(mut self, v: std::option::Option<T>) -> Self
489    where
490        T: std::convert::Into<crate::model::MaintenancePolicy>,
491    {
492        self.maintenance_policy = v.map(|x| x.into());
493        self
494    }
495
496    /// Sets the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
497    ///
498    /// # Example
499    /// ```ignore,no_run
500    /// # use google_cloud_memcache_v1::model::Instance;
501    /// use google_cloud_memcache_v1::model::MaintenanceSchedule;
502    /// let x = Instance::new().set_maintenance_schedule(MaintenanceSchedule::default()/* use setters */);
503    /// ```
504    pub fn set_maintenance_schedule<T>(mut self, v: T) -> Self
505    where
506        T: std::convert::Into<crate::model::MaintenanceSchedule>,
507    {
508        self.maintenance_schedule = std::option::Option::Some(v.into());
509        self
510    }
511
512    /// Sets or clears the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
513    ///
514    /// # Example
515    /// ```ignore,no_run
516    /// # use google_cloud_memcache_v1::model::Instance;
517    /// use google_cloud_memcache_v1::model::MaintenanceSchedule;
518    /// let x = Instance::new().set_or_clear_maintenance_schedule(Some(MaintenanceSchedule::default()/* use setters */));
519    /// let x = Instance::new().set_or_clear_maintenance_schedule(None::<MaintenanceSchedule>);
520    /// ```
521    pub fn set_or_clear_maintenance_schedule<T>(mut self, v: std::option::Option<T>) -> Self
522    where
523        T: std::convert::Into<crate::model::MaintenanceSchedule>,
524    {
525        self.maintenance_schedule = v.map(|x| x.into());
526        self
527    }
528}
529
530impl wkt::message::Message for Instance {
531    fn typename() -> &'static str {
532        "type.googleapis.com/google.cloud.memcache.v1.Instance"
533    }
534}
535
536/// Defines additional types related to [Instance].
537pub mod instance {
538    #[allow(unused_imports)]
539    use super::*;
540
541    /// Configuration for a Memcached Node.
542    #[derive(Clone, Default, PartialEq)]
543    #[non_exhaustive]
544    pub struct NodeConfig {
545        /// Required. Number of cpus per Memcached node.
546        pub cpu_count: i32,
547
548        /// Required. Memory size in MiB for each Memcached node.
549        pub memory_size_mb: i32,
550
551        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
552    }
553
554    impl NodeConfig {
555        pub fn new() -> Self {
556            std::default::Default::default()
557        }
558
559        /// Sets the value of [cpu_count][crate::model::instance::NodeConfig::cpu_count].
560        ///
561        /// # Example
562        /// ```ignore,no_run
563        /// # use google_cloud_memcache_v1::model::instance::NodeConfig;
564        /// let x = NodeConfig::new().set_cpu_count(42);
565        /// ```
566        pub fn set_cpu_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
567            self.cpu_count = v.into();
568            self
569        }
570
571        /// Sets the value of [memory_size_mb][crate::model::instance::NodeConfig::memory_size_mb].
572        ///
573        /// # Example
574        /// ```ignore,no_run
575        /// # use google_cloud_memcache_v1::model::instance::NodeConfig;
576        /// let x = NodeConfig::new().set_memory_size_mb(42);
577        /// ```
578        pub fn set_memory_size_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
579            self.memory_size_mb = v.into();
580            self
581        }
582    }
583
584    impl wkt::message::Message for NodeConfig {
585        fn typename() -> &'static str {
586            "type.googleapis.com/google.cloud.memcache.v1.Instance.NodeConfig"
587        }
588    }
589
590    #[derive(Clone, Default, PartialEq)]
591    #[non_exhaustive]
592    pub struct Node {
593        /// Output only. Identifier of the Memcached node. The node id does not
594        /// include project or location like the Memcached instance name.
595        pub node_id: std::string::String,
596
597        /// Output only. Location (GCP Zone) for the Memcached node.
598        pub zone: std::string::String,
599
600        /// Output only. Current state of the Memcached node.
601        pub state: crate::model::instance::node::State,
602
603        /// Output only. Hostname or IP address of the Memcached node used by the
604        /// clients to connect to the Memcached server on this node.
605        pub host: std::string::String,
606
607        /// Output only. The port number of the Memcached server on this node.
608        pub port: i32,
609
610        /// User defined parameters currently applied to the node.
611        pub parameters: std::option::Option<crate::model::MemcacheParameters>,
612
613        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
614    }
615
616    impl Node {
617        pub fn new() -> Self {
618            std::default::Default::default()
619        }
620
621        /// Sets the value of [node_id][crate::model::instance::Node::node_id].
622        ///
623        /// # Example
624        /// ```ignore,no_run
625        /// # use google_cloud_memcache_v1::model::instance::Node;
626        /// let x = Node::new().set_node_id("example");
627        /// ```
628        pub fn set_node_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
629            self.node_id = v.into();
630            self
631        }
632
633        /// Sets the value of [zone][crate::model::instance::Node::zone].
634        ///
635        /// # Example
636        /// ```ignore,no_run
637        /// # use google_cloud_memcache_v1::model::instance::Node;
638        /// let x = Node::new().set_zone("example");
639        /// ```
640        pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
641            self.zone = v.into();
642            self
643        }
644
645        /// Sets the value of [state][crate::model::instance::Node::state].
646        ///
647        /// # Example
648        /// ```ignore,no_run
649        /// # use google_cloud_memcache_v1::model::instance::Node;
650        /// use google_cloud_memcache_v1::model::instance::node::State;
651        /// let x0 = Node::new().set_state(State::Creating);
652        /// let x1 = Node::new().set_state(State::Ready);
653        /// let x2 = Node::new().set_state(State::Deleting);
654        /// ```
655        pub fn set_state<T: std::convert::Into<crate::model::instance::node::State>>(
656            mut self,
657            v: T,
658        ) -> Self {
659            self.state = v.into();
660            self
661        }
662
663        /// Sets the value of [host][crate::model::instance::Node::host].
664        ///
665        /// # Example
666        /// ```ignore,no_run
667        /// # use google_cloud_memcache_v1::model::instance::Node;
668        /// let x = Node::new().set_host("example");
669        /// ```
670        pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
671            self.host = v.into();
672            self
673        }
674
675        /// Sets the value of [port][crate::model::instance::Node::port].
676        ///
677        /// # Example
678        /// ```ignore,no_run
679        /// # use google_cloud_memcache_v1::model::instance::Node;
680        /// let x = Node::new().set_port(42);
681        /// ```
682        pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
683            self.port = v.into();
684            self
685        }
686
687        /// Sets the value of [parameters][crate::model::instance::Node::parameters].
688        ///
689        /// # Example
690        /// ```ignore,no_run
691        /// # use google_cloud_memcache_v1::model::instance::Node;
692        /// use google_cloud_memcache_v1::model::MemcacheParameters;
693        /// let x = Node::new().set_parameters(MemcacheParameters::default()/* use setters */);
694        /// ```
695        pub fn set_parameters<T>(mut self, v: T) -> Self
696        where
697            T: std::convert::Into<crate::model::MemcacheParameters>,
698        {
699            self.parameters = std::option::Option::Some(v.into());
700            self
701        }
702
703        /// Sets or clears the value of [parameters][crate::model::instance::Node::parameters].
704        ///
705        /// # Example
706        /// ```ignore,no_run
707        /// # use google_cloud_memcache_v1::model::instance::Node;
708        /// use google_cloud_memcache_v1::model::MemcacheParameters;
709        /// let x = Node::new().set_or_clear_parameters(Some(MemcacheParameters::default()/* use setters */));
710        /// let x = Node::new().set_or_clear_parameters(None::<MemcacheParameters>);
711        /// ```
712        pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
713        where
714            T: std::convert::Into<crate::model::MemcacheParameters>,
715        {
716            self.parameters = v.map(|x| x.into());
717            self
718        }
719    }
720
721    impl wkt::message::Message for Node {
722        fn typename() -> &'static str {
723            "type.googleapis.com/google.cloud.memcache.v1.Instance.Node"
724        }
725    }
726
727    /// Defines additional types related to [Node].
728    pub mod node {
729        #[allow(unused_imports)]
730        use super::*;
731
732        /// Different states of a Memcached node.
733        ///
734        /// # Working with unknown values
735        ///
736        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
737        /// additional enum variants at any time. Adding new variants is not considered
738        /// a breaking change. Applications should write their code in anticipation of:
739        ///
740        /// - New values appearing in future releases of the client library, **and**
741        /// - New values received dynamically, without application changes.
742        ///
743        /// Please consult the [Working with enums] section in the user guide for some
744        /// guidelines.
745        ///
746        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
747        #[derive(Clone, Debug, PartialEq)]
748        #[non_exhaustive]
749        pub enum State {
750            /// Node state is not set.
751            Unspecified,
752            /// Node is being created.
753            Creating,
754            /// Node has been created and ready to be used.
755            Ready,
756            /// Node is being deleted.
757            Deleting,
758            /// Node is being updated.
759            Updating,
760            /// If set, the enum was initialized with an unknown value.
761            ///
762            /// Applications can examine the value using [State::value] or
763            /// [State::name].
764            UnknownValue(state::UnknownValue),
765        }
766
767        #[doc(hidden)]
768        pub mod state {
769            #[allow(unused_imports)]
770            use super::*;
771            #[derive(Clone, Debug, PartialEq)]
772            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
773        }
774
775        impl State {
776            /// Gets the enum value.
777            ///
778            /// Returns `None` if the enum contains an unknown value deserialized from
779            /// the string representation of enums.
780            pub fn value(&self) -> std::option::Option<i32> {
781                match self {
782                    Self::Unspecified => std::option::Option::Some(0),
783                    Self::Creating => std::option::Option::Some(1),
784                    Self::Ready => std::option::Option::Some(2),
785                    Self::Deleting => std::option::Option::Some(3),
786                    Self::Updating => std::option::Option::Some(4),
787                    Self::UnknownValue(u) => u.0.value(),
788                }
789            }
790
791            /// Gets the enum value as a string.
792            ///
793            /// Returns `None` if the enum contains an unknown value deserialized from
794            /// the integer representation of enums.
795            pub fn name(&self) -> std::option::Option<&str> {
796                match self {
797                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
798                    Self::Creating => std::option::Option::Some("CREATING"),
799                    Self::Ready => std::option::Option::Some("READY"),
800                    Self::Deleting => std::option::Option::Some("DELETING"),
801                    Self::Updating => std::option::Option::Some("UPDATING"),
802                    Self::UnknownValue(u) => u.0.name(),
803                }
804            }
805        }
806
807        impl std::default::Default for State {
808            fn default() -> Self {
809                use std::convert::From;
810                Self::from(0)
811            }
812        }
813
814        impl std::fmt::Display for State {
815            fn fmt(
816                &self,
817                f: &mut std::fmt::Formatter<'_>,
818            ) -> std::result::Result<(), std::fmt::Error> {
819                wkt::internal::display_enum(f, self.name(), self.value())
820            }
821        }
822
823        impl std::convert::From<i32> for State {
824            fn from(value: i32) -> Self {
825                match value {
826                    0 => Self::Unspecified,
827                    1 => Self::Creating,
828                    2 => Self::Ready,
829                    3 => Self::Deleting,
830                    4 => Self::Updating,
831                    _ => Self::UnknownValue(state::UnknownValue(
832                        wkt::internal::UnknownEnumValue::Integer(value),
833                    )),
834                }
835            }
836        }
837
838        impl std::convert::From<&str> for State {
839            fn from(value: &str) -> Self {
840                use std::string::ToString;
841                match value {
842                    "STATE_UNSPECIFIED" => Self::Unspecified,
843                    "CREATING" => Self::Creating,
844                    "READY" => Self::Ready,
845                    "DELETING" => Self::Deleting,
846                    "UPDATING" => Self::Updating,
847                    _ => Self::UnknownValue(state::UnknownValue(
848                        wkt::internal::UnknownEnumValue::String(value.to_string()),
849                    )),
850                }
851            }
852        }
853
854        impl serde::ser::Serialize for State {
855            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
856            where
857                S: serde::Serializer,
858            {
859                match self {
860                    Self::Unspecified => serializer.serialize_i32(0),
861                    Self::Creating => serializer.serialize_i32(1),
862                    Self::Ready => serializer.serialize_i32(2),
863                    Self::Deleting => serializer.serialize_i32(3),
864                    Self::Updating => serializer.serialize_i32(4),
865                    Self::UnknownValue(u) => u.0.serialize(serializer),
866                }
867            }
868        }
869
870        impl<'de> serde::de::Deserialize<'de> for State {
871            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
872            where
873                D: serde::Deserializer<'de>,
874            {
875                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
876                    ".google.cloud.memcache.v1.Instance.Node.State",
877                ))
878            }
879        }
880    }
881
882    #[derive(Clone, Default, PartialEq)]
883    #[non_exhaustive]
884    pub struct InstanceMessage {
885        /// A code that correspond to one type of user-facing message.
886        pub code: crate::model::instance::instance_message::Code,
887
888        /// Message on memcached instance which will be exposed to users.
889        pub message: std::string::String,
890
891        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
892    }
893
894    impl InstanceMessage {
895        pub fn new() -> Self {
896            std::default::Default::default()
897        }
898
899        /// Sets the value of [code][crate::model::instance::InstanceMessage::code].
900        ///
901        /// # Example
902        /// ```ignore,no_run
903        /// # use google_cloud_memcache_v1::model::instance::InstanceMessage;
904        /// use google_cloud_memcache_v1::model::instance::instance_message::Code;
905        /// let x0 = InstanceMessage::new().set_code(Code::ZoneDistributionUnbalanced);
906        /// ```
907        pub fn set_code<T: std::convert::Into<crate::model::instance::instance_message::Code>>(
908            mut self,
909            v: T,
910        ) -> Self {
911            self.code = v.into();
912            self
913        }
914
915        /// Sets the value of [message][crate::model::instance::InstanceMessage::message].
916        ///
917        /// # Example
918        /// ```ignore,no_run
919        /// # use google_cloud_memcache_v1::model::instance::InstanceMessage;
920        /// let x = InstanceMessage::new().set_message("example");
921        /// ```
922        pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
923            self.message = v.into();
924            self
925        }
926    }
927
928    impl wkt::message::Message for InstanceMessage {
929        fn typename() -> &'static str {
930            "type.googleapis.com/google.cloud.memcache.v1.Instance.InstanceMessage"
931        }
932    }
933
934    /// Defines additional types related to [InstanceMessage].
935    pub mod instance_message {
936        #[allow(unused_imports)]
937        use super::*;
938
939        ///
940        /// # Working with unknown values
941        ///
942        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
943        /// additional enum variants at any time. Adding new variants is not considered
944        /// a breaking change. Applications should write their code in anticipation of:
945        ///
946        /// - New values appearing in future releases of the client library, **and**
947        /// - New values received dynamically, without application changes.
948        ///
949        /// Please consult the [Working with enums] section in the user guide for some
950        /// guidelines.
951        ///
952        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
953        #[derive(Clone, Debug, PartialEq)]
954        #[non_exhaustive]
955        pub enum Code {
956            /// Message Code not set.
957            Unspecified,
958            /// Memcached nodes are distributed unevenly.
959            ZoneDistributionUnbalanced,
960            /// If set, the enum was initialized with an unknown value.
961            ///
962            /// Applications can examine the value using [Code::value] or
963            /// [Code::name].
964            UnknownValue(code::UnknownValue),
965        }
966
967        #[doc(hidden)]
968        pub mod code {
969            #[allow(unused_imports)]
970            use super::*;
971            #[derive(Clone, Debug, PartialEq)]
972            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
973        }
974
975        impl Code {
976            /// Gets the enum value.
977            ///
978            /// Returns `None` if the enum contains an unknown value deserialized from
979            /// the string representation of enums.
980            pub fn value(&self) -> std::option::Option<i32> {
981                match self {
982                    Self::Unspecified => std::option::Option::Some(0),
983                    Self::ZoneDistributionUnbalanced => std::option::Option::Some(1),
984                    Self::UnknownValue(u) => u.0.value(),
985                }
986            }
987
988            /// Gets the enum value as a string.
989            ///
990            /// Returns `None` if the enum contains an unknown value deserialized from
991            /// the integer representation of enums.
992            pub fn name(&self) -> std::option::Option<&str> {
993                match self {
994                    Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
995                    Self::ZoneDistributionUnbalanced => {
996                        std::option::Option::Some("ZONE_DISTRIBUTION_UNBALANCED")
997                    }
998                    Self::UnknownValue(u) => u.0.name(),
999                }
1000            }
1001        }
1002
1003        impl std::default::Default for Code {
1004            fn default() -> Self {
1005                use std::convert::From;
1006                Self::from(0)
1007            }
1008        }
1009
1010        impl std::fmt::Display for Code {
1011            fn fmt(
1012                &self,
1013                f: &mut std::fmt::Formatter<'_>,
1014            ) -> std::result::Result<(), std::fmt::Error> {
1015                wkt::internal::display_enum(f, self.name(), self.value())
1016            }
1017        }
1018
1019        impl std::convert::From<i32> for Code {
1020            fn from(value: i32) -> Self {
1021                match value {
1022                    0 => Self::Unspecified,
1023                    1 => Self::ZoneDistributionUnbalanced,
1024                    _ => Self::UnknownValue(code::UnknownValue(
1025                        wkt::internal::UnknownEnumValue::Integer(value),
1026                    )),
1027                }
1028            }
1029        }
1030
1031        impl std::convert::From<&str> for Code {
1032            fn from(value: &str) -> Self {
1033                use std::string::ToString;
1034                match value {
1035                    "CODE_UNSPECIFIED" => Self::Unspecified,
1036                    "ZONE_DISTRIBUTION_UNBALANCED" => Self::ZoneDistributionUnbalanced,
1037                    _ => Self::UnknownValue(code::UnknownValue(
1038                        wkt::internal::UnknownEnumValue::String(value.to_string()),
1039                    )),
1040                }
1041            }
1042        }
1043
1044        impl serde::ser::Serialize for Code {
1045            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1046            where
1047                S: serde::Serializer,
1048            {
1049                match self {
1050                    Self::Unspecified => serializer.serialize_i32(0),
1051                    Self::ZoneDistributionUnbalanced => serializer.serialize_i32(1),
1052                    Self::UnknownValue(u) => u.0.serialize(serializer),
1053                }
1054            }
1055        }
1056
1057        impl<'de> serde::de::Deserialize<'de> for Code {
1058            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1059            where
1060                D: serde::Deserializer<'de>,
1061            {
1062                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
1063                    ".google.cloud.memcache.v1.Instance.InstanceMessage.Code",
1064                ))
1065            }
1066        }
1067    }
1068
1069    /// Different states of a Memcached instance.
1070    ///
1071    /// # Working with unknown values
1072    ///
1073    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1074    /// additional enum variants at any time. Adding new variants is not considered
1075    /// a breaking change. Applications should write their code in anticipation of:
1076    ///
1077    /// - New values appearing in future releases of the client library, **and**
1078    /// - New values received dynamically, without application changes.
1079    ///
1080    /// Please consult the [Working with enums] section in the user guide for some
1081    /// guidelines.
1082    ///
1083    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1084    #[derive(Clone, Debug, PartialEq)]
1085    #[non_exhaustive]
1086    pub enum State {
1087        /// State not set.
1088        Unspecified,
1089        /// Memcached instance is being created.
1090        Creating,
1091        /// Memcached instance has been created and ready to be used.
1092        Ready,
1093        /// Memcached instance is updating configuration such as maintenance policy
1094        /// and schedule.
1095        Updating,
1096        /// Memcached instance is being deleted.
1097        Deleting,
1098        /// Memcached instance is going through maintenance, e.g. data plane rollout.
1099        PerformingMaintenance,
1100        /// If set, the enum was initialized with an unknown value.
1101        ///
1102        /// Applications can examine the value using [State::value] or
1103        /// [State::name].
1104        UnknownValue(state::UnknownValue),
1105    }
1106
1107    #[doc(hidden)]
1108    pub mod state {
1109        #[allow(unused_imports)]
1110        use super::*;
1111        #[derive(Clone, Debug, PartialEq)]
1112        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1113    }
1114
1115    impl State {
1116        /// Gets the enum value.
1117        ///
1118        /// Returns `None` if the enum contains an unknown value deserialized from
1119        /// the string representation of enums.
1120        pub fn value(&self) -> std::option::Option<i32> {
1121            match self {
1122                Self::Unspecified => std::option::Option::Some(0),
1123                Self::Creating => std::option::Option::Some(1),
1124                Self::Ready => std::option::Option::Some(2),
1125                Self::Updating => std::option::Option::Some(3),
1126                Self::Deleting => std::option::Option::Some(4),
1127                Self::PerformingMaintenance => std::option::Option::Some(5),
1128                Self::UnknownValue(u) => u.0.value(),
1129            }
1130        }
1131
1132        /// Gets the enum value as a string.
1133        ///
1134        /// Returns `None` if the enum contains an unknown value deserialized from
1135        /// the integer representation of enums.
1136        pub fn name(&self) -> std::option::Option<&str> {
1137            match self {
1138                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1139                Self::Creating => std::option::Option::Some("CREATING"),
1140                Self::Ready => std::option::Option::Some("READY"),
1141                Self::Updating => std::option::Option::Some("UPDATING"),
1142                Self::Deleting => std::option::Option::Some("DELETING"),
1143                Self::PerformingMaintenance => std::option::Option::Some("PERFORMING_MAINTENANCE"),
1144                Self::UnknownValue(u) => u.0.name(),
1145            }
1146        }
1147    }
1148
1149    impl std::default::Default for State {
1150        fn default() -> Self {
1151            use std::convert::From;
1152            Self::from(0)
1153        }
1154    }
1155
1156    impl std::fmt::Display for State {
1157        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1158            wkt::internal::display_enum(f, self.name(), self.value())
1159        }
1160    }
1161
1162    impl std::convert::From<i32> for State {
1163        fn from(value: i32) -> Self {
1164            match value {
1165                0 => Self::Unspecified,
1166                1 => Self::Creating,
1167                2 => Self::Ready,
1168                3 => Self::Updating,
1169                4 => Self::Deleting,
1170                5 => Self::PerformingMaintenance,
1171                _ => Self::UnknownValue(state::UnknownValue(
1172                    wkt::internal::UnknownEnumValue::Integer(value),
1173                )),
1174            }
1175        }
1176    }
1177
1178    impl std::convert::From<&str> for State {
1179        fn from(value: &str) -> Self {
1180            use std::string::ToString;
1181            match value {
1182                "STATE_UNSPECIFIED" => Self::Unspecified,
1183                "CREATING" => Self::Creating,
1184                "READY" => Self::Ready,
1185                "UPDATING" => Self::Updating,
1186                "DELETING" => Self::Deleting,
1187                "PERFORMING_MAINTENANCE" => Self::PerformingMaintenance,
1188                _ => Self::UnknownValue(state::UnknownValue(
1189                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1190                )),
1191            }
1192        }
1193    }
1194
1195    impl serde::ser::Serialize for State {
1196        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1197        where
1198            S: serde::Serializer,
1199        {
1200            match self {
1201                Self::Unspecified => serializer.serialize_i32(0),
1202                Self::Creating => serializer.serialize_i32(1),
1203                Self::Ready => serializer.serialize_i32(2),
1204                Self::Updating => serializer.serialize_i32(3),
1205                Self::Deleting => serializer.serialize_i32(4),
1206                Self::PerformingMaintenance => serializer.serialize_i32(5),
1207                Self::UnknownValue(u) => u.0.serialize(serializer),
1208            }
1209        }
1210    }
1211
1212    impl<'de> serde::de::Deserialize<'de> for State {
1213        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1214        where
1215            D: serde::Deserializer<'de>,
1216        {
1217            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1218                ".google.cloud.memcache.v1.Instance.State",
1219            ))
1220        }
1221    }
1222}
1223
1224/// Maintenance policy per instance.
1225#[derive(Clone, Default, PartialEq)]
1226#[non_exhaustive]
1227pub struct MaintenancePolicy {
1228    /// Output only. The time when the policy was created.
1229    pub create_time: std::option::Option<wkt::Timestamp>,
1230
1231    /// Output only. The time when the policy was updated.
1232    pub update_time: std::option::Option<wkt::Timestamp>,
1233
1234    /// Description of what this policy is for. Create/Update methods
1235    /// return INVALID_ARGUMENT if the length is greater than 512.
1236    pub description: std::string::String,
1237
1238    /// Required. Maintenance window that is applied to resources covered by this
1239    /// policy. Minimum 1. For the current version, the maximum number of
1240    /// weekly_maintenance_windows is expected to be one.
1241    pub weekly_maintenance_window: std::vec::Vec<crate::model::WeeklyMaintenanceWindow>,
1242
1243    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1244}
1245
1246impl MaintenancePolicy {
1247    pub fn new() -> Self {
1248        std::default::Default::default()
1249    }
1250
1251    /// Sets the value of [create_time][crate::model::MaintenancePolicy::create_time].
1252    ///
1253    /// # Example
1254    /// ```ignore,no_run
1255    /// # use google_cloud_memcache_v1::model::MaintenancePolicy;
1256    /// use wkt::Timestamp;
1257    /// let x = MaintenancePolicy::new().set_create_time(Timestamp::default()/* use setters */);
1258    /// ```
1259    pub fn set_create_time<T>(mut self, v: T) -> Self
1260    where
1261        T: std::convert::Into<wkt::Timestamp>,
1262    {
1263        self.create_time = std::option::Option::Some(v.into());
1264        self
1265    }
1266
1267    /// Sets or clears the value of [create_time][crate::model::MaintenancePolicy::create_time].
1268    ///
1269    /// # Example
1270    /// ```ignore,no_run
1271    /// # use google_cloud_memcache_v1::model::MaintenancePolicy;
1272    /// use wkt::Timestamp;
1273    /// let x = MaintenancePolicy::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1274    /// let x = MaintenancePolicy::new().set_or_clear_create_time(None::<Timestamp>);
1275    /// ```
1276    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1277    where
1278        T: std::convert::Into<wkt::Timestamp>,
1279    {
1280        self.create_time = v.map(|x| x.into());
1281        self
1282    }
1283
1284    /// Sets the value of [update_time][crate::model::MaintenancePolicy::update_time].
1285    ///
1286    /// # Example
1287    /// ```ignore,no_run
1288    /// # use google_cloud_memcache_v1::model::MaintenancePolicy;
1289    /// use wkt::Timestamp;
1290    /// let x = MaintenancePolicy::new().set_update_time(Timestamp::default()/* use setters */);
1291    /// ```
1292    pub fn set_update_time<T>(mut self, v: T) -> Self
1293    where
1294        T: std::convert::Into<wkt::Timestamp>,
1295    {
1296        self.update_time = std::option::Option::Some(v.into());
1297        self
1298    }
1299
1300    /// Sets or clears the value of [update_time][crate::model::MaintenancePolicy::update_time].
1301    ///
1302    /// # Example
1303    /// ```ignore,no_run
1304    /// # use google_cloud_memcache_v1::model::MaintenancePolicy;
1305    /// use wkt::Timestamp;
1306    /// let x = MaintenancePolicy::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1307    /// let x = MaintenancePolicy::new().set_or_clear_update_time(None::<Timestamp>);
1308    /// ```
1309    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1310    where
1311        T: std::convert::Into<wkt::Timestamp>,
1312    {
1313        self.update_time = v.map(|x| x.into());
1314        self
1315    }
1316
1317    /// Sets the value of [description][crate::model::MaintenancePolicy::description].
1318    ///
1319    /// # Example
1320    /// ```ignore,no_run
1321    /// # use google_cloud_memcache_v1::model::MaintenancePolicy;
1322    /// let x = MaintenancePolicy::new().set_description("example");
1323    /// ```
1324    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1325        self.description = v.into();
1326        self
1327    }
1328
1329    /// Sets the value of [weekly_maintenance_window][crate::model::MaintenancePolicy::weekly_maintenance_window].
1330    ///
1331    /// # Example
1332    /// ```ignore,no_run
1333    /// # use google_cloud_memcache_v1::model::MaintenancePolicy;
1334    /// use google_cloud_memcache_v1::model::WeeklyMaintenanceWindow;
1335    /// let x = MaintenancePolicy::new()
1336    ///     .set_weekly_maintenance_window([
1337    ///         WeeklyMaintenanceWindow::default()/* use setters */,
1338    ///         WeeklyMaintenanceWindow::default()/* use (different) setters */,
1339    ///     ]);
1340    /// ```
1341    pub fn set_weekly_maintenance_window<T, V>(mut self, v: T) -> Self
1342    where
1343        T: std::iter::IntoIterator<Item = V>,
1344        V: std::convert::Into<crate::model::WeeklyMaintenanceWindow>,
1345    {
1346        use std::iter::Iterator;
1347        self.weekly_maintenance_window = v.into_iter().map(|i| i.into()).collect();
1348        self
1349    }
1350}
1351
1352impl wkt::message::Message for MaintenancePolicy {
1353    fn typename() -> &'static str {
1354        "type.googleapis.com/google.cloud.memcache.v1.MaintenancePolicy"
1355    }
1356}
1357
1358/// Time window specified for weekly operations.
1359#[derive(Clone, Default, PartialEq)]
1360#[non_exhaustive]
1361pub struct WeeklyMaintenanceWindow {
1362    /// Required. Allows to define schedule that runs specified day of the week.
1363    pub day: google_cloud_type::model::DayOfWeek,
1364
1365    /// Required. Start time of the window in UTC.
1366    pub start_time: std::option::Option<google_cloud_type::model::TimeOfDay>,
1367
1368    /// Required. Duration of the time window.
1369    pub duration: std::option::Option<wkt::Duration>,
1370
1371    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1372}
1373
1374impl WeeklyMaintenanceWindow {
1375    pub fn new() -> Self {
1376        std::default::Default::default()
1377    }
1378
1379    /// Sets the value of [day][crate::model::WeeklyMaintenanceWindow::day].
1380    ///
1381    /// # Example
1382    /// ```ignore,no_run
1383    /// # use google_cloud_memcache_v1::model::WeeklyMaintenanceWindow;
1384    /// use google_cloud_type::model::DayOfWeek;
1385    /// let x0 = WeeklyMaintenanceWindow::new().set_day(DayOfWeek::Monday);
1386    /// let x1 = WeeklyMaintenanceWindow::new().set_day(DayOfWeek::Tuesday);
1387    /// let x2 = WeeklyMaintenanceWindow::new().set_day(DayOfWeek::Wednesday);
1388    /// ```
1389    pub fn set_day<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
1390        mut self,
1391        v: T,
1392    ) -> Self {
1393        self.day = v.into();
1394        self
1395    }
1396
1397    /// Sets the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
1398    ///
1399    /// # Example
1400    /// ```ignore,no_run
1401    /// # use google_cloud_memcache_v1::model::WeeklyMaintenanceWindow;
1402    /// use google_cloud_type::model::TimeOfDay;
1403    /// let x = WeeklyMaintenanceWindow::new().set_start_time(TimeOfDay::default()/* use setters */);
1404    /// ```
1405    pub fn set_start_time<T>(mut self, v: T) -> Self
1406    where
1407        T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
1408    {
1409        self.start_time = std::option::Option::Some(v.into());
1410        self
1411    }
1412
1413    /// Sets or clears the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
1414    ///
1415    /// # Example
1416    /// ```ignore,no_run
1417    /// # use google_cloud_memcache_v1::model::WeeklyMaintenanceWindow;
1418    /// use google_cloud_type::model::TimeOfDay;
1419    /// let x = WeeklyMaintenanceWindow::new().set_or_clear_start_time(Some(TimeOfDay::default()/* use setters */));
1420    /// let x = WeeklyMaintenanceWindow::new().set_or_clear_start_time(None::<TimeOfDay>);
1421    /// ```
1422    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1423    where
1424        T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
1425    {
1426        self.start_time = v.map(|x| x.into());
1427        self
1428    }
1429
1430    /// Sets the value of [duration][crate::model::WeeklyMaintenanceWindow::duration].
1431    ///
1432    /// # Example
1433    /// ```ignore,no_run
1434    /// # use google_cloud_memcache_v1::model::WeeklyMaintenanceWindow;
1435    /// use wkt::Duration;
1436    /// let x = WeeklyMaintenanceWindow::new().set_duration(Duration::default()/* use setters */);
1437    /// ```
1438    pub fn set_duration<T>(mut self, v: T) -> Self
1439    where
1440        T: std::convert::Into<wkt::Duration>,
1441    {
1442        self.duration = std::option::Option::Some(v.into());
1443        self
1444    }
1445
1446    /// Sets or clears the value of [duration][crate::model::WeeklyMaintenanceWindow::duration].
1447    ///
1448    /// # Example
1449    /// ```ignore,no_run
1450    /// # use google_cloud_memcache_v1::model::WeeklyMaintenanceWindow;
1451    /// use wkt::Duration;
1452    /// let x = WeeklyMaintenanceWindow::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
1453    /// let x = WeeklyMaintenanceWindow::new().set_or_clear_duration(None::<Duration>);
1454    /// ```
1455    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
1456    where
1457        T: std::convert::Into<wkt::Duration>,
1458    {
1459        self.duration = v.map(|x| x.into());
1460        self
1461    }
1462}
1463
1464impl wkt::message::Message for WeeklyMaintenanceWindow {
1465    fn typename() -> &'static str {
1466        "type.googleapis.com/google.cloud.memcache.v1.WeeklyMaintenanceWindow"
1467    }
1468}
1469
1470/// Upcoming maintenance schedule.
1471#[derive(Clone, Default, PartialEq)]
1472#[non_exhaustive]
1473pub struct MaintenanceSchedule {
1474    /// Output only. The start time of any upcoming scheduled maintenance for this instance.
1475    pub start_time: std::option::Option<wkt::Timestamp>,
1476
1477    /// Output only. The end time of any upcoming scheduled maintenance for this instance.
1478    pub end_time: std::option::Option<wkt::Timestamp>,
1479
1480    /// Output only. The deadline that the maintenance schedule start time can not go beyond,
1481    /// including reschedule.
1482    pub schedule_deadline_time: std::option::Option<wkt::Timestamp>,
1483
1484    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1485}
1486
1487impl MaintenanceSchedule {
1488    pub fn new() -> Self {
1489        std::default::Default::default()
1490    }
1491
1492    /// Sets the value of [start_time][crate::model::MaintenanceSchedule::start_time].
1493    ///
1494    /// # Example
1495    /// ```ignore,no_run
1496    /// # use google_cloud_memcache_v1::model::MaintenanceSchedule;
1497    /// use wkt::Timestamp;
1498    /// let x = MaintenanceSchedule::new().set_start_time(Timestamp::default()/* use setters */);
1499    /// ```
1500    pub fn set_start_time<T>(mut self, v: T) -> Self
1501    where
1502        T: std::convert::Into<wkt::Timestamp>,
1503    {
1504        self.start_time = std::option::Option::Some(v.into());
1505        self
1506    }
1507
1508    /// Sets or clears the value of [start_time][crate::model::MaintenanceSchedule::start_time].
1509    ///
1510    /// # Example
1511    /// ```ignore,no_run
1512    /// # use google_cloud_memcache_v1::model::MaintenanceSchedule;
1513    /// use wkt::Timestamp;
1514    /// let x = MaintenanceSchedule::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
1515    /// let x = MaintenanceSchedule::new().set_or_clear_start_time(None::<Timestamp>);
1516    /// ```
1517    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1518    where
1519        T: std::convert::Into<wkt::Timestamp>,
1520    {
1521        self.start_time = v.map(|x| x.into());
1522        self
1523    }
1524
1525    /// Sets the value of [end_time][crate::model::MaintenanceSchedule::end_time].
1526    ///
1527    /// # Example
1528    /// ```ignore,no_run
1529    /// # use google_cloud_memcache_v1::model::MaintenanceSchedule;
1530    /// use wkt::Timestamp;
1531    /// let x = MaintenanceSchedule::new().set_end_time(Timestamp::default()/* use setters */);
1532    /// ```
1533    pub fn set_end_time<T>(mut self, v: T) -> Self
1534    where
1535        T: std::convert::Into<wkt::Timestamp>,
1536    {
1537        self.end_time = std::option::Option::Some(v.into());
1538        self
1539    }
1540
1541    /// Sets or clears the value of [end_time][crate::model::MaintenanceSchedule::end_time].
1542    ///
1543    /// # Example
1544    /// ```ignore,no_run
1545    /// # use google_cloud_memcache_v1::model::MaintenanceSchedule;
1546    /// use wkt::Timestamp;
1547    /// let x = MaintenanceSchedule::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1548    /// let x = MaintenanceSchedule::new().set_or_clear_end_time(None::<Timestamp>);
1549    /// ```
1550    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1551    where
1552        T: std::convert::Into<wkt::Timestamp>,
1553    {
1554        self.end_time = v.map(|x| x.into());
1555        self
1556    }
1557
1558    /// Sets the value of [schedule_deadline_time][crate::model::MaintenanceSchedule::schedule_deadline_time].
1559    ///
1560    /// # Example
1561    /// ```ignore,no_run
1562    /// # use google_cloud_memcache_v1::model::MaintenanceSchedule;
1563    /// use wkt::Timestamp;
1564    /// let x = MaintenanceSchedule::new().set_schedule_deadline_time(Timestamp::default()/* use setters */);
1565    /// ```
1566    pub fn set_schedule_deadline_time<T>(mut self, v: T) -> Self
1567    where
1568        T: std::convert::Into<wkt::Timestamp>,
1569    {
1570        self.schedule_deadline_time = std::option::Option::Some(v.into());
1571        self
1572    }
1573
1574    /// Sets or clears the value of [schedule_deadline_time][crate::model::MaintenanceSchedule::schedule_deadline_time].
1575    ///
1576    /// # Example
1577    /// ```ignore,no_run
1578    /// # use google_cloud_memcache_v1::model::MaintenanceSchedule;
1579    /// use wkt::Timestamp;
1580    /// let x = MaintenanceSchedule::new().set_or_clear_schedule_deadline_time(Some(Timestamp::default()/* use setters */));
1581    /// let x = MaintenanceSchedule::new().set_or_clear_schedule_deadline_time(None::<Timestamp>);
1582    /// ```
1583    pub fn set_or_clear_schedule_deadline_time<T>(mut self, v: std::option::Option<T>) -> Self
1584    where
1585        T: std::convert::Into<wkt::Timestamp>,
1586    {
1587        self.schedule_deadline_time = v.map(|x| x.into());
1588        self
1589    }
1590}
1591
1592impl wkt::message::Message for MaintenanceSchedule {
1593    fn typename() -> &'static str {
1594        "type.googleapis.com/google.cloud.memcache.v1.MaintenanceSchedule"
1595    }
1596}
1597
1598/// Request for [RescheduleMaintenance][google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance].
1599///
1600/// [google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance]: crate::client::CloudMemcache::reschedule_maintenance
1601#[derive(Clone, Default, PartialEq)]
1602#[non_exhaustive]
1603pub struct RescheduleMaintenanceRequest {
1604    /// Required. Memcache instance resource name using the form:
1605    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
1606    /// where `location_id` refers to a GCP region.
1607    pub instance: std::string::String,
1608
1609    /// Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
1610    pub reschedule_type: crate::model::reschedule_maintenance_request::RescheduleType,
1611
1612    /// Timestamp when the maintenance shall be rescheduled to if
1613    /// reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
1614    /// example `2012-11-15T16:19:00.094Z`.
1615    pub schedule_time: std::option::Option<wkt::Timestamp>,
1616
1617    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1618}
1619
1620impl RescheduleMaintenanceRequest {
1621    pub fn new() -> Self {
1622        std::default::Default::default()
1623    }
1624
1625    /// Sets the value of [instance][crate::model::RescheduleMaintenanceRequest::instance].
1626    ///
1627    /// # Example
1628    /// ```ignore,no_run
1629    /// # use google_cloud_memcache_v1::model::RescheduleMaintenanceRequest;
1630    /// let x = RescheduleMaintenanceRequest::new().set_instance("example");
1631    /// ```
1632    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1633        self.instance = v.into();
1634        self
1635    }
1636
1637    /// Sets the value of [reschedule_type][crate::model::RescheduleMaintenanceRequest::reschedule_type].
1638    ///
1639    /// # Example
1640    /// ```ignore,no_run
1641    /// # use google_cloud_memcache_v1::model::RescheduleMaintenanceRequest;
1642    /// use google_cloud_memcache_v1::model::reschedule_maintenance_request::RescheduleType;
1643    /// let x0 = RescheduleMaintenanceRequest::new().set_reschedule_type(RescheduleType::Immediate);
1644    /// let x1 = RescheduleMaintenanceRequest::new().set_reschedule_type(RescheduleType::NextAvailableWindow);
1645    /// let x2 = RescheduleMaintenanceRequest::new().set_reschedule_type(RescheduleType::SpecificTime);
1646    /// ```
1647    pub fn set_reschedule_type<
1648        T: std::convert::Into<crate::model::reschedule_maintenance_request::RescheduleType>,
1649    >(
1650        mut self,
1651        v: T,
1652    ) -> Self {
1653        self.reschedule_type = v.into();
1654        self
1655    }
1656
1657    /// Sets the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
1658    ///
1659    /// # Example
1660    /// ```ignore,no_run
1661    /// # use google_cloud_memcache_v1::model::RescheduleMaintenanceRequest;
1662    /// use wkt::Timestamp;
1663    /// let x = RescheduleMaintenanceRequest::new().set_schedule_time(Timestamp::default()/* use setters */);
1664    /// ```
1665    pub fn set_schedule_time<T>(mut self, v: T) -> Self
1666    where
1667        T: std::convert::Into<wkt::Timestamp>,
1668    {
1669        self.schedule_time = std::option::Option::Some(v.into());
1670        self
1671    }
1672
1673    /// Sets or clears the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
1674    ///
1675    /// # Example
1676    /// ```ignore,no_run
1677    /// # use google_cloud_memcache_v1::model::RescheduleMaintenanceRequest;
1678    /// use wkt::Timestamp;
1679    /// let x = RescheduleMaintenanceRequest::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
1680    /// let x = RescheduleMaintenanceRequest::new().set_or_clear_schedule_time(None::<Timestamp>);
1681    /// ```
1682    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1683    where
1684        T: std::convert::Into<wkt::Timestamp>,
1685    {
1686        self.schedule_time = v.map(|x| x.into());
1687        self
1688    }
1689}
1690
1691impl wkt::message::Message for RescheduleMaintenanceRequest {
1692    fn typename() -> &'static str {
1693        "type.googleapis.com/google.cloud.memcache.v1.RescheduleMaintenanceRequest"
1694    }
1695}
1696
1697/// Defines additional types related to [RescheduleMaintenanceRequest].
1698pub mod reschedule_maintenance_request {
1699    #[allow(unused_imports)]
1700    use super::*;
1701
1702    /// Reschedule options.
1703    ///
1704    /// # Working with unknown values
1705    ///
1706    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1707    /// additional enum variants at any time. Adding new variants is not considered
1708    /// a breaking change. Applications should write their code in anticipation of:
1709    ///
1710    /// - New values appearing in future releases of the client library, **and**
1711    /// - New values received dynamically, without application changes.
1712    ///
1713    /// Please consult the [Working with enums] section in the user guide for some
1714    /// guidelines.
1715    ///
1716    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1717    #[derive(Clone, Debug, PartialEq)]
1718    #[non_exhaustive]
1719    pub enum RescheduleType {
1720        /// Not set.
1721        Unspecified,
1722        /// If the user wants to schedule the maintenance to happen now.
1723        Immediate,
1724        /// If the user wants to use the existing maintenance policy to find the
1725        /// next available window.
1726        NextAvailableWindow,
1727        /// If the user wants to reschedule the maintenance to a specific time.
1728        SpecificTime,
1729        /// If set, the enum was initialized with an unknown value.
1730        ///
1731        /// Applications can examine the value using [RescheduleType::value] or
1732        /// [RescheduleType::name].
1733        UnknownValue(reschedule_type::UnknownValue),
1734    }
1735
1736    #[doc(hidden)]
1737    pub mod reschedule_type {
1738        #[allow(unused_imports)]
1739        use super::*;
1740        #[derive(Clone, Debug, PartialEq)]
1741        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1742    }
1743
1744    impl RescheduleType {
1745        /// Gets the enum value.
1746        ///
1747        /// Returns `None` if the enum contains an unknown value deserialized from
1748        /// the string representation of enums.
1749        pub fn value(&self) -> std::option::Option<i32> {
1750            match self {
1751                Self::Unspecified => std::option::Option::Some(0),
1752                Self::Immediate => std::option::Option::Some(1),
1753                Self::NextAvailableWindow => std::option::Option::Some(2),
1754                Self::SpecificTime => std::option::Option::Some(3),
1755                Self::UnknownValue(u) => u.0.value(),
1756            }
1757        }
1758
1759        /// Gets the enum value as a string.
1760        ///
1761        /// Returns `None` if the enum contains an unknown value deserialized from
1762        /// the integer representation of enums.
1763        pub fn name(&self) -> std::option::Option<&str> {
1764            match self {
1765                Self::Unspecified => std::option::Option::Some("RESCHEDULE_TYPE_UNSPECIFIED"),
1766                Self::Immediate => std::option::Option::Some("IMMEDIATE"),
1767                Self::NextAvailableWindow => std::option::Option::Some("NEXT_AVAILABLE_WINDOW"),
1768                Self::SpecificTime => std::option::Option::Some("SPECIFIC_TIME"),
1769                Self::UnknownValue(u) => u.0.name(),
1770            }
1771        }
1772    }
1773
1774    impl std::default::Default for RescheduleType {
1775        fn default() -> Self {
1776            use std::convert::From;
1777            Self::from(0)
1778        }
1779    }
1780
1781    impl std::fmt::Display for RescheduleType {
1782        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1783            wkt::internal::display_enum(f, self.name(), self.value())
1784        }
1785    }
1786
1787    impl std::convert::From<i32> for RescheduleType {
1788        fn from(value: i32) -> Self {
1789            match value {
1790                0 => Self::Unspecified,
1791                1 => Self::Immediate,
1792                2 => Self::NextAvailableWindow,
1793                3 => Self::SpecificTime,
1794                _ => Self::UnknownValue(reschedule_type::UnknownValue(
1795                    wkt::internal::UnknownEnumValue::Integer(value),
1796                )),
1797            }
1798        }
1799    }
1800
1801    impl std::convert::From<&str> for RescheduleType {
1802        fn from(value: &str) -> Self {
1803            use std::string::ToString;
1804            match value {
1805                "RESCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
1806                "IMMEDIATE" => Self::Immediate,
1807                "NEXT_AVAILABLE_WINDOW" => Self::NextAvailableWindow,
1808                "SPECIFIC_TIME" => Self::SpecificTime,
1809                _ => Self::UnknownValue(reschedule_type::UnknownValue(
1810                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1811                )),
1812            }
1813        }
1814    }
1815
1816    impl serde::ser::Serialize for RescheduleType {
1817        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1818        where
1819            S: serde::Serializer,
1820        {
1821            match self {
1822                Self::Unspecified => serializer.serialize_i32(0),
1823                Self::Immediate => serializer.serialize_i32(1),
1824                Self::NextAvailableWindow => serializer.serialize_i32(2),
1825                Self::SpecificTime => serializer.serialize_i32(3),
1826                Self::UnknownValue(u) => u.0.serialize(serializer),
1827            }
1828        }
1829    }
1830
1831    impl<'de> serde::de::Deserialize<'de> for RescheduleType {
1832        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1833        where
1834            D: serde::Deserializer<'de>,
1835        {
1836            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RescheduleType>::new(
1837                ".google.cloud.memcache.v1.RescheduleMaintenanceRequest.RescheduleType",
1838            ))
1839        }
1840    }
1841}
1842
1843/// Request for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances].
1844///
1845/// [google.cloud.memcache.v1.CloudMemcache.ListInstances]: crate::client::CloudMemcache::list_instances
1846#[derive(Clone, Default, PartialEq)]
1847#[non_exhaustive]
1848pub struct ListInstancesRequest {
1849    /// Required. The resource name of the instance location using the form:
1850    /// `projects/{project_id}/locations/{location_id}`
1851    /// where `location_id` refers to a GCP region
1852    pub parent: std::string::String,
1853
1854    /// The maximum number of items to return.
1855    ///
1856    /// If not specified, a default value of 1000 will be used by the service.
1857    /// Regardless of the `page_size` value, the response may include a partial
1858    /// list and a caller should only rely on response's
1859    /// [`next_page_token`][google.cloud.memcache.v1.ListInstancesResponse.next_page_token]
1860    /// to determine if there are more instances left to be queried.
1861    ///
1862    /// [google.cloud.memcache.v1.ListInstancesResponse.next_page_token]: crate::model::ListInstancesResponse::next_page_token
1863    pub page_size: i32,
1864
1865    /// The `next_page_token` value returned from a previous List request, if any.
1866    pub page_token: std::string::String,
1867
1868    /// List filter. For example, exclude all Memcached instances with name as
1869    /// my-instance by specifying `"name != my-instance"`.
1870    pub filter: std::string::String,
1871
1872    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
1873    pub order_by: std::string::String,
1874
1875    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1876}
1877
1878impl ListInstancesRequest {
1879    pub fn new() -> Self {
1880        std::default::Default::default()
1881    }
1882
1883    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
1884    ///
1885    /// # Example
1886    /// ```ignore,no_run
1887    /// # use google_cloud_memcache_v1::model::ListInstancesRequest;
1888    /// let x = ListInstancesRequest::new().set_parent("example");
1889    /// ```
1890    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1891        self.parent = v.into();
1892        self
1893    }
1894
1895    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
1896    ///
1897    /// # Example
1898    /// ```ignore,no_run
1899    /// # use google_cloud_memcache_v1::model::ListInstancesRequest;
1900    /// let x = ListInstancesRequest::new().set_page_size(42);
1901    /// ```
1902    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1903        self.page_size = v.into();
1904        self
1905    }
1906
1907    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
1908    ///
1909    /// # Example
1910    /// ```ignore,no_run
1911    /// # use google_cloud_memcache_v1::model::ListInstancesRequest;
1912    /// let x = ListInstancesRequest::new().set_page_token("example");
1913    /// ```
1914    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1915        self.page_token = v.into();
1916        self
1917    }
1918
1919    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
1920    ///
1921    /// # Example
1922    /// ```ignore,no_run
1923    /// # use google_cloud_memcache_v1::model::ListInstancesRequest;
1924    /// let x = ListInstancesRequest::new().set_filter("example");
1925    /// ```
1926    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1927        self.filter = v.into();
1928        self
1929    }
1930
1931    /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
1932    ///
1933    /// # Example
1934    /// ```ignore,no_run
1935    /// # use google_cloud_memcache_v1::model::ListInstancesRequest;
1936    /// let x = ListInstancesRequest::new().set_order_by("example");
1937    /// ```
1938    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1939        self.order_by = v.into();
1940        self
1941    }
1942}
1943
1944impl wkt::message::Message for ListInstancesRequest {
1945    fn typename() -> &'static str {
1946        "type.googleapis.com/google.cloud.memcache.v1.ListInstancesRequest"
1947    }
1948}
1949
1950/// Response for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances].
1951///
1952/// [google.cloud.memcache.v1.CloudMemcache.ListInstances]: crate::client::CloudMemcache::list_instances
1953#[derive(Clone, Default, PartialEq)]
1954#[non_exhaustive]
1955pub struct ListInstancesResponse {
1956    /// A list of Memcached instances in the project in the specified location,
1957    /// or across all locations.
1958    ///
1959    /// If the `location_id` in the parent field of the request is "-", all regions
1960    /// available to the project are queried, and the results aggregated.
1961    pub instances: std::vec::Vec<crate::model::Instance>,
1962
1963    /// Token to retrieve the next page of results, or empty if there are no more
1964    /// results in the list.
1965    pub next_page_token: std::string::String,
1966
1967    /// Locations that could not be reached.
1968    pub unreachable: std::vec::Vec<std::string::String>,
1969
1970    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1971}
1972
1973impl ListInstancesResponse {
1974    pub fn new() -> Self {
1975        std::default::Default::default()
1976    }
1977
1978    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
1979    ///
1980    /// # Example
1981    /// ```ignore,no_run
1982    /// # use google_cloud_memcache_v1::model::ListInstancesResponse;
1983    /// use google_cloud_memcache_v1::model::Instance;
1984    /// let x = ListInstancesResponse::new()
1985    ///     .set_instances([
1986    ///         Instance::default()/* use setters */,
1987    ///         Instance::default()/* use (different) setters */,
1988    ///     ]);
1989    /// ```
1990    pub fn set_instances<T, V>(mut self, v: T) -> Self
1991    where
1992        T: std::iter::IntoIterator<Item = V>,
1993        V: std::convert::Into<crate::model::Instance>,
1994    {
1995        use std::iter::Iterator;
1996        self.instances = v.into_iter().map(|i| i.into()).collect();
1997        self
1998    }
1999
2000    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
2001    ///
2002    /// # Example
2003    /// ```ignore,no_run
2004    /// # use google_cloud_memcache_v1::model::ListInstancesResponse;
2005    /// let x = ListInstancesResponse::new().set_next_page_token("example");
2006    /// ```
2007    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2008        self.next_page_token = v.into();
2009        self
2010    }
2011
2012    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
2013    ///
2014    /// # Example
2015    /// ```ignore,no_run
2016    /// # use google_cloud_memcache_v1::model::ListInstancesResponse;
2017    /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
2018    /// ```
2019    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2020    where
2021        T: std::iter::IntoIterator<Item = V>,
2022        V: std::convert::Into<std::string::String>,
2023    {
2024        use std::iter::Iterator;
2025        self.unreachable = v.into_iter().map(|i| i.into()).collect();
2026        self
2027    }
2028}
2029
2030impl wkt::message::Message for ListInstancesResponse {
2031    fn typename() -> &'static str {
2032        "type.googleapis.com/google.cloud.memcache.v1.ListInstancesResponse"
2033    }
2034}
2035
2036#[doc(hidden)]
2037impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
2038    type PageItem = crate::model::Instance;
2039
2040    fn items(self) -> std::vec::Vec<Self::PageItem> {
2041        self.instances
2042    }
2043
2044    fn next_page_token(&self) -> std::string::String {
2045        use std::clone::Clone;
2046        self.next_page_token.clone()
2047    }
2048}
2049
2050/// Request for [GetInstance][google.cloud.memcache.v1.CloudMemcache.GetInstance].
2051///
2052/// [google.cloud.memcache.v1.CloudMemcache.GetInstance]: crate::client::CloudMemcache::get_instance
2053#[derive(Clone, Default, PartialEq)]
2054#[non_exhaustive]
2055pub struct GetInstanceRequest {
2056    /// Required. Memcached instance resource name in the format:
2057    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
2058    /// where `location_id` refers to a GCP region
2059    pub name: std::string::String,
2060
2061    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2062}
2063
2064impl GetInstanceRequest {
2065    pub fn new() -> Self {
2066        std::default::Default::default()
2067    }
2068
2069    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
2070    ///
2071    /// # Example
2072    /// ```ignore,no_run
2073    /// # use google_cloud_memcache_v1::model::GetInstanceRequest;
2074    /// let x = GetInstanceRequest::new().set_name("example");
2075    /// ```
2076    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2077        self.name = v.into();
2078        self
2079    }
2080}
2081
2082impl wkt::message::Message for GetInstanceRequest {
2083    fn typename() -> &'static str {
2084        "type.googleapis.com/google.cloud.memcache.v1.GetInstanceRequest"
2085    }
2086}
2087
2088/// Request for [CreateInstance][google.cloud.memcache.v1.CloudMemcache.CreateInstance].
2089///
2090/// [google.cloud.memcache.v1.CloudMemcache.CreateInstance]: crate::client::CloudMemcache::create_instance
2091#[derive(Clone, Default, PartialEq)]
2092#[non_exhaustive]
2093pub struct CreateInstanceRequest {
2094    /// Required. The resource name of the instance location using the form:
2095    /// `projects/{project_id}/locations/{location_id}`
2096    /// where `location_id` refers to a GCP region
2097    pub parent: std::string::String,
2098
2099    /// Required. The logical name of the Memcached instance in the user
2100    /// project with the following restrictions:
2101    ///
2102    /// * Must contain only lowercase letters, numbers, and hyphens.
2103    /// * Must start with a letter.
2104    /// * Must be between 1-40 characters.
2105    /// * Must end with a number or a letter.
2106    /// * Must be unique within the user project / location.
2107    ///
2108    /// If any of the above are not met, the API raises an invalid argument error.
2109    pub instance_id: std::string::String,
2110
2111    /// Required. A Memcached Instance
2112    pub instance: std::option::Option<crate::model::Instance>,
2113
2114    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2115}
2116
2117impl CreateInstanceRequest {
2118    pub fn new() -> Self {
2119        std::default::Default::default()
2120    }
2121
2122    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
2123    ///
2124    /// # Example
2125    /// ```ignore,no_run
2126    /// # use google_cloud_memcache_v1::model::CreateInstanceRequest;
2127    /// let x = CreateInstanceRequest::new().set_parent("example");
2128    /// ```
2129    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2130        self.parent = v.into();
2131        self
2132    }
2133
2134    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
2135    ///
2136    /// # Example
2137    /// ```ignore,no_run
2138    /// # use google_cloud_memcache_v1::model::CreateInstanceRequest;
2139    /// let x = CreateInstanceRequest::new().set_instance_id("example");
2140    /// ```
2141    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2142        self.instance_id = v.into();
2143        self
2144    }
2145
2146    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
2147    ///
2148    /// # Example
2149    /// ```ignore,no_run
2150    /// # use google_cloud_memcache_v1::model::CreateInstanceRequest;
2151    /// use google_cloud_memcache_v1::model::Instance;
2152    /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
2153    /// ```
2154    pub fn set_instance<T>(mut self, v: T) -> Self
2155    where
2156        T: std::convert::Into<crate::model::Instance>,
2157    {
2158        self.instance = std::option::Option::Some(v.into());
2159        self
2160    }
2161
2162    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
2163    ///
2164    /// # Example
2165    /// ```ignore,no_run
2166    /// # use google_cloud_memcache_v1::model::CreateInstanceRequest;
2167    /// use google_cloud_memcache_v1::model::Instance;
2168    /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
2169    /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
2170    /// ```
2171    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
2172    where
2173        T: std::convert::Into<crate::model::Instance>,
2174    {
2175        self.instance = v.map(|x| x.into());
2176        self
2177    }
2178}
2179
2180impl wkt::message::Message for CreateInstanceRequest {
2181    fn typename() -> &'static str {
2182        "type.googleapis.com/google.cloud.memcache.v1.CreateInstanceRequest"
2183    }
2184}
2185
2186/// Request for [UpdateInstance][google.cloud.memcache.v1.CloudMemcache.UpdateInstance].
2187///
2188/// [google.cloud.memcache.v1.CloudMemcache.UpdateInstance]: crate::client::CloudMemcache::update_instance
2189#[derive(Clone, Default, PartialEq)]
2190#[non_exhaustive]
2191pub struct UpdateInstanceRequest {
2192    /// Required. Mask of fields to update.
2193    ///
2194    /// * `displayName`
2195    pub update_mask: std::option::Option<wkt::FieldMask>,
2196
2197    /// Required. A Memcached Instance.
2198    /// Only fields specified in update_mask are updated.
2199    pub instance: std::option::Option<crate::model::Instance>,
2200
2201    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2202}
2203
2204impl UpdateInstanceRequest {
2205    pub fn new() -> Self {
2206        std::default::Default::default()
2207    }
2208
2209    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
2210    ///
2211    /// # Example
2212    /// ```ignore,no_run
2213    /// # use google_cloud_memcache_v1::model::UpdateInstanceRequest;
2214    /// use wkt::FieldMask;
2215    /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2216    /// ```
2217    pub fn set_update_mask<T>(mut self, v: T) -> Self
2218    where
2219        T: std::convert::Into<wkt::FieldMask>,
2220    {
2221        self.update_mask = std::option::Option::Some(v.into());
2222        self
2223    }
2224
2225    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
2226    ///
2227    /// # Example
2228    /// ```ignore,no_run
2229    /// # use google_cloud_memcache_v1::model::UpdateInstanceRequest;
2230    /// use wkt::FieldMask;
2231    /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2232    /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2233    /// ```
2234    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2235    where
2236        T: std::convert::Into<wkt::FieldMask>,
2237    {
2238        self.update_mask = v.map(|x| x.into());
2239        self
2240    }
2241
2242    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
2243    ///
2244    /// # Example
2245    /// ```ignore,no_run
2246    /// # use google_cloud_memcache_v1::model::UpdateInstanceRequest;
2247    /// use google_cloud_memcache_v1::model::Instance;
2248    /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
2249    /// ```
2250    pub fn set_instance<T>(mut self, v: T) -> Self
2251    where
2252        T: std::convert::Into<crate::model::Instance>,
2253    {
2254        self.instance = std::option::Option::Some(v.into());
2255        self
2256    }
2257
2258    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
2259    ///
2260    /// # Example
2261    /// ```ignore,no_run
2262    /// # use google_cloud_memcache_v1::model::UpdateInstanceRequest;
2263    /// use google_cloud_memcache_v1::model::Instance;
2264    /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
2265    /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
2266    /// ```
2267    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
2268    where
2269        T: std::convert::Into<crate::model::Instance>,
2270    {
2271        self.instance = v.map(|x| x.into());
2272        self
2273    }
2274}
2275
2276impl wkt::message::Message for UpdateInstanceRequest {
2277    fn typename() -> &'static str {
2278        "type.googleapis.com/google.cloud.memcache.v1.UpdateInstanceRequest"
2279    }
2280}
2281
2282/// Request for [DeleteInstance][google.cloud.memcache.v1.CloudMemcache.DeleteInstance].
2283///
2284/// [google.cloud.memcache.v1.CloudMemcache.DeleteInstance]: crate::client::CloudMemcache::delete_instance
2285#[derive(Clone, Default, PartialEq)]
2286#[non_exhaustive]
2287pub struct DeleteInstanceRequest {
2288    /// Required. Memcached instance resource name in the format:
2289    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
2290    /// where `location_id` refers to a GCP region
2291    pub name: std::string::String,
2292
2293    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2294}
2295
2296impl DeleteInstanceRequest {
2297    pub fn new() -> Self {
2298        std::default::Default::default()
2299    }
2300
2301    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
2302    ///
2303    /// # Example
2304    /// ```ignore,no_run
2305    /// # use google_cloud_memcache_v1::model::DeleteInstanceRequest;
2306    /// let x = DeleteInstanceRequest::new().set_name("example");
2307    /// ```
2308    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2309        self.name = v.into();
2310        self
2311    }
2312}
2313
2314impl wkt::message::Message for DeleteInstanceRequest {
2315    fn typename() -> &'static str {
2316        "type.googleapis.com/google.cloud.memcache.v1.DeleteInstanceRequest"
2317    }
2318}
2319
2320/// Request for [ApplyParameters][google.cloud.memcache.v1.CloudMemcache.ApplyParameters].
2321///
2322/// [google.cloud.memcache.v1.CloudMemcache.ApplyParameters]: crate::client::CloudMemcache::apply_parameters
2323#[derive(Clone, Default, PartialEq)]
2324#[non_exhaustive]
2325pub struct ApplyParametersRequest {
2326    /// Required. Resource name of the Memcached instance for which parameter group updates
2327    /// should be applied.
2328    pub name: std::string::String,
2329
2330    /// Nodes to which the instance-level parameter group is applied.
2331    pub node_ids: std::vec::Vec<std::string::String>,
2332
2333    /// Whether to apply instance-level parameter group to all nodes. If set to
2334    /// true, users are restricted from specifying individual nodes, and
2335    /// `ApplyParameters` updates all nodes within the instance.
2336    pub apply_all: bool,
2337
2338    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2339}
2340
2341impl ApplyParametersRequest {
2342    pub fn new() -> Self {
2343        std::default::Default::default()
2344    }
2345
2346    /// Sets the value of [name][crate::model::ApplyParametersRequest::name].
2347    ///
2348    /// # Example
2349    /// ```ignore,no_run
2350    /// # use google_cloud_memcache_v1::model::ApplyParametersRequest;
2351    /// let x = ApplyParametersRequest::new().set_name("example");
2352    /// ```
2353    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2354        self.name = v.into();
2355        self
2356    }
2357
2358    /// Sets the value of [node_ids][crate::model::ApplyParametersRequest::node_ids].
2359    ///
2360    /// # Example
2361    /// ```ignore,no_run
2362    /// # use google_cloud_memcache_v1::model::ApplyParametersRequest;
2363    /// let x = ApplyParametersRequest::new().set_node_ids(["a", "b", "c"]);
2364    /// ```
2365    pub fn set_node_ids<T, V>(mut self, v: T) -> Self
2366    where
2367        T: std::iter::IntoIterator<Item = V>,
2368        V: std::convert::Into<std::string::String>,
2369    {
2370        use std::iter::Iterator;
2371        self.node_ids = v.into_iter().map(|i| i.into()).collect();
2372        self
2373    }
2374
2375    /// Sets the value of [apply_all][crate::model::ApplyParametersRequest::apply_all].
2376    ///
2377    /// # Example
2378    /// ```ignore,no_run
2379    /// # use google_cloud_memcache_v1::model::ApplyParametersRequest;
2380    /// let x = ApplyParametersRequest::new().set_apply_all(true);
2381    /// ```
2382    pub fn set_apply_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2383        self.apply_all = v.into();
2384        self
2385    }
2386}
2387
2388impl wkt::message::Message for ApplyParametersRequest {
2389    fn typename() -> &'static str {
2390        "type.googleapis.com/google.cloud.memcache.v1.ApplyParametersRequest"
2391    }
2392}
2393
2394/// Request for [UpdateParameters][google.cloud.memcache.v1.CloudMemcache.UpdateParameters].
2395///
2396/// [google.cloud.memcache.v1.CloudMemcache.UpdateParameters]: crate::client::CloudMemcache::update_parameters
2397#[derive(Clone, Default, PartialEq)]
2398#[non_exhaustive]
2399pub struct UpdateParametersRequest {
2400    /// Required. Resource name of the Memcached instance for which the parameters should be
2401    /// updated.
2402    pub name: std::string::String,
2403
2404    /// Required. Mask of fields to update.
2405    pub update_mask: std::option::Option<wkt::FieldMask>,
2406
2407    /// The parameters to apply to the instance.
2408    pub parameters: std::option::Option<crate::model::MemcacheParameters>,
2409
2410    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2411}
2412
2413impl UpdateParametersRequest {
2414    pub fn new() -> Self {
2415        std::default::Default::default()
2416    }
2417
2418    /// Sets the value of [name][crate::model::UpdateParametersRequest::name].
2419    ///
2420    /// # Example
2421    /// ```ignore,no_run
2422    /// # use google_cloud_memcache_v1::model::UpdateParametersRequest;
2423    /// let x = UpdateParametersRequest::new().set_name("example");
2424    /// ```
2425    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2426        self.name = v.into();
2427        self
2428    }
2429
2430    /// Sets the value of [update_mask][crate::model::UpdateParametersRequest::update_mask].
2431    ///
2432    /// # Example
2433    /// ```ignore,no_run
2434    /// # use google_cloud_memcache_v1::model::UpdateParametersRequest;
2435    /// use wkt::FieldMask;
2436    /// let x = UpdateParametersRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2437    /// ```
2438    pub fn set_update_mask<T>(mut self, v: T) -> Self
2439    where
2440        T: std::convert::Into<wkt::FieldMask>,
2441    {
2442        self.update_mask = std::option::Option::Some(v.into());
2443        self
2444    }
2445
2446    /// Sets or clears the value of [update_mask][crate::model::UpdateParametersRequest::update_mask].
2447    ///
2448    /// # Example
2449    /// ```ignore,no_run
2450    /// # use google_cloud_memcache_v1::model::UpdateParametersRequest;
2451    /// use wkt::FieldMask;
2452    /// let x = UpdateParametersRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2453    /// let x = UpdateParametersRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2454    /// ```
2455    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2456    where
2457        T: std::convert::Into<wkt::FieldMask>,
2458    {
2459        self.update_mask = v.map(|x| x.into());
2460        self
2461    }
2462
2463    /// Sets the value of [parameters][crate::model::UpdateParametersRequest::parameters].
2464    ///
2465    /// # Example
2466    /// ```ignore,no_run
2467    /// # use google_cloud_memcache_v1::model::UpdateParametersRequest;
2468    /// use google_cloud_memcache_v1::model::MemcacheParameters;
2469    /// let x = UpdateParametersRequest::new().set_parameters(MemcacheParameters::default()/* use setters */);
2470    /// ```
2471    pub fn set_parameters<T>(mut self, v: T) -> Self
2472    where
2473        T: std::convert::Into<crate::model::MemcacheParameters>,
2474    {
2475        self.parameters = std::option::Option::Some(v.into());
2476        self
2477    }
2478
2479    /// Sets or clears the value of [parameters][crate::model::UpdateParametersRequest::parameters].
2480    ///
2481    /// # Example
2482    /// ```ignore,no_run
2483    /// # use google_cloud_memcache_v1::model::UpdateParametersRequest;
2484    /// use google_cloud_memcache_v1::model::MemcacheParameters;
2485    /// let x = UpdateParametersRequest::new().set_or_clear_parameters(Some(MemcacheParameters::default()/* use setters */));
2486    /// let x = UpdateParametersRequest::new().set_or_clear_parameters(None::<MemcacheParameters>);
2487    /// ```
2488    pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
2489    where
2490        T: std::convert::Into<crate::model::MemcacheParameters>,
2491    {
2492        self.parameters = v.map(|x| x.into());
2493        self
2494    }
2495}
2496
2497impl wkt::message::Message for UpdateParametersRequest {
2498    fn typename() -> &'static str {
2499        "type.googleapis.com/google.cloud.memcache.v1.UpdateParametersRequest"
2500    }
2501}
2502
2503#[derive(Clone, Default, PartialEq)]
2504#[non_exhaustive]
2505pub struct MemcacheParameters {
2506    /// Output only. The unique ID associated with this set of parameters. Users
2507    /// can use this id to determine if the parameters associated with the instance
2508    /// differ from the parameters associated with the nodes. A discrepancy between
2509    /// parameter ids can inform users that they may need to take action to apply
2510    /// parameters on nodes.
2511    pub id: std::string::String,
2512
2513    /// User defined set of parameters to use in the memcached process.
2514    pub params: std::collections::HashMap<std::string::String, std::string::String>,
2515
2516    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2517}
2518
2519impl MemcacheParameters {
2520    pub fn new() -> Self {
2521        std::default::Default::default()
2522    }
2523
2524    /// Sets the value of [id][crate::model::MemcacheParameters::id].
2525    ///
2526    /// # Example
2527    /// ```ignore,no_run
2528    /// # use google_cloud_memcache_v1::model::MemcacheParameters;
2529    /// let x = MemcacheParameters::new().set_id("example");
2530    /// ```
2531    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2532        self.id = v.into();
2533        self
2534    }
2535
2536    /// Sets the value of [params][crate::model::MemcacheParameters::params].
2537    ///
2538    /// # Example
2539    /// ```ignore,no_run
2540    /// # use google_cloud_memcache_v1::model::MemcacheParameters;
2541    /// let x = MemcacheParameters::new().set_params([
2542    ///     ("key0", "abc"),
2543    ///     ("key1", "xyz"),
2544    /// ]);
2545    /// ```
2546    pub fn set_params<T, K, V>(mut self, v: T) -> Self
2547    where
2548        T: std::iter::IntoIterator<Item = (K, V)>,
2549        K: std::convert::Into<std::string::String>,
2550        V: std::convert::Into<std::string::String>,
2551    {
2552        use std::iter::Iterator;
2553        self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2554        self
2555    }
2556}
2557
2558impl wkt::message::Message for MemcacheParameters {
2559    fn typename() -> &'static str {
2560        "type.googleapis.com/google.cloud.memcache.v1.MemcacheParameters"
2561    }
2562}
2563
2564/// Represents the metadata of a long-running operation.
2565#[derive(Clone, Default, PartialEq)]
2566#[non_exhaustive]
2567pub struct OperationMetadata {
2568    /// Output only. Time when the operation was created.
2569    pub create_time: std::option::Option<wkt::Timestamp>,
2570
2571    /// Output only. Time when the operation finished running.
2572    pub end_time: std::option::Option<wkt::Timestamp>,
2573
2574    /// Output only. Server-defined resource path for the target of the operation.
2575    pub target: std::string::String,
2576
2577    /// Output only. Name of the verb executed by the operation.
2578    pub verb: std::string::String,
2579
2580    /// Output only. Human-readable status of the operation, if any.
2581    pub status_detail: std::string::String,
2582
2583    /// Output only. Identifies whether the user has requested cancellation
2584    /// of the operation. Operations that have successfully been cancelled
2585    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
2586    /// corresponding to `Code.CANCELLED`.
2587    ///
2588    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
2589    pub cancel_requested: bool,
2590
2591    /// Output only. API version used to start the operation.
2592    pub api_version: std::string::String,
2593
2594    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2595}
2596
2597impl OperationMetadata {
2598    pub fn new() -> Self {
2599        std::default::Default::default()
2600    }
2601
2602    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
2603    ///
2604    /// # Example
2605    /// ```ignore,no_run
2606    /// # use google_cloud_memcache_v1::model::OperationMetadata;
2607    /// use wkt::Timestamp;
2608    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
2609    /// ```
2610    pub fn set_create_time<T>(mut self, v: T) -> Self
2611    where
2612        T: std::convert::Into<wkt::Timestamp>,
2613    {
2614        self.create_time = std::option::Option::Some(v.into());
2615        self
2616    }
2617
2618    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
2619    ///
2620    /// # Example
2621    /// ```ignore,no_run
2622    /// # use google_cloud_memcache_v1::model::OperationMetadata;
2623    /// use wkt::Timestamp;
2624    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2625    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
2626    /// ```
2627    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2628    where
2629        T: std::convert::Into<wkt::Timestamp>,
2630    {
2631        self.create_time = v.map(|x| x.into());
2632        self
2633    }
2634
2635    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
2636    ///
2637    /// # Example
2638    /// ```ignore,no_run
2639    /// # use google_cloud_memcache_v1::model::OperationMetadata;
2640    /// use wkt::Timestamp;
2641    /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
2642    /// ```
2643    pub fn set_end_time<T>(mut self, v: T) -> Self
2644    where
2645        T: std::convert::Into<wkt::Timestamp>,
2646    {
2647        self.end_time = std::option::Option::Some(v.into());
2648        self
2649    }
2650
2651    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
2652    ///
2653    /// # Example
2654    /// ```ignore,no_run
2655    /// # use google_cloud_memcache_v1::model::OperationMetadata;
2656    /// use wkt::Timestamp;
2657    /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
2658    /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
2659    /// ```
2660    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2661    where
2662        T: std::convert::Into<wkt::Timestamp>,
2663    {
2664        self.end_time = v.map(|x| x.into());
2665        self
2666    }
2667
2668    /// Sets the value of [target][crate::model::OperationMetadata::target].
2669    ///
2670    /// # Example
2671    /// ```ignore,no_run
2672    /// # use google_cloud_memcache_v1::model::OperationMetadata;
2673    /// let x = OperationMetadata::new().set_target("example");
2674    /// ```
2675    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2676        self.target = v.into();
2677        self
2678    }
2679
2680    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
2681    ///
2682    /// # Example
2683    /// ```ignore,no_run
2684    /// # use google_cloud_memcache_v1::model::OperationMetadata;
2685    /// let x = OperationMetadata::new().set_verb("example");
2686    /// ```
2687    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2688        self.verb = v.into();
2689        self
2690    }
2691
2692    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
2693    ///
2694    /// # Example
2695    /// ```ignore,no_run
2696    /// # use google_cloud_memcache_v1::model::OperationMetadata;
2697    /// let x = OperationMetadata::new().set_status_detail("example");
2698    /// ```
2699    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2700        self.status_detail = v.into();
2701        self
2702    }
2703
2704    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
2705    ///
2706    /// # Example
2707    /// ```ignore,no_run
2708    /// # use google_cloud_memcache_v1::model::OperationMetadata;
2709    /// let x = OperationMetadata::new().set_cancel_requested(true);
2710    /// ```
2711    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2712        self.cancel_requested = v.into();
2713        self
2714    }
2715
2716    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
2717    ///
2718    /// # Example
2719    /// ```ignore,no_run
2720    /// # use google_cloud_memcache_v1::model::OperationMetadata;
2721    /// let x = OperationMetadata::new().set_api_version("example");
2722    /// ```
2723    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2724        self.api_version = v.into();
2725        self
2726    }
2727}
2728
2729impl wkt::message::Message for OperationMetadata {
2730    fn typename() -> &'static str {
2731        "type.googleapis.com/google.cloud.memcache.v1.OperationMetadata"
2732    }
2733}
2734
2735/// Metadata for the given [google.cloud.location.Location][google.cloud.location.Location].
2736///
2737/// [google.cloud.location.Location]: google_cloud_location::model::Location
2738#[derive(Clone, Default, PartialEq)]
2739#[non_exhaustive]
2740pub struct LocationMetadata {
2741    /// Output only. The set of available zones in the location. The map is keyed
2742    /// by the lowercase ID of each zone, as defined by GCE. These keys can be
2743    /// specified in the `zones` field when creating a Memcached instance.
2744    pub available_zones: std::collections::HashMap<std::string::String, crate::model::ZoneMetadata>,
2745
2746    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2747}
2748
2749impl LocationMetadata {
2750    pub fn new() -> Self {
2751        std::default::Default::default()
2752    }
2753
2754    /// Sets the value of [available_zones][crate::model::LocationMetadata::available_zones].
2755    ///
2756    /// # Example
2757    /// ```ignore,no_run
2758    /// # use google_cloud_memcache_v1::model::LocationMetadata;
2759    /// use google_cloud_memcache_v1::model::ZoneMetadata;
2760    /// let x = LocationMetadata::new().set_available_zones([
2761    ///     ("key0", ZoneMetadata::default()/* use setters */),
2762    ///     ("key1", ZoneMetadata::default()/* use (different) setters */),
2763    /// ]);
2764    /// ```
2765    pub fn set_available_zones<T, K, V>(mut self, v: T) -> Self
2766    where
2767        T: std::iter::IntoIterator<Item = (K, V)>,
2768        K: std::convert::Into<std::string::String>,
2769        V: std::convert::Into<crate::model::ZoneMetadata>,
2770    {
2771        use std::iter::Iterator;
2772        self.available_zones = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2773        self
2774    }
2775}
2776
2777impl wkt::message::Message for LocationMetadata {
2778    fn typename() -> &'static str {
2779        "type.googleapis.com/google.cloud.memcache.v1.LocationMetadata"
2780    }
2781}
2782
2783#[derive(Clone, Default, PartialEq)]
2784#[non_exhaustive]
2785pub struct ZoneMetadata {
2786    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2787}
2788
2789impl ZoneMetadata {
2790    pub fn new() -> Self {
2791        std::default::Default::default()
2792    }
2793}
2794
2795impl wkt::message::Message for ZoneMetadata {
2796    fn typename() -> &'static str {
2797        "type.googleapis.com/google.cloud.memcache.v1.ZoneMetadata"
2798    }
2799}
2800
2801/// Memcached versions supported by our service.
2802///
2803/// # Working with unknown values
2804///
2805/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2806/// additional enum variants at any time. Adding new variants is not considered
2807/// a breaking change. Applications should write their code in anticipation of:
2808///
2809/// - New values appearing in future releases of the client library, **and**
2810/// - New values received dynamically, without application changes.
2811///
2812/// Please consult the [Working with enums] section in the user guide for some
2813/// guidelines.
2814///
2815/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2816#[derive(Clone, Debug, PartialEq)]
2817#[non_exhaustive]
2818pub enum MemcacheVersion {
2819    Unspecified,
2820    /// Memcached 1.5 version.
2821    Memcache15,
2822    /// If set, the enum was initialized with an unknown value.
2823    ///
2824    /// Applications can examine the value using [MemcacheVersion::value] or
2825    /// [MemcacheVersion::name].
2826    UnknownValue(memcache_version::UnknownValue),
2827}
2828
2829#[doc(hidden)]
2830pub mod memcache_version {
2831    #[allow(unused_imports)]
2832    use super::*;
2833    #[derive(Clone, Debug, PartialEq)]
2834    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2835}
2836
2837impl MemcacheVersion {
2838    /// Gets the enum value.
2839    ///
2840    /// Returns `None` if the enum contains an unknown value deserialized from
2841    /// the string representation of enums.
2842    pub fn value(&self) -> std::option::Option<i32> {
2843        match self {
2844            Self::Unspecified => std::option::Option::Some(0),
2845            Self::Memcache15 => std::option::Option::Some(1),
2846            Self::UnknownValue(u) => u.0.value(),
2847        }
2848    }
2849
2850    /// Gets the enum value as a string.
2851    ///
2852    /// Returns `None` if the enum contains an unknown value deserialized from
2853    /// the integer representation of enums.
2854    pub fn name(&self) -> std::option::Option<&str> {
2855        match self {
2856            Self::Unspecified => std::option::Option::Some("MEMCACHE_VERSION_UNSPECIFIED"),
2857            Self::Memcache15 => std::option::Option::Some("MEMCACHE_1_5"),
2858            Self::UnknownValue(u) => u.0.name(),
2859        }
2860    }
2861}
2862
2863impl std::default::Default for MemcacheVersion {
2864    fn default() -> Self {
2865        use std::convert::From;
2866        Self::from(0)
2867    }
2868}
2869
2870impl std::fmt::Display for MemcacheVersion {
2871    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2872        wkt::internal::display_enum(f, self.name(), self.value())
2873    }
2874}
2875
2876impl std::convert::From<i32> for MemcacheVersion {
2877    fn from(value: i32) -> Self {
2878        match value {
2879            0 => Self::Unspecified,
2880            1 => Self::Memcache15,
2881            _ => Self::UnknownValue(memcache_version::UnknownValue(
2882                wkt::internal::UnknownEnumValue::Integer(value),
2883            )),
2884        }
2885    }
2886}
2887
2888impl std::convert::From<&str> for MemcacheVersion {
2889    fn from(value: &str) -> Self {
2890        use std::string::ToString;
2891        match value {
2892            "MEMCACHE_VERSION_UNSPECIFIED" => Self::Unspecified,
2893            "MEMCACHE_1_5" => Self::Memcache15,
2894            _ => Self::UnknownValue(memcache_version::UnknownValue(
2895                wkt::internal::UnknownEnumValue::String(value.to_string()),
2896            )),
2897        }
2898    }
2899}
2900
2901impl serde::ser::Serialize for MemcacheVersion {
2902    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2903    where
2904        S: serde::Serializer,
2905    {
2906        match self {
2907            Self::Unspecified => serializer.serialize_i32(0),
2908            Self::Memcache15 => serializer.serialize_i32(1),
2909            Self::UnknownValue(u) => u.0.serialize(serializer),
2910        }
2911    }
2912}
2913
2914impl<'de> serde::de::Deserialize<'de> for MemcacheVersion {
2915    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2916    where
2917        D: serde::Deserializer<'de>,
2918    {
2919        deserializer.deserialize_any(wkt::internal::EnumVisitor::<MemcacheVersion>::new(
2920            ".google.cloud.memcache.v1.MemcacheVersion",
2921        ))
2922    }
2923}