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