google_cloud_spanner_admin_instance_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 iam_v1;
25extern crate lazy_static;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Encapsulates progress related information for a Cloud Spanner long
41/// running instance operations.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct OperationProgress {
45 /// Percent completion of the operation.
46 /// Values are between 0 and 100 inclusive.
47 pub progress_percent: i32,
48
49 /// Time the request was received.
50 pub start_time: std::option::Option<wkt::Timestamp>,
51
52 /// If set, the time at which this operation failed or was completed
53 /// successfully.
54 pub end_time: std::option::Option<wkt::Timestamp>,
55
56 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
57}
58
59impl OperationProgress {
60 pub fn new() -> Self {
61 std::default::Default::default()
62 }
63
64 /// Sets the value of [progress_percent][crate::model::OperationProgress::progress_percent].
65 ///
66 /// # Example
67 /// ```ignore,no_run
68 /// # use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
69 /// let x = OperationProgress::new().set_progress_percent(42);
70 /// ```
71 pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
72 self.progress_percent = v.into();
73 self
74 }
75
76 /// Sets the value of [start_time][crate::model::OperationProgress::start_time].
77 ///
78 /// # Example
79 /// ```ignore,no_run
80 /// # use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
81 /// use wkt::Timestamp;
82 /// let x = OperationProgress::new().set_start_time(Timestamp::default()/* use setters */);
83 /// ```
84 pub fn set_start_time<T>(mut self, v: T) -> Self
85 where
86 T: std::convert::Into<wkt::Timestamp>,
87 {
88 self.start_time = std::option::Option::Some(v.into());
89 self
90 }
91
92 /// Sets or clears the value of [start_time][crate::model::OperationProgress::start_time].
93 ///
94 /// # Example
95 /// ```ignore,no_run
96 /// # use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
97 /// use wkt::Timestamp;
98 /// let x = OperationProgress::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
99 /// let x = OperationProgress::new().set_or_clear_start_time(None::<Timestamp>);
100 /// ```
101 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
102 where
103 T: std::convert::Into<wkt::Timestamp>,
104 {
105 self.start_time = v.map(|x| x.into());
106 self
107 }
108
109 /// Sets the value of [end_time][crate::model::OperationProgress::end_time].
110 ///
111 /// # Example
112 /// ```ignore,no_run
113 /// # use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
114 /// use wkt::Timestamp;
115 /// let x = OperationProgress::new().set_end_time(Timestamp::default()/* use setters */);
116 /// ```
117 pub fn set_end_time<T>(mut self, v: T) -> Self
118 where
119 T: std::convert::Into<wkt::Timestamp>,
120 {
121 self.end_time = std::option::Option::Some(v.into());
122 self
123 }
124
125 /// Sets or clears the value of [end_time][crate::model::OperationProgress::end_time].
126 ///
127 /// # Example
128 /// ```ignore,no_run
129 /// # use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
130 /// use wkt::Timestamp;
131 /// let x = OperationProgress::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
132 /// let x = OperationProgress::new().set_or_clear_end_time(None::<Timestamp>);
133 /// ```
134 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
135 where
136 T: std::convert::Into<wkt::Timestamp>,
137 {
138 self.end_time = v.map(|x| x.into());
139 self
140 }
141}
142
143impl wkt::message::Message for OperationProgress {
144 fn typename() -> &'static str {
145 "type.googleapis.com/google.spanner.admin.instance.v1.OperationProgress"
146 }
147}
148
149/// ReplicaSelection identifies replicas with common properties.
150#[derive(Clone, Default, PartialEq)]
151#[non_exhaustive]
152pub struct ReplicaSelection {
153 /// Required. Name of the location of the replicas (e.g., "us-central1").
154 pub location: std::string::String,
155
156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
157}
158
159impl ReplicaSelection {
160 pub fn new() -> Self {
161 std::default::Default::default()
162 }
163
164 /// Sets the value of [location][crate::model::ReplicaSelection::location].
165 ///
166 /// # Example
167 /// ```ignore,no_run
168 /// # use google_cloud_spanner_admin_instance_v1::model::ReplicaSelection;
169 /// let x = ReplicaSelection::new().set_location("example");
170 /// ```
171 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
172 self.location = v.into();
173 self
174 }
175}
176
177impl wkt::message::Message for ReplicaSelection {
178 fn typename() -> &'static str {
179 "type.googleapis.com/google.spanner.admin.instance.v1.ReplicaSelection"
180 }
181}
182
183#[derive(Clone, Default, PartialEq)]
184#[non_exhaustive]
185pub struct ReplicaInfo {
186 /// The location of the serving resources, e.g., "us-central1".
187 pub location: std::string::String,
188
189 /// The type of replica.
190 pub r#type: crate::model::replica_info::ReplicaType,
191
192 /// If true, this location is designated as the default leader location where
193 /// leader replicas are placed. See the [region types
194 /// documentation](https://cloud.google.com/spanner/docs/instances#region_types)
195 /// for more details.
196 pub default_leader_location: bool,
197
198 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
199}
200
201impl ReplicaInfo {
202 pub fn new() -> Self {
203 std::default::Default::default()
204 }
205
206 /// Sets the value of [location][crate::model::ReplicaInfo::location].
207 ///
208 /// # Example
209 /// ```ignore,no_run
210 /// # use google_cloud_spanner_admin_instance_v1::model::ReplicaInfo;
211 /// let x = ReplicaInfo::new().set_location("example");
212 /// ```
213 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
214 self.location = v.into();
215 self
216 }
217
218 /// Sets the value of [r#type][crate::model::ReplicaInfo::type].
219 ///
220 /// # Example
221 /// ```ignore,no_run
222 /// # use google_cloud_spanner_admin_instance_v1::model::ReplicaInfo;
223 /// use google_cloud_spanner_admin_instance_v1::model::replica_info::ReplicaType;
224 /// let x0 = ReplicaInfo::new().set_type(ReplicaType::ReadWrite);
225 /// let x1 = ReplicaInfo::new().set_type(ReplicaType::ReadOnly);
226 /// let x2 = ReplicaInfo::new().set_type(ReplicaType::Witness);
227 /// ```
228 pub fn set_type<T: std::convert::Into<crate::model::replica_info::ReplicaType>>(
229 mut self,
230 v: T,
231 ) -> Self {
232 self.r#type = v.into();
233 self
234 }
235
236 /// Sets the value of [default_leader_location][crate::model::ReplicaInfo::default_leader_location].
237 ///
238 /// # Example
239 /// ```ignore,no_run
240 /// # use google_cloud_spanner_admin_instance_v1::model::ReplicaInfo;
241 /// let x = ReplicaInfo::new().set_default_leader_location(true);
242 /// ```
243 pub fn set_default_leader_location<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
244 self.default_leader_location = v.into();
245 self
246 }
247}
248
249impl wkt::message::Message for ReplicaInfo {
250 fn typename() -> &'static str {
251 "type.googleapis.com/google.spanner.admin.instance.v1.ReplicaInfo"
252 }
253}
254
255/// Defines additional types related to [ReplicaInfo].
256pub mod replica_info {
257 #[allow(unused_imports)]
258 use super::*;
259
260 /// Indicates the type of replica. See the [replica types
261 /// documentation](https://cloud.google.com/spanner/docs/replication#replica_types)
262 /// for more details.
263 ///
264 /// # Working with unknown values
265 ///
266 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
267 /// additional enum variants at any time. Adding new variants is not considered
268 /// a breaking change. Applications should write their code in anticipation of:
269 ///
270 /// - New values appearing in future releases of the client library, **and**
271 /// - New values received dynamically, without application changes.
272 ///
273 /// Please consult the [Working with enums] section in the user guide for some
274 /// guidelines.
275 ///
276 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
277 #[derive(Clone, Debug, PartialEq)]
278 #[non_exhaustive]
279 pub enum ReplicaType {
280 /// Not specified.
281 TypeUnspecified,
282 /// Read-write replicas support both reads and writes. These replicas:
283 ///
284 /// * Maintain a full copy of your data.
285 /// * Serve reads.
286 /// * Can vote whether to commit a write.
287 /// * Participate in leadership election.
288 /// * Are eligible to become a leader.
289 ReadWrite,
290 /// Read-only replicas only support reads (not writes). Read-only replicas:
291 ///
292 /// * Maintain a full copy of your data.
293 /// * Serve reads.
294 /// * Do not participate in voting to commit writes.
295 /// * Are not eligible to become a leader.
296 ReadOnly,
297 /// Witness replicas don't support reads but do participate in voting to
298 /// commit writes. Witness replicas:
299 ///
300 /// * Do not maintain a full copy of data.
301 /// * Do not serve reads.
302 /// * Vote whether to commit writes.
303 /// * Participate in leader election but are not eligible to become leader.
304 Witness,
305 /// If set, the enum was initialized with an unknown value.
306 ///
307 /// Applications can examine the value using [ReplicaType::value] or
308 /// [ReplicaType::name].
309 UnknownValue(replica_type::UnknownValue),
310 }
311
312 #[doc(hidden)]
313 pub mod replica_type {
314 #[allow(unused_imports)]
315 use super::*;
316 #[derive(Clone, Debug, PartialEq)]
317 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
318 }
319
320 impl ReplicaType {
321 /// Gets the enum value.
322 ///
323 /// Returns `None` if the enum contains an unknown value deserialized from
324 /// the string representation of enums.
325 pub fn value(&self) -> std::option::Option<i32> {
326 match self {
327 Self::TypeUnspecified => std::option::Option::Some(0),
328 Self::ReadWrite => std::option::Option::Some(1),
329 Self::ReadOnly => std::option::Option::Some(2),
330 Self::Witness => std::option::Option::Some(3),
331 Self::UnknownValue(u) => u.0.value(),
332 }
333 }
334
335 /// Gets the enum value as a string.
336 ///
337 /// Returns `None` if the enum contains an unknown value deserialized from
338 /// the integer representation of enums.
339 pub fn name(&self) -> std::option::Option<&str> {
340 match self {
341 Self::TypeUnspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
342 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
343 Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
344 Self::Witness => std::option::Option::Some("WITNESS"),
345 Self::UnknownValue(u) => u.0.name(),
346 }
347 }
348 }
349
350 impl std::default::Default for ReplicaType {
351 fn default() -> Self {
352 use std::convert::From;
353 Self::from(0)
354 }
355 }
356
357 impl std::fmt::Display for ReplicaType {
358 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
359 wkt::internal::display_enum(f, self.name(), self.value())
360 }
361 }
362
363 impl std::convert::From<i32> for ReplicaType {
364 fn from(value: i32) -> Self {
365 match value {
366 0 => Self::TypeUnspecified,
367 1 => Self::ReadWrite,
368 2 => Self::ReadOnly,
369 3 => Self::Witness,
370 _ => Self::UnknownValue(replica_type::UnknownValue(
371 wkt::internal::UnknownEnumValue::Integer(value),
372 )),
373 }
374 }
375 }
376
377 impl std::convert::From<&str> for ReplicaType {
378 fn from(value: &str) -> Self {
379 use std::string::ToString;
380 match value {
381 "TYPE_UNSPECIFIED" => Self::TypeUnspecified,
382 "READ_WRITE" => Self::ReadWrite,
383 "READ_ONLY" => Self::ReadOnly,
384 "WITNESS" => Self::Witness,
385 _ => Self::UnknownValue(replica_type::UnknownValue(
386 wkt::internal::UnknownEnumValue::String(value.to_string()),
387 )),
388 }
389 }
390 }
391
392 impl serde::ser::Serialize for ReplicaType {
393 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
394 where
395 S: serde::Serializer,
396 {
397 match self {
398 Self::TypeUnspecified => serializer.serialize_i32(0),
399 Self::ReadWrite => serializer.serialize_i32(1),
400 Self::ReadOnly => serializer.serialize_i32(2),
401 Self::Witness => serializer.serialize_i32(3),
402 Self::UnknownValue(u) => u.0.serialize(serializer),
403 }
404 }
405 }
406
407 impl<'de> serde::de::Deserialize<'de> for ReplicaType {
408 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
409 where
410 D: serde::Deserializer<'de>,
411 {
412 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReplicaType>::new(
413 ".google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType",
414 ))
415 }
416 }
417}
418
419/// A possible configuration for a Cloud Spanner instance. Configurations
420/// define the geographic placement of nodes and their replication.
421#[derive(Clone, Default, PartialEq)]
422#[non_exhaustive]
423pub struct InstanceConfig {
424 /// A unique identifier for the instance configuration. Values
425 /// are of the form
426 /// `projects/<project>/instanceConfigs/[a-z][-a-z0-9]*`.
427 ///
428 /// User instance configuration must start with `custom-`.
429 pub name: std::string::String,
430
431 /// The name of this instance configuration as it appears in UIs.
432 pub display_name: std::string::String,
433
434 /// Output only. Whether this instance configuration is a Google-managed or
435 /// user-managed configuration.
436 pub config_type: crate::model::instance_config::Type,
437
438 /// The geographic placement of nodes in this instance configuration and their
439 /// replication properties.
440 ///
441 /// To create user-managed configurations, input
442 /// `replicas` must include all replicas in `replicas` of the `base_config`
443 /// and include one or more replicas in the `optional_replicas` of the
444 /// `base_config`.
445 pub replicas: std::vec::Vec<crate::model::ReplicaInfo>,
446
447 /// Output only. The available optional replicas to choose from for
448 /// user-managed configurations. Populated for Google-managed configurations.
449 pub optional_replicas: std::vec::Vec<crate::model::ReplicaInfo>,
450
451 /// Base configuration name, e.g. projects/<project_name>/instanceConfigs/nam3,
452 /// based on which this configuration is created. Only set for user-managed
453 /// configurations. `base_config` must refer to a configuration of type
454 /// `GOOGLE_MANAGED` in the same project as this configuration.
455 pub base_config: std::string::String,
456
457 /// Cloud Labels are a flexible and lightweight mechanism for organizing cloud
458 /// resources into groups that reflect a customer's organizational needs and
459 /// deployment strategies. Cloud Labels can be used to filter collections of
460 /// resources. They can be used to control how resource metrics are aggregated.
461 /// And they can be used as arguments to policy management rules (e.g. route,
462 /// firewall, load balancing, etc.).
463 ///
464 /// * Label keys must be between 1 and 63 characters long and must conform to
465 /// the following regular expression: `[a-z][a-z0-9_-]{0,62}`.
466 /// * Label values must be between 0 and 63 characters long and must conform
467 /// to the regular expression `[a-z0-9_-]{0,63}`.
468 /// * No more than 64 labels can be associated with a given resource.
469 ///
470 /// See <https://goo.gl/xmQnxf> for more information on and examples of labels.
471 ///
472 /// If you plan to use labels in your own code, please note that additional
473 /// characters may be allowed in the future. Therefore, you are advised to use
474 /// an internal label representation, such as JSON, which doesn't rely upon
475 /// specific characters being disallowed. For example, representing labels
476 /// as the string: name + "_" + value would prove problematic if we were to
477 /// allow "_" in a future release.
478 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
479
480 /// etag is used for optimistic concurrency control as a way
481 /// to help prevent simultaneous updates of a instance configuration from
482 /// overwriting each other. It is strongly suggested that systems make use of
483 /// the etag in the read-modify-write cycle to perform instance configuration
484 /// updates in order to avoid race conditions: An etag is returned in the
485 /// response which contains instance configurations, and systems are expected
486 /// to put that etag in the request to update instance configuration to ensure
487 /// that their change is applied to the same version of the instance
488 /// configuration. If no etag is provided in the call to update the instance
489 /// configuration, then the existing instance configuration is overwritten
490 /// blindly.
491 pub etag: std::string::String,
492
493 /// Allowed values of the "default_leader" schema option for databases in
494 /// instances that use this instance configuration.
495 pub leader_options: std::vec::Vec<std::string::String>,
496
497 /// Output only. If true, the instance configuration is being created or
498 /// updated. If false, there are no ongoing operations for the instance
499 /// configuration.
500 pub reconciling: bool,
501
502 /// Output only. The current instance configuration state. Applicable only for
503 /// `USER_MANAGED` configurations.
504 pub state: crate::model::instance_config::State,
505
506 /// Output only. Describes whether free instances are available to be created
507 /// in this instance configuration.
508 pub free_instance_availability: crate::model::instance_config::FreeInstanceAvailability,
509
510 /// Output only. The `QuorumType` of the instance configuration.
511 pub quorum_type: crate::model::instance_config::QuorumType,
512
513 /// Output only. The storage limit in bytes per processing unit.
514 pub storage_limit_per_processing_unit: i64,
515
516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
517}
518
519impl InstanceConfig {
520 pub fn new() -> Self {
521 std::default::Default::default()
522 }
523
524 /// Sets the value of [name][crate::model::InstanceConfig::name].
525 ///
526 /// # Example
527 /// ```ignore,no_run
528 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
529 /// let x = InstanceConfig::new().set_name("example");
530 /// ```
531 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
532 self.name = v.into();
533 self
534 }
535
536 /// Sets the value of [display_name][crate::model::InstanceConfig::display_name].
537 ///
538 /// # Example
539 /// ```ignore,no_run
540 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
541 /// let x = InstanceConfig::new().set_display_name("example");
542 /// ```
543 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
544 self.display_name = v.into();
545 self
546 }
547
548 /// Sets the value of [config_type][crate::model::InstanceConfig::config_type].
549 ///
550 /// # Example
551 /// ```ignore,no_run
552 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
553 /// use google_cloud_spanner_admin_instance_v1::model::instance_config::Type;
554 /// let x0 = InstanceConfig::new().set_config_type(Type::GoogleManaged);
555 /// let x1 = InstanceConfig::new().set_config_type(Type::UserManaged);
556 /// ```
557 pub fn set_config_type<T: std::convert::Into<crate::model::instance_config::Type>>(
558 mut self,
559 v: T,
560 ) -> Self {
561 self.config_type = v.into();
562 self
563 }
564
565 /// Sets the value of [replicas][crate::model::InstanceConfig::replicas].
566 ///
567 /// # Example
568 /// ```ignore,no_run
569 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
570 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaInfo;
571 /// let x = InstanceConfig::new()
572 /// .set_replicas([
573 /// ReplicaInfo::default()/* use setters */,
574 /// ReplicaInfo::default()/* use (different) setters */,
575 /// ]);
576 /// ```
577 pub fn set_replicas<T, V>(mut self, v: T) -> Self
578 where
579 T: std::iter::IntoIterator<Item = V>,
580 V: std::convert::Into<crate::model::ReplicaInfo>,
581 {
582 use std::iter::Iterator;
583 self.replicas = v.into_iter().map(|i| i.into()).collect();
584 self
585 }
586
587 /// Sets the value of [optional_replicas][crate::model::InstanceConfig::optional_replicas].
588 ///
589 /// # Example
590 /// ```ignore,no_run
591 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
592 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaInfo;
593 /// let x = InstanceConfig::new()
594 /// .set_optional_replicas([
595 /// ReplicaInfo::default()/* use setters */,
596 /// ReplicaInfo::default()/* use (different) setters */,
597 /// ]);
598 /// ```
599 pub fn set_optional_replicas<T, V>(mut self, v: T) -> Self
600 where
601 T: std::iter::IntoIterator<Item = V>,
602 V: std::convert::Into<crate::model::ReplicaInfo>,
603 {
604 use std::iter::Iterator;
605 self.optional_replicas = v.into_iter().map(|i| i.into()).collect();
606 self
607 }
608
609 /// Sets the value of [base_config][crate::model::InstanceConfig::base_config].
610 ///
611 /// # Example
612 /// ```ignore,no_run
613 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
614 /// let x = InstanceConfig::new().set_base_config("example");
615 /// ```
616 pub fn set_base_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
617 self.base_config = v.into();
618 self
619 }
620
621 /// Sets the value of [labels][crate::model::InstanceConfig::labels].
622 ///
623 /// # Example
624 /// ```ignore,no_run
625 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
626 /// let x = InstanceConfig::new().set_labels([
627 /// ("key0", "abc"),
628 /// ("key1", "xyz"),
629 /// ]);
630 /// ```
631 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
632 where
633 T: std::iter::IntoIterator<Item = (K, V)>,
634 K: std::convert::Into<std::string::String>,
635 V: std::convert::Into<std::string::String>,
636 {
637 use std::iter::Iterator;
638 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
639 self
640 }
641
642 /// Sets the value of [etag][crate::model::InstanceConfig::etag].
643 ///
644 /// # Example
645 /// ```ignore,no_run
646 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
647 /// let x = InstanceConfig::new().set_etag("example");
648 /// ```
649 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
650 self.etag = v.into();
651 self
652 }
653
654 /// Sets the value of [leader_options][crate::model::InstanceConfig::leader_options].
655 ///
656 /// # Example
657 /// ```ignore,no_run
658 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
659 /// let x = InstanceConfig::new().set_leader_options(["a", "b", "c"]);
660 /// ```
661 pub fn set_leader_options<T, V>(mut self, v: T) -> Self
662 where
663 T: std::iter::IntoIterator<Item = V>,
664 V: std::convert::Into<std::string::String>,
665 {
666 use std::iter::Iterator;
667 self.leader_options = v.into_iter().map(|i| i.into()).collect();
668 self
669 }
670
671 /// Sets the value of [reconciling][crate::model::InstanceConfig::reconciling].
672 ///
673 /// # Example
674 /// ```ignore,no_run
675 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
676 /// let x = InstanceConfig::new().set_reconciling(true);
677 /// ```
678 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
679 self.reconciling = v.into();
680 self
681 }
682
683 /// Sets the value of [state][crate::model::InstanceConfig::state].
684 ///
685 /// # Example
686 /// ```ignore,no_run
687 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
688 /// use google_cloud_spanner_admin_instance_v1::model::instance_config::State;
689 /// let x0 = InstanceConfig::new().set_state(State::Creating);
690 /// let x1 = InstanceConfig::new().set_state(State::Ready);
691 /// ```
692 pub fn set_state<T: std::convert::Into<crate::model::instance_config::State>>(
693 mut self,
694 v: T,
695 ) -> Self {
696 self.state = v.into();
697 self
698 }
699
700 /// Sets the value of [free_instance_availability][crate::model::InstanceConfig::free_instance_availability].
701 ///
702 /// # Example
703 /// ```ignore,no_run
704 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
705 /// use google_cloud_spanner_admin_instance_v1::model::instance_config::FreeInstanceAvailability;
706 /// let x0 = InstanceConfig::new().set_free_instance_availability(FreeInstanceAvailability::Available);
707 /// let x1 = InstanceConfig::new().set_free_instance_availability(FreeInstanceAvailability::Unsupported);
708 /// let x2 = InstanceConfig::new().set_free_instance_availability(FreeInstanceAvailability::Disabled);
709 /// ```
710 pub fn set_free_instance_availability<
711 T: std::convert::Into<crate::model::instance_config::FreeInstanceAvailability>,
712 >(
713 mut self,
714 v: T,
715 ) -> Self {
716 self.free_instance_availability = v.into();
717 self
718 }
719
720 /// Sets the value of [quorum_type][crate::model::InstanceConfig::quorum_type].
721 ///
722 /// # Example
723 /// ```ignore,no_run
724 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
725 /// use google_cloud_spanner_admin_instance_v1::model::instance_config::QuorumType;
726 /// let x0 = InstanceConfig::new().set_quorum_type(QuorumType::Region);
727 /// let x1 = InstanceConfig::new().set_quorum_type(QuorumType::DualRegion);
728 /// let x2 = InstanceConfig::new().set_quorum_type(QuorumType::MultiRegion);
729 /// ```
730 pub fn set_quorum_type<T: std::convert::Into<crate::model::instance_config::QuorumType>>(
731 mut self,
732 v: T,
733 ) -> Self {
734 self.quorum_type = v.into();
735 self
736 }
737
738 /// Sets the value of [storage_limit_per_processing_unit][crate::model::InstanceConfig::storage_limit_per_processing_unit].
739 ///
740 /// # Example
741 /// ```ignore,no_run
742 /// # use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
743 /// let x = InstanceConfig::new().set_storage_limit_per_processing_unit(42);
744 /// ```
745 pub fn set_storage_limit_per_processing_unit<T: std::convert::Into<i64>>(
746 mut self,
747 v: T,
748 ) -> Self {
749 self.storage_limit_per_processing_unit = v.into();
750 self
751 }
752}
753
754impl wkt::message::Message for InstanceConfig {
755 fn typename() -> &'static str {
756 "type.googleapis.com/google.spanner.admin.instance.v1.InstanceConfig"
757 }
758}
759
760/// Defines additional types related to [InstanceConfig].
761pub mod instance_config {
762 #[allow(unused_imports)]
763 use super::*;
764
765 /// The type of this configuration.
766 ///
767 /// # Working with unknown values
768 ///
769 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
770 /// additional enum variants at any time. Adding new variants is not considered
771 /// a breaking change. Applications should write their code in anticipation of:
772 ///
773 /// - New values appearing in future releases of the client library, **and**
774 /// - New values received dynamically, without application changes.
775 ///
776 /// Please consult the [Working with enums] section in the user guide for some
777 /// guidelines.
778 ///
779 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
780 #[derive(Clone, Debug, PartialEq)]
781 #[non_exhaustive]
782 pub enum Type {
783 /// Unspecified.
784 Unspecified,
785 /// Google-managed configuration.
786 GoogleManaged,
787 /// User-managed configuration.
788 UserManaged,
789 /// If set, the enum was initialized with an unknown value.
790 ///
791 /// Applications can examine the value using [Type::value] or
792 /// [Type::name].
793 UnknownValue(r#type::UnknownValue),
794 }
795
796 #[doc(hidden)]
797 pub mod r#type {
798 #[allow(unused_imports)]
799 use super::*;
800 #[derive(Clone, Debug, PartialEq)]
801 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
802 }
803
804 impl Type {
805 /// Gets the enum value.
806 ///
807 /// Returns `None` if the enum contains an unknown value deserialized from
808 /// the string representation of enums.
809 pub fn value(&self) -> std::option::Option<i32> {
810 match self {
811 Self::Unspecified => std::option::Option::Some(0),
812 Self::GoogleManaged => std::option::Option::Some(1),
813 Self::UserManaged => std::option::Option::Some(2),
814 Self::UnknownValue(u) => u.0.value(),
815 }
816 }
817
818 /// Gets the enum value as a string.
819 ///
820 /// Returns `None` if the enum contains an unknown value deserialized from
821 /// the integer representation of enums.
822 pub fn name(&self) -> std::option::Option<&str> {
823 match self {
824 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
825 Self::GoogleManaged => std::option::Option::Some("GOOGLE_MANAGED"),
826 Self::UserManaged => std::option::Option::Some("USER_MANAGED"),
827 Self::UnknownValue(u) => u.0.name(),
828 }
829 }
830 }
831
832 impl std::default::Default for Type {
833 fn default() -> Self {
834 use std::convert::From;
835 Self::from(0)
836 }
837 }
838
839 impl std::fmt::Display for Type {
840 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
841 wkt::internal::display_enum(f, self.name(), self.value())
842 }
843 }
844
845 impl std::convert::From<i32> for Type {
846 fn from(value: i32) -> Self {
847 match value {
848 0 => Self::Unspecified,
849 1 => Self::GoogleManaged,
850 2 => Self::UserManaged,
851 _ => Self::UnknownValue(r#type::UnknownValue(
852 wkt::internal::UnknownEnumValue::Integer(value),
853 )),
854 }
855 }
856 }
857
858 impl std::convert::From<&str> for Type {
859 fn from(value: &str) -> Self {
860 use std::string::ToString;
861 match value {
862 "TYPE_UNSPECIFIED" => Self::Unspecified,
863 "GOOGLE_MANAGED" => Self::GoogleManaged,
864 "USER_MANAGED" => Self::UserManaged,
865 _ => Self::UnknownValue(r#type::UnknownValue(
866 wkt::internal::UnknownEnumValue::String(value.to_string()),
867 )),
868 }
869 }
870 }
871
872 impl serde::ser::Serialize for Type {
873 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
874 where
875 S: serde::Serializer,
876 {
877 match self {
878 Self::Unspecified => serializer.serialize_i32(0),
879 Self::GoogleManaged => serializer.serialize_i32(1),
880 Self::UserManaged => serializer.serialize_i32(2),
881 Self::UnknownValue(u) => u.0.serialize(serializer),
882 }
883 }
884 }
885
886 impl<'de> serde::de::Deserialize<'de> for Type {
887 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
888 where
889 D: serde::Deserializer<'de>,
890 {
891 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
892 ".google.spanner.admin.instance.v1.InstanceConfig.Type",
893 ))
894 }
895 }
896
897 /// Indicates the current state of the instance configuration.
898 ///
899 /// # Working with unknown values
900 ///
901 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
902 /// additional enum variants at any time. Adding new variants is not considered
903 /// a breaking change. Applications should write their code in anticipation of:
904 ///
905 /// - New values appearing in future releases of the client library, **and**
906 /// - New values received dynamically, without application changes.
907 ///
908 /// Please consult the [Working with enums] section in the user guide for some
909 /// guidelines.
910 ///
911 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
912 #[derive(Clone, Debug, PartialEq)]
913 #[non_exhaustive]
914 pub enum State {
915 /// Not specified.
916 Unspecified,
917 /// The instance configuration is still being created.
918 Creating,
919 /// The instance configuration is fully created and ready to be used to
920 /// create instances.
921 Ready,
922 /// If set, the enum was initialized with an unknown value.
923 ///
924 /// Applications can examine the value using [State::value] or
925 /// [State::name].
926 UnknownValue(state::UnknownValue),
927 }
928
929 #[doc(hidden)]
930 pub mod state {
931 #[allow(unused_imports)]
932 use super::*;
933 #[derive(Clone, Debug, PartialEq)]
934 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
935 }
936
937 impl State {
938 /// Gets the enum value.
939 ///
940 /// Returns `None` if the enum contains an unknown value deserialized from
941 /// the string representation of enums.
942 pub fn value(&self) -> std::option::Option<i32> {
943 match self {
944 Self::Unspecified => std::option::Option::Some(0),
945 Self::Creating => std::option::Option::Some(1),
946 Self::Ready => std::option::Option::Some(2),
947 Self::UnknownValue(u) => u.0.value(),
948 }
949 }
950
951 /// Gets the enum value as a string.
952 ///
953 /// Returns `None` if the enum contains an unknown value deserialized from
954 /// the integer representation of enums.
955 pub fn name(&self) -> std::option::Option<&str> {
956 match self {
957 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
958 Self::Creating => std::option::Option::Some("CREATING"),
959 Self::Ready => std::option::Option::Some("READY"),
960 Self::UnknownValue(u) => u.0.name(),
961 }
962 }
963 }
964
965 impl std::default::Default for State {
966 fn default() -> Self {
967 use std::convert::From;
968 Self::from(0)
969 }
970 }
971
972 impl std::fmt::Display for State {
973 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
974 wkt::internal::display_enum(f, self.name(), self.value())
975 }
976 }
977
978 impl std::convert::From<i32> for State {
979 fn from(value: i32) -> Self {
980 match value {
981 0 => Self::Unspecified,
982 1 => Self::Creating,
983 2 => Self::Ready,
984 _ => Self::UnknownValue(state::UnknownValue(
985 wkt::internal::UnknownEnumValue::Integer(value),
986 )),
987 }
988 }
989 }
990
991 impl std::convert::From<&str> for State {
992 fn from(value: &str) -> Self {
993 use std::string::ToString;
994 match value {
995 "STATE_UNSPECIFIED" => Self::Unspecified,
996 "CREATING" => Self::Creating,
997 "READY" => Self::Ready,
998 _ => Self::UnknownValue(state::UnknownValue(
999 wkt::internal::UnknownEnumValue::String(value.to_string()),
1000 )),
1001 }
1002 }
1003 }
1004
1005 impl serde::ser::Serialize for State {
1006 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1007 where
1008 S: serde::Serializer,
1009 {
1010 match self {
1011 Self::Unspecified => serializer.serialize_i32(0),
1012 Self::Creating => serializer.serialize_i32(1),
1013 Self::Ready => serializer.serialize_i32(2),
1014 Self::UnknownValue(u) => u.0.serialize(serializer),
1015 }
1016 }
1017 }
1018
1019 impl<'de> serde::de::Deserialize<'de> for State {
1020 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1021 where
1022 D: serde::Deserializer<'de>,
1023 {
1024 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1025 ".google.spanner.admin.instance.v1.InstanceConfig.State",
1026 ))
1027 }
1028 }
1029
1030 /// Describes the availability for free instances to be created in an instance
1031 /// configuration.
1032 ///
1033 /// # Working with unknown values
1034 ///
1035 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1036 /// additional enum variants at any time. Adding new variants is not considered
1037 /// a breaking change. Applications should write their code in anticipation of:
1038 ///
1039 /// - New values appearing in future releases of the client library, **and**
1040 /// - New values received dynamically, without application changes.
1041 ///
1042 /// Please consult the [Working with enums] section in the user guide for some
1043 /// guidelines.
1044 ///
1045 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1046 #[derive(Clone, Debug, PartialEq)]
1047 #[non_exhaustive]
1048 pub enum FreeInstanceAvailability {
1049 /// Not specified.
1050 Unspecified,
1051 /// Indicates that free instances are available to be created in this
1052 /// instance configuration.
1053 Available,
1054 /// Indicates that free instances are not supported in this instance
1055 /// configuration.
1056 Unsupported,
1057 /// Indicates that free instances are currently not available to be created
1058 /// in this instance configuration.
1059 Disabled,
1060 /// Indicates that additional free instances cannot be created in this
1061 /// instance configuration because the project has reached its limit of free
1062 /// instances.
1063 QuotaExceeded,
1064 /// If set, the enum was initialized with an unknown value.
1065 ///
1066 /// Applications can examine the value using [FreeInstanceAvailability::value] or
1067 /// [FreeInstanceAvailability::name].
1068 UnknownValue(free_instance_availability::UnknownValue),
1069 }
1070
1071 #[doc(hidden)]
1072 pub mod free_instance_availability {
1073 #[allow(unused_imports)]
1074 use super::*;
1075 #[derive(Clone, Debug, PartialEq)]
1076 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1077 }
1078
1079 impl FreeInstanceAvailability {
1080 /// Gets the enum value.
1081 ///
1082 /// Returns `None` if the enum contains an unknown value deserialized from
1083 /// the string representation of enums.
1084 pub fn value(&self) -> std::option::Option<i32> {
1085 match self {
1086 Self::Unspecified => std::option::Option::Some(0),
1087 Self::Available => std::option::Option::Some(1),
1088 Self::Unsupported => std::option::Option::Some(2),
1089 Self::Disabled => std::option::Option::Some(3),
1090 Self::QuotaExceeded => std::option::Option::Some(4),
1091 Self::UnknownValue(u) => u.0.value(),
1092 }
1093 }
1094
1095 /// Gets the enum value as a string.
1096 ///
1097 /// Returns `None` if the enum contains an unknown value deserialized from
1098 /// the integer representation of enums.
1099 pub fn name(&self) -> std::option::Option<&str> {
1100 match self {
1101 Self::Unspecified => {
1102 std::option::Option::Some("FREE_INSTANCE_AVAILABILITY_UNSPECIFIED")
1103 }
1104 Self::Available => std::option::Option::Some("AVAILABLE"),
1105 Self::Unsupported => std::option::Option::Some("UNSUPPORTED"),
1106 Self::Disabled => std::option::Option::Some("DISABLED"),
1107 Self::QuotaExceeded => std::option::Option::Some("QUOTA_EXCEEDED"),
1108 Self::UnknownValue(u) => u.0.name(),
1109 }
1110 }
1111 }
1112
1113 impl std::default::Default for FreeInstanceAvailability {
1114 fn default() -> Self {
1115 use std::convert::From;
1116 Self::from(0)
1117 }
1118 }
1119
1120 impl std::fmt::Display for FreeInstanceAvailability {
1121 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1122 wkt::internal::display_enum(f, self.name(), self.value())
1123 }
1124 }
1125
1126 impl std::convert::From<i32> for FreeInstanceAvailability {
1127 fn from(value: i32) -> Self {
1128 match value {
1129 0 => Self::Unspecified,
1130 1 => Self::Available,
1131 2 => Self::Unsupported,
1132 3 => Self::Disabled,
1133 4 => Self::QuotaExceeded,
1134 _ => Self::UnknownValue(free_instance_availability::UnknownValue(
1135 wkt::internal::UnknownEnumValue::Integer(value),
1136 )),
1137 }
1138 }
1139 }
1140
1141 impl std::convert::From<&str> for FreeInstanceAvailability {
1142 fn from(value: &str) -> Self {
1143 use std::string::ToString;
1144 match value {
1145 "FREE_INSTANCE_AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
1146 "AVAILABLE" => Self::Available,
1147 "UNSUPPORTED" => Self::Unsupported,
1148 "DISABLED" => Self::Disabled,
1149 "QUOTA_EXCEEDED" => Self::QuotaExceeded,
1150 _ => Self::UnknownValue(free_instance_availability::UnknownValue(
1151 wkt::internal::UnknownEnumValue::String(value.to_string()),
1152 )),
1153 }
1154 }
1155 }
1156
1157 impl serde::ser::Serialize for FreeInstanceAvailability {
1158 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1159 where
1160 S: serde::Serializer,
1161 {
1162 match self {
1163 Self::Unspecified => serializer.serialize_i32(0),
1164 Self::Available => serializer.serialize_i32(1),
1165 Self::Unsupported => serializer.serialize_i32(2),
1166 Self::Disabled => serializer.serialize_i32(3),
1167 Self::QuotaExceeded => serializer.serialize_i32(4),
1168 Self::UnknownValue(u) => u.0.serialize(serializer),
1169 }
1170 }
1171 }
1172
1173 impl<'de> serde::de::Deserialize<'de> for FreeInstanceAvailability {
1174 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1175 where
1176 D: serde::Deserializer<'de>,
1177 {
1178 deserializer.deserialize_any(
1179 wkt::internal::EnumVisitor::<FreeInstanceAvailability>::new(
1180 ".google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability",
1181 ),
1182 )
1183 }
1184 }
1185
1186 /// Indicates the quorum type of this instance configuration.
1187 ///
1188 /// # Working with unknown values
1189 ///
1190 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1191 /// additional enum variants at any time. Adding new variants is not considered
1192 /// a breaking change. Applications should write their code in anticipation of:
1193 ///
1194 /// - New values appearing in future releases of the client library, **and**
1195 /// - New values received dynamically, without application changes.
1196 ///
1197 /// Please consult the [Working with enums] section in the user guide for some
1198 /// guidelines.
1199 ///
1200 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1201 #[derive(Clone, Debug, PartialEq)]
1202 #[non_exhaustive]
1203 pub enum QuorumType {
1204 /// Quorum type not specified.
1205 Unspecified,
1206 /// An instance configuration tagged with `REGION` quorum type forms a write
1207 /// quorum in a single region.
1208 Region,
1209 /// An instance configuration tagged with the `DUAL_REGION` quorum type forms
1210 /// a write quorum with exactly two read-write regions in a multi-region
1211 /// configuration.
1212 ///
1213 /// This instance configuration requires failover in the event of
1214 /// regional failures.
1215 DualRegion,
1216 /// An instance configuration tagged with the `MULTI_REGION` quorum type
1217 /// forms a write quorum from replicas that are spread across more than one
1218 /// region in a multi-region configuration.
1219 MultiRegion,
1220 /// If set, the enum was initialized with an unknown value.
1221 ///
1222 /// Applications can examine the value using [QuorumType::value] or
1223 /// [QuorumType::name].
1224 UnknownValue(quorum_type::UnknownValue),
1225 }
1226
1227 #[doc(hidden)]
1228 pub mod quorum_type {
1229 #[allow(unused_imports)]
1230 use super::*;
1231 #[derive(Clone, Debug, PartialEq)]
1232 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1233 }
1234
1235 impl QuorumType {
1236 /// Gets the enum value.
1237 ///
1238 /// Returns `None` if the enum contains an unknown value deserialized from
1239 /// the string representation of enums.
1240 pub fn value(&self) -> std::option::Option<i32> {
1241 match self {
1242 Self::Unspecified => std::option::Option::Some(0),
1243 Self::Region => std::option::Option::Some(1),
1244 Self::DualRegion => std::option::Option::Some(2),
1245 Self::MultiRegion => std::option::Option::Some(3),
1246 Self::UnknownValue(u) => u.0.value(),
1247 }
1248 }
1249
1250 /// Gets the enum value as a string.
1251 ///
1252 /// Returns `None` if the enum contains an unknown value deserialized from
1253 /// the integer representation of enums.
1254 pub fn name(&self) -> std::option::Option<&str> {
1255 match self {
1256 Self::Unspecified => std::option::Option::Some("QUORUM_TYPE_UNSPECIFIED"),
1257 Self::Region => std::option::Option::Some("REGION"),
1258 Self::DualRegion => std::option::Option::Some("DUAL_REGION"),
1259 Self::MultiRegion => std::option::Option::Some("MULTI_REGION"),
1260 Self::UnknownValue(u) => u.0.name(),
1261 }
1262 }
1263 }
1264
1265 impl std::default::Default for QuorumType {
1266 fn default() -> Self {
1267 use std::convert::From;
1268 Self::from(0)
1269 }
1270 }
1271
1272 impl std::fmt::Display for QuorumType {
1273 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1274 wkt::internal::display_enum(f, self.name(), self.value())
1275 }
1276 }
1277
1278 impl std::convert::From<i32> for QuorumType {
1279 fn from(value: i32) -> Self {
1280 match value {
1281 0 => Self::Unspecified,
1282 1 => Self::Region,
1283 2 => Self::DualRegion,
1284 3 => Self::MultiRegion,
1285 _ => Self::UnknownValue(quorum_type::UnknownValue(
1286 wkt::internal::UnknownEnumValue::Integer(value),
1287 )),
1288 }
1289 }
1290 }
1291
1292 impl std::convert::From<&str> for QuorumType {
1293 fn from(value: &str) -> Self {
1294 use std::string::ToString;
1295 match value {
1296 "QUORUM_TYPE_UNSPECIFIED" => Self::Unspecified,
1297 "REGION" => Self::Region,
1298 "DUAL_REGION" => Self::DualRegion,
1299 "MULTI_REGION" => Self::MultiRegion,
1300 _ => Self::UnknownValue(quorum_type::UnknownValue(
1301 wkt::internal::UnknownEnumValue::String(value.to_string()),
1302 )),
1303 }
1304 }
1305 }
1306
1307 impl serde::ser::Serialize for QuorumType {
1308 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1309 where
1310 S: serde::Serializer,
1311 {
1312 match self {
1313 Self::Unspecified => serializer.serialize_i32(0),
1314 Self::Region => serializer.serialize_i32(1),
1315 Self::DualRegion => serializer.serialize_i32(2),
1316 Self::MultiRegion => serializer.serialize_i32(3),
1317 Self::UnknownValue(u) => u.0.serialize(serializer),
1318 }
1319 }
1320 }
1321
1322 impl<'de> serde::de::Deserialize<'de> for QuorumType {
1323 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1324 where
1325 D: serde::Deserializer<'de>,
1326 {
1327 deserializer.deserialize_any(wkt::internal::EnumVisitor::<QuorumType>::new(
1328 ".google.spanner.admin.instance.v1.InstanceConfig.QuorumType",
1329 ))
1330 }
1331 }
1332}
1333
1334/// ReplicaComputeCapacity describes the amount of server resources that are
1335/// allocated to each replica identified by the replica selection.
1336#[derive(Clone, Default, PartialEq)]
1337#[non_exhaustive]
1338pub struct ReplicaComputeCapacity {
1339 /// Required. Identifies replicas by specified properties.
1340 /// All replicas in the selection have the same amount of compute capacity.
1341 pub replica_selection: std::option::Option<crate::model::ReplicaSelection>,
1342
1343 /// Compute capacity allocated to each replica identified by the specified
1344 /// selection.
1345 /// The unit is selected based on the unit used to specify the instance size
1346 /// for non-autoscaling instances, or the unit used in autoscaling limit for
1347 /// autoscaling instances.
1348 pub compute_capacity:
1349 std::option::Option<crate::model::replica_compute_capacity::ComputeCapacity>,
1350
1351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1352}
1353
1354impl ReplicaComputeCapacity {
1355 pub fn new() -> Self {
1356 std::default::Default::default()
1357 }
1358
1359 /// Sets the value of [replica_selection][crate::model::ReplicaComputeCapacity::replica_selection].
1360 ///
1361 /// # Example
1362 /// ```ignore,no_run
1363 /// # use google_cloud_spanner_admin_instance_v1::model::ReplicaComputeCapacity;
1364 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaSelection;
1365 /// let x = ReplicaComputeCapacity::new().set_replica_selection(ReplicaSelection::default()/* use setters */);
1366 /// ```
1367 pub fn set_replica_selection<T>(mut self, v: T) -> Self
1368 where
1369 T: std::convert::Into<crate::model::ReplicaSelection>,
1370 {
1371 self.replica_selection = std::option::Option::Some(v.into());
1372 self
1373 }
1374
1375 /// Sets or clears the value of [replica_selection][crate::model::ReplicaComputeCapacity::replica_selection].
1376 ///
1377 /// # Example
1378 /// ```ignore,no_run
1379 /// # use google_cloud_spanner_admin_instance_v1::model::ReplicaComputeCapacity;
1380 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaSelection;
1381 /// let x = ReplicaComputeCapacity::new().set_or_clear_replica_selection(Some(ReplicaSelection::default()/* use setters */));
1382 /// let x = ReplicaComputeCapacity::new().set_or_clear_replica_selection(None::<ReplicaSelection>);
1383 /// ```
1384 pub fn set_or_clear_replica_selection<T>(mut self, v: std::option::Option<T>) -> Self
1385 where
1386 T: std::convert::Into<crate::model::ReplicaSelection>,
1387 {
1388 self.replica_selection = v.map(|x| x.into());
1389 self
1390 }
1391
1392 /// Sets the value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity].
1393 ///
1394 /// Note that all the setters affecting `compute_capacity` are mutually
1395 /// exclusive.
1396 ///
1397 /// # Example
1398 /// ```ignore,no_run
1399 /// # use google_cloud_spanner_admin_instance_v1::model::ReplicaComputeCapacity;
1400 /// use google_cloud_spanner_admin_instance_v1::model::replica_compute_capacity::ComputeCapacity;
1401 /// let x = ReplicaComputeCapacity::new().set_compute_capacity(Some(ComputeCapacity::NodeCount(42)));
1402 /// ```
1403 pub fn set_compute_capacity<
1404 T: std::convert::Into<
1405 std::option::Option<crate::model::replica_compute_capacity::ComputeCapacity>,
1406 >,
1407 >(
1408 mut self,
1409 v: T,
1410 ) -> Self {
1411 self.compute_capacity = v.into();
1412 self
1413 }
1414
1415 /// The value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity]
1416 /// if it holds a `NodeCount`, `None` if the field is not set or
1417 /// holds a different branch.
1418 pub fn node_count(&self) -> std::option::Option<&i32> {
1419 #[allow(unreachable_patterns)]
1420 self.compute_capacity.as_ref().and_then(|v| match v {
1421 crate::model::replica_compute_capacity::ComputeCapacity::NodeCount(v) => {
1422 std::option::Option::Some(v)
1423 }
1424 _ => std::option::Option::None,
1425 })
1426 }
1427
1428 /// Sets the value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity]
1429 /// to hold a `NodeCount`.
1430 ///
1431 /// Note that all the setters affecting `compute_capacity` are
1432 /// mutually exclusive.
1433 ///
1434 /// # Example
1435 /// ```ignore,no_run
1436 /// # use google_cloud_spanner_admin_instance_v1::model::ReplicaComputeCapacity;
1437 /// let x = ReplicaComputeCapacity::new().set_node_count(42);
1438 /// assert!(x.node_count().is_some());
1439 /// assert!(x.processing_units().is_none());
1440 /// ```
1441 pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1442 self.compute_capacity = std::option::Option::Some(
1443 crate::model::replica_compute_capacity::ComputeCapacity::NodeCount(v.into()),
1444 );
1445 self
1446 }
1447
1448 /// The value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity]
1449 /// if it holds a `ProcessingUnits`, `None` if the field is not set or
1450 /// holds a different branch.
1451 pub fn processing_units(&self) -> std::option::Option<&i32> {
1452 #[allow(unreachable_patterns)]
1453 self.compute_capacity.as_ref().and_then(|v| match v {
1454 crate::model::replica_compute_capacity::ComputeCapacity::ProcessingUnits(v) => {
1455 std::option::Option::Some(v)
1456 }
1457 _ => std::option::Option::None,
1458 })
1459 }
1460
1461 /// Sets the value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity]
1462 /// to hold a `ProcessingUnits`.
1463 ///
1464 /// Note that all the setters affecting `compute_capacity` are
1465 /// mutually exclusive.
1466 ///
1467 /// # Example
1468 /// ```ignore,no_run
1469 /// # use google_cloud_spanner_admin_instance_v1::model::ReplicaComputeCapacity;
1470 /// let x = ReplicaComputeCapacity::new().set_processing_units(42);
1471 /// assert!(x.processing_units().is_some());
1472 /// assert!(x.node_count().is_none());
1473 /// ```
1474 pub fn set_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1475 self.compute_capacity = std::option::Option::Some(
1476 crate::model::replica_compute_capacity::ComputeCapacity::ProcessingUnits(v.into()),
1477 );
1478 self
1479 }
1480}
1481
1482impl wkt::message::Message for ReplicaComputeCapacity {
1483 fn typename() -> &'static str {
1484 "type.googleapis.com/google.spanner.admin.instance.v1.ReplicaComputeCapacity"
1485 }
1486}
1487
1488/// Defines additional types related to [ReplicaComputeCapacity].
1489pub mod replica_compute_capacity {
1490 #[allow(unused_imports)]
1491 use super::*;
1492
1493 /// Compute capacity allocated to each replica identified by the specified
1494 /// selection.
1495 /// The unit is selected based on the unit used to specify the instance size
1496 /// for non-autoscaling instances, or the unit used in autoscaling limit for
1497 /// autoscaling instances.
1498 #[derive(Clone, Debug, PartialEq)]
1499 #[non_exhaustive]
1500 pub enum ComputeCapacity {
1501 /// The number of nodes allocated to each replica.
1502 ///
1503 /// This may be zero in API responses for instances that are not yet in
1504 /// state `READY`.
1505 NodeCount(i32),
1506 /// The number of processing units allocated to each replica.
1507 ///
1508 /// This may be zero in API responses for instances that are not yet in
1509 /// state `READY`.
1510 ProcessingUnits(i32),
1511 }
1512}
1513
1514/// Autoscaling configuration for an instance.
1515#[derive(Clone, Default, PartialEq)]
1516#[non_exhaustive]
1517pub struct AutoscalingConfig {
1518 /// Required. Autoscaling limits for an instance.
1519 pub autoscaling_limits:
1520 std::option::Option<crate::model::autoscaling_config::AutoscalingLimits>,
1521
1522 /// Required. The autoscaling targets for an instance.
1523 pub autoscaling_targets:
1524 std::option::Option<crate::model::autoscaling_config::AutoscalingTargets>,
1525
1526 /// Optional. Optional asymmetric autoscaling options.
1527 /// Replicas matching the replica selection criteria will be autoscaled
1528 /// independently from other replicas. The autoscaler will scale the replicas
1529 /// based on the utilization of replicas identified by the replica selection.
1530 /// Replica selections should not overlap with each other.
1531 ///
1532 /// Other replicas (those do not match any replica selection) will be
1533 /// autoscaled together and will have the same compute capacity allocated to
1534 /// them.
1535 pub asymmetric_autoscaling_options:
1536 std::vec::Vec<crate::model::autoscaling_config::AsymmetricAutoscalingOption>,
1537
1538 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1539}
1540
1541impl AutoscalingConfig {
1542 pub fn new() -> Self {
1543 std::default::Default::default()
1544 }
1545
1546 /// Sets the value of [autoscaling_limits][crate::model::AutoscalingConfig::autoscaling_limits].
1547 ///
1548 /// # Example
1549 /// ```ignore,no_run
1550 /// # use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
1551 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
1552 /// let x = AutoscalingConfig::new().set_autoscaling_limits(AutoscalingLimits::default()/* use setters */);
1553 /// ```
1554 pub fn set_autoscaling_limits<T>(mut self, v: T) -> Self
1555 where
1556 T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
1557 {
1558 self.autoscaling_limits = std::option::Option::Some(v.into());
1559 self
1560 }
1561
1562 /// Sets or clears the value of [autoscaling_limits][crate::model::AutoscalingConfig::autoscaling_limits].
1563 ///
1564 /// # Example
1565 /// ```ignore,no_run
1566 /// # use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
1567 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
1568 /// let x = AutoscalingConfig::new().set_or_clear_autoscaling_limits(Some(AutoscalingLimits::default()/* use setters */));
1569 /// let x = AutoscalingConfig::new().set_or_clear_autoscaling_limits(None::<AutoscalingLimits>);
1570 /// ```
1571 pub fn set_or_clear_autoscaling_limits<T>(mut self, v: std::option::Option<T>) -> Self
1572 where
1573 T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
1574 {
1575 self.autoscaling_limits = v.map(|x| x.into());
1576 self
1577 }
1578
1579 /// Sets the value of [autoscaling_targets][crate::model::AutoscalingConfig::autoscaling_targets].
1580 ///
1581 /// # Example
1582 /// ```ignore,no_run
1583 /// # use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
1584 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingTargets;
1585 /// let x = AutoscalingConfig::new().set_autoscaling_targets(AutoscalingTargets::default()/* use setters */);
1586 /// ```
1587 pub fn set_autoscaling_targets<T>(mut self, v: T) -> Self
1588 where
1589 T: std::convert::Into<crate::model::autoscaling_config::AutoscalingTargets>,
1590 {
1591 self.autoscaling_targets = std::option::Option::Some(v.into());
1592 self
1593 }
1594
1595 /// Sets or clears the value of [autoscaling_targets][crate::model::AutoscalingConfig::autoscaling_targets].
1596 ///
1597 /// # Example
1598 /// ```ignore,no_run
1599 /// # use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
1600 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingTargets;
1601 /// let x = AutoscalingConfig::new().set_or_clear_autoscaling_targets(Some(AutoscalingTargets::default()/* use setters */));
1602 /// let x = AutoscalingConfig::new().set_or_clear_autoscaling_targets(None::<AutoscalingTargets>);
1603 /// ```
1604 pub fn set_or_clear_autoscaling_targets<T>(mut self, v: std::option::Option<T>) -> Self
1605 where
1606 T: std::convert::Into<crate::model::autoscaling_config::AutoscalingTargets>,
1607 {
1608 self.autoscaling_targets = v.map(|x| x.into());
1609 self
1610 }
1611
1612 /// Sets the value of [asymmetric_autoscaling_options][crate::model::AutoscalingConfig::asymmetric_autoscaling_options].
1613 ///
1614 /// # Example
1615 /// ```ignore,no_run
1616 /// # use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
1617 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AsymmetricAutoscalingOption;
1618 /// let x = AutoscalingConfig::new()
1619 /// .set_asymmetric_autoscaling_options([
1620 /// AsymmetricAutoscalingOption::default()/* use setters */,
1621 /// AsymmetricAutoscalingOption::default()/* use (different) setters */,
1622 /// ]);
1623 /// ```
1624 pub fn set_asymmetric_autoscaling_options<T, V>(mut self, v: T) -> Self
1625 where
1626 T: std::iter::IntoIterator<Item = V>,
1627 V: std::convert::Into<crate::model::autoscaling_config::AsymmetricAutoscalingOption>,
1628 {
1629 use std::iter::Iterator;
1630 self.asymmetric_autoscaling_options = v.into_iter().map(|i| i.into()).collect();
1631 self
1632 }
1633}
1634
1635impl wkt::message::Message for AutoscalingConfig {
1636 fn typename() -> &'static str {
1637 "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig"
1638 }
1639}
1640
1641/// Defines additional types related to [AutoscalingConfig].
1642pub mod autoscaling_config {
1643 #[allow(unused_imports)]
1644 use super::*;
1645
1646 /// The autoscaling limits for the instance. Users can define the minimum and
1647 /// maximum compute capacity allocated to the instance, and the autoscaler will
1648 /// only scale within that range. Users can either use nodes or processing
1649 /// units to specify the limits, but should use the same unit to set both the
1650 /// min_limit and max_limit.
1651 #[derive(Clone, Default, PartialEq)]
1652 #[non_exhaustive]
1653 pub struct AutoscalingLimits {
1654 /// The minimum compute capacity for the instance.
1655 pub min_limit:
1656 std::option::Option<crate::model::autoscaling_config::autoscaling_limits::MinLimit>,
1657
1658 /// The maximum compute capacity for the instance. The maximum compute
1659 /// capacity should be less than or equal to 10X the minimum compute
1660 /// capacity.
1661 pub max_limit:
1662 std::option::Option<crate::model::autoscaling_config::autoscaling_limits::MaxLimit>,
1663
1664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1665 }
1666
1667 impl AutoscalingLimits {
1668 pub fn new() -> Self {
1669 std::default::Default::default()
1670 }
1671
1672 /// Sets the value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit].
1673 ///
1674 /// Note that all the setters affecting `min_limit` are mutually
1675 /// exclusive.
1676 ///
1677 /// # Example
1678 /// ```ignore,no_run
1679 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
1680 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::autoscaling_limits::MinLimit;
1681 /// let x = AutoscalingLimits::new().set_min_limit(Some(MinLimit::MinNodes(42)));
1682 /// ```
1683 pub fn set_min_limit<
1684 T: std::convert::Into<
1685 std::option::Option<
1686 crate::model::autoscaling_config::autoscaling_limits::MinLimit,
1687 >,
1688 >,
1689 >(
1690 mut self,
1691 v: T,
1692 ) -> Self {
1693 self.min_limit = v.into();
1694 self
1695 }
1696
1697 /// The value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit]
1698 /// if it holds a `MinNodes`, `None` if the field is not set or
1699 /// holds a different branch.
1700 pub fn min_nodes(&self) -> std::option::Option<&i32> {
1701 #[allow(unreachable_patterns)]
1702 self.min_limit.as_ref().and_then(|v| match v {
1703 crate::model::autoscaling_config::autoscaling_limits::MinLimit::MinNodes(v) => {
1704 std::option::Option::Some(v)
1705 }
1706 _ => std::option::Option::None,
1707 })
1708 }
1709
1710 /// Sets the value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit]
1711 /// to hold a `MinNodes`.
1712 ///
1713 /// Note that all the setters affecting `min_limit` are
1714 /// mutually exclusive.
1715 ///
1716 /// # Example
1717 /// ```ignore,no_run
1718 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
1719 /// let x = AutoscalingLimits::new().set_min_nodes(42);
1720 /// assert!(x.min_nodes().is_some());
1721 /// assert!(x.min_processing_units().is_none());
1722 /// ```
1723 pub fn set_min_nodes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1724 self.min_limit = std::option::Option::Some(
1725 crate::model::autoscaling_config::autoscaling_limits::MinLimit::MinNodes(v.into()),
1726 );
1727 self
1728 }
1729
1730 /// The value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit]
1731 /// if it holds a `MinProcessingUnits`, `None` if the field is not set or
1732 /// holds a different branch.
1733 pub fn min_processing_units(&self) -> std::option::Option<&i32> {
1734 #[allow(unreachable_patterns)]
1735 self.min_limit.as_ref().and_then(|v| match v {
1736 crate::model::autoscaling_config::autoscaling_limits::MinLimit::MinProcessingUnits(v) => std::option::Option::Some(v),
1737 _ => std::option::Option::None,
1738 })
1739 }
1740
1741 /// Sets the value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit]
1742 /// to hold a `MinProcessingUnits`.
1743 ///
1744 /// Note that all the setters affecting `min_limit` are
1745 /// mutually exclusive.
1746 ///
1747 /// # Example
1748 /// ```ignore,no_run
1749 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
1750 /// let x = AutoscalingLimits::new().set_min_processing_units(42);
1751 /// assert!(x.min_processing_units().is_some());
1752 /// assert!(x.min_nodes().is_none());
1753 /// ```
1754 pub fn set_min_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1755 self.min_limit = std::option::Option::Some(
1756 crate::model::autoscaling_config::autoscaling_limits::MinLimit::MinProcessingUnits(
1757 v.into(),
1758 ),
1759 );
1760 self
1761 }
1762
1763 /// Sets the value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit].
1764 ///
1765 /// Note that all the setters affecting `max_limit` are mutually
1766 /// exclusive.
1767 ///
1768 /// # Example
1769 /// ```ignore,no_run
1770 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
1771 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::autoscaling_limits::MaxLimit;
1772 /// let x = AutoscalingLimits::new().set_max_limit(Some(MaxLimit::MaxNodes(42)));
1773 /// ```
1774 pub fn set_max_limit<
1775 T: std::convert::Into<
1776 std::option::Option<
1777 crate::model::autoscaling_config::autoscaling_limits::MaxLimit,
1778 >,
1779 >,
1780 >(
1781 mut self,
1782 v: T,
1783 ) -> Self {
1784 self.max_limit = v.into();
1785 self
1786 }
1787
1788 /// The value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit]
1789 /// if it holds a `MaxNodes`, `None` if the field is not set or
1790 /// holds a different branch.
1791 pub fn max_nodes(&self) -> std::option::Option<&i32> {
1792 #[allow(unreachable_patterns)]
1793 self.max_limit.as_ref().and_then(|v| match v {
1794 crate::model::autoscaling_config::autoscaling_limits::MaxLimit::MaxNodes(v) => {
1795 std::option::Option::Some(v)
1796 }
1797 _ => std::option::Option::None,
1798 })
1799 }
1800
1801 /// Sets the value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit]
1802 /// to hold a `MaxNodes`.
1803 ///
1804 /// Note that all the setters affecting `max_limit` are
1805 /// mutually exclusive.
1806 ///
1807 /// # Example
1808 /// ```ignore,no_run
1809 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
1810 /// let x = AutoscalingLimits::new().set_max_nodes(42);
1811 /// assert!(x.max_nodes().is_some());
1812 /// assert!(x.max_processing_units().is_none());
1813 /// ```
1814 pub fn set_max_nodes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1815 self.max_limit = std::option::Option::Some(
1816 crate::model::autoscaling_config::autoscaling_limits::MaxLimit::MaxNodes(v.into()),
1817 );
1818 self
1819 }
1820
1821 /// The value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit]
1822 /// if it holds a `MaxProcessingUnits`, `None` if the field is not set or
1823 /// holds a different branch.
1824 pub fn max_processing_units(&self) -> std::option::Option<&i32> {
1825 #[allow(unreachable_patterns)]
1826 self.max_limit.as_ref().and_then(|v| match v {
1827 crate::model::autoscaling_config::autoscaling_limits::MaxLimit::MaxProcessingUnits(v) => std::option::Option::Some(v),
1828 _ => std::option::Option::None,
1829 })
1830 }
1831
1832 /// Sets the value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit]
1833 /// to hold a `MaxProcessingUnits`.
1834 ///
1835 /// Note that all the setters affecting `max_limit` are
1836 /// mutually exclusive.
1837 ///
1838 /// # Example
1839 /// ```ignore,no_run
1840 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
1841 /// let x = AutoscalingLimits::new().set_max_processing_units(42);
1842 /// assert!(x.max_processing_units().is_some());
1843 /// assert!(x.max_nodes().is_none());
1844 /// ```
1845 pub fn set_max_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1846 self.max_limit = std::option::Option::Some(
1847 crate::model::autoscaling_config::autoscaling_limits::MaxLimit::MaxProcessingUnits(
1848 v.into(),
1849 ),
1850 );
1851 self
1852 }
1853 }
1854
1855 impl wkt::message::Message for AutoscalingLimits {
1856 fn typename() -> &'static str {
1857 "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits"
1858 }
1859 }
1860
1861 /// Defines additional types related to [AutoscalingLimits].
1862 pub mod autoscaling_limits {
1863 #[allow(unused_imports)]
1864 use super::*;
1865
1866 /// The minimum compute capacity for the instance.
1867 #[derive(Clone, Debug, PartialEq)]
1868 #[non_exhaustive]
1869 pub enum MinLimit {
1870 /// Minimum number of nodes allocated to the instance. If set, this number
1871 /// should be greater than or equal to 1.
1872 MinNodes(i32),
1873 /// Minimum number of processing units allocated to the instance. If set,
1874 /// this number should be multiples of 1000.
1875 MinProcessingUnits(i32),
1876 }
1877
1878 /// The maximum compute capacity for the instance. The maximum compute
1879 /// capacity should be less than or equal to 10X the minimum compute
1880 /// capacity.
1881 #[derive(Clone, Debug, PartialEq)]
1882 #[non_exhaustive]
1883 pub enum MaxLimit {
1884 /// Maximum number of nodes allocated to the instance. If set, this number
1885 /// should be greater than or equal to min_nodes.
1886 MaxNodes(i32),
1887 /// Maximum number of processing units allocated to the instance. If set,
1888 /// this number should be multiples of 1000 and be greater than or equal to
1889 /// min_processing_units.
1890 MaxProcessingUnits(i32),
1891 }
1892 }
1893
1894 /// The autoscaling targets for an instance.
1895 #[derive(Clone, Default, PartialEq)]
1896 #[non_exhaustive]
1897 pub struct AutoscalingTargets {
1898 /// Required. The target high priority cpu utilization percentage that the
1899 /// autoscaler should be trying to achieve for the instance. This number is
1900 /// on a scale from 0 (no utilization) to 100 (full utilization). The valid
1901 /// range is [10, 90] inclusive.
1902 pub high_priority_cpu_utilization_percent: i32,
1903
1904 /// Required. The target storage utilization percentage that the autoscaler
1905 /// should be trying to achieve for the instance. This number is on a scale
1906 /// from 0 (no utilization) to 100 (full utilization). The valid range is
1907 /// [10, 99] inclusive.
1908 pub storage_utilization_percent: i32,
1909
1910 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1911 }
1912
1913 impl AutoscalingTargets {
1914 pub fn new() -> Self {
1915 std::default::Default::default()
1916 }
1917
1918 /// Sets the value of [high_priority_cpu_utilization_percent][crate::model::autoscaling_config::AutoscalingTargets::high_priority_cpu_utilization_percent].
1919 ///
1920 /// # Example
1921 /// ```ignore,no_run
1922 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingTargets;
1923 /// let x = AutoscalingTargets::new().set_high_priority_cpu_utilization_percent(42);
1924 /// ```
1925 pub fn set_high_priority_cpu_utilization_percent<T: std::convert::Into<i32>>(
1926 mut self,
1927 v: T,
1928 ) -> Self {
1929 self.high_priority_cpu_utilization_percent = v.into();
1930 self
1931 }
1932
1933 /// Sets the value of [storage_utilization_percent][crate::model::autoscaling_config::AutoscalingTargets::storage_utilization_percent].
1934 ///
1935 /// # Example
1936 /// ```ignore,no_run
1937 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingTargets;
1938 /// let x = AutoscalingTargets::new().set_storage_utilization_percent(42);
1939 /// ```
1940 pub fn set_storage_utilization_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1941 self.storage_utilization_percent = v.into();
1942 self
1943 }
1944 }
1945
1946 impl wkt::message::Message for AutoscalingTargets {
1947 fn typename() -> &'static str {
1948 "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets"
1949 }
1950 }
1951
1952 /// AsymmetricAutoscalingOption specifies the scaling of replicas identified by
1953 /// the given selection.
1954 #[derive(Clone, Default, PartialEq)]
1955 #[non_exhaustive]
1956 pub struct AsymmetricAutoscalingOption {
1957
1958 /// Required. Selects the replicas to which this AsymmetricAutoscalingOption
1959 /// applies. Only read-only replicas are supported.
1960 pub replica_selection: std::option::Option<crate::model::ReplicaSelection>,
1961
1962 /// Optional. Overrides applied to the top-level autoscaling configuration
1963 /// for the selected replicas.
1964 pub overrides: std::option::Option<crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides>,
1965
1966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1967 }
1968
1969 impl AsymmetricAutoscalingOption {
1970 pub fn new() -> Self {
1971 std::default::Default::default()
1972 }
1973
1974 /// Sets the value of [replica_selection][crate::model::autoscaling_config::AsymmetricAutoscalingOption::replica_selection].
1975 ///
1976 /// # Example
1977 /// ```ignore,no_run
1978 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AsymmetricAutoscalingOption;
1979 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaSelection;
1980 /// let x = AsymmetricAutoscalingOption::new().set_replica_selection(ReplicaSelection::default()/* use setters */);
1981 /// ```
1982 pub fn set_replica_selection<T>(mut self, v: T) -> Self
1983 where
1984 T: std::convert::Into<crate::model::ReplicaSelection>,
1985 {
1986 self.replica_selection = std::option::Option::Some(v.into());
1987 self
1988 }
1989
1990 /// Sets or clears the value of [replica_selection][crate::model::autoscaling_config::AsymmetricAutoscalingOption::replica_selection].
1991 ///
1992 /// # Example
1993 /// ```ignore,no_run
1994 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AsymmetricAutoscalingOption;
1995 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaSelection;
1996 /// let x = AsymmetricAutoscalingOption::new().set_or_clear_replica_selection(Some(ReplicaSelection::default()/* use setters */));
1997 /// let x = AsymmetricAutoscalingOption::new().set_or_clear_replica_selection(None::<ReplicaSelection>);
1998 /// ```
1999 pub fn set_or_clear_replica_selection<T>(mut self, v: std::option::Option<T>) -> Self
2000 where
2001 T: std::convert::Into<crate::model::ReplicaSelection>,
2002 {
2003 self.replica_selection = v.map(|x| x.into());
2004 self
2005 }
2006
2007 /// Sets the value of [overrides][crate::model::autoscaling_config::AsymmetricAutoscalingOption::overrides].
2008 ///
2009 /// # Example
2010 /// ```ignore,no_run
2011 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AsymmetricAutoscalingOption;
2012 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2013 /// let x = AsymmetricAutoscalingOption::new().set_overrides(AutoscalingConfigOverrides::default()/* use setters */);
2014 /// ```
2015 pub fn set_overrides<T>(mut self, v: T) -> Self
2016 where T: std::convert::Into<crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides>
2017 {
2018 self.overrides = std::option::Option::Some(v.into());
2019 self
2020 }
2021
2022 /// Sets or clears the value of [overrides][crate::model::autoscaling_config::AsymmetricAutoscalingOption::overrides].
2023 ///
2024 /// # Example
2025 /// ```ignore,no_run
2026 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AsymmetricAutoscalingOption;
2027 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2028 /// let x = AsymmetricAutoscalingOption::new().set_or_clear_overrides(Some(AutoscalingConfigOverrides::default()/* use setters */));
2029 /// let x = AsymmetricAutoscalingOption::new().set_or_clear_overrides(None::<AutoscalingConfigOverrides>);
2030 /// ```
2031 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
2032 where T: std::convert::Into<crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides>
2033 {
2034 self.overrides = v.map(|x| x.into());
2035 self
2036 }
2037 }
2038
2039 impl wkt::message::Message for AsymmetricAutoscalingOption {
2040 fn typename() -> &'static str {
2041 "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption"
2042 }
2043 }
2044
2045 /// Defines additional types related to [AsymmetricAutoscalingOption].
2046 pub mod asymmetric_autoscaling_option {
2047 #[allow(unused_imports)]
2048 use super::*;
2049
2050 /// Overrides the top-level autoscaling configuration for the replicas
2051 /// identified by `replica_selection`. All fields in this message are
2052 /// optional. Any unspecified fields will use the corresponding values from
2053 /// the top-level autoscaling configuration.
2054 #[derive(Clone, Default, PartialEq)]
2055 #[non_exhaustive]
2056 pub struct AutoscalingConfigOverrides {
2057 /// Optional. If specified, overrides the min/max limit in the top-level
2058 /// autoscaling configuration for the selected replicas.
2059 pub autoscaling_limits:
2060 std::option::Option<crate::model::autoscaling_config::AutoscalingLimits>,
2061
2062 /// Optional. If specified, overrides the autoscaling target
2063 /// high_priority_cpu_utilization_percent in the top-level autoscaling
2064 /// configuration for the selected replicas.
2065 pub autoscaling_target_high_priority_cpu_utilization_percent: i32,
2066
2067 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2068 }
2069
2070 impl AutoscalingConfigOverrides {
2071 pub fn new() -> Self {
2072 std::default::Default::default()
2073 }
2074
2075 /// Sets the value of [autoscaling_limits][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_limits].
2076 ///
2077 /// # Example
2078 /// ```ignore,no_run
2079 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2080 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
2081 /// let x = AutoscalingConfigOverrides::new().set_autoscaling_limits(AutoscalingLimits::default()/* use setters */);
2082 /// ```
2083 pub fn set_autoscaling_limits<T>(mut self, v: T) -> Self
2084 where
2085 T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
2086 {
2087 self.autoscaling_limits = std::option::Option::Some(v.into());
2088 self
2089 }
2090
2091 /// Sets or clears the value of [autoscaling_limits][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_limits].
2092 ///
2093 /// # Example
2094 /// ```ignore,no_run
2095 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2096 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
2097 /// let x = AutoscalingConfigOverrides::new().set_or_clear_autoscaling_limits(Some(AutoscalingLimits::default()/* use setters */));
2098 /// let x = AutoscalingConfigOverrides::new().set_or_clear_autoscaling_limits(None::<AutoscalingLimits>);
2099 /// ```
2100 pub fn set_or_clear_autoscaling_limits<T>(mut self, v: std::option::Option<T>) -> Self
2101 where
2102 T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
2103 {
2104 self.autoscaling_limits = v.map(|x| x.into());
2105 self
2106 }
2107
2108 /// Sets the value of [autoscaling_target_high_priority_cpu_utilization_percent][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_target_high_priority_cpu_utilization_percent].
2109 ///
2110 /// # Example
2111 /// ```ignore,no_run
2112 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2113 /// let x = AutoscalingConfigOverrides::new().set_autoscaling_target_high_priority_cpu_utilization_percent(42);
2114 /// ```
2115 pub fn set_autoscaling_target_high_priority_cpu_utilization_percent<
2116 T: std::convert::Into<i32>,
2117 >(
2118 mut self,
2119 v: T,
2120 ) -> Self {
2121 self.autoscaling_target_high_priority_cpu_utilization_percent = v.into();
2122 self
2123 }
2124 }
2125
2126 impl wkt::message::Message for AutoscalingConfigOverrides {
2127 fn typename() -> &'static str {
2128 "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides"
2129 }
2130 }
2131 }
2132}
2133
2134/// An isolated set of Cloud Spanner resources on which databases can be hosted.
2135#[derive(Clone, Default, PartialEq)]
2136#[non_exhaustive]
2137pub struct Instance {
2138 /// Required. A unique identifier for the instance, which cannot be changed
2139 /// after the instance is created. Values are of the form
2140 /// `projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]`. The final
2141 /// segment of the name must be between 2 and 64 characters in length.
2142 pub name: std::string::String,
2143
2144 /// Required. The name of the instance's configuration. Values are of the form
2145 /// `projects/<project>/instanceConfigs/<configuration>`. See
2146 /// also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
2147 /// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
2148 ///
2149 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
2150 /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
2151 pub config: std::string::String,
2152
2153 /// Required. The descriptive name for this instance as it appears in UIs.
2154 /// Must be unique per project and between 4 and 30 characters in length.
2155 pub display_name: std::string::String,
2156
2157 /// The number of nodes allocated to this instance. At most, one of either
2158 /// `node_count` or `processing_units` should be present in the message.
2159 ///
2160 /// Users can set the `node_count` field to specify the target number of nodes
2161 /// allocated to the instance.
2162 ///
2163 /// If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY`
2164 /// field and reflects the current number of nodes allocated to the instance.
2165 ///
2166 /// This might be zero in API responses for instances that are not yet in the
2167 /// `READY` state.
2168 ///
2169 /// For more information, see
2170 /// [Compute capacity, nodes, and processing
2171 /// units](https://cloud.google.com/spanner/docs/compute-capacity).
2172 pub node_count: i32,
2173
2174 /// The number of processing units allocated to this instance. At most, one of
2175 /// either `processing_units` or `node_count` should be present in the message.
2176 ///
2177 /// Users can set the `processing_units` field to specify the target number of
2178 /// processing units allocated to the instance.
2179 ///
2180 /// If autoscaling is enabled, `processing_units` is treated as an
2181 /// `OUTPUT_ONLY` field and reflects the current number of processing units
2182 /// allocated to the instance.
2183 ///
2184 /// This might be zero in API responses for instances that are not yet in the
2185 /// `READY` state.
2186 ///
2187 /// For more information, see
2188 /// [Compute capacity, nodes and processing
2189 /// units](https://cloud.google.com/spanner/docs/compute-capacity).
2190 pub processing_units: i32,
2191
2192 /// Output only. Lists the compute capacity per ReplicaSelection. A replica
2193 /// selection identifies a set of replicas with common properties. Replicas
2194 /// identified by a ReplicaSelection are scaled with the same compute capacity.
2195 pub replica_compute_capacity: std::vec::Vec<crate::model::ReplicaComputeCapacity>,
2196
2197 /// Optional. The autoscaling configuration. Autoscaling is enabled if this
2198 /// field is set. When autoscaling is enabled, node_count and processing_units
2199 /// are treated as OUTPUT_ONLY fields and reflect the current compute capacity
2200 /// allocated to the instance.
2201 pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
2202
2203 /// Output only. The current instance state. For
2204 /// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance],
2205 /// the state must be either omitted or set to `CREATING`. For
2206 /// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance],
2207 /// the state must be either omitted or set to `READY`.
2208 ///
2209 /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
2210 /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
2211 pub state: crate::model::instance::State,
2212
2213 /// Cloud Labels are a flexible and lightweight mechanism for organizing cloud
2214 /// resources into groups that reflect a customer's organizational needs and
2215 /// deployment strategies. Cloud Labels can be used to filter collections of
2216 /// resources. They can be used to control how resource metrics are aggregated.
2217 /// And they can be used as arguments to policy management rules (e.g. route,
2218 /// firewall, load balancing, etc.).
2219 ///
2220 /// * Label keys must be between 1 and 63 characters long and must conform to
2221 /// the following regular expression: `[a-z][a-z0-9_-]{0,62}`.
2222 /// * Label values must be between 0 and 63 characters long and must conform
2223 /// to the regular expression `[a-z0-9_-]{0,63}`.
2224 /// * No more than 64 labels can be associated with a given resource.
2225 ///
2226 /// See <https://goo.gl/xmQnxf> for more information on and examples of labels.
2227 ///
2228 /// If you plan to use labels in your own code, please note that additional
2229 /// characters may be allowed in the future. And so you are advised to use an
2230 /// internal label representation, such as JSON, which doesn't rely upon
2231 /// specific characters being disallowed. For example, representing labels
2232 /// as the string: name + "_" + value would prove problematic if we were to
2233 /// allow "_" in a future release.
2234 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2235
2236 /// The `InstanceType` of the current instance.
2237 pub instance_type: crate::model::instance::InstanceType,
2238
2239 /// Deprecated. This field is not populated.
2240 pub endpoint_uris: std::vec::Vec<std::string::String>,
2241
2242 /// Output only. The time at which the instance was created.
2243 pub create_time: std::option::Option<wkt::Timestamp>,
2244
2245 /// Output only. The time at which the instance was most recently updated.
2246 pub update_time: std::option::Option<wkt::Timestamp>,
2247
2248 /// Free instance metadata. Only populated for free instances.
2249 pub free_instance_metadata: std::option::Option<crate::model::FreeInstanceMetadata>,
2250
2251 /// Optional. The `Edition` of the current instance.
2252 pub edition: crate::model::instance::Edition,
2253
2254 /// Optional. Controls the default backup schedule behavior for new databases
2255 /// within the instance. By default, a backup schedule is created automatically
2256 /// when a new database is created in a new instance.
2257 ///
2258 /// Note that the `AUTOMATIC` value isn't permitted for free instances,
2259 /// as backups and backup schedules aren't supported for free instances.
2260 ///
2261 /// In the `GetInstance` or `ListInstances` response, if the value of
2262 /// `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't
2263 /// create a default backup schedule for new databases in the instance.
2264 pub default_backup_schedule_type: crate::model::instance::DefaultBackupScheduleType,
2265
2266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2267}
2268
2269impl Instance {
2270 pub fn new() -> Self {
2271 std::default::Default::default()
2272 }
2273
2274 /// Sets the value of [name][crate::model::Instance::name].
2275 ///
2276 /// # Example
2277 /// ```ignore,no_run
2278 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2279 /// let x = Instance::new().set_name("example");
2280 /// ```
2281 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2282 self.name = v.into();
2283 self
2284 }
2285
2286 /// Sets the value of [config][crate::model::Instance::config].
2287 ///
2288 /// # Example
2289 /// ```ignore,no_run
2290 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2291 /// let x = Instance::new().set_config("example");
2292 /// ```
2293 pub fn set_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2294 self.config = v.into();
2295 self
2296 }
2297
2298 /// Sets the value of [display_name][crate::model::Instance::display_name].
2299 ///
2300 /// # Example
2301 /// ```ignore,no_run
2302 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2303 /// let x = Instance::new().set_display_name("example");
2304 /// ```
2305 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2306 self.display_name = v.into();
2307 self
2308 }
2309
2310 /// Sets the value of [node_count][crate::model::Instance::node_count].
2311 ///
2312 /// # Example
2313 /// ```ignore,no_run
2314 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2315 /// let x = Instance::new().set_node_count(42);
2316 /// ```
2317 pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2318 self.node_count = v.into();
2319 self
2320 }
2321
2322 /// Sets the value of [processing_units][crate::model::Instance::processing_units].
2323 ///
2324 /// # Example
2325 /// ```ignore,no_run
2326 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2327 /// let x = Instance::new().set_processing_units(42);
2328 /// ```
2329 pub fn set_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2330 self.processing_units = v.into();
2331 self
2332 }
2333
2334 /// Sets the value of [replica_compute_capacity][crate::model::Instance::replica_compute_capacity].
2335 ///
2336 /// # Example
2337 /// ```ignore,no_run
2338 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2339 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaComputeCapacity;
2340 /// let x = Instance::new()
2341 /// .set_replica_compute_capacity([
2342 /// ReplicaComputeCapacity::default()/* use setters */,
2343 /// ReplicaComputeCapacity::default()/* use (different) setters */,
2344 /// ]);
2345 /// ```
2346 pub fn set_replica_compute_capacity<T, V>(mut self, v: T) -> Self
2347 where
2348 T: std::iter::IntoIterator<Item = V>,
2349 V: std::convert::Into<crate::model::ReplicaComputeCapacity>,
2350 {
2351 use std::iter::Iterator;
2352 self.replica_compute_capacity = v.into_iter().map(|i| i.into()).collect();
2353 self
2354 }
2355
2356 /// Sets the value of [autoscaling_config][crate::model::Instance::autoscaling_config].
2357 ///
2358 /// # Example
2359 /// ```ignore,no_run
2360 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2361 /// use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
2362 /// let x = Instance::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
2363 /// ```
2364 pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
2365 where
2366 T: std::convert::Into<crate::model::AutoscalingConfig>,
2367 {
2368 self.autoscaling_config = std::option::Option::Some(v.into());
2369 self
2370 }
2371
2372 /// Sets or clears the value of [autoscaling_config][crate::model::Instance::autoscaling_config].
2373 ///
2374 /// # Example
2375 /// ```ignore,no_run
2376 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2377 /// use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
2378 /// let x = Instance::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
2379 /// let x = Instance::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
2380 /// ```
2381 pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
2382 where
2383 T: std::convert::Into<crate::model::AutoscalingConfig>,
2384 {
2385 self.autoscaling_config = v.map(|x| x.into());
2386 self
2387 }
2388
2389 /// Sets the value of [state][crate::model::Instance::state].
2390 ///
2391 /// # Example
2392 /// ```ignore,no_run
2393 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2394 /// use google_cloud_spanner_admin_instance_v1::model::instance::State;
2395 /// let x0 = Instance::new().set_state(State::Creating);
2396 /// let x1 = Instance::new().set_state(State::Ready);
2397 /// ```
2398 pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
2399 self.state = v.into();
2400 self
2401 }
2402
2403 /// Sets the value of [labels][crate::model::Instance::labels].
2404 ///
2405 /// # Example
2406 /// ```ignore,no_run
2407 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2408 /// let x = Instance::new().set_labels([
2409 /// ("key0", "abc"),
2410 /// ("key1", "xyz"),
2411 /// ]);
2412 /// ```
2413 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2414 where
2415 T: std::iter::IntoIterator<Item = (K, V)>,
2416 K: std::convert::Into<std::string::String>,
2417 V: std::convert::Into<std::string::String>,
2418 {
2419 use std::iter::Iterator;
2420 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2421 self
2422 }
2423
2424 /// Sets the value of [instance_type][crate::model::Instance::instance_type].
2425 ///
2426 /// # Example
2427 /// ```ignore,no_run
2428 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2429 /// use google_cloud_spanner_admin_instance_v1::model::instance::InstanceType;
2430 /// let x0 = Instance::new().set_instance_type(InstanceType::Provisioned);
2431 /// let x1 = Instance::new().set_instance_type(InstanceType::FreeInstance);
2432 /// ```
2433 pub fn set_instance_type<T: std::convert::Into<crate::model::instance::InstanceType>>(
2434 mut self,
2435 v: T,
2436 ) -> Self {
2437 self.instance_type = v.into();
2438 self
2439 }
2440
2441 /// Sets the value of [endpoint_uris][crate::model::Instance::endpoint_uris].
2442 ///
2443 /// # Example
2444 /// ```ignore,no_run
2445 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2446 /// let x = Instance::new().set_endpoint_uris(["a", "b", "c"]);
2447 /// ```
2448 pub fn set_endpoint_uris<T, V>(mut self, v: T) -> Self
2449 where
2450 T: std::iter::IntoIterator<Item = V>,
2451 V: std::convert::Into<std::string::String>,
2452 {
2453 use std::iter::Iterator;
2454 self.endpoint_uris = v.into_iter().map(|i| i.into()).collect();
2455 self
2456 }
2457
2458 /// Sets the value of [create_time][crate::model::Instance::create_time].
2459 ///
2460 /// # Example
2461 /// ```ignore,no_run
2462 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2463 /// use wkt::Timestamp;
2464 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
2465 /// ```
2466 pub fn set_create_time<T>(mut self, v: T) -> Self
2467 where
2468 T: std::convert::Into<wkt::Timestamp>,
2469 {
2470 self.create_time = std::option::Option::Some(v.into());
2471 self
2472 }
2473
2474 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
2475 ///
2476 /// # Example
2477 /// ```ignore,no_run
2478 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2479 /// use wkt::Timestamp;
2480 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2481 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
2482 /// ```
2483 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2484 where
2485 T: std::convert::Into<wkt::Timestamp>,
2486 {
2487 self.create_time = v.map(|x| x.into());
2488 self
2489 }
2490
2491 /// Sets the value of [update_time][crate::model::Instance::update_time].
2492 ///
2493 /// # Example
2494 /// ```ignore,no_run
2495 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2496 /// use wkt::Timestamp;
2497 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
2498 /// ```
2499 pub fn set_update_time<T>(mut self, v: T) -> Self
2500 where
2501 T: std::convert::Into<wkt::Timestamp>,
2502 {
2503 self.update_time = std::option::Option::Some(v.into());
2504 self
2505 }
2506
2507 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
2508 ///
2509 /// # Example
2510 /// ```ignore,no_run
2511 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2512 /// use wkt::Timestamp;
2513 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2514 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
2515 /// ```
2516 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2517 where
2518 T: std::convert::Into<wkt::Timestamp>,
2519 {
2520 self.update_time = v.map(|x| x.into());
2521 self
2522 }
2523
2524 /// Sets the value of [free_instance_metadata][crate::model::Instance::free_instance_metadata].
2525 ///
2526 /// # Example
2527 /// ```ignore,no_run
2528 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2529 /// use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
2530 /// let x = Instance::new().set_free_instance_metadata(FreeInstanceMetadata::default()/* use setters */);
2531 /// ```
2532 pub fn set_free_instance_metadata<T>(mut self, v: T) -> Self
2533 where
2534 T: std::convert::Into<crate::model::FreeInstanceMetadata>,
2535 {
2536 self.free_instance_metadata = std::option::Option::Some(v.into());
2537 self
2538 }
2539
2540 /// Sets or clears the value of [free_instance_metadata][crate::model::Instance::free_instance_metadata].
2541 ///
2542 /// # Example
2543 /// ```ignore,no_run
2544 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2545 /// use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
2546 /// let x = Instance::new().set_or_clear_free_instance_metadata(Some(FreeInstanceMetadata::default()/* use setters */));
2547 /// let x = Instance::new().set_or_clear_free_instance_metadata(None::<FreeInstanceMetadata>);
2548 /// ```
2549 pub fn set_or_clear_free_instance_metadata<T>(mut self, v: std::option::Option<T>) -> Self
2550 where
2551 T: std::convert::Into<crate::model::FreeInstanceMetadata>,
2552 {
2553 self.free_instance_metadata = v.map(|x| x.into());
2554 self
2555 }
2556
2557 /// Sets the value of [edition][crate::model::Instance::edition].
2558 ///
2559 /// # Example
2560 /// ```ignore,no_run
2561 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2562 /// use google_cloud_spanner_admin_instance_v1::model::instance::Edition;
2563 /// let x0 = Instance::new().set_edition(Edition::Standard);
2564 /// let x1 = Instance::new().set_edition(Edition::Enterprise);
2565 /// let x2 = Instance::new().set_edition(Edition::EnterprisePlus);
2566 /// ```
2567 pub fn set_edition<T: std::convert::Into<crate::model::instance::Edition>>(
2568 mut self,
2569 v: T,
2570 ) -> Self {
2571 self.edition = v.into();
2572 self
2573 }
2574
2575 /// Sets the value of [default_backup_schedule_type][crate::model::Instance::default_backup_schedule_type].
2576 ///
2577 /// # Example
2578 /// ```ignore,no_run
2579 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2580 /// use google_cloud_spanner_admin_instance_v1::model::instance::DefaultBackupScheduleType;
2581 /// let x0 = Instance::new().set_default_backup_schedule_type(DefaultBackupScheduleType::None);
2582 /// let x1 = Instance::new().set_default_backup_schedule_type(DefaultBackupScheduleType::Automatic);
2583 /// ```
2584 pub fn set_default_backup_schedule_type<
2585 T: std::convert::Into<crate::model::instance::DefaultBackupScheduleType>,
2586 >(
2587 mut self,
2588 v: T,
2589 ) -> Self {
2590 self.default_backup_schedule_type = v.into();
2591 self
2592 }
2593}
2594
2595impl wkt::message::Message for Instance {
2596 fn typename() -> &'static str {
2597 "type.googleapis.com/google.spanner.admin.instance.v1.Instance"
2598 }
2599}
2600
2601/// Defines additional types related to [Instance].
2602pub mod instance {
2603 #[allow(unused_imports)]
2604 use super::*;
2605
2606 /// Indicates the current state of the instance.
2607 ///
2608 /// # Working with unknown values
2609 ///
2610 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2611 /// additional enum variants at any time. Adding new variants is not considered
2612 /// a breaking change. Applications should write their code in anticipation of:
2613 ///
2614 /// - New values appearing in future releases of the client library, **and**
2615 /// - New values received dynamically, without application changes.
2616 ///
2617 /// Please consult the [Working with enums] section in the user guide for some
2618 /// guidelines.
2619 ///
2620 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2621 #[derive(Clone, Debug, PartialEq)]
2622 #[non_exhaustive]
2623 pub enum State {
2624 /// Not specified.
2625 Unspecified,
2626 /// The instance is still being created. Resources may not be
2627 /// available yet, and operations such as database creation may not
2628 /// work.
2629 Creating,
2630 /// The instance is fully created and ready to do work such as
2631 /// creating databases.
2632 Ready,
2633 /// If set, the enum was initialized with an unknown value.
2634 ///
2635 /// Applications can examine the value using [State::value] or
2636 /// [State::name].
2637 UnknownValue(state::UnknownValue),
2638 }
2639
2640 #[doc(hidden)]
2641 pub mod state {
2642 #[allow(unused_imports)]
2643 use super::*;
2644 #[derive(Clone, Debug, PartialEq)]
2645 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2646 }
2647
2648 impl State {
2649 /// Gets the enum value.
2650 ///
2651 /// Returns `None` if the enum contains an unknown value deserialized from
2652 /// the string representation of enums.
2653 pub fn value(&self) -> std::option::Option<i32> {
2654 match self {
2655 Self::Unspecified => std::option::Option::Some(0),
2656 Self::Creating => std::option::Option::Some(1),
2657 Self::Ready => std::option::Option::Some(2),
2658 Self::UnknownValue(u) => u.0.value(),
2659 }
2660 }
2661
2662 /// Gets the enum value as a string.
2663 ///
2664 /// Returns `None` if the enum contains an unknown value deserialized from
2665 /// the integer representation of enums.
2666 pub fn name(&self) -> std::option::Option<&str> {
2667 match self {
2668 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2669 Self::Creating => std::option::Option::Some("CREATING"),
2670 Self::Ready => std::option::Option::Some("READY"),
2671 Self::UnknownValue(u) => u.0.name(),
2672 }
2673 }
2674 }
2675
2676 impl std::default::Default for State {
2677 fn default() -> Self {
2678 use std::convert::From;
2679 Self::from(0)
2680 }
2681 }
2682
2683 impl std::fmt::Display for State {
2684 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2685 wkt::internal::display_enum(f, self.name(), self.value())
2686 }
2687 }
2688
2689 impl std::convert::From<i32> for State {
2690 fn from(value: i32) -> Self {
2691 match value {
2692 0 => Self::Unspecified,
2693 1 => Self::Creating,
2694 2 => Self::Ready,
2695 _ => Self::UnknownValue(state::UnknownValue(
2696 wkt::internal::UnknownEnumValue::Integer(value),
2697 )),
2698 }
2699 }
2700 }
2701
2702 impl std::convert::From<&str> for State {
2703 fn from(value: &str) -> Self {
2704 use std::string::ToString;
2705 match value {
2706 "STATE_UNSPECIFIED" => Self::Unspecified,
2707 "CREATING" => Self::Creating,
2708 "READY" => Self::Ready,
2709 _ => Self::UnknownValue(state::UnknownValue(
2710 wkt::internal::UnknownEnumValue::String(value.to_string()),
2711 )),
2712 }
2713 }
2714 }
2715
2716 impl serde::ser::Serialize for State {
2717 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2718 where
2719 S: serde::Serializer,
2720 {
2721 match self {
2722 Self::Unspecified => serializer.serialize_i32(0),
2723 Self::Creating => serializer.serialize_i32(1),
2724 Self::Ready => serializer.serialize_i32(2),
2725 Self::UnknownValue(u) => u.0.serialize(serializer),
2726 }
2727 }
2728 }
2729
2730 impl<'de> serde::de::Deserialize<'de> for State {
2731 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2732 where
2733 D: serde::Deserializer<'de>,
2734 {
2735 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2736 ".google.spanner.admin.instance.v1.Instance.State",
2737 ))
2738 }
2739 }
2740
2741 /// The type of this instance. The type can be used to distinguish product
2742 /// variants, that can affect aspects like: usage restrictions, quotas and
2743 /// billing. Currently this is used to distinguish FREE_INSTANCE vs PROVISIONED
2744 /// instances.
2745 ///
2746 /// # Working with unknown values
2747 ///
2748 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2749 /// additional enum variants at any time. Adding new variants is not considered
2750 /// a breaking change. Applications should write their code in anticipation of:
2751 ///
2752 /// - New values appearing in future releases of the client library, **and**
2753 /// - New values received dynamically, without application changes.
2754 ///
2755 /// Please consult the [Working with enums] section in the user guide for some
2756 /// guidelines.
2757 ///
2758 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2759 #[derive(Clone, Debug, PartialEq)]
2760 #[non_exhaustive]
2761 pub enum InstanceType {
2762 /// Not specified.
2763 Unspecified,
2764 /// Provisioned instances have dedicated resources, standard usage limits and
2765 /// support.
2766 Provisioned,
2767 /// Free instances provide no guarantee for dedicated resources,
2768 /// [node_count, processing_units] should be 0. They come
2769 /// with stricter usage limits and limited support.
2770 FreeInstance,
2771 /// If set, the enum was initialized with an unknown value.
2772 ///
2773 /// Applications can examine the value using [InstanceType::value] or
2774 /// [InstanceType::name].
2775 UnknownValue(instance_type::UnknownValue),
2776 }
2777
2778 #[doc(hidden)]
2779 pub mod instance_type {
2780 #[allow(unused_imports)]
2781 use super::*;
2782 #[derive(Clone, Debug, PartialEq)]
2783 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2784 }
2785
2786 impl InstanceType {
2787 /// Gets the enum value.
2788 ///
2789 /// Returns `None` if the enum contains an unknown value deserialized from
2790 /// the string representation of enums.
2791 pub fn value(&self) -> std::option::Option<i32> {
2792 match self {
2793 Self::Unspecified => std::option::Option::Some(0),
2794 Self::Provisioned => std::option::Option::Some(1),
2795 Self::FreeInstance => std::option::Option::Some(2),
2796 Self::UnknownValue(u) => u.0.value(),
2797 }
2798 }
2799
2800 /// Gets the enum value as a string.
2801 ///
2802 /// Returns `None` if the enum contains an unknown value deserialized from
2803 /// the integer representation of enums.
2804 pub fn name(&self) -> std::option::Option<&str> {
2805 match self {
2806 Self::Unspecified => std::option::Option::Some("INSTANCE_TYPE_UNSPECIFIED"),
2807 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
2808 Self::FreeInstance => std::option::Option::Some("FREE_INSTANCE"),
2809 Self::UnknownValue(u) => u.0.name(),
2810 }
2811 }
2812 }
2813
2814 impl std::default::Default for InstanceType {
2815 fn default() -> Self {
2816 use std::convert::From;
2817 Self::from(0)
2818 }
2819 }
2820
2821 impl std::fmt::Display for InstanceType {
2822 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2823 wkt::internal::display_enum(f, self.name(), self.value())
2824 }
2825 }
2826
2827 impl std::convert::From<i32> for InstanceType {
2828 fn from(value: i32) -> Self {
2829 match value {
2830 0 => Self::Unspecified,
2831 1 => Self::Provisioned,
2832 2 => Self::FreeInstance,
2833 _ => Self::UnknownValue(instance_type::UnknownValue(
2834 wkt::internal::UnknownEnumValue::Integer(value),
2835 )),
2836 }
2837 }
2838 }
2839
2840 impl std::convert::From<&str> for InstanceType {
2841 fn from(value: &str) -> Self {
2842 use std::string::ToString;
2843 match value {
2844 "INSTANCE_TYPE_UNSPECIFIED" => Self::Unspecified,
2845 "PROVISIONED" => Self::Provisioned,
2846 "FREE_INSTANCE" => Self::FreeInstance,
2847 _ => Self::UnknownValue(instance_type::UnknownValue(
2848 wkt::internal::UnknownEnumValue::String(value.to_string()),
2849 )),
2850 }
2851 }
2852 }
2853
2854 impl serde::ser::Serialize for InstanceType {
2855 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2856 where
2857 S: serde::Serializer,
2858 {
2859 match self {
2860 Self::Unspecified => serializer.serialize_i32(0),
2861 Self::Provisioned => serializer.serialize_i32(1),
2862 Self::FreeInstance => serializer.serialize_i32(2),
2863 Self::UnknownValue(u) => u.0.serialize(serializer),
2864 }
2865 }
2866 }
2867
2868 impl<'de> serde::de::Deserialize<'de> for InstanceType {
2869 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2870 where
2871 D: serde::Deserializer<'de>,
2872 {
2873 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InstanceType>::new(
2874 ".google.spanner.admin.instance.v1.Instance.InstanceType",
2875 ))
2876 }
2877 }
2878
2879 /// The edition selected for this instance. Different editions provide
2880 /// different capabilities at different price points.
2881 ///
2882 /// # Working with unknown values
2883 ///
2884 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2885 /// additional enum variants at any time. Adding new variants is not considered
2886 /// a breaking change. Applications should write their code in anticipation of:
2887 ///
2888 /// - New values appearing in future releases of the client library, **and**
2889 /// - New values received dynamically, without application changes.
2890 ///
2891 /// Please consult the [Working with enums] section in the user guide for some
2892 /// guidelines.
2893 ///
2894 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2895 #[derive(Clone, Debug, PartialEq)]
2896 #[non_exhaustive]
2897 pub enum Edition {
2898 /// Edition not specified.
2899 Unspecified,
2900 /// Standard edition.
2901 Standard,
2902 /// Enterprise edition.
2903 Enterprise,
2904 /// Enterprise Plus edition.
2905 EnterprisePlus,
2906 /// If set, the enum was initialized with an unknown value.
2907 ///
2908 /// Applications can examine the value using [Edition::value] or
2909 /// [Edition::name].
2910 UnknownValue(edition::UnknownValue),
2911 }
2912
2913 #[doc(hidden)]
2914 pub mod edition {
2915 #[allow(unused_imports)]
2916 use super::*;
2917 #[derive(Clone, Debug, PartialEq)]
2918 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2919 }
2920
2921 impl Edition {
2922 /// Gets the enum value.
2923 ///
2924 /// Returns `None` if the enum contains an unknown value deserialized from
2925 /// the string representation of enums.
2926 pub fn value(&self) -> std::option::Option<i32> {
2927 match self {
2928 Self::Unspecified => std::option::Option::Some(0),
2929 Self::Standard => std::option::Option::Some(1),
2930 Self::Enterprise => std::option::Option::Some(2),
2931 Self::EnterprisePlus => std::option::Option::Some(3),
2932 Self::UnknownValue(u) => u.0.value(),
2933 }
2934 }
2935
2936 /// Gets the enum value as a string.
2937 ///
2938 /// Returns `None` if the enum contains an unknown value deserialized from
2939 /// the integer representation of enums.
2940 pub fn name(&self) -> std::option::Option<&str> {
2941 match self {
2942 Self::Unspecified => std::option::Option::Some("EDITION_UNSPECIFIED"),
2943 Self::Standard => std::option::Option::Some("STANDARD"),
2944 Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
2945 Self::EnterprisePlus => std::option::Option::Some("ENTERPRISE_PLUS"),
2946 Self::UnknownValue(u) => u.0.name(),
2947 }
2948 }
2949 }
2950
2951 impl std::default::Default for Edition {
2952 fn default() -> Self {
2953 use std::convert::From;
2954 Self::from(0)
2955 }
2956 }
2957
2958 impl std::fmt::Display for Edition {
2959 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2960 wkt::internal::display_enum(f, self.name(), self.value())
2961 }
2962 }
2963
2964 impl std::convert::From<i32> for Edition {
2965 fn from(value: i32) -> Self {
2966 match value {
2967 0 => Self::Unspecified,
2968 1 => Self::Standard,
2969 2 => Self::Enterprise,
2970 3 => Self::EnterprisePlus,
2971 _ => Self::UnknownValue(edition::UnknownValue(
2972 wkt::internal::UnknownEnumValue::Integer(value),
2973 )),
2974 }
2975 }
2976 }
2977
2978 impl std::convert::From<&str> for Edition {
2979 fn from(value: &str) -> Self {
2980 use std::string::ToString;
2981 match value {
2982 "EDITION_UNSPECIFIED" => Self::Unspecified,
2983 "STANDARD" => Self::Standard,
2984 "ENTERPRISE" => Self::Enterprise,
2985 "ENTERPRISE_PLUS" => Self::EnterprisePlus,
2986 _ => Self::UnknownValue(edition::UnknownValue(
2987 wkt::internal::UnknownEnumValue::String(value.to_string()),
2988 )),
2989 }
2990 }
2991 }
2992
2993 impl serde::ser::Serialize for Edition {
2994 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2995 where
2996 S: serde::Serializer,
2997 {
2998 match self {
2999 Self::Unspecified => serializer.serialize_i32(0),
3000 Self::Standard => serializer.serialize_i32(1),
3001 Self::Enterprise => serializer.serialize_i32(2),
3002 Self::EnterprisePlus => serializer.serialize_i32(3),
3003 Self::UnknownValue(u) => u.0.serialize(serializer),
3004 }
3005 }
3006 }
3007
3008 impl<'de> serde::de::Deserialize<'de> for Edition {
3009 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3010 where
3011 D: serde::Deserializer<'de>,
3012 {
3013 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Edition>::new(
3014 ".google.spanner.admin.instance.v1.Instance.Edition",
3015 ))
3016 }
3017 }
3018
3019 /// Indicates the
3020 /// [default backup
3021 /// schedule](https://cloud.google.com/spanner/docs/backup#default-backup-schedules)
3022 /// behavior for new databases within the instance.
3023 ///
3024 /// # Working with unknown values
3025 ///
3026 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3027 /// additional enum variants at any time. Adding new variants is not considered
3028 /// a breaking change. Applications should write their code in anticipation of:
3029 ///
3030 /// - New values appearing in future releases of the client library, **and**
3031 /// - New values received dynamically, without application changes.
3032 ///
3033 /// Please consult the [Working with enums] section in the user guide for some
3034 /// guidelines.
3035 ///
3036 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3037 #[derive(Clone, Debug, PartialEq)]
3038 #[non_exhaustive]
3039 pub enum DefaultBackupScheduleType {
3040 /// Not specified.
3041 Unspecified,
3042 /// A default backup schedule isn't created automatically when a new database
3043 /// is created in the instance.
3044 None,
3045 /// A default backup schedule is created automatically when a new database
3046 /// is created in the instance. The default backup schedule creates a full
3047 /// backup every 24 hours. These full backups are retained for 7 days.
3048 /// You can edit or delete the default backup schedule once it's created.
3049 Automatic,
3050 /// If set, the enum was initialized with an unknown value.
3051 ///
3052 /// Applications can examine the value using [DefaultBackupScheduleType::value] or
3053 /// [DefaultBackupScheduleType::name].
3054 UnknownValue(default_backup_schedule_type::UnknownValue),
3055 }
3056
3057 #[doc(hidden)]
3058 pub mod default_backup_schedule_type {
3059 #[allow(unused_imports)]
3060 use super::*;
3061 #[derive(Clone, Debug, PartialEq)]
3062 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3063 }
3064
3065 impl DefaultBackupScheduleType {
3066 /// Gets the enum value.
3067 ///
3068 /// Returns `None` if the enum contains an unknown value deserialized from
3069 /// the string representation of enums.
3070 pub fn value(&self) -> std::option::Option<i32> {
3071 match self {
3072 Self::Unspecified => std::option::Option::Some(0),
3073 Self::None => std::option::Option::Some(1),
3074 Self::Automatic => std::option::Option::Some(2),
3075 Self::UnknownValue(u) => u.0.value(),
3076 }
3077 }
3078
3079 /// Gets the enum value as a string.
3080 ///
3081 /// Returns `None` if the enum contains an unknown value deserialized from
3082 /// the integer representation of enums.
3083 pub fn name(&self) -> std::option::Option<&str> {
3084 match self {
3085 Self::Unspecified => {
3086 std::option::Option::Some("DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED")
3087 }
3088 Self::None => std::option::Option::Some("NONE"),
3089 Self::Automatic => std::option::Option::Some("AUTOMATIC"),
3090 Self::UnknownValue(u) => u.0.name(),
3091 }
3092 }
3093 }
3094
3095 impl std::default::Default for DefaultBackupScheduleType {
3096 fn default() -> Self {
3097 use std::convert::From;
3098 Self::from(0)
3099 }
3100 }
3101
3102 impl std::fmt::Display for DefaultBackupScheduleType {
3103 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3104 wkt::internal::display_enum(f, self.name(), self.value())
3105 }
3106 }
3107
3108 impl std::convert::From<i32> for DefaultBackupScheduleType {
3109 fn from(value: i32) -> Self {
3110 match value {
3111 0 => Self::Unspecified,
3112 1 => Self::None,
3113 2 => Self::Automatic,
3114 _ => Self::UnknownValue(default_backup_schedule_type::UnknownValue(
3115 wkt::internal::UnknownEnumValue::Integer(value),
3116 )),
3117 }
3118 }
3119 }
3120
3121 impl std::convert::From<&str> for DefaultBackupScheduleType {
3122 fn from(value: &str) -> Self {
3123 use std::string::ToString;
3124 match value {
3125 "DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
3126 "NONE" => Self::None,
3127 "AUTOMATIC" => Self::Automatic,
3128 _ => Self::UnknownValue(default_backup_schedule_type::UnknownValue(
3129 wkt::internal::UnknownEnumValue::String(value.to_string()),
3130 )),
3131 }
3132 }
3133 }
3134
3135 impl serde::ser::Serialize for DefaultBackupScheduleType {
3136 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3137 where
3138 S: serde::Serializer,
3139 {
3140 match self {
3141 Self::Unspecified => serializer.serialize_i32(0),
3142 Self::None => serializer.serialize_i32(1),
3143 Self::Automatic => serializer.serialize_i32(2),
3144 Self::UnknownValue(u) => u.0.serialize(serializer),
3145 }
3146 }
3147 }
3148
3149 impl<'de> serde::de::Deserialize<'de> for DefaultBackupScheduleType {
3150 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3151 where
3152 D: serde::Deserializer<'de>,
3153 {
3154 deserializer.deserialize_any(
3155 wkt::internal::EnumVisitor::<DefaultBackupScheduleType>::new(
3156 ".google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType",
3157 ),
3158 )
3159 }
3160 }
3161}
3162
3163/// The request for
3164/// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
3165///
3166/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
3167#[derive(Clone, Default, PartialEq)]
3168#[non_exhaustive]
3169pub struct ListInstanceConfigsRequest {
3170 /// Required. The name of the project for which a list of supported instance
3171 /// configurations is requested. Values are of the form
3172 /// `projects/<project>`.
3173 pub parent: std::string::String,
3174
3175 /// Number of instance configurations to be returned in the response. If 0 or
3176 /// less, defaults to the server's maximum allowed page size.
3177 pub page_size: i32,
3178
3179 /// If non-empty, `page_token` should contain a
3180 /// [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token]
3181 /// from a previous
3182 /// [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse].
3183 ///
3184 /// [google.spanner.admin.instance.v1.ListInstanceConfigsResponse]: crate::model::ListInstanceConfigsResponse
3185 /// [google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token]: crate::model::ListInstanceConfigsResponse::next_page_token
3186 pub page_token: std::string::String,
3187
3188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3189}
3190
3191impl ListInstanceConfigsRequest {
3192 pub fn new() -> Self {
3193 std::default::Default::default()
3194 }
3195
3196 /// Sets the value of [parent][crate::model::ListInstanceConfigsRequest::parent].
3197 ///
3198 /// # Example
3199 /// ```ignore,no_run
3200 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsRequest;
3201 /// let x = ListInstanceConfigsRequest::new().set_parent("example");
3202 /// ```
3203 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3204 self.parent = v.into();
3205 self
3206 }
3207
3208 /// Sets the value of [page_size][crate::model::ListInstanceConfigsRequest::page_size].
3209 ///
3210 /// # Example
3211 /// ```ignore,no_run
3212 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsRequest;
3213 /// let x = ListInstanceConfigsRequest::new().set_page_size(42);
3214 /// ```
3215 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3216 self.page_size = v.into();
3217 self
3218 }
3219
3220 /// Sets the value of [page_token][crate::model::ListInstanceConfigsRequest::page_token].
3221 ///
3222 /// # Example
3223 /// ```ignore,no_run
3224 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsRequest;
3225 /// let x = ListInstanceConfigsRequest::new().set_page_token("example");
3226 /// ```
3227 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3228 self.page_token = v.into();
3229 self
3230 }
3231}
3232
3233impl wkt::message::Message for ListInstanceConfigsRequest {
3234 fn typename() -> &'static str {
3235 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigsRequest"
3236 }
3237}
3238
3239/// The response for
3240/// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
3241///
3242/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
3243#[derive(Clone, Default, PartialEq)]
3244#[non_exhaustive]
3245pub struct ListInstanceConfigsResponse {
3246 /// The list of requested instance configurations.
3247 pub instance_configs: std::vec::Vec<crate::model::InstanceConfig>,
3248
3249 /// `next_page_token` can be sent in a subsequent
3250 /// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]
3251 /// call to fetch more of the matching instance configurations.
3252 ///
3253 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
3254 pub next_page_token: std::string::String,
3255
3256 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3257}
3258
3259impl ListInstanceConfigsResponse {
3260 pub fn new() -> Self {
3261 std::default::Default::default()
3262 }
3263
3264 /// Sets the value of [instance_configs][crate::model::ListInstanceConfigsResponse::instance_configs].
3265 ///
3266 /// # Example
3267 /// ```ignore,no_run
3268 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsResponse;
3269 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3270 /// let x = ListInstanceConfigsResponse::new()
3271 /// .set_instance_configs([
3272 /// InstanceConfig::default()/* use setters */,
3273 /// InstanceConfig::default()/* use (different) setters */,
3274 /// ]);
3275 /// ```
3276 pub fn set_instance_configs<T, V>(mut self, v: T) -> Self
3277 where
3278 T: std::iter::IntoIterator<Item = V>,
3279 V: std::convert::Into<crate::model::InstanceConfig>,
3280 {
3281 use std::iter::Iterator;
3282 self.instance_configs = v.into_iter().map(|i| i.into()).collect();
3283 self
3284 }
3285
3286 /// Sets the value of [next_page_token][crate::model::ListInstanceConfigsResponse::next_page_token].
3287 ///
3288 /// # Example
3289 /// ```ignore,no_run
3290 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsResponse;
3291 /// let x = ListInstanceConfigsResponse::new().set_next_page_token("example");
3292 /// ```
3293 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3294 self.next_page_token = v.into();
3295 self
3296 }
3297}
3298
3299impl wkt::message::Message for ListInstanceConfigsResponse {
3300 fn typename() -> &'static str {
3301 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigsResponse"
3302 }
3303}
3304
3305#[doc(hidden)]
3306impl gax::paginator::internal::PageableResponse for ListInstanceConfigsResponse {
3307 type PageItem = crate::model::InstanceConfig;
3308
3309 fn items(self) -> std::vec::Vec<Self::PageItem> {
3310 self.instance_configs
3311 }
3312
3313 fn next_page_token(&self) -> std::string::String {
3314 use std::clone::Clone;
3315 self.next_page_token.clone()
3316 }
3317}
3318
3319/// The request for
3320/// [GetInstanceConfigRequest][google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig].
3321///
3322/// [google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig]: crate::client::InstanceAdmin::get_instance_config
3323#[derive(Clone, Default, PartialEq)]
3324#[non_exhaustive]
3325pub struct GetInstanceConfigRequest {
3326 /// Required. The name of the requested instance configuration. Values are of
3327 /// the form `projects/<project>/instanceConfigs/<config>`.
3328 pub name: std::string::String,
3329
3330 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3331}
3332
3333impl GetInstanceConfigRequest {
3334 pub fn new() -> Self {
3335 std::default::Default::default()
3336 }
3337
3338 /// Sets the value of [name][crate::model::GetInstanceConfigRequest::name].
3339 ///
3340 /// # Example
3341 /// ```ignore,no_run
3342 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstanceConfigRequest;
3343 /// let x = GetInstanceConfigRequest::new().set_name("example");
3344 /// ```
3345 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3346 self.name = v.into();
3347 self
3348 }
3349}
3350
3351impl wkt::message::Message for GetInstanceConfigRequest {
3352 fn typename() -> &'static str {
3353 "type.googleapis.com/google.spanner.admin.instance.v1.GetInstanceConfigRequest"
3354 }
3355}
3356
3357/// The request for
3358/// [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig].
3359///
3360/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]: crate::client::InstanceAdmin::create_instance_config
3361#[derive(Clone, Default, PartialEq)]
3362#[non_exhaustive]
3363pub struct CreateInstanceConfigRequest {
3364 /// Required. The name of the project in which to create the instance
3365 /// configuration. Values are of the form `projects/<project>`.
3366 pub parent: std::string::String,
3367
3368 /// Required. The ID of the instance configuration to create. Valid identifiers
3369 /// are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64
3370 /// characters in length. The `custom-` prefix is required to avoid name
3371 /// conflicts with Google-managed configurations.
3372 pub instance_config_id: std::string::String,
3373
3374 /// Required. The `InstanceConfig` proto of the configuration to create.
3375 /// `instance_config.name` must be
3376 /// `<parent>/instanceConfigs/<instance_config_id>`.
3377 /// `instance_config.base_config` must be a Google-managed configuration name,
3378 /// e.g. \<parent\>/instanceConfigs/us-east1, \<parent\>/instanceConfigs/nam3.
3379 pub instance_config: std::option::Option<crate::model::InstanceConfig>,
3380
3381 /// An option to validate, but not actually execute, a request,
3382 /// and provide the same response.
3383 pub validate_only: bool,
3384
3385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3386}
3387
3388impl CreateInstanceConfigRequest {
3389 pub fn new() -> Self {
3390 std::default::Default::default()
3391 }
3392
3393 /// Sets the value of [parent][crate::model::CreateInstanceConfigRequest::parent].
3394 ///
3395 /// # Example
3396 /// ```ignore,no_run
3397 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3398 /// let x = CreateInstanceConfigRequest::new().set_parent("example");
3399 /// ```
3400 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3401 self.parent = v.into();
3402 self
3403 }
3404
3405 /// Sets the value of [instance_config_id][crate::model::CreateInstanceConfigRequest::instance_config_id].
3406 ///
3407 /// # Example
3408 /// ```ignore,no_run
3409 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3410 /// let x = CreateInstanceConfigRequest::new().set_instance_config_id("example");
3411 /// ```
3412 pub fn set_instance_config_id<T: std::convert::Into<std::string::String>>(
3413 mut self,
3414 v: T,
3415 ) -> Self {
3416 self.instance_config_id = v.into();
3417 self
3418 }
3419
3420 /// Sets the value of [instance_config][crate::model::CreateInstanceConfigRequest::instance_config].
3421 ///
3422 /// # Example
3423 /// ```ignore,no_run
3424 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3425 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3426 /// let x = CreateInstanceConfigRequest::new().set_instance_config(InstanceConfig::default()/* use setters */);
3427 /// ```
3428 pub fn set_instance_config<T>(mut self, v: T) -> Self
3429 where
3430 T: std::convert::Into<crate::model::InstanceConfig>,
3431 {
3432 self.instance_config = std::option::Option::Some(v.into());
3433 self
3434 }
3435
3436 /// Sets or clears the value of [instance_config][crate::model::CreateInstanceConfigRequest::instance_config].
3437 ///
3438 /// # Example
3439 /// ```ignore,no_run
3440 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3441 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3442 /// let x = CreateInstanceConfigRequest::new().set_or_clear_instance_config(Some(InstanceConfig::default()/* use setters */));
3443 /// let x = CreateInstanceConfigRequest::new().set_or_clear_instance_config(None::<InstanceConfig>);
3444 /// ```
3445 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
3446 where
3447 T: std::convert::Into<crate::model::InstanceConfig>,
3448 {
3449 self.instance_config = v.map(|x| x.into());
3450 self
3451 }
3452
3453 /// Sets the value of [validate_only][crate::model::CreateInstanceConfigRequest::validate_only].
3454 ///
3455 /// # Example
3456 /// ```ignore,no_run
3457 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3458 /// let x = CreateInstanceConfigRequest::new().set_validate_only(true);
3459 /// ```
3460 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3461 self.validate_only = v.into();
3462 self
3463 }
3464}
3465
3466impl wkt::message::Message for CreateInstanceConfigRequest {
3467 fn typename() -> &'static str {
3468 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigRequest"
3469 }
3470}
3471
3472/// The request for
3473/// [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig].
3474///
3475/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]: crate::client::InstanceAdmin::update_instance_config
3476#[derive(Clone, Default, PartialEq)]
3477#[non_exhaustive]
3478pub struct UpdateInstanceConfigRequest {
3479 /// Required. The user instance configuration to update, which must always
3480 /// include the instance configuration name. Otherwise, only fields mentioned
3481 /// in
3482 /// [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask]
3483 /// need be included. To prevent conflicts of concurrent updates,
3484 /// [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can
3485 /// be used.
3486 ///
3487 /// [google.spanner.admin.instance.v1.InstanceConfig.reconciling]: crate::model::InstanceConfig::reconciling
3488 /// [google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask]: crate::model::UpdateInstanceConfigRequest::update_mask
3489 pub instance_config: std::option::Option<crate::model::InstanceConfig>,
3490
3491 /// Required. A mask specifying which fields in
3492 /// [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be
3493 /// updated. The field mask must always be specified; this prevents any future
3494 /// fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig]
3495 /// from being erased accidentally by clients that do not know about them. Only
3496 /// display_name and labels can be updated.
3497 ///
3498 /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
3499 pub update_mask: std::option::Option<wkt::FieldMask>,
3500
3501 /// An option to validate, but not actually execute, a request,
3502 /// and provide the same response.
3503 pub validate_only: bool,
3504
3505 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3506}
3507
3508impl UpdateInstanceConfigRequest {
3509 pub fn new() -> Self {
3510 std::default::Default::default()
3511 }
3512
3513 /// Sets the value of [instance_config][crate::model::UpdateInstanceConfigRequest::instance_config].
3514 ///
3515 /// # Example
3516 /// ```ignore,no_run
3517 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3518 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3519 /// let x = UpdateInstanceConfigRequest::new().set_instance_config(InstanceConfig::default()/* use setters */);
3520 /// ```
3521 pub fn set_instance_config<T>(mut self, v: T) -> Self
3522 where
3523 T: std::convert::Into<crate::model::InstanceConfig>,
3524 {
3525 self.instance_config = std::option::Option::Some(v.into());
3526 self
3527 }
3528
3529 /// Sets or clears the value of [instance_config][crate::model::UpdateInstanceConfigRequest::instance_config].
3530 ///
3531 /// # Example
3532 /// ```ignore,no_run
3533 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3534 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3535 /// let x = UpdateInstanceConfigRequest::new().set_or_clear_instance_config(Some(InstanceConfig::default()/* use setters */));
3536 /// let x = UpdateInstanceConfigRequest::new().set_or_clear_instance_config(None::<InstanceConfig>);
3537 /// ```
3538 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
3539 where
3540 T: std::convert::Into<crate::model::InstanceConfig>,
3541 {
3542 self.instance_config = v.map(|x| x.into());
3543 self
3544 }
3545
3546 /// Sets the value of [update_mask][crate::model::UpdateInstanceConfigRequest::update_mask].
3547 ///
3548 /// # Example
3549 /// ```ignore,no_run
3550 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3551 /// use wkt::FieldMask;
3552 /// let x = UpdateInstanceConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3553 /// ```
3554 pub fn set_update_mask<T>(mut self, v: T) -> Self
3555 where
3556 T: std::convert::Into<wkt::FieldMask>,
3557 {
3558 self.update_mask = std::option::Option::Some(v.into());
3559 self
3560 }
3561
3562 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceConfigRequest::update_mask].
3563 ///
3564 /// # Example
3565 /// ```ignore,no_run
3566 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3567 /// use wkt::FieldMask;
3568 /// let x = UpdateInstanceConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3569 /// let x = UpdateInstanceConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3570 /// ```
3571 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3572 where
3573 T: std::convert::Into<wkt::FieldMask>,
3574 {
3575 self.update_mask = v.map(|x| x.into());
3576 self
3577 }
3578
3579 /// Sets the value of [validate_only][crate::model::UpdateInstanceConfigRequest::validate_only].
3580 ///
3581 /// # Example
3582 /// ```ignore,no_run
3583 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3584 /// let x = UpdateInstanceConfigRequest::new().set_validate_only(true);
3585 /// ```
3586 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3587 self.validate_only = v.into();
3588 self
3589 }
3590}
3591
3592impl wkt::message::Message for UpdateInstanceConfigRequest {
3593 fn typename() -> &'static str {
3594 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceConfigRequest"
3595 }
3596}
3597
3598/// The request for
3599/// [DeleteInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstanceConfig].
3600///
3601/// [google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstanceConfig]: crate::client::InstanceAdmin::delete_instance_config
3602#[derive(Clone, Default, PartialEq)]
3603#[non_exhaustive]
3604pub struct DeleteInstanceConfigRequest {
3605 /// Required. The name of the instance configuration to be deleted.
3606 /// Values are of the form
3607 /// `projects/<project>/instanceConfigs/<instance_config>`
3608 pub name: std::string::String,
3609
3610 /// Used for optimistic concurrency control as a way to help prevent
3611 /// simultaneous deletes of an instance configuration from overwriting each
3612 /// other. If not empty, the API
3613 /// only deletes the instance configuration when the etag provided matches the
3614 /// current status of the requested instance configuration. Otherwise, deletes
3615 /// the instance configuration without checking the current status of the
3616 /// requested instance configuration.
3617 pub etag: std::string::String,
3618
3619 /// An option to validate, but not actually execute, a request,
3620 /// and provide the same response.
3621 pub validate_only: bool,
3622
3623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3624}
3625
3626impl DeleteInstanceConfigRequest {
3627 pub fn new() -> Self {
3628 std::default::Default::default()
3629 }
3630
3631 /// Sets the value of [name][crate::model::DeleteInstanceConfigRequest::name].
3632 ///
3633 /// # Example
3634 /// ```ignore,no_run
3635 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstanceConfigRequest;
3636 /// let x = DeleteInstanceConfigRequest::new().set_name("example");
3637 /// ```
3638 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3639 self.name = v.into();
3640 self
3641 }
3642
3643 /// Sets the value of [etag][crate::model::DeleteInstanceConfigRequest::etag].
3644 ///
3645 /// # Example
3646 /// ```ignore,no_run
3647 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstanceConfigRequest;
3648 /// let x = DeleteInstanceConfigRequest::new().set_etag("example");
3649 /// ```
3650 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3651 self.etag = v.into();
3652 self
3653 }
3654
3655 /// Sets the value of [validate_only][crate::model::DeleteInstanceConfigRequest::validate_only].
3656 ///
3657 /// # Example
3658 /// ```ignore,no_run
3659 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstanceConfigRequest;
3660 /// let x = DeleteInstanceConfigRequest::new().set_validate_only(true);
3661 /// ```
3662 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3663 self.validate_only = v.into();
3664 self
3665 }
3666}
3667
3668impl wkt::message::Message for DeleteInstanceConfigRequest {
3669 fn typename() -> &'static str {
3670 "type.googleapis.com/google.spanner.admin.instance.v1.DeleteInstanceConfigRequest"
3671 }
3672}
3673
3674/// The request for
3675/// [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations].
3676///
3677/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]: crate::client::InstanceAdmin::list_instance_config_operations
3678#[derive(Clone, Default, PartialEq)]
3679#[non_exhaustive]
3680pub struct ListInstanceConfigOperationsRequest {
3681 /// Required. The project of the instance configuration operations.
3682 /// Values are of the form `projects/<project>`.
3683 pub parent: std::string::String,
3684
3685 /// An expression that filters the list of returned operations.
3686 ///
3687 /// A filter expression consists of a field name, a
3688 /// comparison operator, and a value for filtering.
3689 /// The value must be a string, a number, or a boolean. The comparison operator
3690 /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
3691 /// Colon `:` is the contains operator. Filter rules are not case sensitive.
3692 ///
3693 /// The following fields in the Operation are eligible for filtering:
3694 ///
3695 /// * `name` - The name of the long-running operation
3696 /// * `done` - False if the operation is in progress, else true.
3697 /// * `metadata.@type` - the type of metadata. For example, the type string
3698 /// for
3699 /// [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]
3700 /// is
3701 /// `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`.
3702 /// * `metadata.<field_name>` - any field in metadata.value.
3703 /// `metadata.@type` must be specified first, if filtering on metadata
3704 /// fields.
3705 /// * `error` - Error associated with the long-running operation.
3706 /// * `response.@type` - the type of response.
3707 /// * `response.<field_name>` - any field in response.value.
3708 ///
3709 /// You can combine multiple expressions by enclosing each expression in
3710 /// parentheses. By default, expressions are combined with AND logic. However,
3711 /// you can specify AND, OR, and NOT logic explicitly.
3712 ///
3713 /// Here are a few examples:
3714 ///
3715 /// * `done:true` - The operation is complete.
3716 /// * `(metadata.@type=` \
3717 /// `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata)
3718 /// AND` \
3719 /// `(metadata.instance_config.name:custom-config) AND` \
3720 /// `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \
3721 /// `(error:*)` - Return operations where:
3722 /// * The operation's metadata type is
3723 /// [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata].
3724 /// * The instance configuration name contains "custom-config".
3725 /// * The operation started before 2021-03-28T14:50:00Z.
3726 /// * The operation resulted in an error.
3727 ///
3728 /// [google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]: crate::model::CreateInstanceConfigMetadata
3729 pub filter: std::string::String,
3730
3731 /// Number of operations to be returned in the response. If 0 or
3732 /// less, defaults to the server's maximum allowed page size.
3733 pub page_size: i32,
3734
3735 /// If non-empty, `page_token` should contain a
3736 /// [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token]
3737 /// from a previous
3738 /// [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse]
3739 /// to the same `parent` and with the same `filter`.
3740 ///
3741 /// [google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse]: crate::model::ListInstanceConfigOperationsResponse
3742 /// [google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token]: crate::model::ListInstanceConfigOperationsResponse::next_page_token
3743 pub page_token: std::string::String,
3744
3745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3746}
3747
3748impl ListInstanceConfigOperationsRequest {
3749 pub fn new() -> Self {
3750 std::default::Default::default()
3751 }
3752
3753 /// Sets the value of [parent][crate::model::ListInstanceConfigOperationsRequest::parent].
3754 ///
3755 /// # Example
3756 /// ```ignore,no_run
3757 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsRequest;
3758 /// let x = ListInstanceConfigOperationsRequest::new().set_parent("example");
3759 /// ```
3760 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3761 self.parent = v.into();
3762 self
3763 }
3764
3765 /// Sets the value of [filter][crate::model::ListInstanceConfigOperationsRequest::filter].
3766 ///
3767 /// # Example
3768 /// ```ignore,no_run
3769 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsRequest;
3770 /// let x = ListInstanceConfigOperationsRequest::new().set_filter("example");
3771 /// ```
3772 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3773 self.filter = v.into();
3774 self
3775 }
3776
3777 /// Sets the value of [page_size][crate::model::ListInstanceConfigOperationsRequest::page_size].
3778 ///
3779 /// # Example
3780 /// ```ignore,no_run
3781 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsRequest;
3782 /// let x = ListInstanceConfigOperationsRequest::new().set_page_size(42);
3783 /// ```
3784 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3785 self.page_size = v.into();
3786 self
3787 }
3788
3789 /// Sets the value of [page_token][crate::model::ListInstanceConfigOperationsRequest::page_token].
3790 ///
3791 /// # Example
3792 /// ```ignore,no_run
3793 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsRequest;
3794 /// let x = ListInstanceConfigOperationsRequest::new().set_page_token("example");
3795 /// ```
3796 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3797 self.page_token = v.into();
3798 self
3799 }
3800}
3801
3802impl wkt::message::Message for ListInstanceConfigOperationsRequest {
3803 fn typename() -> &'static str {
3804 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest"
3805 }
3806}
3807
3808/// The response for
3809/// [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations].
3810///
3811/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]: crate::client::InstanceAdmin::list_instance_config_operations
3812#[derive(Clone, Default, PartialEq)]
3813#[non_exhaustive]
3814pub struct ListInstanceConfigOperationsResponse {
3815 /// The list of matching instance configuration long-running operations. Each
3816 /// operation's name will be
3817 /// prefixed by the name of the instance configuration. The operation's
3818 /// metadata field type
3819 /// `metadata.type_url` describes the type of the metadata.
3820 pub operations: std::vec::Vec<longrunning::model::Operation>,
3821
3822 /// `next_page_token` can be sent in a subsequent
3823 /// [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]
3824 /// call to fetch more of the matching metadata.
3825 ///
3826 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]: crate::client::InstanceAdmin::list_instance_config_operations
3827 pub next_page_token: std::string::String,
3828
3829 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3830}
3831
3832impl ListInstanceConfigOperationsResponse {
3833 pub fn new() -> Self {
3834 std::default::Default::default()
3835 }
3836
3837 /// Sets the value of [operations][crate::model::ListInstanceConfigOperationsResponse::operations].
3838 ///
3839 /// # Example
3840 /// ```ignore,no_run
3841 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsResponse;
3842 /// use longrunning::model::Operation;
3843 /// let x = ListInstanceConfigOperationsResponse::new()
3844 /// .set_operations([
3845 /// Operation::default()/* use setters */,
3846 /// Operation::default()/* use (different) setters */,
3847 /// ]);
3848 /// ```
3849 pub fn set_operations<T, V>(mut self, v: T) -> Self
3850 where
3851 T: std::iter::IntoIterator<Item = V>,
3852 V: std::convert::Into<longrunning::model::Operation>,
3853 {
3854 use std::iter::Iterator;
3855 self.operations = v.into_iter().map(|i| i.into()).collect();
3856 self
3857 }
3858
3859 /// Sets the value of [next_page_token][crate::model::ListInstanceConfigOperationsResponse::next_page_token].
3860 ///
3861 /// # Example
3862 /// ```ignore,no_run
3863 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsResponse;
3864 /// let x = ListInstanceConfigOperationsResponse::new().set_next_page_token("example");
3865 /// ```
3866 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3867 self.next_page_token = v.into();
3868 self
3869 }
3870}
3871
3872impl wkt::message::Message for ListInstanceConfigOperationsResponse {
3873 fn typename() -> &'static str {
3874 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse"
3875 }
3876}
3877
3878#[doc(hidden)]
3879impl gax::paginator::internal::PageableResponse for ListInstanceConfigOperationsResponse {
3880 type PageItem = longrunning::model::Operation;
3881
3882 fn items(self) -> std::vec::Vec<Self::PageItem> {
3883 self.operations
3884 }
3885
3886 fn next_page_token(&self) -> std::string::String {
3887 use std::clone::Clone;
3888 self.next_page_token.clone()
3889 }
3890}
3891
3892/// The request for
3893/// [GetInstance][google.spanner.admin.instance.v1.InstanceAdmin.GetInstance].
3894///
3895/// [google.spanner.admin.instance.v1.InstanceAdmin.GetInstance]: crate::client::InstanceAdmin::get_instance
3896#[derive(Clone, Default, PartialEq)]
3897#[non_exhaustive]
3898pub struct GetInstanceRequest {
3899 /// Required. The name of the requested instance. Values are of the form
3900 /// `projects/<project>/instances/<instance>`.
3901 pub name: std::string::String,
3902
3903 /// If field_mask is present, specifies the subset of
3904 /// [Instance][google.spanner.admin.instance.v1.Instance] fields that should be
3905 /// returned. If absent, all
3906 /// [Instance][google.spanner.admin.instance.v1.Instance] fields are returned.
3907 ///
3908 /// [google.spanner.admin.instance.v1.Instance]: crate::model::Instance
3909 pub field_mask: std::option::Option<wkt::FieldMask>,
3910
3911 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3912}
3913
3914impl GetInstanceRequest {
3915 pub fn new() -> Self {
3916 std::default::Default::default()
3917 }
3918
3919 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3920 ///
3921 /// # Example
3922 /// ```ignore,no_run
3923 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstanceRequest;
3924 /// let x = GetInstanceRequest::new().set_name("example");
3925 /// ```
3926 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3927 self.name = v.into();
3928 self
3929 }
3930
3931 /// Sets the value of [field_mask][crate::model::GetInstanceRequest::field_mask].
3932 ///
3933 /// # Example
3934 /// ```ignore,no_run
3935 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstanceRequest;
3936 /// use wkt::FieldMask;
3937 /// let x = GetInstanceRequest::new().set_field_mask(FieldMask::default()/* use setters */);
3938 /// ```
3939 pub fn set_field_mask<T>(mut self, v: T) -> Self
3940 where
3941 T: std::convert::Into<wkt::FieldMask>,
3942 {
3943 self.field_mask = std::option::Option::Some(v.into());
3944 self
3945 }
3946
3947 /// Sets or clears the value of [field_mask][crate::model::GetInstanceRequest::field_mask].
3948 ///
3949 /// # Example
3950 /// ```ignore,no_run
3951 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstanceRequest;
3952 /// use wkt::FieldMask;
3953 /// let x = GetInstanceRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
3954 /// let x = GetInstanceRequest::new().set_or_clear_field_mask(None::<FieldMask>);
3955 /// ```
3956 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
3957 where
3958 T: std::convert::Into<wkt::FieldMask>,
3959 {
3960 self.field_mask = v.map(|x| x.into());
3961 self
3962 }
3963}
3964
3965impl wkt::message::Message for GetInstanceRequest {
3966 fn typename() -> &'static str {
3967 "type.googleapis.com/google.spanner.admin.instance.v1.GetInstanceRequest"
3968 }
3969}
3970
3971/// The request for
3972/// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance].
3973///
3974/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
3975#[derive(Clone, Default, PartialEq)]
3976#[non_exhaustive]
3977pub struct CreateInstanceRequest {
3978 /// Required. The name of the project in which to create the instance. Values
3979 /// are of the form `projects/<project>`.
3980 pub parent: std::string::String,
3981
3982 /// Required. The ID of the instance to create. Valid identifiers are of the
3983 /// form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in
3984 /// length.
3985 pub instance_id: std::string::String,
3986
3987 /// Required. The instance to create. The name may be omitted, but if
3988 /// specified must be `<parent>/instances/<instance_id>`.
3989 pub instance: std::option::Option<crate::model::Instance>,
3990
3991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3992}
3993
3994impl CreateInstanceRequest {
3995 pub fn new() -> Self {
3996 std::default::Default::default()
3997 }
3998
3999 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
4000 ///
4001 /// # Example
4002 /// ```ignore,no_run
4003 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceRequest;
4004 /// let x = CreateInstanceRequest::new().set_parent("example");
4005 /// ```
4006 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4007 self.parent = v.into();
4008 self
4009 }
4010
4011 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
4012 ///
4013 /// # Example
4014 /// ```ignore,no_run
4015 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceRequest;
4016 /// let x = CreateInstanceRequest::new().set_instance_id("example");
4017 /// ```
4018 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4019 self.instance_id = v.into();
4020 self
4021 }
4022
4023 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
4024 ///
4025 /// # Example
4026 /// ```ignore,no_run
4027 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceRequest;
4028 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4029 /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
4030 /// ```
4031 pub fn set_instance<T>(mut self, v: T) -> Self
4032 where
4033 T: std::convert::Into<crate::model::Instance>,
4034 {
4035 self.instance = std::option::Option::Some(v.into());
4036 self
4037 }
4038
4039 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
4040 ///
4041 /// # Example
4042 /// ```ignore,no_run
4043 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceRequest;
4044 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4045 /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
4046 /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
4047 /// ```
4048 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4049 where
4050 T: std::convert::Into<crate::model::Instance>,
4051 {
4052 self.instance = v.map(|x| x.into());
4053 self
4054 }
4055}
4056
4057impl wkt::message::Message for CreateInstanceRequest {
4058 fn typename() -> &'static str {
4059 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceRequest"
4060 }
4061}
4062
4063/// The request for
4064/// [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].
4065///
4066/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]: crate::client::InstanceAdmin::list_instances
4067#[derive(Clone, Default, PartialEq)]
4068#[non_exhaustive]
4069pub struct ListInstancesRequest {
4070 /// Required. The name of the project for which a list of instances is
4071 /// requested. Values are of the form `projects/<project>`.
4072 pub parent: std::string::String,
4073
4074 /// Number of instances to be returned in the response. If 0 or less, defaults
4075 /// to the server's maximum allowed page size.
4076 pub page_size: i32,
4077
4078 /// If non-empty, `page_token` should contain a
4079 /// [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token]
4080 /// from a previous
4081 /// [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
4082 ///
4083 /// [google.spanner.admin.instance.v1.ListInstancesResponse]: crate::model::ListInstancesResponse
4084 /// [google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token]: crate::model::ListInstancesResponse::next_page_token
4085 pub page_token: std::string::String,
4086
4087 /// An expression for filtering the results of the request. Filter rules are
4088 /// case insensitive. The fields eligible for filtering are:
4089 ///
4090 /// * `name`
4091 /// * `display_name`
4092 /// * `labels.key` where key is the name of a label
4093 ///
4094 /// Some examples of using filters are:
4095 ///
4096 /// * `name:*` --> The instance has a name.
4097 /// * `name:Howl` --> The instance's name contains the string "howl".
4098 /// * `name:HOWL` --> Equivalent to above.
4099 /// * `NAME:howl` --> Equivalent to above.
4100 /// * `labels.env:*` --> The instance has the label "env".
4101 /// * `labels.env:dev` --> The instance has the label "env" and the value of
4102 /// the label contains the string "dev".
4103 /// * `name:howl labels.env:dev` --> The instance's name contains "howl" and
4104 /// it has the label "env" with its value
4105 /// containing "dev".
4106 pub filter: std::string::String,
4107
4108 /// Deadline used while retrieving metadata for instances.
4109 /// Instances whose metadata cannot be retrieved within this deadline will be
4110 /// added to
4111 /// [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
4112 /// in
4113 /// [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
4114 ///
4115 /// [google.spanner.admin.instance.v1.ListInstancesResponse]: crate::model::ListInstancesResponse
4116 /// [google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]: crate::model::ListInstancesResponse::unreachable
4117 pub instance_deadline: std::option::Option<wkt::Timestamp>,
4118
4119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4120}
4121
4122impl ListInstancesRequest {
4123 pub fn new() -> Self {
4124 std::default::Default::default()
4125 }
4126
4127 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
4128 ///
4129 /// # Example
4130 /// ```ignore,no_run
4131 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4132 /// let x = ListInstancesRequest::new().set_parent("example");
4133 /// ```
4134 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4135 self.parent = v.into();
4136 self
4137 }
4138
4139 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
4140 ///
4141 /// # Example
4142 /// ```ignore,no_run
4143 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4144 /// let x = ListInstancesRequest::new().set_page_size(42);
4145 /// ```
4146 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4147 self.page_size = v.into();
4148 self
4149 }
4150
4151 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
4152 ///
4153 /// # Example
4154 /// ```ignore,no_run
4155 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4156 /// let x = ListInstancesRequest::new().set_page_token("example");
4157 /// ```
4158 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4159 self.page_token = v.into();
4160 self
4161 }
4162
4163 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
4164 ///
4165 /// # Example
4166 /// ```ignore,no_run
4167 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4168 /// let x = ListInstancesRequest::new().set_filter("example");
4169 /// ```
4170 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4171 self.filter = v.into();
4172 self
4173 }
4174
4175 /// Sets the value of [instance_deadline][crate::model::ListInstancesRequest::instance_deadline].
4176 ///
4177 /// # Example
4178 /// ```ignore,no_run
4179 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4180 /// use wkt::Timestamp;
4181 /// let x = ListInstancesRequest::new().set_instance_deadline(Timestamp::default()/* use setters */);
4182 /// ```
4183 pub fn set_instance_deadline<T>(mut self, v: T) -> Self
4184 where
4185 T: std::convert::Into<wkt::Timestamp>,
4186 {
4187 self.instance_deadline = std::option::Option::Some(v.into());
4188 self
4189 }
4190
4191 /// Sets or clears the value of [instance_deadline][crate::model::ListInstancesRequest::instance_deadline].
4192 ///
4193 /// # Example
4194 /// ```ignore,no_run
4195 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4196 /// use wkt::Timestamp;
4197 /// let x = ListInstancesRequest::new().set_or_clear_instance_deadline(Some(Timestamp::default()/* use setters */));
4198 /// let x = ListInstancesRequest::new().set_or_clear_instance_deadline(None::<Timestamp>);
4199 /// ```
4200 pub fn set_or_clear_instance_deadline<T>(mut self, v: std::option::Option<T>) -> Self
4201 where
4202 T: std::convert::Into<wkt::Timestamp>,
4203 {
4204 self.instance_deadline = v.map(|x| x.into());
4205 self
4206 }
4207}
4208
4209impl wkt::message::Message for ListInstancesRequest {
4210 fn typename() -> &'static str {
4211 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancesRequest"
4212 }
4213}
4214
4215/// The response for
4216/// [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].
4217///
4218/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]: crate::client::InstanceAdmin::list_instances
4219#[derive(Clone, Default, PartialEq)]
4220#[non_exhaustive]
4221pub struct ListInstancesResponse {
4222 /// The list of requested instances.
4223 pub instances: std::vec::Vec<crate::model::Instance>,
4224
4225 /// `next_page_token` can be sent in a subsequent
4226 /// [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]
4227 /// call to fetch more of the matching instances.
4228 ///
4229 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]: crate::client::InstanceAdmin::list_instances
4230 pub next_page_token: std::string::String,
4231
4232 /// The list of unreachable instances.
4233 /// It includes the names of instances whose metadata could not be retrieved
4234 /// within
4235 /// [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
4236 ///
4237 /// [google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]: crate::model::ListInstancesRequest::instance_deadline
4238 pub unreachable: std::vec::Vec<std::string::String>,
4239
4240 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4241}
4242
4243impl ListInstancesResponse {
4244 pub fn new() -> Self {
4245 std::default::Default::default()
4246 }
4247
4248 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
4249 ///
4250 /// # Example
4251 /// ```ignore,no_run
4252 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesResponse;
4253 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4254 /// let x = ListInstancesResponse::new()
4255 /// .set_instances([
4256 /// Instance::default()/* use setters */,
4257 /// Instance::default()/* use (different) setters */,
4258 /// ]);
4259 /// ```
4260 pub fn set_instances<T, V>(mut self, v: T) -> Self
4261 where
4262 T: std::iter::IntoIterator<Item = V>,
4263 V: std::convert::Into<crate::model::Instance>,
4264 {
4265 use std::iter::Iterator;
4266 self.instances = v.into_iter().map(|i| i.into()).collect();
4267 self
4268 }
4269
4270 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
4271 ///
4272 /// # Example
4273 /// ```ignore,no_run
4274 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesResponse;
4275 /// let x = ListInstancesResponse::new().set_next_page_token("example");
4276 /// ```
4277 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4278 self.next_page_token = v.into();
4279 self
4280 }
4281
4282 /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
4283 ///
4284 /// # Example
4285 /// ```ignore,no_run
4286 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesResponse;
4287 /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
4288 /// ```
4289 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4290 where
4291 T: std::iter::IntoIterator<Item = V>,
4292 V: std::convert::Into<std::string::String>,
4293 {
4294 use std::iter::Iterator;
4295 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4296 self
4297 }
4298}
4299
4300impl wkt::message::Message for ListInstancesResponse {
4301 fn typename() -> &'static str {
4302 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancesResponse"
4303 }
4304}
4305
4306#[doc(hidden)]
4307impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
4308 type PageItem = crate::model::Instance;
4309
4310 fn items(self) -> std::vec::Vec<Self::PageItem> {
4311 self.instances
4312 }
4313
4314 fn next_page_token(&self) -> std::string::String {
4315 use std::clone::Clone;
4316 self.next_page_token.clone()
4317 }
4318}
4319
4320/// The request for
4321/// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance].
4322///
4323/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
4324#[derive(Clone, Default, PartialEq)]
4325#[non_exhaustive]
4326pub struct UpdateInstanceRequest {
4327 /// Required. The instance to update, which must always include the instance
4328 /// name. Otherwise, only fields mentioned in
4329 /// [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask]
4330 /// need be included.
4331 ///
4332 /// [google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask]: crate::model::UpdateInstanceRequest::field_mask
4333 pub instance: std::option::Option<crate::model::Instance>,
4334
4335 /// Required. A mask specifying which fields in
4336 /// [Instance][google.spanner.admin.instance.v1.Instance] should be updated.
4337 /// The field mask must always be specified; this prevents any future fields in
4338 /// [Instance][google.spanner.admin.instance.v1.Instance] from being erased
4339 /// accidentally by clients that do not know about them.
4340 ///
4341 /// [google.spanner.admin.instance.v1.Instance]: crate::model::Instance
4342 pub field_mask: std::option::Option<wkt::FieldMask>,
4343
4344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4345}
4346
4347impl UpdateInstanceRequest {
4348 pub fn new() -> Self {
4349 std::default::Default::default()
4350 }
4351
4352 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
4353 ///
4354 /// # Example
4355 /// ```ignore,no_run
4356 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceRequest;
4357 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4358 /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
4359 /// ```
4360 pub fn set_instance<T>(mut self, v: T) -> Self
4361 where
4362 T: std::convert::Into<crate::model::Instance>,
4363 {
4364 self.instance = std::option::Option::Some(v.into());
4365 self
4366 }
4367
4368 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
4369 ///
4370 /// # Example
4371 /// ```ignore,no_run
4372 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceRequest;
4373 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4374 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
4375 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
4376 /// ```
4377 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4378 where
4379 T: std::convert::Into<crate::model::Instance>,
4380 {
4381 self.instance = v.map(|x| x.into());
4382 self
4383 }
4384
4385 /// Sets the value of [field_mask][crate::model::UpdateInstanceRequest::field_mask].
4386 ///
4387 /// # Example
4388 /// ```ignore,no_run
4389 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceRequest;
4390 /// use wkt::FieldMask;
4391 /// let x = UpdateInstanceRequest::new().set_field_mask(FieldMask::default()/* use setters */);
4392 /// ```
4393 pub fn set_field_mask<T>(mut self, v: T) -> Self
4394 where
4395 T: std::convert::Into<wkt::FieldMask>,
4396 {
4397 self.field_mask = std::option::Option::Some(v.into());
4398 self
4399 }
4400
4401 /// Sets or clears the value of [field_mask][crate::model::UpdateInstanceRequest::field_mask].
4402 ///
4403 /// # Example
4404 /// ```ignore,no_run
4405 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceRequest;
4406 /// use wkt::FieldMask;
4407 /// let x = UpdateInstanceRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
4408 /// let x = UpdateInstanceRequest::new().set_or_clear_field_mask(None::<FieldMask>);
4409 /// ```
4410 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
4411 where
4412 T: std::convert::Into<wkt::FieldMask>,
4413 {
4414 self.field_mask = v.map(|x| x.into());
4415 self
4416 }
4417}
4418
4419impl wkt::message::Message for UpdateInstanceRequest {
4420 fn typename() -> &'static str {
4421 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceRequest"
4422 }
4423}
4424
4425/// The request for
4426/// [DeleteInstance][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance].
4427///
4428/// [google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance]: crate::client::InstanceAdmin::delete_instance
4429#[derive(Clone, Default, PartialEq)]
4430#[non_exhaustive]
4431pub struct DeleteInstanceRequest {
4432 /// Required. The name of the instance to be deleted. Values are of the form
4433 /// `projects/<project>/instances/<instance>`
4434 pub name: std::string::String,
4435
4436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4437}
4438
4439impl DeleteInstanceRequest {
4440 pub fn new() -> Self {
4441 std::default::Default::default()
4442 }
4443
4444 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
4445 ///
4446 /// # Example
4447 /// ```ignore,no_run
4448 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstanceRequest;
4449 /// let x = DeleteInstanceRequest::new().set_name("example");
4450 /// ```
4451 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4452 self.name = v.into();
4453 self
4454 }
4455}
4456
4457impl wkt::message::Message for DeleteInstanceRequest {
4458 fn typename() -> &'static str {
4459 "type.googleapis.com/google.spanner.admin.instance.v1.DeleteInstanceRequest"
4460 }
4461}
4462
4463/// Metadata type for the operation returned by
4464/// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance].
4465///
4466/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
4467#[derive(Clone, Default, PartialEq)]
4468#[non_exhaustive]
4469pub struct CreateInstanceMetadata {
4470 /// The instance being created.
4471 pub instance: std::option::Option<crate::model::Instance>,
4472
4473 /// The time at which the
4474 /// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]
4475 /// request was received.
4476 ///
4477 /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
4478 pub start_time: std::option::Option<wkt::Timestamp>,
4479
4480 /// The time at which this operation was cancelled. If set, this operation is
4481 /// in the process of undoing itself (which is guaranteed to succeed) and
4482 /// cannot be cancelled again.
4483 pub cancel_time: std::option::Option<wkt::Timestamp>,
4484
4485 /// The time at which this operation failed or was completed successfully.
4486 pub end_time: std::option::Option<wkt::Timestamp>,
4487
4488 /// The expected fulfillment period of this create operation.
4489 pub expected_fulfillment_period: crate::model::FulfillmentPeriod,
4490
4491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4492}
4493
4494impl CreateInstanceMetadata {
4495 pub fn new() -> Self {
4496 std::default::Default::default()
4497 }
4498
4499 /// Sets the value of [instance][crate::model::CreateInstanceMetadata::instance].
4500 ///
4501 /// # Example
4502 /// ```ignore,no_run
4503 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4504 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4505 /// let x = CreateInstanceMetadata::new().set_instance(Instance::default()/* use setters */);
4506 /// ```
4507 pub fn set_instance<T>(mut self, v: T) -> Self
4508 where
4509 T: std::convert::Into<crate::model::Instance>,
4510 {
4511 self.instance = std::option::Option::Some(v.into());
4512 self
4513 }
4514
4515 /// Sets or clears the value of [instance][crate::model::CreateInstanceMetadata::instance].
4516 ///
4517 /// # Example
4518 /// ```ignore,no_run
4519 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4520 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4521 /// let x = CreateInstanceMetadata::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
4522 /// let x = CreateInstanceMetadata::new().set_or_clear_instance(None::<Instance>);
4523 /// ```
4524 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4525 where
4526 T: std::convert::Into<crate::model::Instance>,
4527 {
4528 self.instance = v.map(|x| x.into());
4529 self
4530 }
4531
4532 /// Sets the value of [start_time][crate::model::CreateInstanceMetadata::start_time].
4533 ///
4534 /// # Example
4535 /// ```ignore,no_run
4536 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4537 /// use wkt::Timestamp;
4538 /// let x = CreateInstanceMetadata::new().set_start_time(Timestamp::default()/* use setters */);
4539 /// ```
4540 pub fn set_start_time<T>(mut self, v: T) -> Self
4541 where
4542 T: std::convert::Into<wkt::Timestamp>,
4543 {
4544 self.start_time = std::option::Option::Some(v.into());
4545 self
4546 }
4547
4548 /// Sets or clears the value of [start_time][crate::model::CreateInstanceMetadata::start_time].
4549 ///
4550 /// # Example
4551 /// ```ignore,no_run
4552 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4553 /// use wkt::Timestamp;
4554 /// let x = CreateInstanceMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
4555 /// let x = CreateInstanceMetadata::new().set_or_clear_start_time(None::<Timestamp>);
4556 /// ```
4557 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4558 where
4559 T: std::convert::Into<wkt::Timestamp>,
4560 {
4561 self.start_time = v.map(|x| x.into());
4562 self
4563 }
4564
4565 /// Sets the value of [cancel_time][crate::model::CreateInstanceMetadata::cancel_time].
4566 ///
4567 /// # Example
4568 /// ```ignore,no_run
4569 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4570 /// use wkt::Timestamp;
4571 /// let x = CreateInstanceMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
4572 /// ```
4573 pub fn set_cancel_time<T>(mut self, v: T) -> Self
4574 where
4575 T: std::convert::Into<wkt::Timestamp>,
4576 {
4577 self.cancel_time = std::option::Option::Some(v.into());
4578 self
4579 }
4580
4581 /// Sets or clears the value of [cancel_time][crate::model::CreateInstanceMetadata::cancel_time].
4582 ///
4583 /// # Example
4584 /// ```ignore,no_run
4585 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4586 /// use wkt::Timestamp;
4587 /// let x = CreateInstanceMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
4588 /// let x = CreateInstanceMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
4589 /// ```
4590 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
4591 where
4592 T: std::convert::Into<wkt::Timestamp>,
4593 {
4594 self.cancel_time = v.map(|x| x.into());
4595 self
4596 }
4597
4598 /// Sets the value of [end_time][crate::model::CreateInstanceMetadata::end_time].
4599 ///
4600 /// # Example
4601 /// ```ignore,no_run
4602 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4603 /// use wkt::Timestamp;
4604 /// let x = CreateInstanceMetadata::new().set_end_time(Timestamp::default()/* use setters */);
4605 /// ```
4606 pub fn set_end_time<T>(mut self, v: T) -> Self
4607 where
4608 T: std::convert::Into<wkt::Timestamp>,
4609 {
4610 self.end_time = std::option::Option::Some(v.into());
4611 self
4612 }
4613
4614 /// Sets or clears the value of [end_time][crate::model::CreateInstanceMetadata::end_time].
4615 ///
4616 /// # Example
4617 /// ```ignore,no_run
4618 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4619 /// use wkt::Timestamp;
4620 /// let x = CreateInstanceMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4621 /// let x = CreateInstanceMetadata::new().set_or_clear_end_time(None::<Timestamp>);
4622 /// ```
4623 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4624 where
4625 T: std::convert::Into<wkt::Timestamp>,
4626 {
4627 self.end_time = v.map(|x| x.into());
4628 self
4629 }
4630
4631 /// Sets the value of [expected_fulfillment_period][crate::model::CreateInstanceMetadata::expected_fulfillment_period].
4632 ///
4633 /// # Example
4634 /// ```ignore,no_run
4635 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4636 /// use google_cloud_spanner_admin_instance_v1::model::FulfillmentPeriod;
4637 /// let x0 = CreateInstanceMetadata::new().set_expected_fulfillment_period(FulfillmentPeriod::Normal);
4638 /// let x1 = CreateInstanceMetadata::new().set_expected_fulfillment_period(FulfillmentPeriod::Extended);
4639 /// ```
4640 pub fn set_expected_fulfillment_period<
4641 T: std::convert::Into<crate::model::FulfillmentPeriod>,
4642 >(
4643 mut self,
4644 v: T,
4645 ) -> Self {
4646 self.expected_fulfillment_period = v.into();
4647 self
4648 }
4649}
4650
4651impl wkt::message::Message for CreateInstanceMetadata {
4652 fn typename() -> &'static str {
4653 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceMetadata"
4654 }
4655}
4656
4657/// Metadata type for the operation returned by
4658/// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance].
4659///
4660/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
4661#[derive(Clone, Default, PartialEq)]
4662#[non_exhaustive]
4663pub struct UpdateInstanceMetadata {
4664 /// The desired end state of the update.
4665 pub instance: std::option::Option<crate::model::Instance>,
4666
4667 /// The time at which
4668 /// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]
4669 /// request was received.
4670 ///
4671 /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
4672 pub start_time: std::option::Option<wkt::Timestamp>,
4673
4674 /// The time at which this operation was cancelled. If set, this operation is
4675 /// in the process of undoing itself (which is guaranteed to succeed) and
4676 /// cannot be cancelled again.
4677 pub cancel_time: std::option::Option<wkt::Timestamp>,
4678
4679 /// The time at which this operation failed or was completed successfully.
4680 pub end_time: std::option::Option<wkt::Timestamp>,
4681
4682 /// The expected fulfillment period of this update operation.
4683 pub expected_fulfillment_period: crate::model::FulfillmentPeriod,
4684
4685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4686}
4687
4688impl UpdateInstanceMetadata {
4689 pub fn new() -> Self {
4690 std::default::Default::default()
4691 }
4692
4693 /// Sets the value of [instance][crate::model::UpdateInstanceMetadata::instance].
4694 ///
4695 /// # Example
4696 /// ```ignore,no_run
4697 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4698 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4699 /// let x = UpdateInstanceMetadata::new().set_instance(Instance::default()/* use setters */);
4700 /// ```
4701 pub fn set_instance<T>(mut self, v: T) -> Self
4702 where
4703 T: std::convert::Into<crate::model::Instance>,
4704 {
4705 self.instance = std::option::Option::Some(v.into());
4706 self
4707 }
4708
4709 /// Sets or clears the value of [instance][crate::model::UpdateInstanceMetadata::instance].
4710 ///
4711 /// # Example
4712 /// ```ignore,no_run
4713 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4714 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4715 /// let x = UpdateInstanceMetadata::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
4716 /// let x = UpdateInstanceMetadata::new().set_or_clear_instance(None::<Instance>);
4717 /// ```
4718 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4719 where
4720 T: std::convert::Into<crate::model::Instance>,
4721 {
4722 self.instance = v.map(|x| x.into());
4723 self
4724 }
4725
4726 /// Sets the value of [start_time][crate::model::UpdateInstanceMetadata::start_time].
4727 ///
4728 /// # Example
4729 /// ```ignore,no_run
4730 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4731 /// use wkt::Timestamp;
4732 /// let x = UpdateInstanceMetadata::new().set_start_time(Timestamp::default()/* use setters */);
4733 /// ```
4734 pub fn set_start_time<T>(mut self, v: T) -> Self
4735 where
4736 T: std::convert::Into<wkt::Timestamp>,
4737 {
4738 self.start_time = std::option::Option::Some(v.into());
4739 self
4740 }
4741
4742 /// Sets or clears the value of [start_time][crate::model::UpdateInstanceMetadata::start_time].
4743 ///
4744 /// # Example
4745 /// ```ignore,no_run
4746 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4747 /// use wkt::Timestamp;
4748 /// let x = UpdateInstanceMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
4749 /// let x = UpdateInstanceMetadata::new().set_or_clear_start_time(None::<Timestamp>);
4750 /// ```
4751 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4752 where
4753 T: std::convert::Into<wkt::Timestamp>,
4754 {
4755 self.start_time = v.map(|x| x.into());
4756 self
4757 }
4758
4759 /// Sets the value of [cancel_time][crate::model::UpdateInstanceMetadata::cancel_time].
4760 ///
4761 /// # Example
4762 /// ```ignore,no_run
4763 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4764 /// use wkt::Timestamp;
4765 /// let x = UpdateInstanceMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
4766 /// ```
4767 pub fn set_cancel_time<T>(mut self, v: T) -> Self
4768 where
4769 T: std::convert::Into<wkt::Timestamp>,
4770 {
4771 self.cancel_time = std::option::Option::Some(v.into());
4772 self
4773 }
4774
4775 /// Sets or clears the value of [cancel_time][crate::model::UpdateInstanceMetadata::cancel_time].
4776 ///
4777 /// # Example
4778 /// ```ignore,no_run
4779 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4780 /// use wkt::Timestamp;
4781 /// let x = UpdateInstanceMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
4782 /// let x = UpdateInstanceMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
4783 /// ```
4784 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
4785 where
4786 T: std::convert::Into<wkt::Timestamp>,
4787 {
4788 self.cancel_time = v.map(|x| x.into());
4789 self
4790 }
4791
4792 /// Sets the value of [end_time][crate::model::UpdateInstanceMetadata::end_time].
4793 ///
4794 /// # Example
4795 /// ```ignore,no_run
4796 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4797 /// use wkt::Timestamp;
4798 /// let x = UpdateInstanceMetadata::new().set_end_time(Timestamp::default()/* use setters */);
4799 /// ```
4800 pub fn set_end_time<T>(mut self, v: T) -> Self
4801 where
4802 T: std::convert::Into<wkt::Timestamp>,
4803 {
4804 self.end_time = std::option::Option::Some(v.into());
4805 self
4806 }
4807
4808 /// Sets or clears the value of [end_time][crate::model::UpdateInstanceMetadata::end_time].
4809 ///
4810 /// # Example
4811 /// ```ignore,no_run
4812 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4813 /// use wkt::Timestamp;
4814 /// let x = UpdateInstanceMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4815 /// let x = UpdateInstanceMetadata::new().set_or_clear_end_time(None::<Timestamp>);
4816 /// ```
4817 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4818 where
4819 T: std::convert::Into<wkt::Timestamp>,
4820 {
4821 self.end_time = v.map(|x| x.into());
4822 self
4823 }
4824
4825 /// Sets the value of [expected_fulfillment_period][crate::model::UpdateInstanceMetadata::expected_fulfillment_period].
4826 ///
4827 /// # Example
4828 /// ```ignore,no_run
4829 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4830 /// use google_cloud_spanner_admin_instance_v1::model::FulfillmentPeriod;
4831 /// let x0 = UpdateInstanceMetadata::new().set_expected_fulfillment_period(FulfillmentPeriod::Normal);
4832 /// let x1 = UpdateInstanceMetadata::new().set_expected_fulfillment_period(FulfillmentPeriod::Extended);
4833 /// ```
4834 pub fn set_expected_fulfillment_period<
4835 T: std::convert::Into<crate::model::FulfillmentPeriod>,
4836 >(
4837 mut self,
4838 v: T,
4839 ) -> Self {
4840 self.expected_fulfillment_period = v.into();
4841 self
4842 }
4843}
4844
4845impl wkt::message::Message for UpdateInstanceMetadata {
4846 fn typename() -> &'static str {
4847 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceMetadata"
4848 }
4849}
4850
4851/// Free instance specific metadata that is kept even after an instance has been
4852/// upgraded for tracking purposes.
4853#[derive(Clone, Default, PartialEq)]
4854#[non_exhaustive]
4855pub struct FreeInstanceMetadata {
4856 /// Output only. Timestamp after which the instance will either be upgraded or
4857 /// scheduled for deletion after a grace period. ExpireBehavior is used to
4858 /// choose between upgrading or scheduling the free instance for deletion. This
4859 /// timestamp is set during the creation of a free instance.
4860 pub expire_time: std::option::Option<wkt::Timestamp>,
4861
4862 /// Output only. If present, the timestamp at which the free instance was
4863 /// upgraded to a provisioned instance.
4864 pub upgrade_time: std::option::Option<wkt::Timestamp>,
4865
4866 /// Specifies the expiration behavior of a free instance. The default of
4867 /// ExpireBehavior is `REMOVE_AFTER_GRACE_PERIOD`. This can be modified during
4868 /// or after creation, and before expiration.
4869 pub expire_behavior: crate::model::free_instance_metadata::ExpireBehavior,
4870
4871 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4872}
4873
4874impl FreeInstanceMetadata {
4875 pub fn new() -> Self {
4876 std::default::Default::default()
4877 }
4878
4879 /// Sets the value of [expire_time][crate::model::FreeInstanceMetadata::expire_time].
4880 ///
4881 /// # Example
4882 /// ```ignore,no_run
4883 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
4884 /// use wkt::Timestamp;
4885 /// let x = FreeInstanceMetadata::new().set_expire_time(Timestamp::default()/* use setters */);
4886 /// ```
4887 pub fn set_expire_time<T>(mut self, v: T) -> Self
4888 where
4889 T: std::convert::Into<wkt::Timestamp>,
4890 {
4891 self.expire_time = std::option::Option::Some(v.into());
4892 self
4893 }
4894
4895 /// Sets or clears the value of [expire_time][crate::model::FreeInstanceMetadata::expire_time].
4896 ///
4897 /// # Example
4898 /// ```ignore,no_run
4899 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
4900 /// use wkt::Timestamp;
4901 /// let x = FreeInstanceMetadata::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4902 /// let x = FreeInstanceMetadata::new().set_or_clear_expire_time(None::<Timestamp>);
4903 /// ```
4904 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4905 where
4906 T: std::convert::Into<wkt::Timestamp>,
4907 {
4908 self.expire_time = v.map(|x| x.into());
4909 self
4910 }
4911
4912 /// Sets the value of [upgrade_time][crate::model::FreeInstanceMetadata::upgrade_time].
4913 ///
4914 /// # Example
4915 /// ```ignore,no_run
4916 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
4917 /// use wkt::Timestamp;
4918 /// let x = FreeInstanceMetadata::new().set_upgrade_time(Timestamp::default()/* use setters */);
4919 /// ```
4920 pub fn set_upgrade_time<T>(mut self, v: T) -> Self
4921 where
4922 T: std::convert::Into<wkt::Timestamp>,
4923 {
4924 self.upgrade_time = std::option::Option::Some(v.into());
4925 self
4926 }
4927
4928 /// Sets or clears the value of [upgrade_time][crate::model::FreeInstanceMetadata::upgrade_time].
4929 ///
4930 /// # Example
4931 /// ```ignore,no_run
4932 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
4933 /// use wkt::Timestamp;
4934 /// let x = FreeInstanceMetadata::new().set_or_clear_upgrade_time(Some(Timestamp::default()/* use setters */));
4935 /// let x = FreeInstanceMetadata::new().set_or_clear_upgrade_time(None::<Timestamp>);
4936 /// ```
4937 pub fn set_or_clear_upgrade_time<T>(mut self, v: std::option::Option<T>) -> Self
4938 where
4939 T: std::convert::Into<wkt::Timestamp>,
4940 {
4941 self.upgrade_time = v.map(|x| x.into());
4942 self
4943 }
4944
4945 /// Sets the value of [expire_behavior][crate::model::FreeInstanceMetadata::expire_behavior].
4946 ///
4947 /// # Example
4948 /// ```ignore,no_run
4949 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
4950 /// use google_cloud_spanner_admin_instance_v1::model::free_instance_metadata::ExpireBehavior;
4951 /// let x0 = FreeInstanceMetadata::new().set_expire_behavior(ExpireBehavior::FreeToProvisioned);
4952 /// let x1 = FreeInstanceMetadata::new().set_expire_behavior(ExpireBehavior::RemoveAfterGracePeriod);
4953 /// ```
4954 pub fn set_expire_behavior<
4955 T: std::convert::Into<crate::model::free_instance_metadata::ExpireBehavior>,
4956 >(
4957 mut self,
4958 v: T,
4959 ) -> Self {
4960 self.expire_behavior = v.into();
4961 self
4962 }
4963}
4964
4965impl wkt::message::Message for FreeInstanceMetadata {
4966 fn typename() -> &'static str {
4967 "type.googleapis.com/google.spanner.admin.instance.v1.FreeInstanceMetadata"
4968 }
4969}
4970
4971/// Defines additional types related to [FreeInstanceMetadata].
4972pub mod free_instance_metadata {
4973 #[allow(unused_imports)]
4974 use super::*;
4975
4976 /// Allows users to change behavior when a free instance expires.
4977 ///
4978 /// # Working with unknown values
4979 ///
4980 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4981 /// additional enum variants at any time. Adding new variants is not considered
4982 /// a breaking change. Applications should write their code in anticipation of:
4983 ///
4984 /// - New values appearing in future releases of the client library, **and**
4985 /// - New values received dynamically, without application changes.
4986 ///
4987 /// Please consult the [Working with enums] section in the user guide for some
4988 /// guidelines.
4989 ///
4990 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4991 #[derive(Clone, Debug, PartialEq)]
4992 #[non_exhaustive]
4993 pub enum ExpireBehavior {
4994 /// Not specified.
4995 Unspecified,
4996 /// When the free instance expires, upgrade the instance to a provisioned
4997 /// instance.
4998 FreeToProvisioned,
4999 /// When the free instance expires, disable the instance, and delete it
5000 /// after the grace period passes if it has not been upgraded.
5001 RemoveAfterGracePeriod,
5002 /// If set, the enum was initialized with an unknown value.
5003 ///
5004 /// Applications can examine the value using [ExpireBehavior::value] or
5005 /// [ExpireBehavior::name].
5006 UnknownValue(expire_behavior::UnknownValue),
5007 }
5008
5009 #[doc(hidden)]
5010 pub mod expire_behavior {
5011 #[allow(unused_imports)]
5012 use super::*;
5013 #[derive(Clone, Debug, PartialEq)]
5014 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5015 }
5016
5017 impl ExpireBehavior {
5018 /// Gets the enum value.
5019 ///
5020 /// Returns `None` if the enum contains an unknown value deserialized from
5021 /// the string representation of enums.
5022 pub fn value(&self) -> std::option::Option<i32> {
5023 match self {
5024 Self::Unspecified => std::option::Option::Some(0),
5025 Self::FreeToProvisioned => std::option::Option::Some(1),
5026 Self::RemoveAfterGracePeriod => std::option::Option::Some(2),
5027 Self::UnknownValue(u) => u.0.value(),
5028 }
5029 }
5030
5031 /// Gets the enum value as a string.
5032 ///
5033 /// Returns `None` if the enum contains an unknown value deserialized from
5034 /// the integer representation of enums.
5035 pub fn name(&self) -> std::option::Option<&str> {
5036 match self {
5037 Self::Unspecified => std::option::Option::Some("EXPIRE_BEHAVIOR_UNSPECIFIED"),
5038 Self::FreeToProvisioned => std::option::Option::Some("FREE_TO_PROVISIONED"),
5039 Self::RemoveAfterGracePeriod => {
5040 std::option::Option::Some("REMOVE_AFTER_GRACE_PERIOD")
5041 }
5042 Self::UnknownValue(u) => u.0.name(),
5043 }
5044 }
5045 }
5046
5047 impl std::default::Default for ExpireBehavior {
5048 fn default() -> Self {
5049 use std::convert::From;
5050 Self::from(0)
5051 }
5052 }
5053
5054 impl std::fmt::Display for ExpireBehavior {
5055 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5056 wkt::internal::display_enum(f, self.name(), self.value())
5057 }
5058 }
5059
5060 impl std::convert::From<i32> for ExpireBehavior {
5061 fn from(value: i32) -> Self {
5062 match value {
5063 0 => Self::Unspecified,
5064 1 => Self::FreeToProvisioned,
5065 2 => Self::RemoveAfterGracePeriod,
5066 _ => Self::UnknownValue(expire_behavior::UnknownValue(
5067 wkt::internal::UnknownEnumValue::Integer(value),
5068 )),
5069 }
5070 }
5071 }
5072
5073 impl std::convert::From<&str> for ExpireBehavior {
5074 fn from(value: &str) -> Self {
5075 use std::string::ToString;
5076 match value {
5077 "EXPIRE_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
5078 "FREE_TO_PROVISIONED" => Self::FreeToProvisioned,
5079 "REMOVE_AFTER_GRACE_PERIOD" => Self::RemoveAfterGracePeriod,
5080 _ => Self::UnknownValue(expire_behavior::UnknownValue(
5081 wkt::internal::UnknownEnumValue::String(value.to_string()),
5082 )),
5083 }
5084 }
5085 }
5086
5087 impl serde::ser::Serialize for ExpireBehavior {
5088 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5089 where
5090 S: serde::Serializer,
5091 {
5092 match self {
5093 Self::Unspecified => serializer.serialize_i32(0),
5094 Self::FreeToProvisioned => serializer.serialize_i32(1),
5095 Self::RemoveAfterGracePeriod => serializer.serialize_i32(2),
5096 Self::UnknownValue(u) => u.0.serialize(serializer),
5097 }
5098 }
5099 }
5100
5101 impl<'de> serde::de::Deserialize<'de> for ExpireBehavior {
5102 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5103 where
5104 D: serde::Deserializer<'de>,
5105 {
5106 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExpireBehavior>::new(
5107 ".google.spanner.admin.instance.v1.FreeInstanceMetadata.ExpireBehavior",
5108 ))
5109 }
5110 }
5111}
5112
5113/// Metadata type for the operation returned by
5114/// [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig].
5115///
5116/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]: crate::client::InstanceAdmin::create_instance_config
5117#[derive(Clone, Default, PartialEq)]
5118#[non_exhaustive]
5119pub struct CreateInstanceConfigMetadata {
5120 /// The target instance configuration end state.
5121 pub instance_config: std::option::Option<crate::model::InstanceConfig>,
5122
5123 /// The progress of the
5124 /// [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]
5125 /// operation.
5126 ///
5127 /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]: crate::client::InstanceAdmin::create_instance_config
5128 pub progress: std::option::Option<crate::model::OperationProgress>,
5129
5130 /// The time at which this operation was cancelled.
5131 pub cancel_time: std::option::Option<wkt::Timestamp>,
5132
5133 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5134}
5135
5136impl CreateInstanceConfigMetadata {
5137 pub fn new() -> Self {
5138 std::default::Default::default()
5139 }
5140
5141 /// Sets the value of [instance_config][crate::model::CreateInstanceConfigMetadata::instance_config].
5142 ///
5143 /// # Example
5144 /// ```ignore,no_run
5145 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5146 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
5147 /// let x = CreateInstanceConfigMetadata::new().set_instance_config(InstanceConfig::default()/* use setters */);
5148 /// ```
5149 pub fn set_instance_config<T>(mut self, v: T) -> Self
5150 where
5151 T: std::convert::Into<crate::model::InstanceConfig>,
5152 {
5153 self.instance_config = std::option::Option::Some(v.into());
5154 self
5155 }
5156
5157 /// Sets or clears the value of [instance_config][crate::model::CreateInstanceConfigMetadata::instance_config].
5158 ///
5159 /// # Example
5160 /// ```ignore,no_run
5161 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5162 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
5163 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_instance_config(Some(InstanceConfig::default()/* use setters */));
5164 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_instance_config(None::<InstanceConfig>);
5165 /// ```
5166 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5167 where
5168 T: std::convert::Into<crate::model::InstanceConfig>,
5169 {
5170 self.instance_config = v.map(|x| x.into());
5171 self
5172 }
5173
5174 /// Sets the value of [progress][crate::model::CreateInstanceConfigMetadata::progress].
5175 ///
5176 /// # Example
5177 /// ```ignore,no_run
5178 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5179 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
5180 /// let x = CreateInstanceConfigMetadata::new().set_progress(OperationProgress::default()/* use setters */);
5181 /// ```
5182 pub fn set_progress<T>(mut self, v: T) -> Self
5183 where
5184 T: std::convert::Into<crate::model::OperationProgress>,
5185 {
5186 self.progress = std::option::Option::Some(v.into());
5187 self
5188 }
5189
5190 /// Sets or clears the value of [progress][crate::model::CreateInstanceConfigMetadata::progress].
5191 ///
5192 /// # Example
5193 /// ```ignore,no_run
5194 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5195 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
5196 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
5197 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_progress(None::<OperationProgress>);
5198 /// ```
5199 pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
5200 where
5201 T: std::convert::Into<crate::model::OperationProgress>,
5202 {
5203 self.progress = v.map(|x| x.into());
5204 self
5205 }
5206
5207 /// Sets the value of [cancel_time][crate::model::CreateInstanceConfigMetadata::cancel_time].
5208 ///
5209 /// # Example
5210 /// ```ignore,no_run
5211 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5212 /// use wkt::Timestamp;
5213 /// let x = CreateInstanceConfigMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
5214 /// ```
5215 pub fn set_cancel_time<T>(mut self, v: T) -> Self
5216 where
5217 T: std::convert::Into<wkt::Timestamp>,
5218 {
5219 self.cancel_time = std::option::Option::Some(v.into());
5220 self
5221 }
5222
5223 /// Sets or clears the value of [cancel_time][crate::model::CreateInstanceConfigMetadata::cancel_time].
5224 ///
5225 /// # Example
5226 /// ```ignore,no_run
5227 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5228 /// use wkt::Timestamp;
5229 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
5230 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
5231 /// ```
5232 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
5233 where
5234 T: std::convert::Into<wkt::Timestamp>,
5235 {
5236 self.cancel_time = v.map(|x| x.into());
5237 self
5238 }
5239}
5240
5241impl wkt::message::Message for CreateInstanceConfigMetadata {
5242 fn typename() -> &'static str {
5243 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata"
5244 }
5245}
5246
5247/// Metadata type for the operation returned by
5248/// [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig].
5249///
5250/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]: crate::client::InstanceAdmin::update_instance_config
5251#[derive(Clone, Default, PartialEq)]
5252#[non_exhaustive]
5253pub struct UpdateInstanceConfigMetadata {
5254 /// The desired instance configuration after updating.
5255 pub instance_config: std::option::Option<crate::model::InstanceConfig>,
5256
5257 /// The progress of the
5258 /// [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]
5259 /// operation.
5260 ///
5261 /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]: crate::client::InstanceAdmin::update_instance_config
5262 pub progress: std::option::Option<crate::model::OperationProgress>,
5263
5264 /// The time at which this operation was cancelled.
5265 pub cancel_time: std::option::Option<wkt::Timestamp>,
5266
5267 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5268}
5269
5270impl UpdateInstanceConfigMetadata {
5271 pub fn new() -> Self {
5272 std::default::Default::default()
5273 }
5274
5275 /// Sets the value of [instance_config][crate::model::UpdateInstanceConfigMetadata::instance_config].
5276 ///
5277 /// # Example
5278 /// ```ignore,no_run
5279 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5280 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
5281 /// let x = UpdateInstanceConfigMetadata::new().set_instance_config(InstanceConfig::default()/* use setters */);
5282 /// ```
5283 pub fn set_instance_config<T>(mut self, v: T) -> Self
5284 where
5285 T: std::convert::Into<crate::model::InstanceConfig>,
5286 {
5287 self.instance_config = std::option::Option::Some(v.into());
5288 self
5289 }
5290
5291 /// Sets or clears the value of [instance_config][crate::model::UpdateInstanceConfigMetadata::instance_config].
5292 ///
5293 /// # Example
5294 /// ```ignore,no_run
5295 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5296 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
5297 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_instance_config(Some(InstanceConfig::default()/* use setters */));
5298 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_instance_config(None::<InstanceConfig>);
5299 /// ```
5300 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5301 where
5302 T: std::convert::Into<crate::model::InstanceConfig>,
5303 {
5304 self.instance_config = v.map(|x| x.into());
5305 self
5306 }
5307
5308 /// Sets the value of [progress][crate::model::UpdateInstanceConfigMetadata::progress].
5309 ///
5310 /// # Example
5311 /// ```ignore,no_run
5312 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5313 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
5314 /// let x = UpdateInstanceConfigMetadata::new().set_progress(OperationProgress::default()/* use setters */);
5315 /// ```
5316 pub fn set_progress<T>(mut self, v: T) -> Self
5317 where
5318 T: std::convert::Into<crate::model::OperationProgress>,
5319 {
5320 self.progress = std::option::Option::Some(v.into());
5321 self
5322 }
5323
5324 /// Sets or clears the value of [progress][crate::model::UpdateInstanceConfigMetadata::progress].
5325 ///
5326 /// # Example
5327 /// ```ignore,no_run
5328 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5329 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
5330 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
5331 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_progress(None::<OperationProgress>);
5332 /// ```
5333 pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
5334 where
5335 T: std::convert::Into<crate::model::OperationProgress>,
5336 {
5337 self.progress = v.map(|x| x.into());
5338 self
5339 }
5340
5341 /// Sets the value of [cancel_time][crate::model::UpdateInstanceConfigMetadata::cancel_time].
5342 ///
5343 /// # Example
5344 /// ```ignore,no_run
5345 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5346 /// use wkt::Timestamp;
5347 /// let x = UpdateInstanceConfigMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
5348 /// ```
5349 pub fn set_cancel_time<T>(mut self, v: T) -> Self
5350 where
5351 T: std::convert::Into<wkt::Timestamp>,
5352 {
5353 self.cancel_time = std::option::Option::Some(v.into());
5354 self
5355 }
5356
5357 /// Sets or clears the value of [cancel_time][crate::model::UpdateInstanceConfigMetadata::cancel_time].
5358 ///
5359 /// # Example
5360 /// ```ignore,no_run
5361 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5362 /// use wkt::Timestamp;
5363 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
5364 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
5365 /// ```
5366 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
5367 where
5368 T: std::convert::Into<wkt::Timestamp>,
5369 {
5370 self.cancel_time = v.map(|x| x.into());
5371 self
5372 }
5373}
5374
5375impl wkt::message::Message for UpdateInstanceConfigMetadata {
5376 fn typename() -> &'static str {
5377 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata"
5378 }
5379}
5380
5381/// An isolated set of Cloud Spanner resources that databases can define
5382/// placements on.
5383#[derive(Clone, Default, PartialEq)]
5384#[non_exhaustive]
5385pub struct InstancePartition {
5386 /// Required. A unique identifier for the instance partition. Values are of the
5387 /// form
5388 /// `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
5389 /// The final segment of the name must be between 2 and 64 characters in
5390 /// length. An instance partition's name cannot be changed after the instance
5391 /// partition is created.
5392 pub name: std::string::String,
5393
5394 /// Required. The name of the instance partition's configuration. Values are of
5395 /// the form `projects/<project>/instanceConfigs/<configuration>`. See also
5396 /// [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
5397 /// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
5398 ///
5399 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
5400 /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
5401 pub config: std::string::String,
5402
5403 /// Required. The descriptive name for this instance partition as it appears in
5404 /// UIs. Must be unique per project and between 4 and 30 characters in length.
5405 pub display_name: std::string::String,
5406
5407 /// Optional. The autoscaling configuration. Autoscaling is enabled if this
5408 /// field is set. When autoscaling is enabled, fields in compute_capacity are
5409 /// treated as OUTPUT_ONLY fields and reflect the current compute capacity
5410 /// allocated to the instance partition.
5411 pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
5412
5413 /// Output only. The current instance partition state.
5414 pub state: crate::model::instance_partition::State,
5415
5416 /// Output only. The time at which the instance partition was created.
5417 pub create_time: std::option::Option<wkt::Timestamp>,
5418
5419 /// Output only. The time at which the instance partition was most recently
5420 /// updated.
5421 pub update_time: std::option::Option<wkt::Timestamp>,
5422
5423 /// Output only. The names of the databases that reference this
5424 /// instance partition. Referencing databases should share the parent instance.
5425 /// The existence of any referencing database prevents the instance partition
5426 /// from being deleted.
5427 pub referencing_databases: std::vec::Vec<std::string::String>,
5428
5429 /// Output only. Deprecated: This field is not populated.
5430 /// Output only. The names of the backups that reference this instance
5431 /// partition. Referencing backups should share the parent instance. The
5432 /// existence of any referencing backup prevents the instance partition from
5433 /// being deleted.
5434 #[deprecated]
5435 pub referencing_backups: std::vec::Vec<std::string::String>,
5436
5437 /// Used for optimistic concurrency control as a way
5438 /// to help prevent simultaneous updates of a instance partition from
5439 /// overwriting each other. It is strongly suggested that systems make use of
5440 /// the etag in the read-modify-write cycle to perform instance partition
5441 /// updates in order to avoid race conditions: An etag is returned in the
5442 /// response which contains instance partitions, and systems are expected to
5443 /// put that etag in the request to update instance partitions to ensure that
5444 /// their change will be applied to the same version of the instance partition.
5445 /// If no etag is provided in the call to update instance partition, then the
5446 /// existing instance partition is overwritten blindly.
5447 pub etag: std::string::String,
5448
5449 /// Compute capacity defines amount of server and storage resources that are
5450 /// available to the databases in an instance partition. At most, one of either
5451 /// `node_count` or` processing_units` should be present in the message. For
5452 /// more information, see
5453 /// [Compute capacity, nodes, and processing
5454 /// units](https://cloud.google.com/spanner/docs/compute-capacity).
5455 pub compute_capacity: std::option::Option<crate::model::instance_partition::ComputeCapacity>,
5456
5457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5458}
5459
5460impl InstancePartition {
5461 pub fn new() -> Self {
5462 std::default::Default::default()
5463 }
5464
5465 /// Sets the value of [name][crate::model::InstancePartition::name].
5466 ///
5467 /// # Example
5468 /// ```ignore,no_run
5469 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5470 /// let x = InstancePartition::new().set_name("example");
5471 /// ```
5472 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5473 self.name = v.into();
5474 self
5475 }
5476
5477 /// Sets the value of [config][crate::model::InstancePartition::config].
5478 ///
5479 /// # Example
5480 /// ```ignore,no_run
5481 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5482 /// let x = InstancePartition::new().set_config("example");
5483 /// ```
5484 pub fn set_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5485 self.config = v.into();
5486 self
5487 }
5488
5489 /// Sets the value of [display_name][crate::model::InstancePartition::display_name].
5490 ///
5491 /// # Example
5492 /// ```ignore,no_run
5493 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5494 /// let x = InstancePartition::new().set_display_name("example");
5495 /// ```
5496 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5497 self.display_name = v.into();
5498 self
5499 }
5500
5501 /// Sets the value of [autoscaling_config][crate::model::InstancePartition::autoscaling_config].
5502 ///
5503 /// # Example
5504 /// ```ignore,no_run
5505 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5506 /// use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
5507 /// let x = InstancePartition::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
5508 /// ```
5509 pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
5510 where
5511 T: std::convert::Into<crate::model::AutoscalingConfig>,
5512 {
5513 self.autoscaling_config = std::option::Option::Some(v.into());
5514 self
5515 }
5516
5517 /// Sets or clears the value of [autoscaling_config][crate::model::InstancePartition::autoscaling_config].
5518 ///
5519 /// # Example
5520 /// ```ignore,no_run
5521 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5522 /// use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
5523 /// let x = InstancePartition::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
5524 /// let x = InstancePartition::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
5525 /// ```
5526 pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
5527 where
5528 T: std::convert::Into<crate::model::AutoscalingConfig>,
5529 {
5530 self.autoscaling_config = v.map(|x| x.into());
5531 self
5532 }
5533
5534 /// Sets the value of [state][crate::model::InstancePartition::state].
5535 ///
5536 /// # Example
5537 /// ```ignore,no_run
5538 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5539 /// use google_cloud_spanner_admin_instance_v1::model::instance_partition::State;
5540 /// let x0 = InstancePartition::new().set_state(State::Creating);
5541 /// let x1 = InstancePartition::new().set_state(State::Ready);
5542 /// ```
5543 pub fn set_state<T: std::convert::Into<crate::model::instance_partition::State>>(
5544 mut self,
5545 v: T,
5546 ) -> Self {
5547 self.state = v.into();
5548 self
5549 }
5550
5551 /// Sets the value of [create_time][crate::model::InstancePartition::create_time].
5552 ///
5553 /// # Example
5554 /// ```ignore,no_run
5555 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5556 /// use wkt::Timestamp;
5557 /// let x = InstancePartition::new().set_create_time(Timestamp::default()/* use setters */);
5558 /// ```
5559 pub fn set_create_time<T>(mut self, v: T) -> Self
5560 where
5561 T: std::convert::Into<wkt::Timestamp>,
5562 {
5563 self.create_time = std::option::Option::Some(v.into());
5564 self
5565 }
5566
5567 /// Sets or clears the value of [create_time][crate::model::InstancePartition::create_time].
5568 ///
5569 /// # Example
5570 /// ```ignore,no_run
5571 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5572 /// use wkt::Timestamp;
5573 /// let x = InstancePartition::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5574 /// let x = InstancePartition::new().set_or_clear_create_time(None::<Timestamp>);
5575 /// ```
5576 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5577 where
5578 T: std::convert::Into<wkt::Timestamp>,
5579 {
5580 self.create_time = v.map(|x| x.into());
5581 self
5582 }
5583
5584 /// Sets the value of [update_time][crate::model::InstancePartition::update_time].
5585 ///
5586 /// # Example
5587 /// ```ignore,no_run
5588 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5589 /// use wkt::Timestamp;
5590 /// let x = InstancePartition::new().set_update_time(Timestamp::default()/* use setters */);
5591 /// ```
5592 pub fn set_update_time<T>(mut self, v: T) -> Self
5593 where
5594 T: std::convert::Into<wkt::Timestamp>,
5595 {
5596 self.update_time = std::option::Option::Some(v.into());
5597 self
5598 }
5599
5600 /// Sets or clears the value of [update_time][crate::model::InstancePartition::update_time].
5601 ///
5602 /// # Example
5603 /// ```ignore,no_run
5604 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5605 /// use wkt::Timestamp;
5606 /// let x = InstancePartition::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5607 /// let x = InstancePartition::new().set_or_clear_update_time(None::<Timestamp>);
5608 /// ```
5609 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5610 where
5611 T: std::convert::Into<wkt::Timestamp>,
5612 {
5613 self.update_time = v.map(|x| x.into());
5614 self
5615 }
5616
5617 /// Sets the value of [referencing_databases][crate::model::InstancePartition::referencing_databases].
5618 ///
5619 /// # Example
5620 /// ```ignore,no_run
5621 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5622 /// let x = InstancePartition::new().set_referencing_databases(["a", "b", "c"]);
5623 /// ```
5624 pub fn set_referencing_databases<T, V>(mut self, v: T) -> Self
5625 where
5626 T: std::iter::IntoIterator<Item = V>,
5627 V: std::convert::Into<std::string::String>,
5628 {
5629 use std::iter::Iterator;
5630 self.referencing_databases = v.into_iter().map(|i| i.into()).collect();
5631 self
5632 }
5633
5634 /// Sets the value of [referencing_backups][crate::model::InstancePartition::referencing_backups].
5635 ///
5636 /// # Example
5637 /// ```ignore,no_run
5638 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5639 /// let x = InstancePartition::new().set_referencing_backups(["a", "b", "c"]);
5640 /// ```
5641 #[deprecated]
5642 pub fn set_referencing_backups<T, V>(mut self, v: T) -> Self
5643 where
5644 T: std::iter::IntoIterator<Item = V>,
5645 V: std::convert::Into<std::string::String>,
5646 {
5647 use std::iter::Iterator;
5648 self.referencing_backups = v.into_iter().map(|i| i.into()).collect();
5649 self
5650 }
5651
5652 /// Sets the value of [etag][crate::model::InstancePartition::etag].
5653 ///
5654 /// # Example
5655 /// ```ignore,no_run
5656 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5657 /// let x = InstancePartition::new().set_etag("example");
5658 /// ```
5659 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5660 self.etag = v.into();
5661 self
5662 }
5663
5664 /// Sets the value of [compute_capacity][crate::model::InstancePartition::compute_capacity].
5665 ///
5666 /// Note that all the setters affecting `compute_capacity` are mutually
5667 /// exclusive.
5668 ///
5669 /// # Example
5670 /// ```ignore,no_run
5671 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5672 /// use google_cloud_spanner_admin_instance_v1::model::instance_partition::ComputeCapacity;
5673 /// let x = InstancePartition::new().set_compute_capacity(Some(ComputeCapacity::NodeCount(42)));
5674 /// ```
5675 pub fn set_compute_capacity<
5676 T: std::convert::Into<std::option::Option<crate::model::instance_partition::ComputeCapacity>>,
5677 >(
5678 mut self,
5679 v: T,
5680 ) -> Self {
5681 self.compute_capacity = v.into();
5682 self
5683 }
5684
5685 /// The value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
5686 /// if it holds a `NodeCount`, `None` if the field is not set or
5687 /// holds a different branch.
5688 pub fn node_count(&self) -> std::option::Option<&i32> {
5689 #[allow(unreachable_patterns)]
5690 self.compute_capacity.as_ref().and_then(|v| match v {
5691 crate::model::instance_partition::ComputeCapacity::NodeCount(v) => {
5692 std::option::Option::Some(v)
5693 }
5694 _ => std::option::Option::None,
5695 })
5696 }
5697
5698 /// Sets the value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
5699 /// to hold a `NodeCount`.
5700 ///
5701 /// Note that all the setters affecting `compute_capacity` are
5702 /// mutually exclusive.
5703 ///
5704 /// # Example
5705 /// ```ignore,no_run
5706 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5707 /// let x = InstancePartition::new().set_node_count(42);
5708 /// assert!(x.node_count().is_some());
5709 /// assert!(x.processing_units().is_none());
5710 /// ```
5711 pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5712 self.compute_capacity = std::option::Option::Some(
5713 crate::model::instance_partition::ComputeCapacity::NodeCount(v.into()),
5714 );
5715 self
5716 }
5717
5718 /// The value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
5719 /// if it holds a `ProcessingUnits`, `None` if the field is not set or
5720 /// holds a different branch.
5721 pub fn processing_units(&self) -> std::option::Option<&i32> {
5722 #[allow(unreachable_patterns)]
5723 self.compute_capacity.as_ref().and_then(|v| match v {
5724 crate::model::instance_partition::ComputeCapacity::ProcessingUnits(v) => {
5725 std::option::Option::Some(v)
5726 }
5727 _ => std::option::Option::None,
5728 })
5729 }
5730
5731 /// Sets the value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
5732 /// to hold a `ProcessingUnits`.
5733 ///
5734 /// Note that all the setters affecting `compute_capacity` are
5735 /// mutually exclusive.
5736 ///
5737 /// # Example
5738 /// ```ignore,no_run
5739 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5740 /// let x = InstancePartition::new().set_processing_units(42);
5741 /// assert!(x.processing_units().is_some());
5742 /// assert!(x.node_count().is_none());
5743 /// ```
5744 pub fn set_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5745 self.compute_capacity = std::option::Option::Some(
5746 crate::model::instance_partition::ComputeCapacity::ProcessingUnits(v.into()),
5747 );
5748 self
5749 }
5750}
5751
5752impl wkt::message::Message for InstancePartition {
5753 fn typename() -> &'static str {
5754 "type.googleapis.com/google.spanner.admin.instance.v1.InstancePartition"
5755 }
5756}
5757
5758/// Defines additional types related to [InstancePartition].
5759pub mod instance_partition {
5760 #[allow(unused_imports)]
5761 use super::*;
5762
5763 /// Indicates the current state of the instance partition.
5764 ///
5765 /// # Working with unknown values
5766 ///
5767 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5768 /// additional enum variants at any time. Adding new variants is not considered
5769 /// a breaking change. Applications should write their code in anticipation of:
5770 ///
5771 /// - New values appearing in future releases of the client library, **and**
5772 /// - New values received dynamically, without application changes.
5773 ///
5774 /// Please consult the [Working with enums] section in the user guide for some
5775 /// guidelines.
5776 ///
5777 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5778 #[derive(Clone, Debug, PartialEq)]
5779 #[non_exhaustive]
5780 pub enum State {
5781 /// Not specified.
5782 Unspecified,
5783 /// The instance partition is still being created. Resources may not be
5784 /// available yet, and operations such as creating placements using this
5785 /// instance partition may not work.
5786 Creating,
5787 /// The instance partition is fully created and ready to do work such as
5788 /// creating placements and using in databases.
5789 Ready,
5790 /// If set, the enum was initialized with an unknown value.
5791 ///
5792 /// Applications can examine the value using [State::value] or
5793 /// [State::name].
5794 UnknownValue(state::UnknownValue),
5795 }
5796
5797 #[doc(hidden)]
5798 pub mod state {
5799 #[allow(unused_imports)]
5800 use super::*;
5801 #[derive(Clone, Debug, PartialEq)]
5802 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5803 }
5804
5805 impl State {
5806 /// Gets the enum value.
5807 ///
5808 /// Returns `None` if the enum contains an unknown value deserialized from
5809 /// the string representation of enums.
5810 pub fn value(&self) -> std::option::Option<i32> {
5811 match self {
5812 Self::Unspecified => std::option::Option::Some(0),
5813 Self::Creating => std::option::Option::Some(1),
5814 Self::Ready => std::option::Option::Some(2),
5815 Self::UnknownValue(u) => u.0.value(),
5816 }
5817 }
5818
5819 /// Gets the enum value as a string.
5820 ///
5821 /// Returns `None` if the enum contains an unknown value deserialized from
5822 /// the integer representation of enums.
5823 pub fn name(&self) -> std::option::Option<&str> {
5824 match self {
5825 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5826 Self::Creating => std::option::Option::Some("CREATING"),
5827 Self::Ready => std::option::Option::Some("READY"),
5828 Self::UnknownValue(u) => u.0.name(),
5829 }
5830 }
5831 }
5832
5833 impl std::default::Default for State {
5834 fn default() -> Self {
5835 use std::convert::From;
5836 Self::from(0)
5837 }
5838 }
5839
5840 impl std::fmt::Display for State {
5841 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5842 wkt::internal::display_enum(f, self.name(), self.value())
5843 }
5844 }
5845
5846 impl std::convert::From<i32> for State {
5847 fn from(value: i32) -> Self {
5848 match value {
5849 0 => Self::Unspecified,
5850 1 => Self::Creating,
5851 2 => Self::Ready,
5852 _ => Self::UnknownValue(state::UnknownValue(
5853 wkt::internal::UnknownEnumValue::Integer(value),
5854 )),
5855 }
5856 }
5857 }
5858
5859 impl std::convert::From<&str> for State {
5860 fn from(value: &str) -> Self {
5861 use std::string::ToString;
5862 match value {
5863 "STATE_UNSPECIFIED" => Self::Unspecified,
5864 "CREATING" => Self::Creating,
5865 "READY" => Self::Ready,
5866 _ => Self::UnknownValue(state::UnknownValue(
5867 wkt::internal::UnknownEnumValue::String(value.to_string()),
5868 )),
5869 }
5870 }
5871 }
5872
5873 impl serde::ser::Serialize for State {
5874 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5875 where
5876 S: serde::Serializer,
5877 {
5878 match self {
5879 Self::Unspecified => serializer.serialize_i32(0),
5880 Self::Creating => serializer.serialize_i32(1),
5881 Self::Ready => serializer.serialize_i32(2),
5882 Self::UnknownValue(u) => u.0.serialize(serializer),
5883 }
5884 }
5885 }
5886
5887 impl<'de> serde::de::Deserialize<'de> for State {
5888 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5889 where
5890 D: serde::Deserializer<'de>,
5891 {
5892 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5893 ".google.spanner.admin.instance.v1.InstancePartition.State",
5894 ))
5895 }
5896 }
5897
5898 /// Compute capacity defines amount of server and storage resources that are
5899 /// available to the databases in an instance partition. At most, one of either
5900 /// `node_count` or` processing_units` should be present in the message. For
5901 /// more information, see
5902 /// [Compute capacity, nodes, and processing
5903 /// units](https://cloud.google.com/spanner/docs/compute-capacity).
5904 #[derive(Clone, Debug, PartialEq)]
5905 #[non_exhaustive]
5906 pub enum ComputeCapacity {
5907 /// The number of nodes allocated to this instance partition.
5908 ///
5909 /// Users can set the `node_count` field to specify the target number of
5910 /// nodes allocated to the instance partition.
5911 ///
5912 /// This may be zero in API responses for instance partitions that are not
5913 /// yet in state `READY`.
5914 NodeCount(i32),
5915 /// The number of processing units allocated to this instance partition.
5916 ///
5917 /// Users can set the `processing_units` field to specify the target number
5918 /// of processing units allocated to the instance partition.
5919 ///
5920 /// This might be zero in API responses for instance partitions that are not
5921 /// yet in the `READY` state.
5922 ProcessingUnits(i32),
5923 }
5924}
5925
5926/// Metadata type for the operation returned by
5927/// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
5928///
5929/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]: crate::client::InstanceAdmin::create_instance_partition
5930#[derive(Clone, Default, PartialEq)]
5931#[non_exhaustive]
5932pub struct CreateInstancePartitionMetadata {
5933 /// The instance partition being created.
5934 pub instance_partition: std::option::Option<crate::model::InstancePartition>,
5935
5936 /// The time at which the
5937 /// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
5938 /// request was received.
5939 ///
5940 /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]: crate::client::InstanceAdmin::create_instance_partition
5941 pub start_time: std::option::Option<wkt::Timestamp>,
5942
5943 /// The time at which this operation was cancelled. If set, this operation is
5944 /// in the process of undoing itself (which is guaranteed to succeed) and
5945 /// cannot be cancelled again.
5946 pub cancel_time: std::option::Option<wkt::Timestamp>,
5947
5948 /// The time at which this operation failed or was completed successfully.
5949 pub end_time: std::option::Option<wkt::Timestamp>,
5950
5951 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5952}
5953
5954impl CreateInstancePartitionMetadata {
5955 pub fn new() -> Self {
5956 std::default::Default::default()
5957 }
5958
5959 /// Sets the value of [instance_partition][crate::model::CreateInstancePartitionMetadata::instance_partition].
5960 ///
5961 /// # Example
5962 /// ```ignore,no_run
5963 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
5964 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5965 /// let x = CreateInstancePartitionMetadata::new().set_instance_partition(InstancePartition::default()/* use setters */);
5966 /// ```
5967 pub fn set_instance_partition<T>(mut self, v: T) -> Self
5968 where
5969 T: std::convert::Into<crate::model::InstancePartition>,
5970 {
5971 self.instance_partition = std::option::Option::Some(v.into());
5972 self
5973 }
5974
5975 /// Sets or clears the value of [instance_partition][crate::model::CreateInstancePartitionMetadata::instance_partition].
5976 ///
5977 /// # Example
5978 /// ```ignore,no_run
5979 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
5980 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5981 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_instance_partition(Some(InstancePartition::default()/* use setters */));
5982 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_instance_partition(None::<InstancePartition>);
5983 /// ```
5984 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
5985 where
5986 T: std::convert::Into<crate::model::InstancePartition>,
5987 {
5988 self.instance_partition = v.map(|x| x.into());
5989 self
5990 }
5991
5992 /// Sets the value of [start_time][crate::model::CreateInstancePartitionMetadata::start_time].
5993 ///
5994 /// # Example
5995 /// ```ignore,no_run
5996 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
5997 /// use wkt::Timestamp;
5998 /// let x = CreateInstancePartitionMetadata::new().set_start_time(Timestamp::default()/* use setters */);
5999 /// ```
6000 pub fn set_start_time<T>(mut self, v: T) -> Self
6001 where
6002 T: std::convert::Into<wkt::Timestamp>,
6003 {
6004 self.start_time = std::option::Option::Some(v.into());
6005 self
6006 }
6007
6008 /// Sets or clears the value of [start_time][crate::model::CreateInstancePartitionMetadata::start_time].
6009 ///
6010 /// # Example
6011 /// ```ignore,no_run
6012 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6013 /// use wkt::Timestamp;
6014 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
6015 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_start_time(None::<Timestamp>);
6016 /// ```
6017 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6018 where
6019 T: std::convert::Into<wkt::Timestamp>,
6020 {
6021 self.start_time = v.map(|x| x.into());
6022 self
6023 }
6024
6025 /// Sets the value of [cancel_time][crate::model::CreateInstancePartitionMetadata::cancel_time].
6026 ///
6027 /// # Example
6028 /// ```ignore,no_run
6029 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6030 /// use wkt::Timestamp;
6031 /// let x = CreateInstancePartitionMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
6032 /// ```
6033 pub fn set_cancel_time<T>(mut self, v: T) -> Self
6034 where
6035 T: std::convert::Into<wkt::Timestamp>,
6036 {
6037 self.cancel_time = std::option::Option::Some(v.into());
6038 self
6039 }
6040
6041 /// Sets or clears the value of [cancel_time][crate::model::CreateInstancePartitionMetadata::cancel_time].
6042 ///
6043 /// # Example
6044 /// ```ignore,no_run
6045 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6046 /// use wkt::Timestamp;
6047 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
6048 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
6049 /// ```
6050 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
6051 where
6052 T: std::convert::Into<wkt::Timestamp>,
6053 {
6054 self.cancel_time = v.map(|x| x.into());
6055 self
6056 }
6057
6058 /// Sets the value of [end_time][crate::model::CreateInstancePartitionMetadata::end_time].
6059 ///
6060 /// # Example
6061 /// ```ignore,no_run
6062 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6063 /// use wkt::Timestamp;
6064 /// let x = CreateInstancePartitionMetadata::new().set_end_time(Timestamp::default()/* use setters */);
6065 /// ```
6066 pub fn set_end_time<T>(mut self, v: T) -> Self
6067 where
6068 T: std::convert::Into<wkt::Timestamp>,
6069 {
6070 self.end_time = std::option::Option::Some(v.into());
6071 self
6072 }
6073
6074 /// Sets or clears the value of [end_time][crate::model::CreateInstancePartitionMetadata::end_time].
6075 ///
6076 /// # Example
6077 /// ```ignore,no_run
6078 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6079 /// use wkt::Timestamp;
6080 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
6081 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_end_time(None::<Timestamp>);
6082 /// ```
6083 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
6084 where
6085 T: std::convert::Into<wkt::Timestamp>,
6086 {
6087 self.end_time = v.map(|x| x.into());
6088 self
6089 }
6090}
6091
6092impl wkt::message::Message for CreateInstancePartitionMetadata {
6093 fn typename() -> &'static str {
6094 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata"
6095 }
6096}
6097
6098/// The request for
6099/// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
6100///
6101/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]: crate::client::InstanceAdmin::create_instance_partition
6102#[derive(Clone, Default, PartialEq)]
6103#[non_exhaustive]
6104pub struct CreateInstancePartitionRequest {
6105 /// Required. The name of the instance in which to create the instance
6106 /// partition. Values are of the form
6107 /// `projects/<project>/instances/<instance>`.
6108 pub parent: std::string::String,
6109
6110 /// Required. The ID of the instance partition to create. Valid identifiers are
6111 /// of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
6112 /// characters in length.
6113 pub instance_partition_id: std::string::String,
6114
6115 /// Required. The instance partition to create. The instance_partition.name may
6116 /// be omitted, but if specified must be
6117 /// `<parent>/instancePartitions/<instance_partition_id>`.
6118 pub instance_partition: std::option::Option<crate::model::InstancePartition>,
6119
6120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6121}
6122
6123impl CreateInstancePartitionRequest {
6124 pub fn new() -> Self {
6125 std::default::Default::default()
6126 }
6127
6128 /// Sets the value of [parent][crate::model::CreateInstancePartitionRequest::parent].
6129 ///
6130 /// # Example
6131 /// ```ignore,no_run
6132 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionRequest;
6133 /// let x = CreateInstancePartitionRequest::new().set_parent("example");
6134 /// ```
6135 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6136 self.parent = v.into();
6137 self
6138 }
6139
6140 /// Sets the value of [instance_partition_id][crate::model::CreateInstancePartitionRequest::instance_partition_id].
6141 ///
6142 /// # Example
6143 /// ```ignore,no_run
6144 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionRequest;
6145 /// let x = CreateInstancePartitionRequest::new().set_instance_partition_id("example");
6146 /// ```
6147 pub fn set_instance_partition_id<T: std::convert::Into<std::string::String>>(
6148 mut self,
6149 v: T,
6150 ) -> Self {
6151 self.instance_partition_id = v.into();
6152 self
6153 }
6154
6155 /// Sets the value of [instance_partition][crate::model::CreateInstancePartitionRequest::instance_partition].
6156 ///
6157 /// # Example
6158 /// ```ignore,no_run
6159 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionRequest;
6160 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6161 /// let x = CreateInstancePartitionRequest::new().set_instance_partition(InstancePartition::default()/* use setters */);
6162 /// ```
6163 pub fn set_instance_partition<T>(mut self, v: T) -> Self
6164 where
6165 T: std::convert::Into<crate::model::InstancePartition>,
6166 {
6167 self.instance_partition = std::option::Option::Some(v.into());
6168 self
6169 }
6170
6171 /// Sets or clears the value of [instance_partition][crate::model::CreateInstancePartitionRequest::instance_partition].
6172 ///
6173 /// # Example
6174 /// ```ignore,no_run
6175 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionRequest;
6176 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6177 /// let x = CreateInstancePartitionRequest::new().set_or_clear_instance_partition(Some(InstancePartition::default()/* use setters */));
6178 /// let x = CreateInstancePartitionRequest::new().set_or_clear_instance_partition(None::<InstancePartition>);
6179 /// ```
6180 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
6181 where
6182 T: std::convert::Into<crate::model::InstancePartition>,
6183 {
6184 self.instance_partition = v.map(|x| x.into());
6185 self
6186 }
6187}
6188
6189impl wkt::message::Message for CreateInstancePartitionRequest {
6190 fn typename() -> &'static str {
6191 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionRequest"
6192 }
6193}
6194
6195/// The request for
6196/// [DeleteInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition].
6197///
6198/// [google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition]: crate::client::InstanceAdmin::delete_instance_partition
6199#[derive(Clone, Default, PartialEq)]
6200#[non_exhaustive]
6201pub struct DeleteInstancePartitionRequest {
6202 /// Required. The name of the instance partition to be deleted.
6203 /// Values are of the form
6204 /// `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
6205 pub name: std::string::String,
6206
6207 /// Optional. If not empty, the API only deletes the instance partition when
6208 /// the etag provided matches the current status of the requested instance
6209 /// partition. Otherwise, deletes the instance partition without checking the
6210 /// current status of the requested instance partition.
6211 pub etag: std::string::String,
6212
6213 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6214}
6215
6216impl DeleteInstancePartitionRequest {
6217 pub fn new() -> Self {
6218 std::default::Default::default()
6219 }
6220
6221 /// Sets the value of [name][crate::model::DeleteInstancePartitionRequest::name].
6222 ///
6223 /// # Example
6224 /// ```ignore,no_run
6225 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstancePartitionRequest;
6226 /// let x = DeleteInstancePartitionRequest::new().set_name("example");
6227 /// ```
6228 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6229 self.name = v.into();
6230 self
6231 }
6232
6233 /// Sets the value of [etag][crate::model::DeleteInstancePartitionRequest::etag].
6234 ///
6235 /// # Example
6236 /// ```ignore,no_run
6237 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstancePartitionRequest;
6238 /// let x = DeleteInstancePartitionRequest::new().set_etag("example");
6239 /// ```
6240 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6241 self.etag = v.into();
6242 self
6243 }
6244}
6245
6246impl wkt::message::Message for DeleteInstancePartitionRequest {
6247 fn typename() -> &'static str {
6248 "type.googleapis.com/google.spanner.admin.instance.v1.DeleteInstancePartitionRequest"
6249 }
6250}
6251
6252/// The request for
6253/// [GetInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition].
6254///
6255/// [google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition]: crate::client::InstanceAdmin::get_instance_partition
6256#[derive(Clone, Default, PartialEq)]
6257#[non_exhaustive]
6258pub struct GetInstancePartitionRequest {
6259 /// Required. The name of the requested instance partition. Values are of
6260 /// the form
6261 /// `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
6262 pub name: std::string::String,
6263
6264 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6265}
6266
6267impl GetInstancePartitionRequest {
6268 pub fn new() -> Self {
6269 std::default::Default::default()
6270 }
6271
6272 /// Sets the value of [name][crate::model::GetInstancePartitionRequest::name].
6273 ///
6274 /// # Example
6275 /// ```ignore,no_run
6276 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstancePartitionRequest;
6277 /// let x = GetInstancePartitionRequest::new().set_name("example");
6278 /// ```
6279 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6280 self.name = v.into();
6281 self
6282 }
6283}
6284
6285impl wkt::message::Message for GetInstancePartitionRequest {
6286 fn typename() -> &'static str {
6287 "type.googleapis.com/google.spanner.admin.instance.v1.GetInstancePartitionRequest"
6288 }
6289}
6290
6291/// The request for
6292/// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
6293///
6294/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]: crate::client::InstanceAdmin::update_instance_partition
6295#[derive(Clone, Default, PartialEq)]
6296#[non_exhaustive]
6297pub struct UpdateInstancePartitionRequest {
6298 /// Required. The instance partition to update, which must always include the
6299 /// instance partition name. Otherwise, only fields mentioned in
6300 /// [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
6301 /// need be included.
6302 ///
6303 /// [google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]: crate::model::UpdateInstancePartitionRequest::field_mask
6304 pub instance_partition: std::option::Option<crate::model::InstancePartition>,
6305
6306 /// Required. A mask specifying which fields in
6307 /// [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
6308 /// should be updated. The field mask must always be specified; this prevents
6309 /// any future fields in
6310 /// [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
6311 /// from being erased accidentally by clients that do not know about them.
6312 ///
6313 /// [google.spanner.admin.instance.v1.InstancePartition]: crate::model::InstancePartition
6314 pub field_mask: std::option::Option<wkt::FieldMask>,
6315
6316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6317}
6318
6319impl UpdateInstancePartitionRequest {
6320 pub fn new() -> Self {
6321 std::default::Default::default()
6322 }
6323
6324 /// Sets the value of [instance_partition][crate::model::UpdateInstancePartitionRequest::instance_partition].
6325 ///
6326 /// # Example
6327 /// ```ignore,no_run
6328 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionRequest;
6329 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6330 /// let x = UpdateInstancePartitionRequest::new().set_instance_partition(InstancePartition::default()/* use setters */);
6331 /// ```
6332 pub fn set_instance_partition<T>(mut self, v: T) -> Self
6333 where
6334 T: std::convert::Into<crate::model::InstancePartition>,
6335 {
6336 self.instance_partition = std::option::Option::Some(v.into());
6337 self
6338 }
6339
6340 /// Sets or clears the value of [instance_partition][crate::model::UpdateInstancePartitionRequest::instance_partition].
6341 ///
6342 /// # Example
6343 /// ```ignore,no_run
6344 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionRequest;
6345 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6346 /// let x = UpdateInstancePartitionRequest::new().set_or_clear_instance_partition(Some(InstancePartition::default()/* use setters */));
6347 /// let x = UpdateInstancePartitionRequest::new().set_or_clear_instance_partition(None::<InstancePartition>);
6348 /// ```
6349 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
6350 where
6351 T: std::convert::Into<crate::model::InstancePartition>,
6352 {
6353 self.instance_partition = v.map(|x| x.into());
6354 self
6355 }
6356
6357 /// Sets the value of [field_mask][crate::model::UpdateInstancePartitionRequest::field_mask].
6358 ///
6359 /// # Example
6360 /// ```ignore,no_run
6361 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionRequest;
6362 /// use wkt::FieldMask;
6363 /// let x = UpdateInstancePartitionRequest::new().set_field_mask(FieldMask::default()/* use setters */);
6364 /// ```
6365 pub fn set_field_mask<T>(mut self, v: T) -> Self
6366 where
6367 T: std::convert::Into<wkt::FieldMask>,
6368 {
6369 self.field_mask = std::option::Option::Some(v.into());
6370 self
6371 }
6372
6373 /// Sets or clears the value of [field_mask][crate::model::UpdateInstancePartitionRequest::field_mask].
6374 ///
6375 /// # Example
6376 /// ```ignore,no_run
6377 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionRequest;
6378 /// use wkt::FieldMask;
6379 /// let x = UpdateInstancePartitionRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
6380 /// let x = UpdateInstancePartitionRequest::new().set_or_clear_field_mask(None::<FieldMask>);
6381 /// ```
6382 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
6383 where
6384 T: std::convert::Into<wkt::FieldMask>,
6385 {
6386 self.field_mask = v.map(|x| x.into());
6387 self
6388 }
6389}
6390
6391impl wkt::message::Message for UpdateInstancePartitionRequest {
6392 fn typename() -> &'static str {
6393 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstancePartitionRequest"
6394 }
6395}
6396
6397/// Metadata type for the operation returned by
6398/// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
6399///
6400/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]: crate::client::InstanceAdmin::update_instance_partition
6401#[derive(Clone, Default, PartialEq)]
6402#[non_exhaustive]
6403pub struct UpdateInstancePartitionMetadata {
6404 /// The desired end state of the update.
6405 pub instance_partition: std::option::Option<crate::model::InstancePartition>,
6406
6407 /// The time at which
6408 /// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
6409 /// request was received.
6410 ///
6411 /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]: crate::client::InstanceAdmin::update_instance_partition
6412 pub start_time: std::option::Option<wkt::Timestamp>,
6413
6414 /// The time at which this operation was cancelled. If set, this operation is
6415 /// in the process of undoing itself (which is guaranteed to succeed) and
6416 /// cannot be cancelled again.
6417 pub cancel_time: std::option::Option<wkt::Timestamp>,
6418
6419 /// The time at which this operation failed or was completed successfully.
6420 pub end_time: std::option::Option<wkt::Timestamp>,
6421
6422 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6423}
6424
6425impl UpdateInstancePartitionMetadata {
6426 pub fn new() -> Self {
6427 std::default::Default::default()
6428 }
6429
6430 /// Sets the value of [instance_partition][crate::model::UpdateInstancePartitionMetadata::instance_partition].
6431 ///
6432 /// # Example
6433 /// ```ignore,no_run
6434 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6435 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6436 /// let x = UpdateInstancePartitionMetadata::new().set_instance_partition(InstancePartition::default()/* use setters */);
6437 /// ```
6438 pub fn set_instance_partition<T>(mut self, v: T) -> Self
6439 where
6440 T: std::convert::Into<crate::model::InstancePartition>,
6441 {
6442 self.instance_partition = std::option::Option::Some(v.into());
6443 self
6444 }
6445
6446 /// Sets or clears the value of [instance_partition][crate::model::UpdateInstancePartitionMetadata::instance_partition].
6447 ///
6448 /// # Example
6449 /// ```ignore,no_run
6450 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6451 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6452 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_instance_partition(Some(InstancePartition::default()/* use setters */));
6453 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_instance_partition(None::<InstancePartition>);
6454 /// ```
6455 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
6456 where
6457 T: std::convert::Into<crate::model::InstancePartition>,
6458 {
6459 self.instance_partition = v.map(|x| x.into());
6460 self
6461 }
6462
6463 /// Sets the value of [start_time][crate::model::UpdateInstancePartitionMetadata::start_time].
6464 ///
6465 /// # Example
6466 /// ```ignore,no_run
6467 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6468 /// use wkt::Timestamp;
6469 /// let x = UpdateInstancePartitionMetadata::new().set_start_time(Timestamp::default()/* use setters */);
6470 /// ```
6471 pub fn set_start_time<T>(mut self, v: T) -> Self
6472 where
6473 T: std::convert::Into<wkt::Timestamp>,
6474 {
6475 self.start_time = std::option::Option::Some(v.into());
6476 self
6477 }
6478
6479 /// Sets or clears the value of [start_time][crate::model::UpdateInstancePartitionMetadata::start_time].
6480 ///
6481 /// # Example
6482 /// ```ignore,no_run
6483 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6484 /// use wkt::Timestamp;
6485 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
6486 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_start_time(None::<Timestamp>);
6487 /// ```
6488 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6489 where
6490 T: std::convert::Into<wkt::Timestamp>,
6491 {
6492 self.start_time = v.map(|x| x.into());
6493 self
6494 }
6495
6496 /// Sets the value of [cancel_time][crate::model::UpdateInstancePartitionMetadata::cancel_time].
6497 ///
6498 /// # Example
6499 /// ```ignore,no_run
6500 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6501 /// use wkt::Timestamp;
6502 /// let x = UpdateInstancePartitionMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
6503 /// ```
6504 pub fn set_cancel_time<T>(mut self, v: T) -> Self
6505 where
6506 T: std::convert::Into<wkt::Timestamp>,
6507 {
6508 self.cancel_time = std::option::Option::Some(v.into());
6509 self
6510 }
6511
6512 /// Sets or clears the value of [cancel_time][crate::model::UpdateInstancePartitionMetadata::cancel_time].
6513 ///
6514 /// # Example
6515 /// ```ignore,no_run
6516 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6517 /// use wkt::Timestamp;
6518 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
6519 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
6520 /// ```
6521 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
6522 where
6523 T: std::convert::Into<wkt::Timestamp>,
6524 {
6525 self.cancel_time = v.map(|x| x.into());
6526 self
6527 }
6528
6529 /// Sets the value of [end_time][crate::model::UpdateInstancePartitionMetadata::end_time].
6530 ///
6531 /// # Example
6532 /// ```ignore,no_run
6533 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6534 /// use wkt::Timestamp;
6535 /// let x = UpdateInstancePartitionMetadata::new().set_end_time(Timestamp::default()/* use setters */);
6536 /// ```
6537 pub fn set_end_time<T>(mut self, v: T) -> Self
6538 where
6539 T: std::convert::Into<wkt::Timestamp>,
6540 {
6541 self.end_time = std::option::Option::Some(v.into());
6542 self
6543 }
6544
6545 /// Sets or clears the value of [end_time][crate::model::UpdateInstancePartitionMetadata::end_time].
6546 ///
6547 /// # Example
6548 /// ```ignore,no_run
6549 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6550 /// use wkt::Timestamp;
6551 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
6552 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_end_time(None::<Timestamp>);
6553 /// ```
6554 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
6555 where
6556 T: std::convert::Into<wkt::Timestamp>,
6557 {
6558 self.end_time = v.map(|x| x.into());
6559 self
6560 }
6561}
6562
6563impl wkt::message::Message for UpdateInstancePartitionMetadata {
6564 fn typename() -> &'static str {
6565 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata"
6566 }
6567}
6568
6569/// The request for
6570/// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
6571///
6572/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]: crate::client::InstanceAdmin::list_instance_partitions
6573#[derive(Clone, Default, PartialEq)]
6574#[non_exhaustive]
6575pub struct ListInstancePartitionsRequest {
6576 /// Required. The instance whose instance partitions should be listed. Values
6577 /// are of the form `projects/<project>/instances/<instance>`. Use `{instance}
6578 /// = '-'` to list instance partitions for all Instances in a project, e.g.,
6579 /// `projects/myproject/instances/-`.
6580 pub parent: std::string::String,
6581
6582 /// Number of instance partitions to be returned in the response. If 0 or less,
6583 /// defaults to the server's maximum allowed page size.
6584 pub page_size: i32,
6585
6586 /// If non-empty, `page_token` should contain a
6587 /// [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
6588 /// from a previous
6589 /// [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
6590 ///
6591 /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse]: crate::model::ListInstancePartitionsResponse
6592 /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]: crate::model::ListInstancePartitionsResponse::next_page_token
6593 pub page_token: std::string::String,
6594
6595 /// Optional. Deadline used while retrieving metadata for instance partitions.
6596 /// Instance partitions whose metadata cannot be retrieved within this deadline
6597 /// will be added to
6598 /// [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
6599 /// in
6600 /// [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
6601 ///
6602 /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse]: crate::model::ListInstancePartitionsResponse
6603 /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]: crate::model::ListInstancePartitionsResponse::unreachable
6604 pub instance_partition_deadline: std::option::Option<wkt::Timestamp>,
6605
6606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6607}
6608
6609impl ListInstancePartitionsRequest {
6610 pub fn new() -> Self {
6611 std::default::Default::default()
6612 }
6613
6614 /// Sets the value of [parent][crate::model::ListInstancePartitionsRequest::parent].
6615 ///
6616 /// # Example
6617 /// ```ignore,no_run
6618 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6619 /// let x = ListInstancePartitionsRequest::new().set_parent("example");
6620 /// ```
6621 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6622 self.parent = v.into();
6623 self
6624 }
6625
6626 /// Sets the value of [page_size][crate::model::ListInstancePartitionsRequest::page_size].
6627 ///
6628 /// # Example
6629 /// ```ignore,no_run
6630 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6631 /// let x = ListInstancePartitionsRequest::new().set_page_size(42);
6632 /// ```
6633 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6634 self.page_size = v.into();
6635 self
6636 }
6637
6638 /// Sets the value of [page_token][crate::model::ListInstancePartitionsRequest::page_token].
6639 ///
6640 /// # Example
6641 /// ```ignore,no_run
6642 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6643 /// let x = ListInstancePartitionsRequest::new().set_page_token("example");
6644 /// ```
6645 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6646 self.page_token = v.into();
6647 self
6648 }
6649
6650 /// Sets the value of [instance_partition_deadline][crate::model::ListInstancePartitionsRequest::instance_partition_deadline].
6651 ///
6652 /// # Example
6653 /// ```ignore,no_run
6654 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6655 /// use wkt::Timestamp;
6656 /// let x = ListInstancePartitionsRequest::new().set_instance_partition_deadline(Timestamp::default()/* use setters */);
6657 /// ```
6658 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
6659 where
6660 T: std::convert::Into<wkt::Timestamp>,
6661 {
6662 self.instance_partition_deadline = std::option::Option::Some(v.into());
6663 self
6664 }
6665
6666 /// Sets or clears the value of [instance_partition_deadline][crate::model::ListInstancePartitionsRequest::instance_partition_deadline].
6667 ///
6668 /// # Example
6669 /// ```ignore,no_run
6670 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6671 /// use wkt::Timestamp;
6672 /// let x = ListInstancePartitionsRequest::new().set_or_clear_instance_partition_deadline(Some(Timestamp::default()/* use setters */));
6673 /// let x = ListInstancePartitionsRequest::new().set_or_clear_instance_partition_deadline(None::<Timestamp>);
6674 /// ```
6675 pub fn set_or_clear_instance_partition_deadline<T>(mut self, v: std::option::Option<T>) -> Self
6676 where
6677 T: std::convert::Into<wkt::Timestamp>,
6678 {
6679 self.instance_partition_deadline = v.map(|x| x.into());
6680 self
6681 }
6682}
6683
6684impl wkt::message::Message for ListInstancePartitionsRequest {
6685 fn typename() -> &'static str {
6686 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionsRequest"
6687 }
6688}
6689
6690/// The response for
6691/// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
6692///
6693/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]: crate::client::InstanceAdmin::list_instance_partitions
6694#[derive(Clone, Default, PartialEq)]
6695#[non_exhaustive]
6696pub struct ListInstancePartitionsResponse {
6697 /// The list of requested instancePartitions.
6698 pub instance_partitions: std::vec::Vec<crate::model::InstancePartition>,
6699
6700 /// `next_page_token` can be sent in a subsequent
6701 /// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
6702 /// call to fetch more of the matching instance partitions.
6703 ///
6704 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]: crate::client::InstanceAdmin::list_instance_partitions
6705 pub next_page_token: std::string::String,
6706
6707 /// The list of unreachable instances or instance partitions.
6708 /// It includes the names of instances or instance partitions whose metadata
6709 /// could not be retrieved within
6710 /// [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
6711 ///
6712 /// [google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]: crate::model::ListInstancePartitionsRequest::instance_partition_deadline
6713 pub unreachable: std::vec::Vec<std::string::String>,
6714
6715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6716}
6717
6718impl ListInstancePartitionsResponse {
6719 pub fn new() -> Self {
6720 std::default::Default::default()
6721 }
6722
6723 /// Sets the value of [instance_partitions][crate::model::ListInstancePartitionsResponse::instance_partitions].
6724 ///
6725 /// # Example
6726 /// ```ignore,no_run
6727 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsResponse;
6728 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6729 /// let x = ListInstancePartitionsResponse::new()
6730 /// .set_instance_partitions([
6731 /// InstancePartition::default()/* use setters */,
6732 /// InstancePartition::default()/* use (different) setters */,
6733 /// ]);
6734 /// ```
6735 pub fn set_instance_partitions<T, V>(mut self, v: T) -> Self
6736 where
6737 T: std::iter::IntoIterator<Item = V>,
6738 V: std::convert::Into<crate::model::InstancePartition>,
6739 {
6740 use std::iter::Iterator;
6741 self.instance_partitions = v.into_iter().map(|i| i.into()).collect();
6742 self
6743 }
6744
6745 /// Sets the value of [next_page_token][crate::model::ListInstancePartitionsResponse::next_page_token].
6746 ///
6747 /// # Example
6748 /// ```ignore,no_run
6749 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsResponse;
6750 /// let x = ListInstancePartitionsResponse::new().set_next_page_token("example");
6751 /// ```
6752 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6753 self.next_page_token = v.into();
6754 self
6755 }
6756
6757 /// Sets the value of [unreachable][crate::model::ListInstancePartitionsResponse::unreachable].
6758 ///
6759 /// # Example
6760 /// ```ignore,no_run
6761 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsResponse;
6762 /// let x = ListInstancePartitionsResponse::new().set_unreachable(["a", "b", "c"]);
6763 /// ```
6764 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6765 where
6766 T: std::iter::IntoIterator<Item = V>,
6767 V: std::convert::Into<std::string::String>,
6768 {
6769 use std::iter::Iterator;
6770 self.unreachable = v.into_iter().map(|i| i.into()).collect();
6771 self
6772 }
6773}
6774
6775impl wkt::message::Message for ListInstancePartitionsResponse {
6776 fn typename() -> &'static str {
6777 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionsResponse"
6778 }
6779}
6780
6781#[doc(hidden)]
6782impl gax::paginator::internal::PageableResponse for ListInstancePartitionsResponse {
6783 type PageItem = crate::model::InstancePartition;
6784
6785 fn items(self) -> std::vec::Vec<Self::PageItem> {
6786 self.instance_partitions
6787 }
6788
6789 fn next_page_token(&self) -> std::string::String {
6790 use std::clone::Clone;
6791 self.next_page_token.clone()
6792 }
6793}
6794
6795/// The request for
6796/// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
6797///
6798/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]: crate::client::InstanceAdmin::list_instance_partition_operations
6799#[derive(Clone, Default, PartialEq)]
6800#[non_exhaustive]
6801pub struct ListInstancePartitionOperationsRequest {
6802 /// Required. The parent instance of the instance partition operations.
6803 /// Values are of the form `projects/<project>/instances/<instance>`.
6804 pub parent: std::string::String,
6805
6806 /// Optional. An expression that filters the list of returned operations.
6807 ///
6808 /// A filter expression consists of a field name, a
6809 /// comparison operator, and a value for filtering.
6810 /// The value must be a string, a number, or a boolean. The comparison operator
6811 /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
6812 /// Colon `:` is the contains operator. Filter rules are not case sensitive.
6813 ///
6814 /// The following fields in the Operation are eligible for filtering:
6815 ///
6816 /// * `name` - The name of the long-running operation
6817 /// * `done` - False if the operation is in progress, else true.
6818 /// * `metadata.@type` - the type of metadata. For example, the type string
6819 /// for
6820 /// [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
6821 /// is
6822 /// `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
6823 /// * `metadata.<field_name>` - any field in metadata.value.
6824 /// `metadata.@type` must be specified first, if filtering on metadata
6825 /// fields.
6826 /// * `error` - Error associated with the long-running operation.
6827 /// * `response.@type` - the type of response.
6828 /// * `response.<field_name>` - any field in response.value.
6829 ///
6830 /// You can combine multiple expressions by enclosing each expression in
6831 /// parentheses. By default, expressions are combined with AND logic. However,
6832 /// you can specify AND, OR, and NOT logic explicitly.
6833 ///
6834 /// Here are a few examples:
6835 ///
6836 /// * `done:true` - The operation is complete.
6837 /// * `(metadata.@type=` \
6838 /// `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
6839 /// AND` \
6840 /// `(metadata.instance_partition.name:custom-instance-partition) AND` \
6841 /// `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
6842 /// `(error:*)` - Return operations where:
6843 /// * The operation's metadata type is
6844 /// [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
6845 /// * The instance partition name contains "custom-instance-partition".
6846 /// * The operation started before 2021-03-28T14:50:00Z.
6847 /// * The operation resulted in an error.
6848 ///
6849 /// [google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]: crate::model::CreateInstancePartitionMetadata
6850 pub filter: std::string::String,
6851
6852 /// Optional. Number of operations to be returned in the response. If 0 or
6853 /// less, defaults to the server's maximum allowed page size.
6854 pub page_size: i32,
6855
6856 /// Optional. If non-empty, `page_token` should contain a
6857 /// [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
6858 /// from a previous
6859 /// [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
6860 /// to the same `parent` and with the same `filter`.
6861 ///
6862 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]: crate::model::ListInstancePartitionOperationsResponse
6863 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]: crate::model::ListInstancePartitionOperationsResponse::next_page_token
6864 pub page_token: std::string::String,
6865
6866 /// Optional. Deadline used while retrieving metadata for instance partition
6867 /// operations. Instance partitions whose operation metadata cannot be
6868 /// retrieved within this deadline will be added to
6869 /// [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions]
6870 /// in
6871 /// [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
6872 ///
6873 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]: crate::model::ListInstancePartitionOperationsResponse
6874 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions]: crate::model::ListInstancePartitionOperationsResponse::unreachable_instance_partitions
6875 pub instance_partition_deadline: std::option::Option<wkt::Timestamp>,
6876
6877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6878}
6879
6880impl ListInstancePartitionOperationsRequest {
6881 pub fn new() -> Self {
6882 std::default::Default::default()
6883 }
6884
6885 /// Sets the value of [parent][crate::model::ListInstancePartitionOperationsRequest::parent].
6886 ///
6887 /// # Example
6888 /// ```ignore,no_run
6889 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
6890 /// let x = ListInstancePartitionOperationsRequest::new().set_parent("example");
6891 /// ```
6892 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6893 self.parent = v.into();
6894 self
6895 }
6896
6897 /// Sets the value of [filter][crate::model::ListInstancePartitionOperationsRequest::filter].
6898 ///
6899 /// # Example
6900 /// ```ignore,no_run
6901 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
6902 /// let x = ListInstancePartitionOperationsRequest::new().set_filter("example");
6903 /// ```
6904 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6905 self.filter = v.into();
6906 self
6907 }
6908
6909 /// Sets the value of [page_size][crate::model::ListInstancePartitionOperationsRequest::page_size].
6910 ///
6911 /// # Example
6912 /// ```ignore,no_run
6913 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
6914 /// let x = ListInstancePartitionOperationsRequest::new().set_page_size(42);
6915 /// ```
6916 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6917 self.page_size = v.into();
6918 self
6919 }
6920
6921 /// Sets the value of [page_token][crate::model::ListInstancePartitionOperationsRequest::page_token].
6922 ///
6923 /// # Example
6924 /// ```ignore,no_run
6925 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
6926 /// let x = ListInstancePartitionOperationsRequest::new().set_page_token("example");
6927 /// ```
6928 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6929 self.page_token = v.into();
6930 self
6931 }
6932
6933 /// Sets the value of [instance_partition_deadline][crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline].
6934 ///
6935 /// # Example
6936 /// ```ignore,no_run
6937 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
6938 /// use wkt::Timestamp;
6939 /// let x = ListInstancePartitionOperationsRequest::new().set_instance_partition_deadline(Timestamp::default()/* use setters */);
6940 /// ```
6941 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
6942 where
6943 T: std::convert::Into<wkt::Timestamp>,
6944 {
6945 self.instance_partition_deadline = std::option::Option::Some(v.into());
6946 self
6947 }
6948
6949 /// Sets or clears the value of [instance_partition_deadline][crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline].
6950 ///
6951 /// # Example
6952 /// ```ignore,no_run
6953 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
6954 /// use wkt::Timestamp;
6955 /// let x = ListInstancePartitionOperationsRequest::new().set_or_clear_instance_partition_deadline(Some(Timestamp::default()/* use setters */));
6956 /// let x = ListInstancePartitionOperationsRequest::new().set_or_clear_instance_partition_deadline(None::<Timestamp>);
6957 /// ```
6958 pub fn set_or_clear_instance_partition_deadline<T>(mut self, v: std::option::Option<T>) -> Self
6959 where
6960 T: std::convert::Into<wkt::Timestamp>,
6961 {
6962 self.instance_partition_deadline = v.map(|x| x.into());
6963 self
6964 }
6965}
6966
6967impl wkt::message::Message for ListInstancePartitionOperationsRequest {
6968 fn typename() -> &'static str {
6969 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest"
6970 }
6971}
6972
6973/// The response for
6974/// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
6975///
6976/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]: crate::client::InstanceAdmin::list_instance_partition_operations
6977#[derive(Clone, Default, PartialEq)]
6978#[non_exhaustive]
6979pub struct ListInstancePartitionOperationsResponse {
6980 /// The list of matching instance partition long-running operations. Each
6981 /// operation's name will be
6982 /// prefixed by the instance partition's name. The operation's
6983 /// metadata field type
6984 /// `metadata.type_url` describes the type of the metadata.
6985 pub operations: std::vec::Vec<longrunning::model::Operation>,
6986
6987 /// `next_page_token` can be sent in a subsequent
6988 /// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
6989 /// call to fetch more of the matching metadata.
6990 ///
6991 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]: crate::client::InstanceAdmin::list_instance_partition_operations
6992 pub next_page_token: std::string::String,
6993
6994 /// The list of unreachable instance partitions.
6995 /// It includes the names of instance partitions whose operation metadata could
6996 /// not be retrieved within
6997 /// [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
6998 ///
6999 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]: crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline
7000 pub unreachable_instance_partitions: std::vec::Vec<std::string::String>,
7001
7002 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7003}
7004
7005impl ListInstancePartitionOperationsResponse {
7006 pub fn new() -> Self {
7007 std::default::Default::default()
7008 }
7009
7010 /// Sets the value of [operations][crate::model::ListInstancePartitionOperationsResponse::operations].
7011 ///
7012 /// # Example
7013 /// ```ignore,no_run
7014 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsResponse;
7015 /// use longrunning::model::Operation;
7016 /// let x = ListInstancePartitionOperationsResponse::new()
7017 /// .set_operations([
7018 /// Operation::default()/* use setters */,
7019 /// Operation::default()/* use (different) setters */,
7020 /// ]);
7021 /// ```
7022 pub fn set_operations<T, V>(mut self, v: T) -> Self
7023 where
7024 T: std::iter::IntoIterator<Item = V>,
7025 V: std::convert::Into<longrunning::model::Operation>,
7026 {
7027 use std::iter::Iterator;
7028 self.operations = v.into_iter().map(|i| i.into()).collect();
7029 self
7030 }
7031
7032 /// Sets the value of [next_page_token][crate::model::ListInstancePartitionOperationsResponse::next_page_token].
7033 ///
7034 /// # Example
7035 /// ```ignore,no_run
7036 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsResponse;
7037 /// let x = ListInstancePartitionOperationsResponse::new().set_next_page_token("example");
7038 /// ```
7039 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7040 self.next_page_token = v.into();
7041 self
7042 }
7043
7044 /// Sets the value of [unreachable_instance_partitions][crate::model::ListInstancePartitionOperationsResponse::unreachable_instance_partitions].
7045 ///
7046 /// # Example
7047 /// ```ignore,no_run
7048 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsResponse;
7049 /// let x = ListInstancePartitionOperationsResponse::new().set_unreachable_instance_partitions(["a", "b", "c"]);
7050 /// ```
7051 pub fn set_unreachable_instance_partitions<T, V>(mut self, v: T) -> Self
7052 where
7053 T: std::iter::IntoIterator<Item = V>,
7054 V: std::convert::Into<std::string::String>,
7055 {
7056 use std::iter::Iterator;
7057 self.unreachable_instance_partitions = v.into_iter().map(|i| i.into()).collect();
7058 self
7059 }
7060}
7061
7062impl wkt::message::Message for ListInstancePartitionOperationsResponse {
7063 fn typename() -> &'static str {
7064 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse"
7065 }
7066}
7067
7068#[doc(hidden)]
7069impl gax::paginator::internal::PageableResponse for ListInstancePartitionOperationsResponse {
7070 type PageItem = longrunning::model::Operation;
7071
7072 fn items(self) -> std::vec::Vec<Self::PageItem> {
7073 self.operations
7074 }
7075
7076 fn next_page_token(&self) -> std::string::String {
7077 use std::clone::Clone;
7078 self.next_page_token.clone()
7079 }
7080}
7081
7082/// The request for
7083/// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
7084///
7085/// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
7086#[derive(Clone, Default, PartialEq)]
7087#[non_exhaustive]
7088pub struct MoveInstanceRequest {
7089 /// Required. The instance to move.
7090 /// Values are of the form `projects/<project>/instances/<instance>`.
7091 pub name: std::string::String,
7092
7093 /// Required. The target instance configuration where to move the instance.
7094 /// Values are of the form `projects/<project>/instanceConfigs/<config>`.
7095 pub target_config: std::string::String,
7096
7097 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7098}
7099
7100impl MoveInstanceRequest {
7101 pub fn new() -> Self {
7102 std::default::Default::default()
7103 }
7104
7105 /// Sets the value of [name][crate::model::MoveInstanceRequest::name].
7106 ///
7107 /// # Example
7108 /// ```ignore,no_run
7109 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceRequest;
7110 /// let x = MoveInstanceRequest::new().set_name("example");
7111 /// ```
7112 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7113 self.name = v.into();
7114 self
7115 }
7116
7117 /// Sets the value of [target_config][crate::model::MoveInstanceRequest::target_config].
7118 ///
7119 /// # Example
7120 /// ```ignore,no_run
7121 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceRequest;
7122 /// let x = MoveInstanceRequest::new().set_target_config("example");
7123 /// ```
7124 pub fn set_target_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7125 self.target_config = v.into();
7126 self
7127 }
7128}
7129
7130impl wkt::message::Message for MoveInstanceRequest {
7131 fn typename() -> &'static str {
7132 "type.googleapis.com/google.spanner.admin.instance.v1.MoveInstanceRequest"
7133 }
7134}
7135
7136/// The response for
7137/// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
7138///
7139/// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
7140#[derive(Clone, Default, PartialEq)]
7141#[non_exhaustive]
7142pub struct MoveInstanceResponse {
7143 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7144}
7145
7146impl MoveInstanceResponse {
7147 pub fn new() -> Self {
7148 std::default::Default::default()
7149 }
7150}
7151
7152impl wkt::message::Message for MoveInstanceResponse {
7153 fn typename() -> &'static str {
7154 "type.googleapis.com/google.spanner.admin.instance.v1.MoveInstanceResponse"
7155 }
7156}
7157
7158/// Metadata type for the operation returned by
7159/// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
7160///
7161/// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
7162#[derive(Clone, Default, PartialEq)]
7163#[non_exhaustive]
7164pub struct MoveInstanceMetadata {
7165 /// The target instance configuration where to move the instance.
7166 /// Values are of the form `projects/<project>/instanceConfigs/<config>`.
7167 pub target_config: std::string::String,
7168
7169 /// The progress of the
7170 /// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]
7171 /// operation.
7172 /// [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent]
7173 /// is reset when cancellation is requested.
7174 ///
7175 /// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
7176 /// [google.spanner.admin.instance.v1.OperationProgress.progress_percent]: crate::model::OperationProgress::progress_percent
7177 pub progress: std::option::Option<crate::model::OperationProgress>,
7178
7179 /// The time at which this operation was cancelled.
7180 pub cancel_time: std::option::Option<wkt::Timestamp>,
7181
7182 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7183}
7184
7185impl MoveInstanceMetadata {
7186 pub fn new() -> Self {
7187 std::default::Default::default()
7188 }
7189
7190 /// Sets the value of [target_config][crate::model::MoveInstanceMetadata::target_config].
7191 ///
7192 /// # Example
7193 /// ```ignore,no_run
7194 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7195 /// let x = MoveInstanceMetadata::new().set_target_config("example");
7196 /// ```
7197 pub fn set_target_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7198 self.target_config = v.into();
7199 self
7200 }
7201
7202 /// Sets the value of [progress][crate::model::MoveInstanceMetadata::progress].
7203 ///
7204 /// # Example
7205 /// ```ignore,no_run
7206 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7207 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
7208 /// let x = MoveInstanceMetadata::new().set_progress(OperationProgress::default()/* use setters */);
7209 /// ```
7210 pub fn set_progress<T>(mut self, v: T) -> Self
7211 where
7212 T: std::convert::Into<crate::model::OperationProgress>,
7213 {
7214 self.progress = std::option::Option::Some(v.into());
7215 self
7216 }
7217
7218 /// Sets or clears the value of [progress][crate::model::MoveInstanceMetadata::progress].
7219 ///
7220 /// # Example
7221 /// ```ignore,no_run
7222 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7223 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
7224 /// let x = MoveInstanceMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
7225 /// let x = MoveInstanceMetadata::new().set_or_clear_progress(None::<OperationProgress>);
7226 /// ```
7227 pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
7228 where
7229 T: std::convert::Into<crate::model::OperationProgress>,
7230 {
7231 self.progress = v.map(|x| x.into());
7232 self
7233 }
7234
7235 /// Sets the value of [cancel_time][crate::model::MoveInstanceMetadata::cancel_time].
7236 ///
7237 /// # Example
7238 /// ```ignore,no_run
7239 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7240 /// use wkt::Timestamp;
7241 /// let x = MoveInstanceMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
7242 /// ```
7243 pub fn set_cancel_time<T>(mut self, v: T) -> Self
7244 where
7245 T: std::convert::Into<wkt::Timestamp>,
7246 {
7247 self.cancel_time = std::option::Option::Some(v.into());
7248 self
7249 }
7250
7251 /// Sets or clears the value of [cancel_time][crate::model::MoveInstanceMetadata::cancel_time].
7252 ///
7253 /// # Example
7254 /// ```ignore,no_run
7255 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7256 /// use wkt::Timestamp;
7257 /// let x = MoveInstanceMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
7258 /// let x = MoveInstanceMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
7259 /// ```
7260 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
7261 where
7262 T: std::convert::Into<wkt::Timestamp>,
7263 {
7264 self.cancel_time = v.map(|x| x.into());
7265 self
7266 }
7267}
7268
7269impl wkt::message::Message for MoveInstanceMetadata {
7270 fn typename() -> &'static str {
7271 "type.googleapis.com/google.spanner.admin.instance.v1.MoveInstanceMetadata"
7272 }
7273}
7274
7275/// Indicates the expected fulfillment period of an operation.
7276///
7277/// # Working with unknown values
7278///
7279/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7280/// additional enum variants at any time. Adding new variants is not considered
7281/// a breaking change. Applications should write their code in anticipation of:
7282///
7283/// - New values appearing in future releases of the client library, **and**
7284/// - New values received dynamically, without application changes.
7285///
7286/// Please consult the [Working with enums] section in the user guide for some
7287/// guidelines.
7288///
7289/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7290#[derive(Clone, Debug, PartialEq)]
7291#[non_exhaustive]
7292pub enum FulfillmentPeriod {
7293 /// Not specified.
7294 Unspecified,
7295 /// Normal fulfillment period. The operation is expected to complete within
7296 /// minutes.
7297 Normal,
7298 /// Extended fulfillment period. It can take up to an hour for the operation
7299 /// to complete.
7300 Extended,
7301 /// If set, the enum was initialized with an unknown value.
7302 ///
7303 /// Applications can examine the value using [FulfillmentPeriod::value] or
7304 /// [FulfillmentPeriod::name].
7305 UnknownValue(fulfillment_period::UnknownValue),
7306}
7307
7308#[doc(hidden)]
7309pub mod fulfillment_period {
7310 #[allow(unused_imports)]
7311 use super::*;
7312 #[derive(Clone, Debug, PartialEq)]
7313 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7314}
7315
7316impl FulfillmentPeriod {
7317 /// Gets the enum value.
7318 ///
7319 /// Returns `None` if the enum contains an unknown value deserialized from
7320 /// the string representation of enums.
7321 pub fn value(&self) -> std::option::Option<i32> {
7322 match self {
7323 Self::Unspecified => std::option::Option::Some(0),
7324 Self::Normal => std::option::Option::Some(1),
7325 Self::Extended => std::option::Option::Some(2),
7326 Self::UnknownValue(u) => u.0.value(),
7327 }
7328 }
7329
7330 /// Gets the enum value as a string.
7331 ///
7332 /// Returns `None` if the enum contains an unknown value deserialized from
7333 /// the integer representation of enums.
7334 pub fn name(&self) -> std::option::Option<&str> {
7335 match self {
7336 Self::Unspecified => std::option::Option::Some("FULFILLMENT_PERIOD_UNSPECIFIED"),
7337 Self::Normal => std::option::Option::Some("FULFILLMENT_PERIOD_NORMAL"),
7338 Self::Extended => std::option::Option::Some("FULFILLMENT_PERIOD_EXTENDED"),
7339 Self::UnknownValue(u) => u.0.name(),
7340 }
7341 }
7342}
7343
7344impl std::default::Default for FulfillmentPeriod {
7345 fn default() -> Self {
7346 use std::convert::From;
7347 Self::from(0)
7348 }
7349}
7350
7351impl std::fmt::Display for FulfillmentPeriod {
7352 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7353 wkt::internal::display_enum(f, self.name(), self.value())
7354 }
7355}
7356
7357impl std::convert::From<i32> for FulfillmentPeriod {
7358 fn from(value: i32) -> Self {
7359 match value {
7360 0 => Self::Unspecified,
7361 1 => Self::Normal,
7362 2 => Self::Extended,
7363 _ => Self::UnknownValue(fulfillment_period::UnknownValue(
7364 wkt::internal::UnknownEnumValue::Integer(value),
7365 )),
7366 }
7367 }
7368}
7369
7370impl std::convert::From<&str> for FulfillmentPeriod {
7371 fn from(value: &str) -> Self {
7372 use std::string::ToString;
7373 match value {
7374 "FULFILLMENT_PERIOD_UNSPECIFIED" => Self::Unspecified,
7375 "FULFILLMENT_PERIOD_NORMAL" => Self::Normal,
7376 "FULFILLMENT_PERIOD_EXTENDED" => Self::Extended,
7377 _ => Self::UnknownValue(fulfillment_period::UnknownValue(
7378 wkt::internal::UnknownEnumValue::String(value.to_string()),
7379 )),
7380 }
7381 }
7382}
7383
7384impl serde::ser::Serialize for FulfillmentPeriod {
7385 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7386 where
7387 S: serde::Serializer,
7388 {
7389 match self {
7390 Self::Unspecified => serializer.serialize_i32(0),
7391 Self::Normal => serializer.serialize_i32(1),
7392 Self::Extended => serializer.serialize_i32(2),
7393 Self::UnknownValue(u) => u.0.serialize(serializer),
7394 }
7395 }
7396}
7397
7398impl<'de> serde::de::Deserialize<'de> for FulfillmentPeriod {
7399 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7400 where
7401 D: serde::Deserializer<'de>,
7402 {
7403 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FulfillmentPeriod>::new(
7404 ".google.spanner.admin.instance.v1.FulfillmentPeriod",
7405 ))
7406 }
7407}