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