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