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