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