google_cloud_memcache_v1/
model.rs

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