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 /// Optional. 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. If not specified or set to 0, the autoscaler
1902 /// skips scaling based on high priority CPU utilization.
1903 pub high_priority_cpu_utilization_percent: i32,
1904
1905 /// Optional. The target total CPU utilization percentage that the autoscaler
1906 /// should be trying to achieve for the instance. This number is on a scale
1907 /// from 0 (no utilization) to 100 (full utilization). The valid range is
1908 /// [10, 90] inclusive. If not specified or set to 0, the autoscaler skips
1909 /// scaling based on total CPU utilization. If both
1910 /// `high_priority_cpu_utilization_percent` and
1911 /// `total_cpu_utilization_percent` are specified, the autoscaler provisions
1912 /// the larger of the two required compute capacities to satisfy both
1913 /// targets.
1914 pub total_cpu_utilization_percent: i32,
1915
1916 /// Required. The target storage utilization percentage that the autoscaler
1917 /// should be trying to achieve for the instance. This number is on a scale
1918 /// from 0 (no utilization) to 100 (full utilization). The valid range is
1919 /// [10, 99] inclusive.
1920 pub storage_utilization_percent: i32,
1921
1922 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1923 }
1924
1925 impl AutoscalingTargets {
1926 pub fn new() -> Self {
1927 std::default::Default::default()
1928 }
1929
1930 /// Sets the value of [high_priority_cpu_utilization_percent][crate::model::autoscaling_config::AutoscalingTargets::high_priority_cpu_utilization_percent].
1931 ///
1932 /// # Example
1933 /// ```ignore,no_run
1934 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingTargets;
1935 /// let x = AutoscalingTargets::new().set_high_priority_cpu_utilization_percent(42);
1936 /// ```
1937 pub fn set_high_priority_cpu_utilization_percent<T: std::convert::Into<i32>>(
1938 mut self,
1939 v: T,
1940 ) -> Self {
1941 self.high_priority_cpu_utilization_percent = v.into();
1942 self
1943 }
1944
1945 /// Sets the value of [total_cpu_utilization_percent][crate::model::autoscaling_config::AutoscalingTargets::total_cpu_utilization_percent].
1946 ///
1947 /// # Example
1948 /// ```ignore,no_run
1949 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingTargets;
1950 /// let x = AutoscalingTargets::new().set_total_cpu_utilization_percent(42);
1951 /// ```
1952 pub fn set_total_cpu_utilization_percent<T: std::convert::Into<i32>>(
1953 mut self,
1954 v: T,
1955 ) -> Self {
1956 self.total_cpu_utilization_percent = v.into();
1957 self
1958 }
1959
1960 /// Sets the value of [storage_utilization_percent][crate::model::autoscaling_config::AutoscalingTargets::storage_utilization_percent].
1961 ///
1962 /// # Example
1963 /// ```ignore,no_run
1964 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingTargets;
1965 /// let x = AutoscalingTargets::new().set_storage_utilization_percent(42);
1966 /// ```
1967 pub fn set_storage_utilization_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1968 self.storage_utilization_percent = v.into();
1969 self
1970 }
1971 }
1972
1973 impl wkt::message::Message for AutoscalingTargets {
1974 fn typename() -> &'static str {
1975 "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets"
1976 }
1977 }
1978
1979 /// AsymmetricAutoscalingOption specifies the scaling of replicas identified by
1980 /// the given selection.
1981 #[derive(Clone, Default, PartialEq)]
1982 #[non_exhaustive]
1983 pub struct AsymmetricAutoscalingOption {
1984
1985 /// Required. Selects the replicas to which this AsymmetricAutoscalingOption
1986 /// applies. Only read-only replicas are supported.
1987 pub replica_selection: std::option::Option<crate::model::ReplicaSelection>,
1988
1989 /// Optional. Overrides applied to the top-level autoscaling configuration
1990 /// for the selected replicas.
1991 pub overrides: std::option::Option<crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides>,
1992
1993 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1994 }
1995
1996 impl AsymmetricAutoscalingOption {
1997 pub fn new() -> Self {
1998 std::default::Default::default()
1999 }
2000
2001 /// Sets the value of [replica_selection][crate::model::autoscaling_config::AsymmetricAutoscalingOption::replica_selection].
2002 ///
2003 /// # Example
2004 /// ```ignore,no_run
2005 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AsymmetricAutoscalingOption;
2006 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaSelection;
2007 /// let x = AsymmetricAutoscalingOption::new().set_replica_selection(ReplicaSelection::default()/* use setters */);
2008 /// ```
2009 pub fn set_replica_selection<T>(mut self, v: T) -> Self
2010 where
2011 T: std::convert::Into<crate::model::ReplicaSelection>,
2012 {
2013 self.replica_selection = std::option::Option::Some(v.into());
2014 self
2015 }
2016
2017 /// Sets or clears the value of [replica_selection][crate::model::autoscaling_config::AsymmetricAutoscalingOption::replica_selection].
2018 ///
2019 /// # Example
2020 /// ```ignore,no_run
2021 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AsymmetricAutoscalingOption;
2022 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaSelection;
2023 /// let x = AsymmetricAutoscalingOption::new().set_or_clear_replica_selection(Some(ReplicaSelection::default()/* use setters */));
2024 /// let x = AsymmetricAutoscalingOption::new().set_or_clear_replica_selection(None::<ReplicaSelection>);
2025 /// ```
2026 pub fn set_or_clear_replica_selection<T>(mut self, v: std::option::Option<T>) -> Self
2027 where
2028 T: std::convert::Into<crate::model::ReplicaSelection>,
2029 {
2030 self.replica_selection = v.map(|x| x.into());
2031 self
2032 }
2033
2034 /// Sets the value of [overrides][crate::model::autoscaling_config::AsymmetricAutoscalingOption::overrides].
2035 ///
2036 /// # Example
2037 /// ```ignore,no_run
2038 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AsymmetricAutoscalingOption;
2039 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2040 /// let x = AsymmetricAutoscalingOption::new().set_overrides(AutoscalingConfigOverrides::default()/* use setters */);
2041 /// ```
2042 pub fn set_overrides<T>(mut self, v: T) -> Self
2043 where T: std::convert::Into<crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides>
2044 {
2045 self.overrides = std::option::Option::Some(v.into());
2046 self
2047 }
2048
2049 /// Sets or clears the value of [overrides][crate::model::autoscaling_config::AsymmetricAutoscalingOption::overrides].
2050 ///
2051 /// # Example
2052 /// ```ignore,no_run
2053 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AsymmetricAutoscalingOption;
2054 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2055 /// let x = AsymmetricAutoscalingOption::new().set_or_clear_overrides(Some(AutoscalingConfigOverrides::default()/* use setters */));
2056 /// let x = AsymmetricAutoscalingOption::new().set_or_clear_overrides(None::<AutoscalingConfigOverrides>);
2057 /// ```
2058 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
2059 where T: std::convert::Into<crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides>
2060 {
2061 self.overrides = v.map(|x| x.into());
2062 self
2063 }
2064 }
2065
2066 impl wkt::message::Message for AsymmetricAutoscalingOption {
2067 fn typename() -> &'static str {
2068 "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption"
2069 }
2070 }
2071
2072 /// Defines additional types related to [AsymmetricAutoscalingOption].
2073 pub mod asymmetric_autoscaling_option {
2074 #[allow(unused_imports)]
2075 use super::*;
2076
2077 /// Overrides the top-level autoscaling configuration for the replicas
2078 /// identified by `replica_selection`. All fields in this message are
2079 /// optional. Any unspecified fields will use the corresponding values from
2080 /// the top-level autoscaling configuration.
2081 #[derive(Clone, Default, PartialEq)]
2082 #[non_exhaustive]
2083 pub struct AutoscalingConfigOverrides {
2084 /// Optional. If specified, overrides the min/max limit in the top-level
2085 /// autoscaling configuration for the selected replicas.
2086 pub autoscaling_limits:
2087 std::option::Option<crate::model::autoscaling_config::AutoscalingLimits>,
2088
2089 /// Optional. If specified, overrides the autoscaling target
2090 /// high_priority_cpu_utilization_percent in the top-level autoscaling
2091 /// configuration for the selected replicas.
2092 pub autoscaling_target_high_priority_cpu_utilization_percent: i32,
2093
2094 /// Optional. If specified, overrides the
2095 /// autoscaling target `total_cpu_utilization_percent`
2096 /// in the top-level autoscaling configuration for the selected replicas.
2097 pub autoscaling_target_total_cpu_utilization_percent: i32,
2098
2099 /// Optional. If true, disables high priority CPU autoscaling for the
2100 /// selected replicas and ignores
2101 /// [high_priority_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.high_priority_cpu_utilization_percent]
2102 /// in the top-level autoscaling configuration.
2103 ///
2104 /// When setting this field to true, setting
2105 /// [autoscaling_target_high_priority_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_high_priority_cpu_utilization_percent]
2106 /// field to a non-zero value for the same replica is not supported.
2107 ///
2108 /// If false, the
2109 /// [autoscaling_target_high_priority_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_high_priority_cpu_utilization_percent]
2110 /// field in the replica will be used if set to a non-zero value.
2111 /// Otherwise, the
2112 /// [high_priority_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.high_priority_cpu_utilization_percent]
2113 /// field in the top-level autoscaling configuration will be used.
2114 ///
2115 /// Setting both
2116 /// [disable_high_priority_cpu_autoscaling][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_high_priority_cpu_autoscaling]
2117 /// and
2118 /// [disable_total_cpu_autoscaling][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_total_cpu_autoscaling]
2119 /// to true for the same replica is not supported.
2120 ///
2121 /// [google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_high_priority_cpu_utilization_percent]: crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_target_high_priority_cpu_utilization_percent
2122 /// [google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_high_priority_cpu_autoscaling]: crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::disable_high_priority_cpu_autoscaling
2123 /// [google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_total_cpu_autoscaling]: crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::disable_total_cpu_autoscaling
2124 /// [google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.high_priority_cpu_utilization_percent]: crate::model::autoscaling_config::AutoscalingTargets::high_priority_cpu_utilization_percent
2125 pub disable_high_priority_cpu_autoscaling: bool,
2126
2127 /// Optional. If true, disables total CPU autoscaling for the selected
2128 /// replicas and ignores
2129 /// [total_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.total_cpu_utilization_percent]
2130 /// in the top-level autoscaling configuration.
2131 ///
2132 /// When setting this field to true, setting
2133 /// [autoscaling_target_total_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_total_cpu_utilization_percent]
2134 /// field to a non-zero value for the same replica is not supported.
2135 ///
2136 /// If false, the
2137 /// [autoscaling_target_total_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_total_cpu_utilization_percent]
2138 /// field in the replica will be used if set to a non-zero value.
2139 /// Otherwise, the
2140 /// [total_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.total_cpu_utilization_percent]
2141 /// field in the top-level autoscaling configuration will be used.
2142 ///
2143 /// Setting both
2144 /// [disable_high_priority_cpu_autoscaling][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_high_priority_cpu_autoscaling]
2145 /// and
2146 /// [disable_total_cpu_autoscaling][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_total_cpu_autoscaling]
2147 /// to true for the same replica is not supported.
2148 ///
2149 /// [google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_total_cpu_utilization_percent]: crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_target_total_cpu_utilization_percent
2150 /// [google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_high_priority_cpu_autoscaling]: crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::disable_high_priority_cpu_autoscaling
2151 /// [google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_total_cpu_autoscaling]: crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::disable_total_cpu_autoscaling
2152 /// [google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.total_cpu_utilization_percent]: crate::model::autoscaling_config::AutoscalingTargets::total_cpu_utilization_percent
2153 pub disable_total_cpu_autoscaling: bool,
2154
2155 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2156 }
2157
2158 impl AutoscalingConfigOverrides {
2159 pub fn new() -> Self {
2160 std::default::Default::default()
2161 }
2162
2163 /// Sets the value of [autoscaling_limits][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_limits].
2164 ///
2165 /// # Example
2166 /// ```ignore,no_run
2167 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2168 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
2169 /// let x = AutoscalingConfigOverrides::new().set_autoscaling_limits(AutoscalingLimits::default()/* use setters */);
2170 /// ```
2171 pub fn set_autoscaling_limits<T>(mut self, v: T) -> Self
2172 where
2173 T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
2174 {
2175 self.autoscaling_limits = std::option::Option::Some(v.into());
2176 self
2177 }
2178
2179 /// Sets or clears the value of [autoscaling_limits][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_limits].
2180 ///
2181 /// # Example
2182 /// ```ignore,no_run
2183 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2184 /// use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::AutoscalingLimits;
2185 /// let x = AutoscalingConfigOverrides::new().set_or_clear_autoscaling_limits(Some(AutoscalingLimits::default()/* use setters */));
2186 /// let x = AutoscalingConfigOverrides::new().set_or_clear_autoscaling_limits(None::<AutoscalingLimits>);
2187 /// ```
2188 pub fn set_or_clear_autoscaling_limits<T>(mut self, v: std::option::Option<T>) -> Self
2189 where
2190 T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
2191 {
2192 self.autoscaling_limits = v.map(|x| x.into());
2193 self
2194 }
2195
2196 /// 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].
2197 ///
2198 /// # Example
2199 /// ```ignore,no_run
2200 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2201 /// let x = AutoscalingConfigOverrides::new().set_autoscaling_target_high_priority_cpu_utilization_percent(42);
2202 /// ```
2203 pub fn set_autoscaling_target_high_priority_cpu_utilization_percent<
2204 T: std::convert::Into<i32>,
2205 >(
2206 mut self,
2207 v: T,
2208 ) -> Self {
2209 self.autoscaling_target_high_priority_cpu_utilization_percent = v.into();
2210 self
2211 }
2212
2213 /// Sets the value of [autoscaling_target_total_cpu_utilization_percent][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_target_total_cpu_utilization_percent].
2214 ///
2215 /// # Example
2216 /// ```ignore,no_run
2217 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2218 /// let x = AutoscalingConfigOverrides::new().set_autoscaling_target_total_cpu_utilization_percent(42);
2219 /// ```
2220 pub fn set_autoscaling_target_total_cpu_utilization_percent<
2221 T: std::convert::Into<i32>,
2222 >(
2223 mut self,
2224 v: T,
2225 ) -> Self {
2226 self.autoscaling_target_total_cpu_utilization_percent = v.into();
2227 self
2228 }
2229
2230 /// Sets the value of [disable_high_priority_cpu_autoscaling][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::disable_high_priority_cpu_autoscaling].
2231 ///
2232 /// # Example
2233 /// ```ignore,no_run
2234 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2235 /// let x = AutoscalingConfigOverrides::new().set_disable_high_priority_cpu_autoscaling(true);
2236 /// ```
2237 pub fn set_disable_high_priority_cpu_autoscaling<T: std::convert::Into<bool>>(
2238 mut self,
2239 v: T,
2240 ) -> Self {
2241 self.disable_high_priority_cpu_autoscaling = v.into();
2242 self
2243 }
2244
2245 /// Sets the value of [disable_total_cpu_autoscaling][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::disable_total_cpu_autoscaling].
2246 ///
2247 /// # Example
2248 /// ```ignore,no_run
2249 /// # use google_cloud_spanner_admin_instance_v1::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides;
2250 /// let x = AutoscalingConfigOverrides::new().set_disable_total_cpu_autoscaling(true);
2251 /// ```
2252 pub fn set_disable_total_cpu_autoscaling<T: std::convert::Into<bool>>(
2253 mut self,
2254 v: T,
2255 ) -> Self {
2256 self.disable_total_cpu_autoscaling = v.into();
2257 self
2258 }
2259 }
2260
2261 impl wkt::message::Message for AutoscalingConfigOverrides {
2262 fn typename() -> &'static str {
2263 "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides"
2264 }
2265 }
2266 }
2267}
2268
2269/// An isolated set of Cloud Spanner resources on which databases can be hosted.
2270#[derive(Clone, Default, PartialEq)]
2271#[non_exhaustive]
2272pub struct Instance {
2273 /// Required. A unique identifier for the instance, which cannot be changed
2274 /// after the instance is created. Values are of the form
2275 /// `projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]`. The final
2276 /// segment of the name must be between 2 and 64 characters in length.
2277 pub name: std::string::String,
2278
2279 /// Required. The name of the instance's configuration. Values are of the form
2280 /// `projects/<project>/instanceConfigs/<configuration>`. See
2281 /// also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
2282 /// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
2283 ///
2284 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
2285 /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
2286 pub config: std::string::String,
2287
2288 /// Required. The descriptive name for this instance as it appears in UIs.
2289 /// Must be unique per project and between 4 and 30 characters in length.
2290 pub display_name: std::string::String,
2291
2292 /// The number of nodes allocated to this instance. At most, one of either
2293 /// `node_count` or `processing_units` should be present in the message.
2294 ///
2295 /// Users can set the `node_count` field to specify the target number of nodes
2296 /// allocated to the instance.
2297 ///
2298 /// If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY`
2299 /// field and reflects the current number of nodes allocated to the instance.
2300 ///
2301 /// This might be zero in API responses for instances that are not yet in the
2302 /// `READY` state.
2303 ///
2304 /// For more information, see
2305 /// [Compute capacity, nodes, and processing
2306 /// units](https://cloud.google.com/spanner/docs/compute-capacity).
2307 pub node_count: i32,
2308
2309 /// The number of processing units allocated to this instance. At most, one of
2310 /// either `processing_units` or `node_count` should be present in the message.
2311 ///
2312 /// Users can set the `processing_units` field to specify the target number of
2313 /// processing units allocated to the instance.
2314 ///
2315 /// If autoscaling is enabled, `processing_units` is treated as an
2316 /// `OUTPUT_ONLY` field and reflects the current number of processing units
2317 /// allocated to the instance.
2318 ///
2319 /// This might be zero in API responses for instances that are not yet in the
2320 /// `READY` state.
2321 ///
2322 /// For more information, see
2323 /// [Compute capacity, nodes and processing
2324 /// units](https://cloud.google.com/spanner/docs/compute-capacity).
2325 pub processing_units: i32,
2326
2327 /// Output only. Lists the compute capacity per ReplicaSelection. A replica
2328 /// selection identifies a set of replicas with common properties. Replicas
2329 /// identified by a ReplicaSelection are scaled with the same compute capacity.
2330 pub replica_compute_capacity: std::vec::Vec<crate::model::ReplicaComputeCapacity>,
2331
2332 /// Optional. The autoscaling configuration. Autoscaling is enabled if this
2333 /// field is set. When autoscaling is enabled, node_count and processing_units
2334 /// are treated as OUTPUT_ONLY fields and reflect the current compute capacity
2335 /// allocated to the instance.
2336 pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
2337
2338 /// Output only. The current instance state. For
2339 /// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance],
2340 /// the state must be either omitted or set to `CREATING`. For
2341 /// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance],
2342 /// the state must be either omitted or set to `READY`.
2343 ///
2344 /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
2345 /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
2346 pub state: crate::model::instance::State,
2347
2348 /// Cloud Labels are a flexible and lightweight mechanism for organizing cloud
2349 /// resources into groups that reflect a customer's organizational needs and
2350 /// deployment strategies. Cloud Labels can be used to filter collections of
2351 /// resources. They can be used to control how resource metrics are aggregated.
2352 /// And they can be used as arguments to policy management rules (e.g. route,
2353 /// firewall, load balancing, etc.).
2354 ///
2355 /// * Label keys must be between 1 and 63 characters long and must conform to
2356 /// the following regular expression: `[a-z][a-z0-9_-]{0,62}`.
2357 /// * Label values must be between 0 and 63 characters long and must conform
2358 /// to the regular expression `[a-z0-9_-]{0,63}`.
2359 /// * No more than 64 labels can be associated with a given resource.
2360 ///
2361 /// See <https://goo.gl/xmQnxf> for more information on and examples of labels.
2362 ///
2363 /// If you plan to use labels in your own code, please note that additional
2364 /// characters may be allowed in the future. And so you are advised to use an
2365 /// internal label representation, such as JSON, which doesn't rely upon
2366 /// specific characters being disallowed. For example, representing labels
2367 /// as the string: name + "_" + value would prove problematic if we were to
2368 /// allow "_" in a future release.
2369 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2370
2371 /// The `InstanceType` of the current instance.
2372 pub instance_type: crate::model::instance::InstanceType,
2373
2374 /// Deprecated. This field is not populated.
2375 pub endpoint_uris: std::vec::Vec<std::string::String>,
2376
2377 /// Output only. The time at which the instance was created.
2378 pub create_time: std::option::Option<wkt::Timestamp>,
2379
2380 /// Output only. The time at which the instance was most recently updated.
2381 pub update_time: std::option::Option<wkt::Timestamp>,
2382
2383 /// Free instance metadata. Only populated for free instances.
2384 pub free_instance_metadata: std::option::Option<crate::model::FreeInstanceMetadata>,
2385
2386 /// Optional. The `Edition` of the current instance.
2387 pub edition: crate::model::instance::Edition,
2388
2389 /// Optional. Controls the default backup schedule behavior for new databases
2390 /// within the instance. By default, a backup schedule is created automatically
2391 /// when a new database is created in a new instance.
2392 ///
2393 /// Note that the `AUTOMATIC` value isn't permitted for free instances,
2394 /// as backups and backup schedules aren't supported for free instances.
2395 ///
2396 /// In the `GetInstance` or `ListInstances` response, if the value of
2397 /// `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't
2398 /// create a default backup schedule for new databases in the instance.
2399 pub default_backup_schedule_type: crate::model::instance::DefaultBackupScheduleType,
2400
2401 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2402}
2403
2404impl Instance {
2405 pub fn new() -> Self {
2406 std::default::Default::default()
2407 }
2408
2409 /// Sets the value of [name][crate::model::Instance::name].
2410 ///
2411 /// # Example
2412 /// ```ignore,no_run
2413 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2414 /// let x = Instance::new().set_name("example");
2415 /// ```
2416 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2417 self.name = v.into();
2418 self
2419 }
2420
2421 /// Sets the value of [config][crate::model::Instance::config].
2422 ///
2423 /// # Example
2424 /// ```ignore,no_run
2425 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2426 /// let x = Instance::new().set_config("example");
2427 /// ```
2428 pub fn set_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2429 self.config = v.into();
2430 self
2431 }
2432
2433 /// Sets the value of [display_name][crate::model::Instance::display_name].
2434 ///
2435 /// # Example
2436 /// ```ignore,no_run
2437 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2438 /// let x = Instance::new().set_display_name("example");
2439 /// ```
2440 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2441 self.display_name = v.into();
2442 self
2443 }
2444
2445 /// Sets the value of [node_count][crate::model::Instance::node_count].
2446 ///
2447 /// # Example
2448 /// ```ignore,no_run
2449 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2450 /// let x = Instance::new().set_node_count(42);
2451 /// ```
2452 pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2453 self.node_count = v.into();
2454 self
2455 }
2456
2457 /// Sets the value of [processing_units][crate::model::Instance::processing_units].
2458 ///
2459 /// # Example
2460 /// ```ignore,no_run
2461 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2462 /// let x = Instance::new().set_processing_units(42);
2463 /// ```
2464 pub fn set_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2465 self.processing_units = v.into();
2466 self
2467 }
2468
2469 /// Sets the value of [replica_compute_capacity][crate::model::Instance::replica_compute_capacity].
2470 ///
2471 /// # Example
2472 /// ```ignore,no_run
2473 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2474 /// use google_cloud_spanner_admin_instance_v1::model::ReplicaComputeCapacity;
2475 /// let x = Instance::new()
2476 /// .set_replica_compute_capacity([
2477 /// ReplicaComputeCapacity::default()/* use setters */,
2478 /// ReplicaComputeCapacity::default()/* use (different) setters */,
2479 /// ]);
2480 /// ```
2481 pub fn set_replica_compute_capacity<T, V>(mut self, v: T) -> Self
2482 where
2483 T: std::iter::IntoIterator<Item = V>,
2484 V: std::convert::Into<crate::model::ReplicaComputeCapacity>,
2485 {
2486 use std::iter::Iterator;
2487 self.replica_compute_capacity = v.into_iter().map(|i| i.into()).collect();
2488 self
2489 }
2490
2491 /// Sets the value of [autoscaling_config][crate::model::Instance::autoscaling_config].
2492 ///
2493 /// # Example
2494 /// ```ignore,no_run
2495 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2496 /// use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
2497 /// let x = Instance::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
2498 /// ```
2499 pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
2500 where
2501 T: std::convert::Into<crate::model::AutoscalingConfig>,
2502 {
2503 self.autoscaling_config = std::option::Option::Some(v.into());
2504 self
2505 }
2506
2507 /// Sets or clears the value of [autoscaling_config][crate::model::Instance::autoscaling_config].
2508 ///
2509 /// # Example
2510 /// ```ignore,no_run
2511 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2512 /// use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
2513 /// let x = Instance::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
2514 /// let x = Instance::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
2515 /// ```
2516 pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
2517 where
2518 T: std::convert::Into<crate::model::AutoscalingConfig>,
2519 {
2520 self.autoscaling_config = v.map(|x| x.into());
2521 self
2522 }
2523
2524 /// Sets the value of [state][crate::model::Instance::state].
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::instance::State;
2530 /// let x0 = Instance::new().set_state(State::Creating);
2531 /// let x1 = Instance::new().set_state(State::Ready);
2532 /// ```
2533 pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
2534 self.state = v.into();
2535 self
2536 }
2537
2538 /// Sets the value of [labels][crate::model::Instance::labels].
2539 ///
2540 /// # Example
2541 /// ```ignore,no_run
2542 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2543 /// let x = Instance::new().set_labels([
2544 /// ("key0", "abc"),
2545 /// ("key1", "xyz"),
2546 /// ]);
2547 /// ```
2548 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2549 where
2550 T: std::iter::IntoIterator<Item = (K, V)>,
2551 K: std::convert::Into<std::string::String>,
2552 V: std::convert::Into<std::string::String>,
2553 {
2554 use std::iter::Iterator;
2555 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2556 self
2557 }
2558
2559 /// Sets the value of [instance_type][crate::model::Instance::instance_type].
2560 ///
2561 /// # Example
2562 /// ```ignore,no_run
2563 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2564 /// use google_cloud_spanner_admin_instance_v1::model::instance::InstanceType;
2565 /// let x0 = Instance::new().set_instance_type(InstanceType::Provisioned);
2566 /// let x1 = Instance::new().set_instance_type(InstanceType::FreeInstance);
2567 /// ```
2568 pub fn set_instance_type<T: std::convert::Into<crate::model::instance::InstanceType>>(
2569 mut self,
2570 v: T,
2571 ) -> Self {
2572 self.instance_type = v.into();
2573 self
2574 }
2575
2576 /// Sets the value of [endpoint_uris][crate::model::Instance::endpoint_uris].
2577 ///
2578 /// # Example
2579 /// ```ignore,no_run
2580 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2581 /// let x = Instance::new().set_endpoint_uris(["a", "b", "c"]);
2582 /// ```
2583 pub fn set_endpoint_uris<T, V>(mut self, v: T) -> Self
2584 where
2585 T: std::iter::IntoIterator<Item = V>,
2586 V: std::convert::Into<std::string::String>,
2587 {
2588 use std::iter::Iterator;
2589 self.endpoint_uris = v.into_iter().map(|i| i.into()).collect();
2590 self
2591 }
2592
2593 /// Sets the value of [create_time][crate::model::Instance::create_time].
2594 ///
2595 /// # Example
2596 /// ```ignore,no_run
2597 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2598 /// use wkt::Timestamp;
2599 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
2600 /// ```
2601 pub fn set_create_time<T>(mut self, v: T) -> Self
2602 where
2603 T: std::convert::Into<wkt::Timestamp>,
2604 {
2605 self.create_time = std::option::Option::Some(v.into());
2606 self
2607 }
2608
2609 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
2610 ///
2611 /// # Example
2612 /// ```ignore,no_run
2613 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2614 /// use wkt::Timestamp;
2615 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2616 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
2617 /// ```
2618 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2619 where
2620 T: std::convert::Into<wkt::Timestamp>,
2621 {
2622 self.create_time = v.map(|x| x.into());
2623 self
2624 }
2625
2626 /// Sets the value of [update_time][crate::model::Instance::update_time].
2627 ///
2628 /// # Example
2629 /// ```ignore,no_run
2630 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2631 /// use wkt::Timestamp;
2632 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
2633 /// ```
2634 pub fn set_update_time<T>(mut self, v: T) -> Self
2635 where
2636 T: std::convert::Into<wkt::Timestamp>,
2637 {
2638 self.update_time = std::option::Option::Some(v.into());
2639 self
2640 }
2641
2642 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
2643 ///
2644 /// # Example
2645 /// ```ignore,no_run
2646 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2647 /// use wkt::Timestamp;
2648 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2649 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
2650 /// ```
2651 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2652 where
2653 T: std::convert::Into<wkt::Timestamp>,
2654 {
2655 self.update_time = v.map(|x| x.into());
2656 self
2657 }
2658
2659 /// Sets the value of [free_instance_metadata][crate::model::Instance::free_instance_metadata].
2660 ///
2661 /// # Example
2662 /// ```ignore,no_run
2663 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2664 /// use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
2665 /// let x = Instance::new().set_free_instance_metadata(FreeInstanceMetadata::default()/* use setters */);
2666 /// ```
2667 pub fn set_free_instance_metadata<T>(mut self, v: T) -> Self
2668 where
2669 T: std::convert::Into<crate::model::FreeInstanceMetadata>,
2670 {
2671 self.free_instance_metadata = std::option::Option::Some(v.into());
2672 self
2673 }
2674
2675 /// Sets or clears the value of [free_instance_metadata][crate::model::Instance::free_instance_metadata].
2676 ///
2677 /// # Example
2678 /// ```ignore,no_run
2679 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2680 /// use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
2681 /// let x = Instance::new().set_or_clear_free_instance_metadata(Some(FreeInstanceMetadata::default()/* use setters */));
2682 /// let x = Instance::new().set_or_clear_free_instance_metadata(None::<FreeInstanceMetadata>);
2683 /// ```
2684 pub fn set_or_clear_free_instance_metadata<T>(mut self, v: std::option::Option<T>) -> Self
2685 where
2686 T: std::convert::Into<crate::model::FreeInstanceMetadata>,
2687 {
2688 self.free_instance_metadata = v.map(|x| x.into());
2689 self
2690 }
2691
2692 /// Sets the value of [edition][crate::model::Instance::edition].
2693 ///
2694 /// # Example
2695 /// ```ignore,no_run
2696 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2697 /// use google_cloud_spanner_admin_instance_v1::model::instance::Edition;
2698 /// let x0 = Instance::new().set_edition(Edition::Standard);
2699 /// let x1 = Instance::new().set_edition(Edition::Enterprise);
2700 /// let x2 = Instance::new().set_edition(Edition::EnterprisePlus);
2701 /// ```
2702 pub fn set_edition<T: std::convert::Into<crate::model::instance::Edition>>(
2703 mut self,
2704 v: T,
2705 ) -> Self {
2706 self.edition = v.into();
2707 self
2708 }
2709
2710 /// Sets the value of [default_backup_schedule_type][crate::model::Instance::default_backup_schedule_type].
2711 ///
2712 /// # Example
2713 /// ```ignore,no_run
2714 /// # use google_cloud_spanner_admin_instance_v1::model::Instance;
2715 /// use google_cloud_spanner_admin_instance_v1::model::instance::DefaultBackupScheduleType;
2716 /// let x0 = Instance::new().set_default_backup_schedule_type(DefaultBackupScheduleType::None);
2717 /// let x1 = Instance::new().set_default_backup_schedule_type(DefaultBackupScheduleType::Automatic);
2718 /// ```
2719 pub fn set_default_backup_schedule_type<
2720 T: std::convert::Into<crate::model::instance::DefaultBackupScheduleType>,
2721 >(
2722 mut self,
2723 v: T,
2724 ) -> Self {
2725 self.default_backup_schedule_type = v.into();
2726 self
2727 }
2728}
2729
2730impl wkt::message::Message for Instance {
2731 fn typename() -> &'static str {
2732 "type.googleapis.com/google.spanner.admin.instance.v1.Instance"
2733 }
2734}
2735
2736/// Defines additional types related to [Instance].
2737pub mod instance {
2738 #[allow(unused_imports)]
2739 use super::*;
2740
2741 /// Indicates the current state of the instance.
2742 ///
2743 /// # Working with unknown values
2744 ///
2745 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2746 /// additional enum variants at any time. Adding new variants is not considered
2747 /// a breaking change. Applications should write their code in anticipation of:
2748 ///
2749 /// - New values appearing in future releases of the client library, **and**
2750 /// - New values received dynamically, without application changes.
2751 ///
2752 /// Please consult the [Working with enums] section in the user guide for some
2753 /// guidelines.
2754 ///
2755 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2756 #[derive(Clone, Debug, PartialEq)]
2757 #[non_exhaustive]
2758 pub enum State {
2759 /// Not specified.
2760 Unspecified,
2761 /// The instance is still being created. Resources may not be
2762 /// available yet, and operations such as database creation may not
2763 /// work.
2764 Creating,
2765 /// The instance is fully created and ready to do work such as
2766 /// creating databases.
2767 Ready,
2768 /// If set, the enum was initialized with an unknown value.
2769 ///
2770 /// Applications can examine the value using [State::value] or
2771 /// [State::name].
2772 UnknownValue(state::UnknownValue),
2773 }
2774
2775 #[doc(hidden)]
2776 pub mod state {
2777 #[allow(unused_imports)]
2778 use super::*;
2779 #[derive(Clone, Debug, PartialEq)]
2780 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2781 }
2782
2783 impl State {
2784 /// Gets the enum value.
2785 ///
2786 /// Returns `None` if the enum contains an unknown value deserialized from
2787 /// the string representation of enums.
2788 pub fn value(&self) -> std::option::Option<i32> {
2789 match self {
2790 Self::Unspecified => std::option::Option::Some(0),
2791 Self::Creating => std::option::Option::Some(1),
2792 Self::Ready => std::option::Option::Some(2),
2793 Self::UnknownValue(u) => u.0.value(),
2794 }
2795 }
2796
2797 /// Gets the enum value as a string.
2798 ///
2799 /// Returns `None` if the enum contains an unknown value deserialized from
2800 /// the integer representation of enums.
2801 pub fn name(&self) -> std::option::Option<&str> {
2802 match self {
2803 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2804 Self::Creating => std::option::Option::Some("CREATING"),
2805 Self::Ready => std::option::Option::Some("READY"),
2806 Self::UnknownValue(u) => u.0.name(),
2807 }
2808 }
2809 }
2810
2811 impl std::default::Default for State {
2812 fn default() -> Self {
2813 use std::convert::From;
2814 Self::from(0)
2815 }
2816 }
2817
2818 impl std::fmt::Display for State {
2819 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2820 wkt::internal::display_enum(f, self.name(), self.value())
2821 }
2822 }
2823
2824 impl std::convert::From<i32> for State {
2825 fn from(value: i32) -> Self {
2826 match value {
2827 0 => Self::Unspecified,
2828 1 => Self::Creating,
2829 2 => Self::Ready,
2830 _ => Self::UnknownValue(state::UnknownValue(
2831 wkt::internal::UnknownEnumValue::Integer(value),
2832 )),
2833 }
2834 }
2835 }
2836
2837 impl std::convert::From<&str> for State {
2838 fn from(value: &str) -> Self {
2839 use std::string::ToString;
2840 match value {
2841 "STATE_UNSPECIFIED" => Self::Unspecified,
2842 "CREATING" => Self::Creating,
2843 "READY" => Self::Ready,
2844 _ => Self::UnknownValue(state::UnknownValue(
2845 wkt::internal::UnknownEnumValue::String(value.to_string()),
2846 )),
2847 }
2848 }
2849 }
2850
2851 impl serde::ser::Serialize for State {
2852 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2853 where
2854 S: serde::Serializer,
2855 {
2856 match self {
2857 Self::Unspecified => serializer.serialize_i32(0),
2858 Self::Creating => serializer.serialize_i32(1),
2859 Self::Ready => serializer.serialize_i32(2),
2860 Self::UnknownValue(u) => u.0.serialize(serializer),
2861 }
2862 }
2863 }
2864
2865 impl<'de> serde::de::Deserialize<'de> for State {
2866 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2867 where
2868 D: serde::Deserializer<'de>,
2869 {
2870 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2871 ".google.spanner.admin.instance.v1.Instance.State",
2872 ))
2873 }
2874 }
2875
2876 /// The type of this instance. The type can be used to distinguish product
2877 /// variants, that can affect aspects like: usage restrictions, quotas and
2878 /// billing. Currently this is used to distinguish FREE_INSTANCE vs PROVISIONED
2879 /// instances.
2880 ///
2881 /// # Working with unknown values
2882 ///
2883 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2884 /// additional enum variants at any time. Adding new variants is not considered
2885 /// a breaking change. Applications should write their code in anticipation of:
2886 ///
2887 /// - New values appearing in future releases of the client library, **and**
2888 /// - New values received dynamically, without application changes.
2889 ///
2890 /// Please consult the [Working with enums] section in the user guide for some
2891 /// guidelines.
2892 ///
2893 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2894 #[derive(Clone, Debug, PartialEq)]
2895 #[non_exhaustive]
2896 pub enum InstanceType {
2897 /// Not specified.
2898 Unspecified,
2899 /// Provisioned instances have dedicated resources, standard usage limits and
2900 /// support.
2901 Provisioned,
2902 /// Free instances provide no guarantee for dedicated resources,
2903 /// [node_count, processing_units] should be 0. They come
2904 /// with stricter usage limits and limited support.
2905 FreeInstance,
2906 /// If set, the enum was initialized with an unknown value.
2907 ///
2908 /// Applications can examine the value using [InstanceType::value] or
2909 /// [InstanceType::name].
2910 UnknownValue(instance_type::UnknownValue),
2911 }
2912
2913 #[doc(hidden)]
2914 pub mod instance_type {
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 InstanceType {
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::Provisioned => std::option::Option::Some(1),
2930 Self::FreeInstance => std::option::Option::Some(2),
2931 Self::UnknownValue(u) => u.0.value(),
2932 }
2933 }
2934
2935 /// Gets the enum value as a string.
2936 ///
2937 /// Returns `None` if the enum contains an unknown value deserialized from
2938 /// the integer representation of enums.
2939 pub fn name(&self) -> std::option::Option<&str> {
2940 match self {
2941 Self::Unspecified => std::option::Option::Some("INSTANCE_TYPE_UNSPECIFIED"),
2942 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
2943 Self::FreeInstance => std::option::Option::Some("FREE_INSTANCE"),
2944 Self::UnknownValue(u) => u.0.name(),
2945 }
2946 }
2947 }
2948
2949 impl std::default::Default for InstanceType {
2950 fn default() -> Self {
2951 use std::convert::From;
2952 Self::from(0)
2953 }
2954 }
2955
2956 impl std::fmt::Display for InstanceType {
2957 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2958 wkt::internal::display_enum(f, self.name(), self.value())
2959 }
2960 }
2961
2962 impl std::convert::From<i32> for InstanceType {
2963 fn from(value: i32) -> Self {
2964 match value {
2965 0 => Self::Unspecified,
2966 1 => Self::Provisioned,
2967 2 => Self::FreeInstance,
2968 _ => Self::UnknownValue(instance_type::UnknownValue(
2969 wkt::internal::UnknownEnumValue::Integer(value),
2970 )),
2971 }
2972 }
2973 }
2974
2975 impl std::convert::From<&str> for InstanceType {
2976 fn from(value: &str) -> Self {
2977 use std::string::ToString;
2978 match value {
2979 "INSTANCE_TYPE_UNSPECIFIED" => Self::Unspecified,
2980 "PROVISIONED" => Self::Provisioned,
2981 "FREE_INSTANCE" => Self::FreeInstance,
2982 _ => Self::UnknownValue(instance_type::UnknownValue(
2983 wkt::internal::UnknownEnumValue::String(value.to_string()),
2984 )),
2985 }
2986 }
2987 }
2988
2989 impl serde::ser::Serialize for InstanceType {
2990 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2991 where
2992 S: serde::Serializer,
2993 {
2994 match self {
2995 Self::Unspecified => serializer.serialize_i32(0),
2996 Self::Provisioned => serializer.serialize_i32(1),
2997 Self::FreeInstance => serializer.serialize_i32(2),
2998 Self::UnknownValue(u) => u.0.serialize(serializer),
2999 }
3000 }
3001 }
3002
3003 impl<'de> serde::de::Deserialize<'de> for InstanceType {
3004 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3005 where
3006 D: serde::Deserializer<'de>,
3007 {
3008 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InstanceType>::new(
3009 ".google.spanner.admin.instance.v1.Instance.InstanceType",
3010 ))
3011 }
3012 }
3013
3014 /// The edition selected for this instance. Different editions provide
3015 /// different capabilities at different price points.
3016 ///
3017 /// # Working with unknown values
3018 ///
3019 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3020 /// additional enum variants at any time. Adding new variants is not considered
3021 /// a breaking change. Applications should write their code in anticipation of:
3022 ///
3023 /// - New values appearing in future releases of the client library, **and**
3024 /// - New values received dynamically, without application changes.
3025 ///
3026 /// Please consult the [Working with enums] section in the user guide for some
3027 /// guidelines.
3028 ///
3029 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3030 #[derive(Clone, Debug, PartialEq)]
3031 #[non_exhaustive]
3032 pub enum Edition {
3033 /// Edition not specified.
3034 Unspecified,
3035 /// Standard edition.
3036 Standard,
3037 /// Enterprise edition.
3038 Enterprise,
3039 /// Enterprise Plus edition.
3040 EnterprisePlus,
3041 /// If set, the enum was initialized with an unknown value.
3042 ///
3043 /// Applications can examine the value using [Edition::value] or
3044 /// [Edition::name].
3045 UnknownValue(edition::UnknownValue),
3046 }
3047
3048 #[doc(hidden)]
3049 pub mod edition {
3050 #[allow(unused_imports)]
3051 use super::*;
3052 #[derive(Clone, Debug, PartialEq)]
3053 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3054 }
3055
3056 impl Edition {
3057 /// Gets the enum value.
3058 ///
3059 /// Returns `None` if the enum contains an unknown value deserialized from
3060 /// the string representation of enums.
3061 pub fn value(&self) -> std::option::Option<i32> {
3062 match self {
3063 Self::Unspecified => std::option::Option::Some(0),
3064 Self::Standard => std::option::Option::Some(1),
3065 Self::Enterprise => std::option::Option::Some(2),
3066 Self::EnterprisePlus => std::option::Option::Some(3),
3067 Self::UnknownValue(u) => u.0.value(),
3068 }
3069 }
3070
3071 /// Gets the enum value as a string.
3072 ///
3073 /// Returns `None` if the enum contains an unknown value deserialized from
3074 /// the integer representation of enums.
3075 pub fn name(&self) -> std::option::Option<&str> {
3076 match self {
3077 Self::Unspecified => std::option::Option::Some("EDITION_UNSPECIFIED"),
3078 Self::Standard => std::option::Option::Some("STANDARD"),
3079 Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
3080 Self::EnterprisePlus => std::option::Option::Some("ENTERPRISE_PLUS"),
3081 Self::UnknownValue(u) => u.0.name(),
3082 }
3083 }
3084 }
3085
3086 impl std::default::Default for Edition {
3087 fn default() -> Self {
3088 use std::convert::From;
3089 Self::from(0)
3090 }
3091 }
3092
3093 impl std::fmt::Display for Edition {
3094 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3095 wkt::internal::display_enum(f, self.name(), self.value())
3096 }
3097 }
3098
3099 impl std::convert::From<i32> for Edition {
3100 fn from(value: i32) -> Self {
3101 match value {
3102 0 => Self::Unspecified,
3103 1 => Self::Standard,
3104 2 => Self::Enterprise,
3105 3 => Self::EnterprisePlus,
3106 _ => Self::UnknownValue(edition::UnknownValue(
3107 wkt::internal::UnknownEnumValue::Integer(value),
3108 )),
3109 }
3110 }
3111 }
3112
3113 impl std::convert::From<&str> for Edition {
3114 fn from(value: &str) -> Self {
3115 use std::string::ToString;
3116 match value {
3117 "EDITION_UNSPECIFIED" => Self::Unspecified,
3118 "STANDARD" => Self::Standard,
3119 "ENTERPRISE" => Self::Enterprise,
3120 "ENTERPRISE_PLUS" => Self::EnterprisePlus,
3121 _ => Self::UnknownValue(edition::UnknownValue(
3122 wkt::internal::UnknownEnumValue::String(value.to_string()),
3123 )),
3124 }
3125 }
3126 }
3127
3128 impl serde::ser::Serialize for Edition {
3129 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3130 where
3131 S: serde::Serializer,
3132 {
3133 match self {
3134 Self::Unspecified => serializer.serialize_i32(0),
3135 Self::Standard => serializer.serialize_i32(1),
3136 Self::Enterprise => serializer.serialize_i32(2),
3137 Self::EnterprisePlus => serializer.serialize_i32(3),
3138 Self::UnknownValue(u) => u.0.serialize(serializer),
3139 }
3140 }
3141 }
3142
3143 impl<'de> serde::de::Deserialize<'de> for Edition {
3144 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3145 where
3146 D: serde::Deserializer<'de>,
3147 {
3148 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Edition>::new(
3149 ".google.spanner.admin.instance.v1.Instance.Edition",
3150 ))
3151 }
3152 }
3153
3154 /// Indicates the
3155 /// [default backup
3156 /// schedule](https://cloud.google.com/spanner/docs/backup#default-backup-schedules)
3157 /// behavior for new databases within the instance.
3158 ///
3159 /// # Working with unknown values
3160 ///
3161 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3162 /// additional enum variants at any time. Adding new variants is not considered
3163 /// a breaking change. Applications should write their code in anticipation of:
3164 ///
3165 /// - New values appearing in future releases of the client library, **and**
3166 /// - New values received dynamically, without application changes.
3167 ///
3168 /// Please consult the [Working with enums] section in the user guide for some
3169 /// guidelines.
3170 ///
3171 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3172 #[derive(Clone, Debug, PartialEq)]
3173 #[non_exhaustive]
3174 pub enum DefaultBackupScheduleType {
3175 /// Not specified.
3176 Unspecified,
3177 /// A default backup schedule isn't created automatically when a new database
3178 /// is created in the instance.
3179 None,
3180 /// A default backup schedule is created automatically when a new database
3181 /// is created in the instance. The default backup schedule creates a full
3182 /// backup every 24 hours. These full backups are retained for 7 days.
3183 /// You can edit or delete the default backup schedule once it's created.
3184 Automatic,
3185 /// If set, the enum was initialized with an unknown value.
3186 ///
3187 /// Applications can examine the value using [DefaultBackupScheduleType::value] or
3188 /// [DefaultBackupScheduleType::name].
3189 UnknownValue(default_backup_schedule_type::UnknownValue),
3190 }
3191
3192 #[doc(hidden)]
3193 pub mod default_backup_schedule_type {
3194 #[allow(unused_imports)]
3195 use super::*;
3196 #[derive(Clone, Debug, PartialEq)]
3197 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3198 }
3199
3200 impl DefaultBackupScheduleType {
3201 /// Gets the enum value.
3202 ///
3203 /// Returns `None` if the enum contains an unknown value deserialized from
3204 /// the string representation of enums.
3205 pub fn value(&self) -> std::option::Option<i32> {
3206 match self {
3207 Self::Unspecified => std::option::Option::Some(0),
3208 Self::None => std::option::Option::Some(1),
3209 Self::Automatic => std::option::Option::Some(2),
3210 Self::UnknownValue(u) => u.0.value(),
3211 }
3212 }
3213
3214 /// Gets the enum value as a string.
3215 ///
3216 /// Returns `None` if the enum contains an unknown value deserialized from
3217 /// the integer representation of enums.
3218 pub fn name(&self) -> std::option::Option<&str> {
3219 match self {
3220 Self::Unspecified => {
3221 std::option::Option::Some("DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED")
3222 }
3223 Self::None => std::option::Option::Some("NONE"),
3224 Self::Automatic => std::option::Option::Some("AUTOMATIC"),
3225 Self::UnknownValue(u) => u.0.name(),
3226 }
3227 }
3228 }
3229
3230 impl std::default::Default for DefaultBackupScheduleType {
3231 fn default() -> Self {
3232 use std::convert::From;
3233 Self::from(0)
3234 }
3235 }
3236
3237 impl std::fmt::Display for DefaultBackupScheduleType {
3238 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3239 wkt::internal::display_enum(f, self.name(), self.value())
3240 }
3241 }
3242
3243 impl std::convert::From<i32> for DefaultBackupScheduleType {
3244 fn from(value: i32) -> Self {
3245 match value {
3246 0 => Self::Unspecified,
3247 1 => Self::None,
3248 2 => Self::Automatic,
3249 _ => Self::UnknownValue(default_backup_schedule_type::UnknownValue(
3250 wkt::internal::UnknownEnumValue::Integer(value),
3251 )),
3252 }
3253 }
3254 }
3255
3256 impl std::convert::From<&str> for DefaultBackupScheduleType {
3257 fn from(value: &str) -> Self {
3258 use std::string::ToString;
3259 match value {
3260 "DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
3261 "NONE" => Self::None,
3262 "AUTOMATIC" => Self::Automatic,
3263 _ => Self::UnknownValue(default_backup_schedule_type::UnknownValue(
3264 wkt::internal::UnknownEnumValue::String(value.to_string()),
3265 )),
3266 }
3267 }
3268 }
3269
3270 impl serde::ser::Serialize for DefaultBackupScheduleType {
3271 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3272 where
3273 S: serde::Serializer,
3274 {
3275 match self {
3276 Self::Unspecified => serializer.serialize_i32(0),
3277 Self::None => serializer.serialize_i32(1),
3278 Self::Automatic => serializer.serialize_i32(2),
3279 Self::UnknownValue(u) => u.0.serialize(serializer),
3280 }
3281 }
3282 }
3283
3284 impl<'de> serde::de::Deserialize<'de> for DefaultBackupScheduleType {
3285 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3286 where
3287 D: serde::Deserializer<'de>,
3288 {
3289 deserializer.deserialize_any(
3290 wkt::internal::EnumVisitor::<DefaultBackupScheduleType>::new(
3291 ".google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType",
3292 ),
3293 )
3294 }
3295 }
3296}
3297
3298/// The request for
3299/// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
3300///
3301/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
3302#[derive(Clone, Default, PartialEq)]
3303#[non_exhaustive]
3304pub struct ListInstanceConfigsRequest {
3305 /// Required. The name of the project for which a list of supported instance
3306 /// configurations is requested. Values are of the form
3307 /// `projects/<project>`.
3308 pub parent: std::string::String,
3309
3310 /// Number of instance configurations to be returned in the response. If 0 or
3311 /// less, defaults to the server's maximum allowed page size.
3312 pub page_size: i32,
3313
3314 /// If non-empty, `page_token` should contain a
3315 /// [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token]
3316 /// from a previous
3317 /// [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse].
3318 ///
3319 /// [google.spanner.admin.instance.v1.ListInstanceConfigsResponse]: crate::model::ListInstanceConfigsResponse
3320 /// [google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token]: crate::model::ListInstanceConfigsResponse::next_page_token
3321 pub page_token: std::string::String,
3322
3323 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3324}
3325
3326impl ListInstanceConfigsRequest {
3327 pub fn new() -> Self {
3328 std::default::Default::default()
3329 }
3330
3331 /// Sets the value of [parent][crate::model::ListInstanceConfigsRequest::parent].
3332 ///
3333 /// # Example
3334 /// ```ignore,no_run
3335 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsRequest;
3336 /// let x = ListInstanceConfigsRequest::new().set_parent("example");
3337 /// ```
3338 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3339 self.parent = v.into();
3340 self
3341 }
3342
3343 /// Sets the value of [page_size][crate::model::ListInstanceConfigsRequest::page_size].
3344 ///
3345 /// # Example
3346 /// ```ignore,no_run
3347 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsRequest;
3348 /// let x = ListInstanceConfigsRequest::new().set_page_size(42);
3349 /// ```
3350 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3351 self.page_size = v.into();
3352 self
3353 }
3354
3355 /// Sets the value of [page_token][crate::model::ListInstanceConfigsRequest::page_token].
3356 ///
3357 /// # Example
3358 /// ```ignore,no_run
3359 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsRequest;
3360 /// let x = ListInstanceConfigsRequest::new().set_page_token("example");
3361 /// ```
3362 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3363 self.page_token = v.into();
3364 self
3365 }
3366}
3367
3368impl wkt::message::Message for ListInstanceConfigsRequest {
3369 fn typename() -> &'static str {
3370 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigsRequest"
3371 }
3372}
3373
3374/// The response for
3375/// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
3376///
3377/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
3378#[derive(Clone, Default, PartialEq)]
3379#[non_exhaustive]
3380pub struct ListInstanceConfigsResponse {
3381 /// The list of requested instance configurations.
3382 pub instance_configs: std::vec::Vec<crate::model::InstanceConfig>,
3383
3384 /// `next_page_token` can be sent in a subsequent
3385 /// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]
3386 /// call to fetch more of the matching instance configurations.
3387 ///
3388 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
3389 pub next_page_token: std::string::String,
3390
3391 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3392}
3393
3394impl ListInstanceConfigsResponse {
3395 pub fn new() -> Self {
3396 std::default::Default::default()
3397 }
3398
3399 /// Sets the value of [instance_configs][crate::model::ListInstanceConfigsResponse::instance_configs].
3400 ///
3401 /// # Example
3402 /// ```ignore,no_run
3403 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsResponse;
3404 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3405 /// let x = ListInstanceConfigsResponse::new()
3406 /// .set_instance_configs([
3407 /// InstanceConfig::default()/* use setters */,
3408 /// InstanceConfig::default()/* use (different) setters */,
3409 /// ]);
3410 /// ```
3411 pub fn set_instance_configs<T, V>(mut self, v: T) -> Self
3412 where
3413 T: std::iter::IntoIterator<Item = V>,
3414 V: std::convert::Into<crate::model::InstanceConfig>,
3415 {
3416 use std::iter::Iterator;
3417 self.instance_configs = v.into_iter().map(|i| i.into()).collect();
3418 self
3419 }
3420
3421 /// Sets the value of [next_page_token][crate::model::ListInstanceConfigsResponse::next_page_token].
3422 ///
3423 /// # Example
3424 /// ```ignore,no_run
3425 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigsResponse;
3426 /// let x = ListInstanceConfigsResponse::new().set_next_page_token("example");
3427 /// ```
3428 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3429 self.next_page_token = v.into();
3430 self
3431 }
3432}
3433
3434impl wkt::message::Message for ListInstanceConfigsResponse {
3435 fn typename() -> &'static str {
3436 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigsResponse"
3437 }
3438}
3439
3440#[doc(hidden)]
3441impl gax::paginator::internal::PageableResponse for ListInstanceConfigsResponse {
3442 type PageItem = crate::model::InstanceConfig;
3443
3444 fn items(self) -> std::vec::Vec<Self::PageItem> {
3445 self.instance_configs
3446 }
3447
3448 fn next_page_token(&self) -> std::string::String {
3449 use std::clone::Clone;
3450 self.next_page_token.clone()
3451 }
3452}
3453
3454/// The request for
3455/// [GetInstanceConfigRequest][google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig].
3456///
3457/// [google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig]: crate::client::InstanceAdmin::get_instance_config
3458#[derive(Clone, Default, PartialEq)]
3459#[non_exhaustive]
3460pub struct GetInstanceConfigRequest {
3461 /// Required. The name of the requested instance configuration. Values are of
3462 /// the form `projects/<project>/instanceConfigs/<config>`.
3463 pub name: std::string::String,
3464
3465 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3466}
3467
3468impl GetInstanceConfigRequest {
3469 pub fn new() -> Self {
3470 std::default::Default::default()
3471 }
3472
3473 /// Sets the value of [name][crate::model::GetInstanceConfigRequest::name].
3474 ///
3475 /// # Example
3476 /// ```ignore,no_run
3477 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstanceConfigRequest;
3478 /// let x = GetInstanceConfigRequest::new().set_name("example");
3479 /// ```
3480 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3481 self.name = v.into();
3482 self
3483 }
3484}
3485
3486impl wkt::message::Message for GetInstanceConfigRequest {
3487 fn typename() -> &'static str {
3488 "type.googleapis.com/google.spanner.admin.instance.v1.GetInstanceConfigRequest"
3489 }
3490}
3491
3492/// The request for
3493/// [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig].
3494///
3495/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]: crate::client::InstanceAdmin::create_instance_config
3496#[derive(Clone, Default, PartialEq)]
3497#[non_exhaustive]
3498pub struct CreateInstanceConfigRequest {
3499 /// Required. The name of the project in which to create the instance
3500 /// configuration. Values are of the form `projects/<project>`.
3501 pub parent: std::string::String,
3502
3503 /// Required. The ID of the instance configuration to create. Valid identifiers
3504 /// are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64
3505 /// characters in length. The `custom-` prefix is required to avoid name
3506 /// conflicts with Google-managed configurations.
3507 pub instance_config_id: std::string::String,
3508
3509 /// Required. The `InstanceConfig` proto of the configuration to create.
3510 /// `instance_config.name` must be
3511 /// `<parent>/instanceConfigs/<instance_config_id>`.
3512 /// `instance_config.base_config` must be a Google-managed configuration name,
3513 /// e.g. \<parent\>/instanceConfigs/us-east1, \<parent\>/instanceConfigs/nam3.
3514 pub instance_config: std::option::Option<crate::model::InstanceConfig>,
3515
3516 /// An option to validate, but not actually execute, a request,
3517 /// and provide the same response.
3518 pub validate_only: bool,
3519
3520 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3521}
3522
3523impl CreateInstanceConfigRequest {
3524 pub fn new() -> Self {
3525 std::default::Default::default()
3526 }
3527
3528 /// Sets the value of [parent][crate::model::CreateInstanceConfigRequest::parent].
3529 ///
3530 /// # Example
3531 /// ```ignore,no_run
3532 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3533 /// let x = CreateInstanceConfigRequest::new().set_parent("example");
3534 /// ```
3535 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3536 self.parent = v.into();
3537 self
3538 }
3539
3540 /// Sets the value of [instance_config_id][crate::model::CreateInstanceConfigRequest::instance_config_id].
3541 ///
3542 /// # Example
3543 /// ```ignore,no_run
3544 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3545 /// let x = CreateInstanceConfigRequest::new().set_instance_config_id("example");
3546 /// ```
3547 pub fn set_instance_config_id<T: std::convert::Into<std::string::String>>(
3548 mut self,
3549 v: T,
3550 ) -> Self {
3551 self.instance_config_id = v.into();
3552 self
3553 }
3554
3555 /// Sets the value of [instance_config][crate::model::CreateInstanceConfigRequest::instance_config].
3556 ///
3557 /// # Example
3558 /// ```ignore,no_run
3559 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3560 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3561 /// let x = CreateInstanceConfigRequest::new().set_instance_config(InstanceConfig::default()/* use setters */);
3562 /// ```
3563 pub fn set_instance_config<T>(mut self, v: T) -> Self
3564 where
3565 T: std::convert::Into<crate::model::InstanceConfig>,
3566 {
3567 self.instance_config = std::option::Option::Some(v.into());
3568 self
3569 }
3570
3571 /// Sets or clears the value of [instance_config][crate::model::CreateInstanceConfigRequest::instance_config].
3572 ///
3573 /// # Example
3574 /// ```ignore,no_run
3575 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3576 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3577 /// let x = CreateInstanceConfigRequest::new().set_or_clear_instance_config(Some(InstanceConfig::default()/* use setters */));
3578 /// let x = CreateInstanceConfigRequest::new().set_or_clear_instance_config(None::<InstanceConfig>);
3579 /// ```
3580 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
3581 where
3582 T: std::convert::Into<crate::model::InstanceConfig>,
3583 {
3584 self.instance_config = v.map(|x| x.into());
3585 self
3586 }
3587
3588 /// Sets the value of [validate_only][crate::model::CreateInstanceConfigRequest::validate_only].
3589 ///
3590 /// # Example
3591 /// ```ignore,no_run
3592 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigRequest;
3593 /// let x = CreateInstanceConfigRequest::new().set_validate_only(true);
3594 /// ```
3595 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3596 self.validate_only = v.into();
3597 self
3598 }
3599}
3600
3601impl wkt::message::Message for CreateInstanceConfigRequest {
3602 fn typename() -> &'static str {
3603 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigRequest"
3604 }
3605}
3606
3607/// The request for
3608/// [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig].
3609///
3610/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]: crate::client::InstanceAdmin::update_instance_config
3611#[derive(Clone, Default, PartialEq)]
3612#[non_exhaustive]
3613pub struct UpdateInstanceConfigRequest {
3614 /// Required. The user instance configuration to update, which must always
3615 /// include the instance configuration name. Otherwise, only fields mentioned
3616 /// in
3617 /// [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask]
3618 /// need be included. To prevent conflicts of concurrent updates,
3619 /// [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can
3620 /// be used.
3621 ///
3622 /// [google.spanner.admin.instance.v1.InstanceConfig.reconciling]: crate::model::InstanceConfig::reconciling
3623 /// [google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask]: crate::model::UpdateInstanceConfigRequest::update_mask
3624 pub instance_config: std::option::Option<crate::model::InstanceConfig>,
3625
3626 /// Required. A mask specifying which fields in
3627 /// [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be
3628 /// updated. The field mask must always be specified; this prevents any future
3629 /// fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig]
3630 /// from being erased accidentally by clients that do not know about them. Only
3631 /// display_name and labels can be updated.
3632 ///
3633 /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
3634 pub update_mask: std::option::Option<wkt::FieldMask>,
3635
3636 /// An option to validate, but not actually execute, a request,
3637 /// and provide the same response.
3638 pub validate_only: bool,
3639
3640 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3641}
3642
3643impl UpdateInstanceConfigRequest {
3644 pub fn new() -> Self {
3645 std::default::Default::default()
3646 }
3647
3648 /// Sets the value of [instance_config][crate::model::UpdateInstanceConfigRequest::instance_config].
3649 ///
3650 /// # Example
3651 /// ```ignore,no_run
3652 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3653 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3654 /// let x = UpdateInstanceConfigRequest::new().set_instance_config(InstanceConfig::default()/* use setters */);
3655 /// ```
3656 pub fn set_instance_config<T>(mut self, v: T) -> Self
3657 where
3658 T: std::convert::Into<crate::model::InstanceConfig>,
3659 {
3660 self.instance_config = std::option::Option::Some(v.into());
3661 self
3662 }
3663
3664 /// Sets or clears the value of [instance_config][crate::model::UpdateInstanceConfigRequest::instance_config].
3665 ///
3666 /// # Example
3667 /// ```ignore,no_run
3668 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3669 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
3670 /// let x = UpdateInstanceConfigRequest::new().set_or_clear_instance_config(Some(InstanceConfig::default()/* use setters */));
3671 /// let x = UpdateInstanceConfigRequest::new().set_or_clear_instance_config(None::<InstanceConfig>);
3672 /// ```
3673 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
3674 where
3675 T: std::convert::Into<crate::model::InstanceConfig>,
3676 {
3677 self.instance_config = v.map(|x| x.into());
3678 self
3679 }
3680
3681 /// Sets the value of [update_mask][crate::model::UpdateInstanceConfigRequest::update_mask].
3682 ///
3683 /// # Example
3684 /// ```ignore,no_run
3685 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3686 /// use wkt::FieldMask;
3687 /// let x = UpdateInstanceConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3688 /// ```
3689 pub fn set_update_mask<T>(mut self, v: T) -> Self
3690 where
3691 T: std::convert::Into<wkt::FieldMask>,
3692 {
3693 self.update_mask = std::option::Option::Some(v.into());
3694 self
3695 }
3696
3697 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceConfigRequest::update_mask].
3698 ///
3699 /// # Example
3700 /// ```ignore,no_run
3701 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3702 /// use wkt::FieldMask;
3703 /// let x = UpdateInstanceConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3704 /// let x = UpdateInstanceConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3705 /// ```
3706 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3707 where
3708 T: std::convert::Into<wkt::FieldMask>,
3709 {
3710 self.update_mask = v.map(|x| x.into());
3711 self
3712 }
3713
3714 /// Sets the value of [validate_only][crate::model::UpdateInstanceConfigRequest::validate_only].
3715 ///
3716 /// # Example
3717 /// ```ignore,no_run
3718 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigRequest;
3719 /// let x = UpdateInstanceConfigRequest::new().set_validate_only(true);
3720 /// ```
3721 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3722 self.validate_only = v.into();
3723 self
3724 }
3725}
3726
3727impl wkt::message::Message for UpdateInstanceConfigRequest {
3728 fn typename() -> &'static str {
3729 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceConfigRequest"
3730 }
3731}
3732
3733/// The request for
3734/// [DeleteInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstanceConfig].
3735///
3736/// [google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstanceConfig]: crate::client::InstanceAdmin::delete_instance_config
3737#[derive(Clone, Default, PartialEq)]
3738#[non_exhaustive]
3739pub struct DeleteInstanceConfigRequest {
3740 /// Required. The name of the instance configuration to be deleted.
3741 /// Values are of the form
3742 /// `projects/<project>/instanceConfigs/<instance_config>`
3743 pub name: std::string::String,
3744
3745 /// Used for optimistic concurrency control as a way to help prevent
3746 /// simultaneous deletes of an instance configuration from overwriting each
3747 /// other. If not empty, the API
3748 /// only deletes the instance configuration when the etag provided matches the
3749 /// current status of the requested instance configuration. Otherwise, deletes
3750 /// the instance configuration without checking the current status of the
3751 /// requested instance configuration.
3752 pub etag: std::string::String,
3753
3754 /// An option to validate, but not actually execute, a request,
3755 /// and provide the same response.
3756 pub validate_only: bool,
3757
3758 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3759}
3760
3761impl DeleteInstanceConfigRequest {
3762 pub fn new() -> Self {
3763 std::default::Default::default()
3764 }
3765
3766 /// Sets the value of [name][crate::model::DeleteInstanceConfigRequest::name].
3767 ///
3768 /// # Example
3769 /// ```ignore,no_run
3770 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstanceConfigRequest;
3771 /// let x = DeleteInstanceConfigRequest::new().set_name("example");
3772 /// ```
3773 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3774 self.name = v.into();
3775 self
3776 }
3777
3778 /// Sets the value of [etag][crate::model::DeleteInstanceConfigRequest::etag].
3779 ///
3780 /// # Example
3781 /// ```ignore,no_run
3782 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstanceConfigRequest;
3783 /// let x = DeleteInstanceConfigRequest::new().set_etag("example");
3784 /// ```
3785 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3786 self.etag = v.into();
3787 self
3788 }
3789
3790 /// Sets the value of [validate_only][crate::model::DeleteInstanceConfigRequest::validate_only].
3791 ///
3792 /// # Example
3793 /// ```ignore,no_run
3794 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstanceConfigRequest;
3795 /// let x = DeleteInstanceConfigRequest::new().set_validate_only(true);
3796 /// ```
3797 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3798 self.validate_only = v.into();
3799 self
3800 }
3801}
3802
3803impl wkt::message::Message for DeleteInstanceConfigRequest {
3804 fn typename() -> &'static str {
3805 "type.googleapis.com/google.spanner.admin.instance.v1.DeleteInstanceConfigRequest"
3806 }
3807}
3808
3809/// The request for
3810/// [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations].
3811///
3812/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]: crate::client::InstanceAdmin::list_instance_config_operations
3813#[derive(Clone, Default, PartialEq)]
3814#[non_exhaustive]
3815pub struct ListInstanceConfigOperationsRequest {
3816 /// Required. The project of the instance configuration operations.
3817 /// Values are of the form `projects/<project>`.
3818 pub parent: std::string::String,
3819
3820 /// An expression that filters the list of returned operations.
3821 ///
3822 /// A filter expression consists of a field name, a
3823 /// comparison operator, and a value for filtering.
3824 /// The value must be a string, a number, or a boolean. The comparison operator
3825 /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
3826 /// Colon `:` is the contains operator. Filter rules are not case sensitive.
3827 ///
3828 /// The following fields in the Operation are eligible for filtering:
3829 ///
3830 /// * `name` - The name of the long-running operation
3831 /// * `done` - False if the operation is in progress, else true.
3832 /// * `metadata.@type` - the type of metadata. For example, the type string
3833 /// for
3834 /// [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]
3835 /// is
3836 /// `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`.
3837 /// * `metadata.<field_name>` - any field in metadata.value.
3838 /// `metadata.@type` must be specified first, if filtering on metadata
3839 /// fields.
3840 /// * `error` - Error associated with the long-running operation.
3841 /// * `response.@type` - the type of response.
3842 /// * `response.<field_name>` - any field in response.value.
3843 ///
3844 /// You can combine multiple expressions by enclosing each expression in
3845 /// parentheses. By default, expressions are combined with AND logic. However,
3846 /// you can specify AND, OR, and NOT logic explicitly.
3847 ///
3848 /// Here are a few examples:
3849 ///
3850 /// * `done:true` - The operation is complete.
3851 /// * `(metadata.@type=` \
3852 /// `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata)
3853 /// AND` \
3854 /// `(metadata.instance_config.name:custom-config) AND` \
3855 /// `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \
3856 /// `(error:*)` - Return operations where:
3857 /// * The operation's metadata type is
3858 /// [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata].
3859 /// * The instance configuration name contains "custom-config".
3860 /// * The operation started before 2021-03-28T14:50:00Z.
3861 /// * The operation resulted in an error.
3862 ///
3863 /// [google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]: crate::model::CreateInstanceConfigMetadata
3864 pub filter: std::string::String,
3865
3866 /// Number of operations to be returned in the response. If 0 or
3867 /// less, defaults to the server's maximum allowed page size.
3868 pub page_size: i32,
3869
3870 /// If non-empty, `page_token` should contain a
3871 /// [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token]
3872 /// from a previous
3873 /// [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse]
3874 /// to the same `parent` and with the same `filter`.
3875 ///
3876 /// [google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse]: crate::model::ListInstanceConfigOperationsResponse
3877 /// [google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token]: crate::model::ListInstanceConfigOperationsResponse::next_page_token
3878 pub page_token: std::string::String,
3879
3880 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3881}
3882
3883impl ListInstanceConfigOperationsRequest {
3884 pub fn new() -> Self {
3885 std::default::Default::default()
3886 }
3887
3888 /// Sets the value of [parent][crate::model::ListInstanceConfigOperationsRequest::parent].
3889 ///
3890 /// # Example
3891 /// ```ignore,no_run
3892 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsRequest;
3893 /// let x = ListInstanceConfigOperationsRequest::new().set_parent("example");
3894 /// ```
3895 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3896 self.parent = v.into();
3897 self
3898 }
3899
3900 /// Sets the value of [filter][crate::model::ListInstanceConfigOperationsRequest::filter].
3901 ///
3902 /// # Example
3903 /// ```ignore,no_run
3904 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsRequest;
3905 /// let x = ListInstanceConfigOperationsRequest::new().set_filter("example");
3906 /// ```
3907 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3908 self.filter = v.into();
3909 self
3910 }
3911
3912 /// Sets the value of [page_size][crate::model::ListInstanceConfigOperationsRequest::page_size].
3913 ///
3914 /// # Example
3915 /// ```ignore,no_run
3916 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsRequest;
3917 /// let x = ListInstanceConfigOperationsRequest::new().set_page_size(42);
3918 /// ```
3919 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3920 self.page_size = v.into();
3921 self
3922 }
3923
3924 /// Sets the value of [page_token][crate::model::ListInstanceConfigOperationsRequest::page_token].
3925 ///
3926 /// # Example
3927 /// ```ignore,no_run
3928 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsRequest;
3929 /// let x = ListInstanceConfigOperationsRequest::new().set_page_token("example");
3930 /// ```
3931 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3932 self.page_token = v.into();
3933 self
3934 }
3935}
3936
3937impl wkt::message::Message for ListInstanceConfigOperationsRequest {
3938 fn typename() -> &'static str {
3939 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest"
3940 }
3941}
3942
3943/// The response for
3944/// [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations].
3945///
3946/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]: crate::client::InstanceAdmin::list_instance_config_operations
3947#[derive(Clone, Default, PartialEq)]
3948#[non_exhaustive]
3949pub struct ListInstanceConfigOperationsResponse {
3950 /// The list of matching instance configuration long-running operations. Each
3951 /// operation's name will be
3952 /// prefixed by the name of the instance configuration. The operation's
3953 /// metadata field type
3954 /// `metadata.type_url` describes the type of the metadata.
3955 pub operations: std::vec::Vec<longrunning::model::Operation>,
3956
3957 /// `next_page_token` can be sent in a subsequent
3958 /// [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]
3959 /// call to fetch more of the matching metadata.
3960 ///
3961 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]: crate::client::InstanceAdmin::list_instance_config_operations
3962 pub next_page_token: std::string::String,
3963
3964 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3965}
3966
3967impl ListInstanceConfigOperationsResponse {
3968 pub fn new() -> Self {
3969 std::default::Default::default()
3970 }
3971
3972 /// Sets the value of [operations][crate::model::ListInstanceConfigOperationsResponse::operations].
3973 ///
3974 /// # Example
3975 /// ```ignore,no_run
3976 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsResponse;
3977 /// use longrunning::model::Operation;
3978 /// let x = ListInstanceConfigOperationsResponse::new()
3979 /// .set_operations([
3980 /// Operation::default()/* use setters */,
3981 /// Operation::default()/* use (different) setters */,
3982 /// ]);
3983 /// ```
3984 pub fn set_operations<T, V>(mut self, v: T) -> Self
3985 where
3986 T: std::iter::IntoIterator<Item = V>,
3987 V: std::convert::Into<longrunning::model::Operation>,
3988 {
3989 use std::iter::Iterator;
3990 self.operations = v.into_iter().map(|i| i.into()).collect();
3991 self
3992 }
3993
3994 /// Sets the value of [next_page_token][crate::model::ListInstanceConfigOperationsResponse::next_page_token].
3995 ///
3996 /// # Example
3997 /// ```ignore,no_run
3998 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstanceConfigOperationsResponse;
3999 /// let x = ListInstanceConfigOperationsResponse::new().set_next_page_token("example");
4000 /// ```
4001 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4002 self.next_page_token = v.into();
4003 self
4004 }
4005}
4006
4007impl wkt::message::Message for ListInstanceConfigOperationsResponse {
4008 fn typename() -> &'static str {
4009 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse"
4010 }
4011}
4012
4013#[doc(hidden)]
4014impl gax::paginator::internal::PageableResponse for ListInstanceConfigOperationsResponse {
4015 type PageItem = longrunning::model::Operation;
4016
4017 fn items(self) -> std::vec::Vec<Self::PageItem> {
4018 self.operations
4019 }
4020
4021 fn next_page_token(&self) -> std::string::String {
4022 use std::clone::Clone;
4023 self.next_page_token.clone()
4024 }
4025}
4026
4027/// The request for
4028/// [GetInstance][google.spanner.admin.instance.v1.InstanceAdmin.GetInstance].
4029///
4030/// [google.spanner.admin.instance.v1.InstanceAdmin.GetInstance]: crate::client::InstanceAdmin::get_instance
4031#[derive(Clone, Default, PartialEq)]
4032#[non_exhaustive]
4033pub struct GetInstanceRequest {
4034 /// Required. The name of the requested instance. Values are of the form
4035 /// `projects/<project>/instances/<instance>`.
4036 pub name: std::string::String,
4037
4038 /// If field_mask is present, specifies the subset of
4039 /// [Instance][google.spanner.admin.instance.v1.Instance] fields that should be
4040 /// returned. If absent, all
4041 /// [Instance][google.spanner.admin.instance.v1.Instance] fields are returned.
4042 ///
4043 /// [google.spanner.admin.instance.v1.Instance]: crate::model::Instance
4044 pub field_mask: std::option::Option<wkt::FieldMask>,
4045
4046 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4047}
4048
4049impl GetInstanceRequest {
4050 pub fn new() -> Self {
4051 std::default::Default::default()
4052 }
4053
4054 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
4055 ///
4056 /// # Example
4057 /// ```ignore,no_run
4058 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstanceRequest;
4059 /// let x = GetInstanceRequest::new().set_name("example");
4060 /// ```
4061 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4062 self.name = v.into();
4063 self
4064 }
4065
4066 /// Sets the value of [field_mask][crate::model::GetInstanceRequest::field_mask].
4067 ///
4068 /// # Example
4069 /// ```ignore,no_run
4070 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstanceRequest;
4071 /// use wkt::FieldMask;
4072 /// let x = GetInstanceRequest::new().set_field_mask(FieldMask::default()/* use setters */);
4073 /// ```
4074 pub fn set_field_mask<T>(mut self, v: T) -> Self
4075 where
4076 T: std::convert::Into<wkt::FieldMask>,
4077 {
4078 self.field_mask = std::option::Option::Some(v.into());
4079 self
4080 }
4081
4082 /// Sets or clears the value of [field_mask][crate::model::GetInstanceRequest::field_mask].
4083 ///
4084 /// # Example
4085 /// ```ignore,no_run
4086 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstanceRequest;
4087 /// use wkt::FieldMask;
4088 /// let x = GetInstanceRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
4089 /// let x = GetInstanceRequest::new().set_or_clear_field_mask(None::<FieldMask>);
4090 /// ```
4091 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
4092 where
4093 T: std::convert::Into<wkt::FieldMask>,
4094 {
4095 self.field_mask = v.map(|x| x.into());
4096 self
4097 }
4098}
4099
4100impl wkt::message::Message for GetInstanceRequest {
4101 fn typename() -> &'static str {
4102 "type.googleapis.com/google.spanner.admin.instance.v1.GetInstanceRequest"
4103 }
4104}
4105
4106/// The request for
4107/// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance].
4108///
4109/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
4110#[derive(Clone, Default, PartialEq)]
4111#[non_exhaustive]
4112pub struct CreateInstanceRequest {
4113 /// Required. The name of the project in which to create the instance. Values
4114 /// are of the form `projects/<project>`.
4115 pub parent: std::string::String,
4116
4117 /// Required. The ID of the instance to create. Valid identifiers are of the
4118 /// form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in
4119 /// length.
4120 pub instance_id: std::string::String,
4121
4122 /// Required. The instance to create. The name may be omitted, but if
4123 /// specified must be `<parent>/instances/<instance_id>`.
4124 pub instance: std::option::Option<crate::model::Instance>,
4125
4126 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4127}
4128
4129impl CreateInstanceRequest {
4130 pub fn new() -> Self {
4131 std::default::Default::default()
4132 }
4133
4134 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
4135 ///
4136 /// # Example
4137 /// ```ignore,no_run
4138 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceRequest;
4139 /// let x = CreateInstanceRequest::new().set_parent("example");
4140 /// ```
4141 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4142 self.parent = v.into();
4143 self
4144 }
4145
4146 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
4147 ///
4148 /// # Example
4149 /// ```ignore,no_run
4150 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceRequest;
4151 /// let x = CreateInstanceRequest::new().set_instance_id("example");
4152 /// ```
4153 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4154 self.instance_id = v.into();
4155 self
4156 }
4157
4158 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
4159 ///
4160 /// # Example
4161 /// ```ignore,no_run
4162 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceRequest;
4163 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4164 /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
4165 /// ```
4166 pub fn set_instance<T>(mut self, v: T) -> Self
4167 where
4168 T: std::convert::Into<crate::model::Instance>,
4169 {
4170 self.instance = std::option::Option::Some(v.into());
4171 self
4172 }
4173
4174 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
4175 ///
4176 /// # Example
4177 /// ```ignore,no_run
4178 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceRequest;
4179 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4180 /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
4181 /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
4182 /// ```
4183 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4184 where
4185 T: std::convert::Into<crate::model::Instance>,
4186 {
4187 self.instance = v.map(|x| x.into());
4188 self
4189 }
4190}
4191
4192impl wkt::message::Message for CreateInstanceRequest {
4193 fn typename() -> &'static str {
4194 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceRequest"
4195 }
4196}
4197
4198/// The request for
4199/// [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].
4200///
4201/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]: crate::client::InstanceAdmin::list_instances
4202#[derive(Clone, Default, PartialEq)]
4203#[non_exhaustive]
4204pub struct ListInstancesRequest {
4205 /// Required. The name of the project for which a list of instances is
4206 /// requested. Values are of the form `projects/<project>`.
4207 pub parent: std::string::String,
4208
4209 /// Number of instances to be returned in the response. If 0 or less, defaults
4210 /// to the server's maximum allowed page size.
4211 pub page_size: i32,
4212
4213 /// If non-empty, `page_token` should contain a
4214 /// [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token]
4215 /// from a previous
4216 /// [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
4217 ///
4218 /// [google.spanner.admin.instance.v1.ListInstancesResponse]: crate::model::ListInstancesResponse
4219 /// [google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token]: crate::model::ListInstancesResponse::next_page_token
4220 pub page_token: std::string::String,
4221
4222 /// An expression for filtering the results of the request. Filter rules are
4223 /// case insensitive. The fields eligible for filtering are:
4224 ///
4225 /// * `name`
4226 /// * `display_name`
4227 /// * `labels.key` where key is the name of a label
4228 ///
4229 /// Some examples of using filters are:
4230 ///
4231 /// * `name:*` --> The instance has a name.
4232 /// * `name:Howl` --> The instance's name contains the string "howl".
4233 /// * `name:HOWL` --> Equivalent to above.
4234 /// * `NAME:howl` --> Equivalent to above.
4235 /// * `labels.env:*` --> The instance has the label "env".
4236 /// * `labels.env:dev` --> The instance has the label "env" and the value of
4237 /// the label contains the string "dev".
4238 /// * `name:howl labels.env:dev` --> The instance's name contains "howl" and
4239 /// it has the label "env" with its value
4240 /// containing "dev".
4241 pub filter: std::string::String,
4242
4243 /// Deadline used while retrieving metadata for instances.
4244 /// Instances whose metadata cannot be retrieved within this deadline will be
4245 /// added to
4246 /// [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
4247 /// in
4248 /// [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
4249 ///
4250 /// [google.spanner.admin.instance.v1.ListInstancesResponse]: crate::model::ListInstancesResponse
4251 /// [google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]: crate::model::ListInstancesResponse::unreachable
4252 pub instance_deadline: std::option::Option<wkt::Timestamp>,
4253
4254 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4255}
4256
4257impl ListInstancesRequest {
4258 pub fn new() -> Self {
4259 std::default::Default::default()
4260 }
4261
4262 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
4263 ///
4264 /// # Example
4265 /// ```ignore,no_run
4266 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4267 /// let x = ListInstancesRequest::new().set_parent("example");
4268 /// ```
4269 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4270 self.parent = v.into();
4271 self
4272 }
4273
4274 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
4275 ///
4276 /// # Example
4277 /// ```ignore,no_run
4278 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4279 /// let x = ListInstancesRequest::new().set_page_size(42);
4280 /// ```
4281 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4282 self.page_size = v.into();
4283 self
4284 }
4285
4286 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
4287 ///
4288 /// # Example
4289 /// ```ignore,no_run
4290 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4291 /// let x = ListInstancesRequest::new().set_page_token("example");
4292 /// ```
4293 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4294 self.page_token = v.into();
4295 self
4296 }
4297
4298 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
4299 ///
4300 /// # Example
4301 /// ```ignore,no_run
4302 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4303 /// let x = ListInstancesRequest::new().set_filter("example");
4304 /// ```
4305 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4306 self.filter = v.into();
4307 self
4308 }
4309
4310 /// Sets the value of [instance_deadline][crate::model::ListInstancesRequest::instance_deadline].
4311 ///
4312 /// # Example
4313 /// ```ignore,no_run
4314 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4315 /// use wkt::Timestamp;
4316 /// let x = ListInstancesRequest::new().set_instance_deadline(Timestamp::default()/* use setters */);
4317 /// ```
4318 pub fn set_instance_deadline<T>(mut self, v: T) -> Self
4319 where
4320 T: std::convert::Into<wkt::Timestamp>,
4321 {
4322 self.instance_deadline = std::option::Option::Some(v.into());
4323 self
4324 }
4325
4326 /// Sets or clears the value of [instance_deadline][crate::model::ListInstancesRequest::instance_deadline].
4327 ///
4328 /// # Example
4329 /// ```ignore,no_run
4330 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesRequest;
4331 /// use wkt::Timestamp;
4332 /// let x = ListInstancesRequest::new().set_or_clear_instance_deadline(Some(Timestamp::default()/* use setters */));
4333 /// let x = ListInstancesRequest::new().set_or_clear_instance_deadline(None::<Timestamp>);
4334 /// ```
4335 pub fn set_or_clear_instance_deadline<T>(mut self, v: std::option::Option<T>) -> Self
4336 where
4337 T: std::convert::Into<wkt::Timestamp>,
4338 {
4339 self.instance_deadline = v.map(|x| x.into());
4340 self
4341 }
4342}
4343
4344impl wkt::message::Message for ListInstancesRequest {
4345 fn typename() -> &'static str {
4346 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancesRequest"
4347 }
4348}
4349
4350/// The response for
4351/// [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].
4352///
4353/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]: crate::client::InstanceAdmin::list_instances
4354#[derive(Clone, Default, PartialEq)]
4355#[non_exhaustive]
4356pub struct ListInstancesResponse {
4357 /// The list of requested instances.
4358 pub instances: std::vec::Vec<crate::model::Instance>,
4359
4360 /// `next_page_token` can be sent in a subsequent
4361 /// [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]
4362 /// call to fetch more of the matching instances.
4363 ///
4364 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]: crate::client::InstanceAdmin::list_instances
4365 pub next_page_token: std::string::String,
4366
4367 /// The list of unreachable instances.
4368 /// It includes the names of instances whose metadata could not be retrieved
4369 /// within
4370 /// [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
4371 ///
4372 /// [google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]: crate::model::ListInstancesRequest::instance_deadline
4373 pub unreachable: std::vec::Vec<std::string::String>,
4374
4375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4376}
4377
4378impl ListInstancesResponse {
4379 pub fn new() -> Self {
4380 std::default::Default::default()
4381 }
4382
4383 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
4384 ///
4385 /// # Example
4386 /// ```ignore,no_run
4387 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesResponse;
4388 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4389 /// let x = ListInstancesResponse::new()
4390 /// .set_instances([
4391 /// Instance::default()/* use setters */,
4392 /// Instance::default()/* use (different) setters */,
4393 /// ]);
4394 /// ```
4395 pub fn set_instances<T, V>(mut self, v: T) -> Self
4396 where
4397 T: std::iter::IntoIterator<Item = V>,
4398 V: std::convert::Into<crate::model::Instance>,
4399 {
4400 use std::iter::Iterator;
4401 self.instances = v.into_iter().map(|i| i.into()).collect();
4402 self
4403 }
4404
4405 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
4406 ///
4407 /// # Example
4408 /// ```ignore,no_run
4409 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesResponse;
4410 /// let x = ListInstancesResponse::new().set_next_page_token("example");
4411 /// ```
4412 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4413 self.next_page_token = v.into();
4414 self
4415 }
4416
4417 /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
4418 ///
4419 /// # Example
4420 /// ```ignore,no_run
4421 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancesResponse;
4422 /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
4423 /// ```
4424 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4425 where
4426 T: std::iter::IntoIterator<Item = V>,
4427 V: std::convert::Into<std::string::String>,
4428 {
4429 use std::iter::Iterator;
4430 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4431 self
4432 }
4433}
4434
4435impl wkt::message::Message for ListInstancesResponse {
4436 fn typename() -> &'static str {
4437 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancesResponse"
4438 }
4439}
4440
4441#[doc(hidden)]
4442impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
4443 type PageItem = crate::model::Instance;
4444
4445 fn items(self) -> std::vec::Vec<Self::PageItem> {
4446 self.instances
4447 }
4448
4449 fn next_page_token(&self) -> std::string::String {
4450 use std::clone::Clone;
4451 self.next_page_token.clone()
4452 }
4453}
4454
4455/// The request for
4456/// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance].
4457///
4458/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
4459#[derive(Clone, Default, PartialEq)]
4460#[non_exhaustive]
4461pub struct UpdateInstanceRequest {
4462 /// Required. The instance to update, which must always include the instance
4463 /// name. Otherwise, only fields mentioned in
4464 /// [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask]
4465 /// need be included.
4466 ///
4467 /// [google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask]: crate::model::UpdateInstanceRequest::field_mask
4468 pub instance: std::option::Option<crate::model::Instance>,
4469
4470 /// Required. A mask specifying which fields in
4471 /// [Instance][google.spanner.admin.instance.v1.Instance] should be updated.
4472 /// The field mask must always be specified; this prevents any future fields in
4473 /// [Instance][google.spanner.admin.instance.v1.Instance] from being erased
4474 /// accidentally by clients that do not know about them.
4475 ///
4476 /// [google.spanner.admin.instance.v1.Instance]: crate::model::Instance
4477 pub field_mask: std::option::Option<wkt::FieldMask>,
4478
4479 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4480}
4481
4482impl UpdateInstanceRequest {
4483 pub fn new() -> Self {
4484 std::default::Default::default()
4485 }
4486
4487 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
4488 ///
4489 /// # Example
4490 /// ```ignore,no_run
4491 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceRequest;
4492 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4493 /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
4494 /// ```
4495 pub fn set_instance<T>(mut self, v: T) -> Self
4496 where
4497 T: std::convert::Into<crate::model::Instance>,
4498 {
4499 self.instance = std::option::Option::Some(v.into());
4500 self
4501 }
4502
4503 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
4504 ///
4505 /// # Example
4506 /// ```ignore,no_run
4507 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceRequest;
4508 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4509 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
4510 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
4511 /// ```
4512 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4513 where
4514 T: std::convert::Into<crate::model::Instance>,
4515 {
4516 self.instance = v.map(|x| x.into());
4517 self
4518 }
4519
4520 /// Sets the value of [field_mask][crate::model::UpdateInstanceRequest::field_mask].
4521 ///
4522 /// # Example
4523 /// ```ignore,no_run
4524 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceRequest;
4525 /// use wkt::FieldMask;
4526 /// let x = UpdateInstanceRequest::new().set_field_mask(FieldMask::default()/* use setters */);
4527 /// ```
4528 pub fn set_field_mask<T>(mut self, v: T) -> Self
4529 where
4530 T: std::convert::Into<wkt::FieldMask>,
4531 {
4532 self.field_mask = std::option::Option::Some(v.into());
4533 self
4534 }
4535
4536 /// Sets or clears the value of [field_mask][crate::model::UpdateInstanceRequest::field_mask].
4537 ///
4538 /// # Example
4539 /// ```ignore,no_run
4540 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceRequest;
4541 /// use wkt::FieldMask;
4542 /// let x = UpdateInstanceRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
4543 /// let x = UpdateInstanceRequest::new().set_or_clear_field_mask(None::<FieldMask>);
4544 /// ```
4545 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
4546 where
4547 T: std::convert::Into<wkt::FieldMask>,
4548 {
4549 self.field_mask = v.map(|x| x.into());
4550 self
4551 }
4552}
4553
4554impl wkt::message::Message for UpdateInstanceRequest {
4555 fn typename() -> &'static str {
4556 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceRequest"
4557 }
4558}
4559
4560/// The request for
4561/// [DeleteInstance][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance].
4562///
4563/// [google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance]: crate::client::InstanceAdmin::delete_instance
4564#[derive(Clone, Default, PartialEq)]
4565#[non_exhaustive]
4566pub struct DeleteInstanceRequest {
4567 /// Required. The name of the instance to be deleted. Values are of the form
4568 /// `projects/<project>/instances/<instance>`
4569 pub name: std::string::String,
4570
4571 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4572}
4573
4574impl DeleteInstanceRequest {
4575 pub fn new() -> Self {
4576 std::default::Default::default()
4577 }
4578
4579 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
4580 ///
4581 /// # Example
4582 /// ```ignore,no_run
4583 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstanceRequest;
4584 /// let x = DeleteInstanceRequest::new().set_name("example");
4585 /// ```
4586 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4587 self.name = v.into();
4588 self
4589 }
4590}
4591
4592impl wkt::message::Message for DeleteInstanceRequest {
4593 fn typename() -> &'static str {
4594 "type.googleapis.com/google.spanner.admin.instance.v1.DeleteInstanceRequest"
4595 }
4596}
4597
4598/// Metadata type for the operation returned by
4599/// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance].
4600///
4601/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
4602#[derive(Clone, Default, PartialEq)]
4603#[non_exhaustive]
4604pub struct CreateInstanceMetadata {
4605 /// The instance being created.
4606 pub instance: std::option::Option<crate::model::Instance>,
4607
4608 /// The time at which the
4609 /// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]
4610 /// request was received.
4611 ///
4612 /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
4613 pub start_time: std::option::Option<wkt::Timestamp>,
4614
4615 /// The time at which this operation was cancelled. If set, this operation is
4616 /// in the process of undoing itself (which is guaranteed to succeed) and
4617 /// cannot be cancelled again.
4618 pub cancel_time: std::option::Option<wkt::Timestamp>,
4619
4620 /// The time at which this operation failed or was completed successfully.
4621 pub end_time: std::option::Option<wkt::Timestamp>,
4622
4623 /// The expected fulfillment period of this create operation.
4624 pub expected_fulfillment_period: crate::model::FulfillmentPeriod,
4625
4626 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4627}
4628
4629impl CreateInstanceMetadata {
4630 pub fn new() -> Self {
4631 std::default::Default::default()
4632 }
4633
4634 /// Sets the value of [instance][crate::model::CreateInstanceMetadata::instance].
4635 ///
4636 /// # Example
4637 /// ```ignore,no_run
4638 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4639 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4640 /// let x = CreateInstanceMetadata::new().set_instance(Instance::default()/* use setters */);
4641 /// ```
4642 pub fn set_instance<T>(mut self, v: T) -> Self
4643 where
4644 T: std::convert::Into<crate::model::Instance>,
4645 {
4646 self.instance = std::option::Option::Some(v.into());
4647 self
4648 }
4649
4650 /// Sets or clears the value of [instance][crate::model::CreateInstanceMetadata::instance].
4651 ///
4652 /// # Example
4653 /// ```ignore,no_run
4654 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4655 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4656 /// let x = CreateInstanceMetadata::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
4657 /// let x = CreateInstanceMetadata::new().set_or_clear_instance(None::<Instance>);
4658 /// ```
4659 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4660 where
4661 T: std::convert::Into<crate::model::Instance>,
4662 {
4663 self.instance = v.map(|x| x.into());
4664 self
4665 }
4666
4667 /// Sets the value of [start_time][crate::model::CreateInstanceMetadata::start_time].
4668 ///
4669 /// # Example
4670 /// ```ignore,no_run
4671 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4672 /// use wkt::Timestamp;
4673 /// let x = CreateInstanceMetadata::new().set_start_time(Timestamp::default()/* use setters */);
4674 /// ```
4675 pub fn set_start_time<T>(mut self, v: T) -> Self
4676 where
4677 T: std::convert::Into<wkt::Timestamp>,
4678 {
4679 self.start_time = std::option::Option::Some(v.into());
4680 self
4681 }
4682
4683 /// Sets or clears the value of [start_time][crate::model::CreateInstanceMetadata::start_time].
4684 ///
4685 /// # Example
4686 /// ```ignore,no_run
4687 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4688 /// use wkt::Timestamp;
4689 /// let x = CreateInstanceMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
4690 /// let x = CreateInstanceMetadata::new().set_or_clear_start_time(None::<Timestamp>);
4691 /// ```
4692 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4693 where
4694 T: std::convert::Into<wkt::Timestamp>,
4695 {
4696 self.start_time = v.map(|x| x.into());
4697 self
4698 }
4699
4700 /// Sets the value of [cancel_time][crate::model::CreateInstanceMetadata::cancel_time].
4701 ///
4702 /// # Example
4703 /// ```ignore,no_run
4704 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4705 /// use wkt::Timestamp;
4706 /// let x = CreateInstanceMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
4707 /// ```
4708 pub fn set_cancel_time<T>(mut self, v: T) -> Self
4709 where
4710 T: std::convert::Into<wkt::Timestamp>,
4711 {
4712 self.cancel_time = std::option::Option::Some(v.into());
4713 self
4714 }
4715
4716 /// Sets or clears the value of [cancel_time][crate::model::CreateInstanceMetadata::cancel_time].
4717 ///
4718 /// # Example
4719 /// ```ignore,no_run
4720 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4721 /// use wkt::Timestamp;
4722 /// let x = CreateInstanceMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
4723 /// let x = CreateInstanceMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
4724 /// ```
4725 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
4726 where
4727 T: std::convert::Into<wkt::Timestamp>,
4728 {
4729 self.cancel_time = v.map(|x| x.into());
4730 self
4731 }
4732
4733 /// Sets the value of [end_time][crate::model::CreateInstanceMetadata::end_time].
4734 ///
4735 /// # Example
4736 /// ```ignore,no_run
4737 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4738 /// use wkt::Timestamp;
4739 /// let x = CreateInstanceMetadata::new().set_end_time(Timestamp::default()/* use setters */);
4740 /// ```
4741 pub fn set_end_time<T>(mut self, v: T) -> Self
4742 where
4743 T: std::convert::Into<wkt::Timestamp>,
4744 {
4745 self.end_time = std::option::Option::Some(v.into());
4746 self
4747 }
4748
4749 /// Sets or clears the value of [end_time][crate::model::CreateInstanceMetadata::end_time].
4750 ///
4751 /// # Example
4752 /// ```ignore,no_run
4753 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4754 /// use wkt::Timestamp;
4755 /// let x = CreateInstanceMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4756 /// let x = CreateInstanceMetadata::new().set_or_clear_end_time(None::<Timestamp>);
4757 /// ```
4758 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4759 where
4760 T: std::convert::Into<wkt::Timestamp>,
4761 {
4762 self.end_time = v.map(|x| x.into());
4763 self
4764 }
4765
4766 /// Sets the value of [expected_fulfillment_period][crate::model::CreateInstanceMetadata::expected_fulfillment_period].
4767 ///
4768 /// # Example
4769 /// ```ignore,no_run
4770 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceMetadata;
4771 /// use google_cloud_spanner_admin_instance_v1::model::FulfillmentPeriod;
4772 /// let x0 = CreateInstanceMetadata::new().set_expected_fulfillment_period(FulfillmentPeriod::Normal);
4773 /// let x1 = CreateInstanceMetadata::new().set_expected_fulfillment_period(FulfillmentPeriod::Extended);
4774 /// ```
4775 pub fn set_expected_fulfillment_period<
4776 T: std::convert::Into<crate::model::FulfillmentPeriod>,
4777 >(
4778 mut self,
4779 v: T,
4780 ) -> Self {
4781 self.expected_fulfillment_period = v.into();
4782 self
4783 }
4784}
4785
4786impl wkt::message::Message for CreateInstanceMetadata {
4787 fn typename() -> &'static str {
4788 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceMetadata"
4789 }
4790}
4791
4792/// Metadata type for the operation returned by
4793/// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance].
4794///
4795/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
4796#[derive(Clone, Default, PartialEq)]
4797#[non_exhaustive]
4798pub struct UpdateInstanceMetadata {
4799 /// The desired end state of the update.
4800 pub instance: std::option::Option<crate::model::Instance>,
4801
4802 /// The time at which
4803 /// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]
4804 /// request was received.
4805 ///
4806 /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
4807 pub start_time: std::option::Option<wkt::Timestamp>,
4808
4809 /// The time at which this operation was cancelled. If set, this operation is
4810 /// in the process of undoing itself (which is guaranteed to succeed) and
4811 /// cannot be cancelled again.
4812 pub cancel_time: std::option::Option<wkt::Timestamp>,
4813
4814 /// The time at which this operation failed or was completed successfully.
4815 pub end_time: std::option::Option<wkt::Timestamp>,
4816
4817 /// The expected fulfillment period of this update operation.
4818 pub expected_fulfillment_period: crate::model::FulfillmentPeriod,
4819
4820 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4821}
4822
4823impl UpdateInstanceMetadata {
4824 pub fn new() -> Self {
4825 std::default::Default::default()
4826 }
4827
4828 /// Sets the value of [instance][crate::model::UpdateInstanceMetadata::instance].
4829 ///
4830 /// # Example
4831 /// ```ignore,no_run
4832 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4833 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4834 /// let x = UpdateInstanceMetadata::new().set_instance(Instance::default()/* use setters */);
4835 /// ```
4836 pub fn set_instance<T>(mut self, v: T) -> Self
4837 where
4838 T: std::convert::Into<crate::model::Instance>,
4839 {
4840 self.instance = std::option::Option::Some(v.into());
4841 self
4842 }
4843
4844 /// Sets or clears the value of [instance][crate::model::UpdateInstanceMetadata::instance].
4845 ///
4846 /// # Example
4847 /// ```ignore,no_run
4848 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4849 /// use google_cloud_spanner_admin_instance_v1::model::Instance;
4850 /// let x = UpdateInstanceMetadata::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
4851 /// let x = UpdateInstanceMetadata::new().set_or_clear_instance(None::<Instance>);
4852 /// ```
4853 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4854 where
4855 T: std::convert::Into<crate::model::Instance>,
4856 {
4857 self.instance = v.map(|x| x.into());
4858 self
4859 }
4860
4861 /// Sets the value of [start_time][crate::model::UpdateInstanceMetadata::start_time].
4862 ///
4863 /// # Example
4864 /// ```ignore,no_run
4865 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4866 /// use wkt::Timestamp;
4867 /// let x = UpdateInstanceMetadata::new().set_start_time(Timestamp::default()/* use setters */);
4868 /// ```
4869 pub fn set_start_time<T>(mut self, v: T) -> Self
4870 where
4871 T: std::convert::Into<wkt::Timestamp>,
4872 {
4873 self.start_time = std::option::Option::Some(v.into());
4874 self
4875 }
4876
4877 /// Sets or clears the value of [start_time][crate::model::UpdateInstanceMetadata::start_time].
4878 ///
4879 /// # Example
4880 /// ```ignore,no_run
4881 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4882 /// use wkt::Timestamp;
4883 /// let x = UpdateInstanceMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
4884 /// let x = UpdateInstanceMetadata::new().set_or_clear_start_time(None::<Timestamp>);
4885 /// ```
4886 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4887 where
4888 T: std::convert::Into<wkt::Timestamp>,
4889 {
4890 self.start_time = v.map(|x| x.into());
4891 self
4892 }
4893
4894 /// Sets the value of [cancel_time][crate::model::UpdateInstanceMetadata::cancel_time].
4895 ///
4896 /// # Example
4897 /// ```ignore,no_run
4898 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4899 /// use wkt::Timestamp;
4900 /// let x = UpdateInstanceMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
4901 /// ```
4902 pub fn set_cancel_time<T>(mut self, v: T) -> Self
4903 where
4904 T: std::convert::Into<wkt::Timestamp>,
4905 {
4906 self.cancel_time = std::option::Option::Some(v.into());
4907 self
4908 }
4909
4910 /// Sets or clears the value of [cancel_time][crate::model::UpdateInstanceMetadata::cancel_time].
4911 ///
4912 /// # Example
4913 /// ```ignore,no_run
4914 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4915 /// use wkt::Timestamp;
4916 /// let x = UpdateInstanceMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
4917 /// let x = UpdateInstanceMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
4918 /// ```
4919 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
4920 where
4921 T: std::convert::Into<wkt::Timestamp>,
4922 {
4923 self.cancel_time = v.map(|x| x.into());
4924 self
4925 }
4926
4927 /// Sets the value of [end_time][crate::model::UpdateInstanceMetadata::end_time].
4928 ///
4929 /// # Example
4930 /// ```ignore,no_run
4931 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4932 /// use wkt::Timestamp;
4933 /// let x = UpdateInstanceMetadata::new().set_end_time(Timestamp::default()/* use setters */);
4934 /// ```
4935 pub fn set_end_time<T>(mut self, v: T) -> Self
4936 where
4937 T: std::convert::Into<wkt::Timestamp>,
4938 {
4939 self.end_time = std::option::Option::Some(v.into());
4940 self
4941 }
4942
4943 /// Sets or clears the value of [end_time][crate::model::UpdateInstanceMetadata::end_time].
4944 ///
4945 /// # Example
4946 /// ```ignore,no_run
4947 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4948 /// use wkt::Timestamp;
4949 /// let x = UpdateInstanceMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4950 /// let x = UpdateInstanceMetadata::new().set_or_clear_end_time(None::<Timestamp>);
4951 /// ```
4952 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4953 where
4954 T: std::convert::Into<wkt::Timestamp>,
4955 {
4956 self.end_time = v.map(|x| x.into());
4957 self
4958 }
4959
4960 /// Sets the value of [expected_fulfillment_period][crate::model::UpdateInstanceMetadata::expected_fulfillment_period].
4961 ///
4962 /// # Example
4963 /// ```ignore,no_run
4964 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceMetadata;
4965 /// use google_cloud_spanner_admin_instance_v1::model::FulfillmentPeriod;
4966 /// let x0 = UpdateInstanceMetadata::new().set_expected_fulfillment_period(FulfillmentPeriod::Normal);
4967 /// let x1 = UpdateInstanceMetadata::new().set_expected_fulfillment_period(FulfillmentPeriod::Extended);
4968 /// ```
4969 pub fn set_expected_fulfillment_period<
4970 T: std::convert::Into<crate::model::FulfillmentPeriod>,
4971 >(
4972 mut self,
4973 v: T,
4974 ) -> Self {
4975 self.expected_fulfillment_period = v.into();
4976 self
4977 }
4978}
4979
4980impl wkt::message::Message for UpdateInstanceMetadata {
4981 fn typename() -> &'static str {
4982 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceMetadata"
4983 }
4984}
4985
4986/// Free instance specific metadata that is kept even after an instance has been
4987/// upgraded for tracking purposes.
4988#[derive(Clone, Default, PartialEq)]
4989#[non_exhaustive]
4990pub struct FreeInstanceMetadata {
4991 /// Output only. Timestamp after which the instance will either be upgraded or
4992 /// scheduled for deletion after a grace period. ExpireBehavior is used to
4993 /// choose between upgrading or scheduling the free instance for deletion. This
4994 /// timestamp is set during the creation of a free instance.
4995 pub expire_time: std::option::Option<wkt::Timestamp>,
4996
4997 /// Output only. If present, the timestamp at which the free instance was
4998 /// upgraded to a provisioned instance.
4999 pub upgrade_time: std::option::Option<wkt::Timestamp>,
5000
5001 /// Specifies the expiration behavior of a free instance. The default of
5002 /// ExpireBehavior is `REMOVE_AFTER_GRACE_PERIOD`. This can be modified during
5003 /// or after creation, and before expiration.
5004 pub expire_behavior: crate::model::free_instance_metadata::ExpireBehavior,
5005
5006 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5007}
5008
5009impl FreeInstanceMetadata {
5010 pub fn new() -> Self {
5011 std::default::Default::default()
5012 }
5013
5014 /// Sets the value of [expire_time][crate::model::FreeInstanceMetadata::expire_time].
5015 ///
5016 /// # Example
5017 /// ```ignore,no_run
5018 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
5019 /// use wkt::Timestamp;
5020 /// let x = FreeInstanceMetadata::new().set_expire_time(Timestamp::default()/* use setters */);
5021 /// ```
5022 pub fn set_expire_time<T>(mut self, v: T) -> Self
5023 where
5024 T: std::convert::Into<wkt::Timestamp>,
5025 {
5026 self.expire_time = std::option::Option::Some(v.into());
5027 self
5028 }
5029
5030 /// Sets or clears the value of [expire_time][crate::model::FreeInstanceMetadata::expire_time].
5031 ///
5032 /// # Example
5033 /// ```ignore,no_run
5034 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
5035 /// use wkt::Timestamp;
5036 /// let x = FreeInstanceMetadata::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
5037 /// let x = FreeInstanceMetadata::new().set_or_clear_expire_time(None::<Timestamp>);
5038 /// ```
5039 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
5040 where
5041 T: std::convert::Into<wkt::Timestamp>,
5042 {
5043 self.expire_time = v.map(|x| x.into());
5044 self
5045 }
5046
5047 /// Sets the value of [upgrade_time][crate::model::FreeInstanceMetadata::upgrade_time].
5048 ///
5049 /// # Example
5050 /// ```ignore,no_run
5051 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
5052 /// use wkt::Timestamp;
5053 /// let x = FreeInstanceMetadata::new().set_upgrade_time(Timestamp::default()/* use setters */);
5054 /// ```
5055 pub fn set_upgrade_time<T>(mut self, v: T) -> Self
5056 where
5057 T: std::convert::Into<wkt::Timestamp>,
5058 {
5059 self.upgrade_time = std::option::Option::Some(v.into());
5060 self
5061 }
5062
5063 /// Sets or clears the value of [upgrade_time][crate::model::FreeInstanceMetadata::upgrade_time].
5064 ///
5065 /// # Example
5066 /// ```ignore,no_run
5067 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
5068 /// use wkt::Timestamp;
5069 /// let x = FreeInstanceMetadata::new().set_or_clear_upgrade_time(Some(Timestamp::default()/* use setters */));
5070 /// let x = FreeInstanceMetadata::new().set_or_clear_upgrade_time(None::<Timestamp>);
5071 /// ```
5072 pub fn set_or_clear_upgrade_time<T>(mut self, v: std::option::Option<T>) -> Self
5073 where
5074 T: std::convert::Into<wkt::Timestamp>,
5075 {
5076 self.upgrade_time = v.map(|x| x.into());
5077 self
5078 }
5079
5080 /// Sets the value of [expire_behavior][crate::model::FreeInstanceMetadata::expire_behavior].
5081 ///
5082 /// # Example
5083 /// ```ignore,no_run
5084 /// # use google_cloud_spanner_admin_instance_v1::model::FreeInstanceMetadata;
5085 /// use google_cloud_spanner_admin_instance_v1::model::free_instance_metadata::ExpireBehavior;
5086 /// let x0 = FreeInstanceMetadata::new().set_expire_behavior(ExpireBehavior::FreeToProvisioned);
5087 /// let x1 = FreeInstanceMetadata::new().set_expire_behavior(ExpireBehavior::RemoveAfterGracePeriod);
5088 /// ```
5089 pub fn set_expire_behavior<
5090 T: std::convert::Into<crate::model::free_instance_metadata::ExpireBehavior>,
5091 >(
5092 mut self,
5093 v: T,
5094 ) -> Self {
5095 self.expire_behavior = v.into();
5096 self
5097 }
5098}
5099
5100impl wkt::message::Message for FreeInstanceMetadata {
5101 fn typename() -> &'static str {
5102 "type.googleapis.com/google.spanner.admin.instance.v1.FreeInstanceMetadata"
5103 }
5104}
5105
5106/// Defines additional types related to [FreeInstanceMetadata].
5107pub mod free_instance_metadata {
5108 #[allow(unused_imports)]
5109 use super::*;
5110
5111 /// Allows users to change behavior when a free instance expires.
5112 ///
5113 /// # Working with unknown values
5114 ///
5115 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5116 /// additional enum variants at any time. Adding new variants is not considered
5117 /// a breaking change. Applications should write their code in anticipation of:
5118 ///
5119 /// - New values appearing in future releases of the client library, **and**
5120 /// - New values received dynamically, without application changes.
5121 ///
5122 /// Please consult the [Working with enums] section in the user guide for some
5123 /// guidelines.
5124 ///
5125 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5126 #[derive(Clone, Debug, PartialEq)]
5127 #[non_exhaustive]
5128 pub enum ExpireBehavior {
5129 /// Not specified.
5130 Unspecified,
5131 /// When the free instance expires, upgrade the instance to a provisioned
5132 /// instance.
5133 FreeToProvisioned,
5134 /// When the free instance expires, disable the instance, and delete it
5135 /// after the grace period passes if it has not been upgraded.
5136 RemoveAfterGracePeriod,
5137 /// If set, the enum was initialized with an unknown value.
5138 ///
5139 /// Applications can examine the value using [ExpireBehavior::value] or
5140 /// [ExpireBehavior::name].
5141 UnknownValue(expire_behavior::UnknownValue),
5142 }
5143
5144 #[doc(hidden)]
5145 pub mod expire_behavior {
5146 #[allow(unused_imports)]
5147 use super::*;
5148 #[derive(Clone, Debug, PartialEq)]
5149 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5150 }
5151
5152 impl ExpireBehavior {
5153 /// Gets the enum value.
5154 ///
5155 /// Returns `None` if the enum contains an unknown value deserialized from
5156 /// the string representation of enums.
5157 pub fn value(&self) -> std::option::Option<i32> {
5158 match self {
5159 Self::Unspecified => std::option::Option::Some(0),
5160 Self::FreeToProvisioned => std::option::Option::Some(1),
5161 Self::RemoveAfterGracePeriod => std::option::Option::Some(2),
5162 Self::UnknownValue(u) => u.0.value(),
5163 }
5164 }
5165
5166 /// Gets the enum value as a string.
5167 ///
5168 /// Returns `None` if the enum contains an unknown value deserialized from
5169 /// the integer representation of enums.
5170 pub fn name(&self) -> std::option::Option<&str> {
5171 match self {
5172 Self::Unspecified => std::option::Option::Some("EXPIRE_BEHAVIOR_UNSPECIFIED"),
5173 Self::FreeToProvisioned => std::option::Option::Some("FREE_TO_PROVISIONED"),
5174 Self::RemoveAfterGracePeriod => {
5175 std::option::Option::Some("REMOVE_AFTER_GRACE_PERIOD")
5176 }
5177 Self::UnknownValue(u) => u.0.name(),
5178 }
5179 }
5180 }
5181
5182 impl std::default::Default for ExpireBehavior {
5183 fn default() -> Self {
5184 use std::convert::From;
5185 Self::from(0)
5186 }
5187 }
5188
5189 impl std::fmt::Display for ExpireBehavior {
5190 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5191 wkt::internal::display_enum(f, self.name(), self.value())
5192 }
5193 }
5194
5195 impl std::convert::From<i32> for ExpireBehavior {
5196 fn from(value: i32) -> Self {
5197 match value {
5198 0 => Self::Unspecified,
5199 1 => Self::FreeToProvisioned,
5200 2 => Self::RemoveAfterGracePeriod,
5201 _ => Self::UnknownValue(expire_behavior::UnknownValue(
5202 wkt::internal::UnknownEnumValue::Integer(value),
5203 )),
5204 }
5205 }
5206 }
5207
5208 impl std::convert::From<&str> for ExpireBehavior {
5209 fn from(value: &str) -> Self {
5210 use std::string::ToString;
5211 match value {
5212 "EXPIRE_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
5213 "FREE_TO_PROVISIONED" => Self::FreeToProvisioned,
5214 "REMOVE_AFTER_GRACE_PERIOD" => Self::RemoveAfterGracePeriod,
5215 _ => Self::UnknownValue(expire_behavior::UnknownValue(
5216 wkt::internal::UnknownEnumValue::String(value.to_string()),
5217 )),
5218 }
5219 }
5220 }
5221
5222 impl serde::ser::Serialize for ExpireBehavior {
5223 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5224 where
5225 S: serde::Serializer,
5226 {
5227 match self {
5228 Self::Unspecified => serializer.serialize_i32(0),
5229 Self::FreeToProvisioned => serializer.serialize_i32(1),
5230 Self::RemoveAfterGracePeriod => serializer.serialize_i32(2),
5231 Self::UnknownValue(u) => u.0.serialize(serializer),
5232 }
5233 }
5234 }
5235
5236 impl<'de> serde::de::Deserialize<'de> for ExpireBehavior {
5237 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5238 where
5239 D: serde::Deserializer<'de>,
5240 {
5241 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExpireBehavior>::new(
5242 ".google.spanner.admin.instance.v1.FreeInstanceMetadata.ExpireBehavior",
5243 ))
5244 }
5245 }
5246}
5247
5248/// Metadata type for the operation returned by
5249/// [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig].
5250///
5251/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]: crate::client::InstanceAdmin::create_instance_config
5252#[derive(Clone, Default, PartialEq)]
5253#[non_exhaustive]
5254pub struct CreateInstanceConfigMetadata {
5255 /// The target instance configuration end state.
5256 pub instance_config: std::option::Option<crate::model::InstanceConfig>,
5257
5258 /// The progress of the
5259 /// [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]
5260 /// operation.
5261 ///
5262 /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]: crate::client::InstanceAdmin::create_instance_config
5263 pub progress: std::option::Option<crate::model::OperationProgress>,
5264
5265 /// The time at which this operation was cancelled.
5266 pub cancel_time: std::option::Option<wkt::Timestamp>,
5267
5268 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5269}
5270
5271impl CreateInstanceConfigMetadata {
5272 pub fn new() -> Self {
5273 std::default::Default::default()
5274 }
5275
5276 /// Sets the value of [instance_config][crate::model::CreateInstanceConfigMetadata::instance_config].
5277 ///
5278 /// # Example
5279 /// ```ignore,no_run
5280 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5281 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
5282 /// let x = CreateInstanceConfigMetadata::new().set_instance_config(InstanceConfig::default()/* use setters */);
5283 /// ```
5284 pub fn set_instance_config<T>(mut self, v: T) -> Self
5285 where
5286 T: std::convert::Into<crate::model::InstanceConfig>,
5287 {
5288 self.instance_config = std::option::Option::Some(v.into());
5289 self
5290 }
5291
5292 /// Sets or clears the value of [instance_config][crate::model::CreateInstanceConfigMetadata::instance_config].
5293 ///
5294 /// # Example
5295 /// ```ignore,no_run
5296 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5297 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
5298 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_instance_config(Some(InstanceConfig::default()/* use setters */));
5299 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_instance_config(None::<InstanceConfig>);
5300 /// ```
5301 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5302 where
5303 T: std::convert::Into<crate::model::InstanceConfig>,
5304 {
5305 self.instance_config = v.map(|x| x.into());
5306 self
5307 }
5308
5309 /// Sets the value of [progress][crate::model::CreateInstanceConfigMetadata::progress].
5310 ///
5311 /// # Example
5312 /// ```ignore,no_run
5313 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5314 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
5315 /// let x = CreateInstanceConfigMetadata::new().set_progress(OperationProgress::default()/* use setters */);
5316 /// ```
5317 pub fn set_progress<T>(mut self, v: T) -> Self
5318 where
5319 T: std::convert::Into<crate::model::OperationProgress>,
5320 {
5321 self.progress = std::option::Option::Some(v.into());
5322 self
5323 }
5324
5325 /// Sets or clears the value of [progress][crate::model::CreateInstanceConfigMetadata::progress].
5326 ///
5327 /// # Example
5328 /// ```ignore,no_run
5329 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5330 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
5331 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
5332 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_progress(None::<OperationProgress>);
5333 /// ```
5334 pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
5335 where
5336 T: std::convert::Into<crate::model::OperationProgress>,
5337 {
5338 self.progress = v.map(|x| x.into());
5339 self
5340 }
5341
5342 /// Sets the value of [cancel_time][crate::model::CreateInstanceConfigMetadata::cancel_time].
5343 ///
5344 /// # Example
5345 /// ```ignore,no_run
5346 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5347 /// use wkt::Timestamp;
5348 /// let x = CreateInstanceConfigMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
5349 /// ```
5350 pub fn set_cancel_time<T>(mut self, v: T) -> Self
5351 where
5352 T: std::convert::Into<wkt::Timestamp>,
5353 {
5354 self.cancel_time = std::option::Option::Some(v.into());
5355 self
5356 }
5357
5358 /// Sets or clears the value of [cancel_time][crate::model::CreateInstanceConfigMetadata::cancel_time].
5359 ///
5360 /// # Example
5361 /// ```ignore,no_run
5362 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstanceConfigMetadata;
5363 /// use wkt::Timestamp;
5364 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
5365 /// let x = CreateInstanceConfigMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
5366 /// ```
5367 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
5368 where
5369 T: std::convert::Into<wkt::Timestamp>,
5370 {
5371 self.cancel_time = v.map(|x| x.into());
5372 self
5373 }
5374}
5375
5376impl wkt::message::Message for CreateInstanceConfigMetadata {
5377 fn typename() -> &'static str {
5378 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata"
5379 }
5380}
5381
5382/// Metadata type for the operation returned by
5383/// [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig].
5384///
5385/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]: crate::client::InstanceAdmin::update_instance_config
5386#[derive(Clone, Default, PartialEq)]
5387#[non_exhaustive]
5388pub struct UpdateInstanceConfigMetadata {
5389 /// The desired instance configuration after updating.
5390 pub instance_config: std::option::Option<crate::model::InstanceConfig>,
5391
5392 /// The progress of the
5393 /// [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]
5394 /// operation.
5395 ///
5396 /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]: crate::client::InstanceAdmin::update_instance_config
5397 pub progress: std::option::Option<crate::model::OperationProgress>,
5398
5399 /// The time at which this operation was cancelled.
5400 pub cancel_time: std::option::Option<wkt::Timestamp>,
5401
5402 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5403}
5404
5405impl UpdateInstanceConfigMetadata {
5406 pub fn new() -> Self {
5407 std::default::Default::default()
5408 }
5409
5410 /// Sets the value of [instance_config][crate::model::UpdateInstanceConfigMetadata::instance_config].
5411 ///
5412 /// # Example
5413 /// ```ignore,no_run
5414 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5415 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
5416 /// let x = UpdateInstanceConfigMetadata::new().set_instance_config(InstanceConfig::default()/* use setters */);
5417 /// ```
5418 pub fn set_instance_config<T>(mut self, v: T) -> Self
5419 where
5420 T: std::convert::Into<crate::model::InstanceConfig>,
5421 {
5422 self.instance_config = std::option::Option::Some(v.into());
5423 self
5424 }
5425
5426 /// Sets or clears the value of [instance_config][crate::model::UpdateInstanceConfigMetadata::instance_config].
5427 ///
5428 /// # Example
5429 /// ```ignore,no_run
5430 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5431 /// use google_cloud_spanner_admin_instance_v1::model::InstanceConfig;
5432 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_instance_config(Some(InstanceConfig::default()/* use setters */));
5433 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_instance_config(None::<InstanceConfig>);
5434 /// ```
5435 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5436 where
5437 T: std::convert::Into<crate::model::InstanceConfig>,
5438 {
5439 self.instance_config = v.map(|x| x.into());
5440 self
5441 }
5442
5443 /// Sets the value of [progress][crate::model::UpdateInstanceConfigMetadata::progress].
5444 ///
5445 /// # Example
5446 /// ```ignore,no_run
5447 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5448 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
5449 /// let x = UpdateInstanceConfigMetadata::new().set_progress(OperationProgress::default()/* use setters */);
5450 /// ```
5451 pub fn set_progress<T>(mut self, v: T) -> Self
5452 where
5453 T: std::convert::Into<crate::model::OperationProgress>,
5454 {
5455 self.progress = std::option::Option::Some(v.into());
5456 self
5457 }
5458
5459 /// Sets or clears the value of [progress][crate::model::UpdateInstanceConfigMetadata::progress].
5460 ///
5461 /// # Example
5462 /// ```ignore,no_run
5463 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5464 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
5465 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
5466 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_progress(None::<OperationProgress>);
5467 /// ```
5468 pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
5469 where
5470 T: std::convert::Into<crate::model::OperationProgress>,
5471 {
5472 self.progress = v.map(|x| x.into());
5473 self
5474 }
5475
5476 /// Sets the value of [cancel_time][crate::model::UpdateInstanceConfigMetadata::cancel_time].
5477 ///
5478 /// # Example
5479 /// ```ignore,no_run
5480 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5481 /// use wkt::Timestamp;
5482 /// let x = UpdateInstanceConfigMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
5483 /// ```
5484 pub fn set_cancel_time<T>(mut self, v: T) -> Self
5485 where
5486 T: std::convert::Into<wkt::Timestamp>,
5487 {
5488 self.cancel_time = std::option::Option::Some(v.into());
5489 self
5490 }
5491
5492 /// Sets or clears the value of [cancel_time][crate::model::UpdateInstanceConfigMetadata::cancel_time].
5493 ///
5494 /// # Example
5495 /// ```ignore,no_run
5496 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstanceConfigMetadata;
5497 /// use wkt::Timestamp;
5498 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
5499 /// let x = UpdateInstanceConfigMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
5500 /// ```
5501 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
5502 where
5503 T: std::convert::Into<wkt::Timestamp>,
5504 {
5505 self.cancel_time = v.map(|x| x.into());
5506 self
5507 }
5508}
5509
5510impl wkt::message::Message for UpdateInstanceConfigMetadata {
5511 fn typename() -> &'static str {
5512 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata"
5513 }
5514}
5515
5516/// An isolated set of Cloud Spanner resources that databases can define
5517/// placements on.
5518#[derive(Clone, Default, PartialEq)]
5519#[non_exhaustive]
5520pub struct InstancePartition {
5521 /// Required. A unique identifier for the instance partition. Values are of the
5522 /// form
5523 /// `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
5524 /// The final segment of the name must be between 2 and 64 characters in
5525 /// length. An instance partition's name cannot be changed after the instance
5526 /// partition is created.
5527 pub name: std::string::String,
5528
5529 /// Required. The name of the instance partition's configuration. Values are of
5530 /// the form `projects/<project>/instanceConfigs/<configuration>`. See also
5531 /// [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
5532 /// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
5533 ///
5534 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
5535 /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
5536 pub config: std::string::String,
5537
5538 /// Required. The descriptive name for this instance partition as it appears in
5539 /// UIs. Must be unique per project and between 4 and 30 characters in length.
5540 pub display_name: std::string::String,
5541
5542 /// Optional. The autoscaling configuration. Autoscaling is enabled if this
5543 /// field is set. When autoscaling is enabled, fields in compute_capacity are
5544 /// treated as OUTPUT_ONLY fields and reflect the current compute capacity
5545 /// allocated to the instance partition.
5546 pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
5547
5548 /// Output only. The current instance partition state.
5549 pub state: crate::model::instance_partition::State,
5550
5551 /// Output only. The time at which the instance partition was created.
5552 pub create_time: std::option::Option<wkt::Timestamp>,
5553
5554 /// Output only. The time at which the instance partition was most recently
5555 /// updated.
5556 pub update_time: std::option::Option<wkt::Timestamp>,
5557
5558 /// Output only. The names of the databases that reference this
5559 /// instance partition. Referencing databases should share the parent instance.
5560 /// The existence of any referencing database prevents the instance partition
5561 /// from being deleted.
5562 pub referencing_databases: std::vec::Vec<std::string::String>,
5563
5564 /// Output only. Deprecated: This field is not populated.
5565 /// Output only. The names of the backups that reference this instance
5566 /// partition. Referencing backups should share the parent instance. The
5567 /// existence of any referencing backup prevents the instance partition from
5568 /// being deleted.
5569 #[deprecated]
5570 pub referencing_backups: std::vec::Vec<std::string::String>,
5571
5572 /// Used for optimistic concurrency control as a way
5573 /// to help prevent simultaneous updates of a instance partition from
5574 /// overwriting each other. It is strongly suggested that systems make use of
5575 /// the etag in the read-modify-write cycle to perform instance partition
5576 /// updates in order to avoid race conditions: An etag is returned in the
5577 /// response which contains instance partitions, and systems are expected to
5578 /// put that etag in the request to update instance partitions to ensure that
5579 /// their change will be applied to the same version of the instance partition.
5580 /// If no etag is provided in the call to update instance partition, then the
5581 /// existing instance partition is overwritten blindly.
5582 pub etag: std::string::String,
5583
5584 /// Compute capacity defines amount of server and storage resources that are
5585 /// available to the databases in an instance partition. At most, one of either
5586 /// `node_count` or` processing_units` should be present in the message. For
5587 /// more information, see
5588 /// [Compute capacity, nodes, and processing
5589 /// units](https://cloud.google.com/spanner/docs/compute-capacity).
5590 pub compute_capacity: std::option::Option<crate::model::instance_partition::ComputeCapacity>,
5591
5592 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5593}
5594
5595impl InstancePartition {
5596 pub fn new() -> Self {
5597 std::default::Default::default()
5598 }
5599
5600 /// Sets the value of [name][crate::model::InstancePartition::name].
5601 ///
5602 /// # Example
5603 /// ```ignore,no_run
5604 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5605 /// let x = InstancePartition::new().set_name("example");
5606 /// ```
5607 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5608 self.name = v.into();
5609 self
5610 }
5611
5612 /// Sets the value of [config][crate::model::InstancePartition::config].
5613 ///
5614 /// # Example
5615 /// ```ignore,no_run
5616 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5617 /// let x = InstancePartition::new().set_config("example");
5618 /// ```
5619 pub fn set_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5620 self.config = v.into();
5621 self
5622 }
5623
5624 /// Sets the value of [display_name][crate::model::InstancePartition::display_name].
5625 ///
5626 /// # Example
5627 /// ```ignore,no_run
5628 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5629 /// let x = InstancePartition::new().set_display_name("example");
5630 /// ```
5631 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5632 self.display_name = v.into();
5633 self
5634 }
5635
5636 /// Sets the value of [autoscaling_config][crate::model::InstancePartition::autoscaling_config].
5637 ///
5638 /// # Example
5639 /// ```ignore,no_run
5640 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5641 /// use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
5642 /// let x = InstancePartition::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
5643 /// ```
5644 pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
5645 where
5646 T: std::convert::Into<crate::model::AutoscalingConfig>,
5647 {
5648 self.autoscaling_config = std::option::Option::Some(v.into());
5649 self
5650 }
5651
5652 /// Sets or clears the value of [autoscaling_config][crate::model::InstancePartition::autoscaling_config].
5653 ///
5654 /// # Example
5655 /// ```ignore,no_run
5656 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5657 /// use google_cloud_spanner_admin_instance_v1::model::AutoscalingConfig;
5658 /// let x = InstancePartition::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
5659 /// let x = InstancePartition::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
5660 /// ```
5661 pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
5662 where
5663 T: std::convert::Into<crate::model::AutoscalingConfig>,
5664 {
5665 self.autoscaling_config = v.map(|x| x.into());
5666 self
5667 }
5668
5669 /// Sets the value of [state][crate::model::InstancePartition::state].
5670 ///
5671 /// # Example
5672 /// ```ignore,no_run
5673 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5674 /// use google_cloud_spanner_admin_instance_v1::model::instance_partition::State;
5675 /// let x0 = InstancePartition::new().set_state(State::Creating);
5676 /// let x1 = InstancePartition::new().set_state(State::Ready);
5677 /// ```
5678 pub fn set_state<T: std::convert::Into<crate::model::instance_partition::State>>(
5679 mut self,
5680 v: T,
5681 ) -> Self {
5682 self.state = v.into();
5683 self
5684 }
5685
5686 /// Sets the value of [create_time][crate::model::InstancePartition::create_time].
5687 ///
5688 /// # Example
5689 /// ```ignore,no_run
5690 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5691 /// use wkt::Timestamp;
5692 /// let x = InstancePartition::new().set_create_time(Timestamp::default()/* use setters */);
5693 /// ```
5694 pub fn set_create_time<T>(mut self, v: T) -> Self
5695 where
5696 T: std::convert::Into<wkt::Timestamp>,
5697 {
5698 self.create_time = std::option::Option::Some(v.into());
5699 self
5700 }
5701
5702 /// Sets or clears the value of [create_time][crate::model::InstancePartition::create_time].
5703 ///
5704 /// # Example
5705 /// ```ignore,no_run
5706 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5707 /// use wkt::Timestamp;
5708 /// let x = InstancePartition::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5709 /// let x = InstancePartition::new().set_or_clear_create_time(None::<Timestamp>);
5710 /// ```
5711 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5712 where
5713 T: std::convert::Into<wkt::Timestamp>,
5714 {
5715 self.create_time = v.map(|x| x.into());
5716 self
5717 }
5718
5719 /// Sets the value of [update_time][crate::model::InstancePartition::update_time].
5720 ///
5721 /// # Example
5722 /// ```ignore,no_run
5723 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5724 /// use wkt::Timestamp;
5725 /// let x = InstancePartition::new().set_update_time(Timestamp::default()/* use setters */);
5726 /// ```
5727 pub fn set_update_time<T>(mut self, v: T) -> Self
5728 where
5729 T: std::convert::Into<wkt::Timestamp>,
5730 {
5731 self.update_time = std::option::Option::Some(v.into());
5732 self
5733 }
5734
5735 /// Sets or clears the value of [update_time][crate::model::InstancePartition::update_time].
5736 ///
5737 /// # Example
5738 /// ```ignore,no_run
5739 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5740 /// use wkt::Timestamp;
5741 /// let x = InstancePartition::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5742 /// let x = InstancePartition::new().set_or_clear_update_time(None::<Timestamp>);
5743 /// ```
5744 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5745 where
5746 T: std::convert::Into<wkt::Timestamp>,
5747 {
5748 self.update_time = v.map(|x| x.into());
5749 self
5750 }
5751
5752 /// Sets the value of [referencing_databases][crate::model::InstancePartition::referencing_databases].
5753 ///
5754 /// # Example
5755 /// ```ignore,no_run
5756 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5757 /// let x = InstancePartition::new().set_referencing_databases(["a", "b", "c"]);
5758 /// ```
5759 pub fn set_referencing_databases<T, V>(mut self, v: T) -> Self
5760 where
5761 T: std::iter::IntoIterator<Item = V>,
5762 V: std::convert::Into<std::string::String>,
5763 {
5764 use std::iter::Iterator;
5765 self.referencing_databases = v.into_iter().map(|i| i.into()).collect();
5766 self
5767 }
5768
5769 /// Sets the value of [referencing_backups][crate::model::InstancePartition::referencing_backups].
5770 ///
5771 /// # Example
5772 /// ```ignore,no_run
5773 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5774 /// let x = InstancePartition::new().set_referencing_backups(["a", "b", "c"]);
5775 /// ```
5776 #[deprecated]
5777 pub fn set_referencing_backups<T, V>(mut self, v: T) -> Self
5778 where
5779 T: std::iter::IntoIterator<Item = V>,
5780 V: std::convert::Into<std::string::String>,
5781 {
5782 use std::iter::Iterator;
5783 self.referencing_backups = v.into_iter().map(|i| i.into()).collect();
5784 self
5785 }
5786
5787 /// Sets the value of [etag][crate::model::InstancePartition::etag].
5788 ///
5789 /// # Example
5790 /// ```ignore,no_run
5791 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5792 /// let x = InstancePartition::new().set_etag("example");
5793 /// ```
5794 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5795 self.etag = v.into();
5796 self
5797 }
5798
5799 /// Sets the value of [compute_capacity][crate::model::InstancePartition::compute_capacity].
5800 ///
5801 /// Note that all the setters affecting `compute_capacity` are mutually
5802 /// exclusive.
5803 ///
5804 /// # Example
5805 /// ```ignore,no_run
5806 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5807 /// use google_cloud_spanner_admin_instance_v1::model::instance_partition::ComputeCapacity;
5808 /// let x = InstancePartition::new().set_compute_capacity(Some(ComputeCapacity::NodeCount(42)));
5809 /// ```
5810 pub fn set_compute_capacity<
5811 T: std::convert::Into<std::option::Option<crate::model::instance_partition::ComputeCapacity>>,
5812 >(
5813 mut self,
5814 v: T,
5815 ) -> Self {
5816 self.compute_capacity = v.into();
5817 self
5818 }
5819
5820 /// The value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
5821 /// if it holds a `NodeCount`, `None` if the field is not set or
5822 /// holds a different branch.
5823 pub fn node_count(&self) -> std::option::Option<&i32> {
5824 #[allow(unreachable_patterns)]
5825 self.compute_capacity.as_ref().and_then(|v| match v {
5826 crate::model::instance_partition::ComputeCapacity::NodeCount(v) => {
5827 std::option::Option::Some(v)
5828 }
5829 _ => std::option::Option::None,
5830 })
5831 }
5832
5833 /// Sets the value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
5834 /// to hold a `NodeCount`.
5835 ///
5836 /// Note that all the setters affecting `compute_capacity` are
5837 /// mutually exclusive.
5838 ///
5839 /// # Example
5840 /// ```ignore,no_run
5841 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5842 /// let x = InstancePartition::new().set_node_count(42);
5843 /// assert!(x.node_count().is_some());
5844 /// assert!(x.processing_units().is_none());
5845 /// ```
5846 pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5847 self.compute_capacity = std::option::Option::Some(
5848 crate::model::instance_partition::ComputeCapacity::NodeCount(v.into()),
5849 );
5850 self
5851 }
5852
5853 /// The value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
5854 /// if it holds a `ProcessingUnits`, `None` if the field is not set or
5855 /// holds a different branch.
5856 pub fn processing_units(&self) -> std::option::Option<&i32> {
5857 #[allow(unreachable_patterns)]
5858 self.compute_capacity.as_ref().and_then(|v| match v {
5859 crate::model::instance_partition::ComputeCapacity::ProcessingUnits(v) => {
5860 std::option::Option::Some(v)
5861 }
5862 _ => std::option::Option::None,
5863 })
5864 }
5865
5866 /// Sets the value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
5867 /// to hold a `ProcessingUnits`.
5868 ///
5869 /// Note that all the setters affecting `compute_capacity` are
5870 /// mutually exclusive.
5871 ///
5872 /// # Example
5873 /// ```ignore,no_run
5874 /// # use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
5875 /// let x = InstancePartition::new().set_processing_units(42);
5876 /// assert!(x.processing_units().is_some());
5877 /// assert!(x.node_count().is_none());
5878 /// ```
5879 pub fn set_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5880 self.compute_capacity = std::option::Option::Some(
5881 crate::model::instance_partition::ComputeCapacity::ProcessingUnits(v.into()),
5882 );
5883 self
5884 }
5885}
5886
5887impl wkt::message::Message for InstancePartition {
5888 fn typename() -> &'static str {
5889 "type.googleapis.com/google.spanner.admin.instance.v1.InstancePartition"
5890 }
5891}
5892
5893/// Defines additional types related to [InstancePartition].
5894pub mod instance_partition {
5895 #[allow(unused_imports)]
5896 use super::*;
5897
5898 /// Indicates the current state of the instance partition.
5899 ///
5900 /// # Working with unknown values
5901 ///
5902 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5903 /// additional enum variants at any time. Adding new variants is not considered
5904 /// a breaking change. Applications should write their code in anticipation of:
5905 ///
5906 /// - New values appearing in future releases of the client library, **and**
5907 /// - New values received dynamically, without application changes.
5908 ///
5909 /// Please consult the [Working with enums] section in the user guide for some
5910 /// guidelines.
5911 ///
5912 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5913 #[derive(Clone, Debug, PartialEq)]
5914 #[non_exhaustive]
5915 pub enum State {
5916 /// Not specified.
5917 Unspecified,
5918 /// The instance partition is still being created. Resources may not be
5919 /// available yet, and operations such as creating placements using this
5920 /// instance partition may not work.
5921 Creating,
5922 /// The instance partition is fully created and ready to do work such as
5923 /// creating placements and using in databases.
5924 Ready,
5925 /// If set, the enum was initialized with an unknown value.
5926 ///
5927 /// Applications can examine the value using [State::value] or
5928 /// [State::name].
5929 UnknownValue(state::UnknownValue),
5930 }
5931
5932 #[doc(hidden)]
5933 pub mod state {
5934 #[allow(unused_imports)]
5935 use super::*;
5936 #[derive(Clone, Debug, PartialEq)]
5937 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5938 }
5939
5940 impl State {
5941 /// Gets the enum value.
5942 ///
5943 /// Returns `None` if the enum contains an unknown value deserialized from
5944 /// the string representation of enums.
5945 pub fn value(&self) -> std::option::Option<i32> {
5946 match self {
5947 Self::Unspecified => std::option::Option::Some(0),
5948 Self::Creating => std::option::Option::Some(1),
5949 Self::Ready => std::option::Option::Some(2),
5950 Self::UnknownValue(u) => u.0.value(),
5951 }
5952 }
5953
5954 /// Gets the enum value as a string.
5955 ///
5956 /// Returns `None` if the enum contains an unknown value deserialized from
5957 /// the integer representation of enums.
5958 pub fn name(&self) -> std::option::Option<&str> {
5959 match self {
5960 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5961 Self::Creating => std::option::Option::Some("CREATING"),
5962 Self::Ready => std::option::Option::Some("READY"),
5963 Self::UnknownValue(u) => u.0.name(),
5964 }
5965 }
5966 }
5967
5968 impl std::default::Default for State {
5969 fn default() -> Self {
5970 use std::convert::From;
5971 Self::from(0)
5972 }
5973 }
5974
5975 impl std::fmt::Display for State {
5976 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5977 wkt::internal::display_enum(f, self.name(), self.value())
5978 }
5979 }
5980
5981 impl std::convert::From<i32> for State {
5982 fn from(value: i32) -> Self {
5983 match value {
5984 0 => Self::Unspecified,
5985 1 => Self::Creating,
5986 2 => Self::Ready,
5987 _ => Self::UnknownValue(state::UnknownValue(
5988 wkt::internal::UnknownEnumValue::Integer(value),
5989 )),
5990 }
5991 }
5992 }
5993
5994 impl std::convert::From<&str> for State {
5995 fn from(value: &str) -> Self {
5996 use std::string::ToString;
5997 match value {
5998 "STATE_UNSPECIFIED" => Self::Unspecified,
5999 "CREATING" => Self::Creating,
6000 "READY" => Self::Ready,
6001 _ => Self::UnknownValue(state::UnknownValue(
6002 wkt::internal::UnknownEnumValue::String(value.to_string()),
6003 )),
6004 }
6005 }
6006 }
6007
6008 impl serde::ser::Serialize for State {
6009 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6010 where
6011 S: serde::Serializer,
6012 {
6013 match self {
6014 Self::Unspecified => serializer.serialize_i32(0),
6015 Self::Creating => serializer.serialize_i32(1),
6016 Self::Ready => serializer.serialize_i32(2),
6017 Self::UnknownValue(u) => u.0.serialize(serializer),
6018 }
6019 }
6020 }
6021
6022 impl<'de> serde::de::Deserialize<'de> for State {
6023 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6024 where
6025 D: serde::Deserializer<'de>,
6026 {
6027 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6028 ".google.spanner.admin.instance.v1.InstancePartition.State",
6029 ))
6030 }
6031 }
6032
6033 /// Compute capacity defines amount of server and storage resources that are
6034 /// available to the databases in an instance partition. At most, one of either
6035 /// `node_count` or` processing_units` should be present in the message. For
6036 /// more information, see
6037 /// [Compute capacity, nodes, and processing
6038 /// units](https://cloud.google.com/spanner/docs/compute-capacity).
6039 #[derive(Clone, Debug, PartialEq)]
6040 #[non_exhaustive]
6041 pub enum ComputeCapacity {
6042 /// The number of nodes allocated to this instance partition.
6043 ///
6044 /// Users can set the `node_count` field to specify the target number of
6045 /// nodes allocated to the instance partition.
6046 ///
6047 /// This may be zero in API responses for instance partitions that are not
6048 /// yet in state `READY`.
6049 NodeCount(i32),
6050 /// The number of processing units allocated to this instance partition.
6051 ///
6052 /// Users can set the `processing_units` field to specify the target number
6053 /// of processing units allocated to the instance partition.
6054 ///
6055 /// This might be zero in API responses for instance partitions that are not
6056 /// yet in the `READY` state.
6057 ProcessingUnits(i32),
6058 }
6059}
6060
6061/// Metadata type for the operation returned by
6062/// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
6063///
6064/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]: crate::client::InstanceAdmin::create_instance_partition
6065#[derive(Clone, Default, PartialEq)]
6066#[non_exhaustive]
6067pub struct CreateInstancePartitionMetadata {
6068 /// The instance partition being created.
6069 pub instance_partition: std::option::Option<crate::model::InstancePartition>,
6070
6071 /// The time at which the
6072 /// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
6073 /// request was received.
6074 ///
6075 /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]: crate::client::InstanceAdmin::create_instance_partition
6076 pub start_time: std::option::Option<wkt::Timestamp>,
6077
6078 /// The time at which this operation was cancelled. If set, this operation is
6079 /// in the process of undoing itself (which is guaranteed to succeed) and
6080 /// cannot be cancelled again.
6081 pub cancel_time: std::option::Option<wkt::Timestamp>,
6082
6083 /// The time at which this operation failed or was completed successfully.
6084 pub end_time: std::option::Option<wkt::Timestamp>,
6085
6086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6087}
6088
6089impl CreateInstancePartitionMetadata {
6090 pub fn new() -> Self {
6091 std::default::Default::default()
6092 }
6093
6094 /// Sets the value of [instance_partition][crate::model::CreateInstancePartitionMetadata::instance_partition].
6095 ///
6096 /// # Example
6097 /// ```ignore,no_run
6098 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6099 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6100 /// let x = CreateInstancePartitionMetadata::new().set_instance_partition(InstancePartition::default()/* use setters */);
6101 /// ```
6102 pub fn set_instance_partition<T>(mut self, v: T) -> Self
6103 where
6104 T: std::convert::Into<crate::model::InstancePartition>,
6105 {
6106 self.instance_partition = std::option::Option::Some(v.into());
6107 self
6108 }
6109
6110 /// Sets or clears the value of [instance_partition][crate::model::CreateInstancePartitionMetadata::instance_partition].
6111 ///
6112 /// # Example
6113 /// ```ignore,no_run
6114 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6115 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6116 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_instance_partition(Some(InstancePartition::default()/* use setters */));
6117 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_instance_partition(None::<InstancePartition>);
6118 /// ```
6119 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
6120 where
6121 T: std::convert::Into<crate::model::InstancePartition>,
6122 {
6123 self.instance_partition = v.map(|x| x.into());
6124 self
6125 }
6126
6127 /// Sets the value of [start_time][crate::model::CreateInstancePartitionMetadata::start_time].
6128 ///
6129 /// # Example
6130 /// ```ignore,no_run
6131 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6132 /// use wkt::Timestamp;
6133 /// let x = CreateInstancePartitionMetadata::new().set_start_time(Timestamp::default()/* use setters */);
6134 /// ```
6135 pub fn set_start_time<T>(mut self, v: T) -> Self
6136 where
6137 T: std::convert::Into<wkt::Timestamp>,
6138 {
6139 self.start_time = std::option::Option::Some(v.into());
6140 self
6141 }
6142
6143 /// Sets or clears the value of [start_time][crate::model::CreateInstancePartitionMetadata::start_time].
6144 ///
6145 /// # Example
6146 /// ```ignore,no_run
6147 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6148 /// use wkt::Timestamp;
6149 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
6150 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_start_time(None::<Timestamp>);
6151 /// ```
6152 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6153 where
6154 T: std::convert::Into<wkt::Timestamp>,
6155 {
6156 self.start_time = v.map(|x| x.into());
6157 self
6158 }
6159
6160 /// Sets the value of [cancel_time][crate::model::CreateInstancePartitionMetadata::cancel_time].
6161 ///
6162 /// # Example
6163 /// ```ignore,no_run
6164 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6165 /// use wkt::Timestamp;
6166 /// let x = CreateInstancePartitionMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
6167 /// ```
6168 pub fn set_cancel_time<T>(mut self, v: T) -> Self
6169 where
6170 T: std::convert::Into<wkt::Timestamp>,
6171 {
6172 self.cancel_time = std::option::Option::Some(v.into());
6173 self
6174 }
6175
6176 /// Sets or clears the value of [cancel_time][crate::model::CreateInstancePartitionMetadata::cancel_time].
6177 ///
6178 /// # Example
6179 /// ```ignore,no_run
6180 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6181 /// use wkt::Timestamp;
6182 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
6183 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
6184 /// ```
6185 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
6186 where
6187 T: std::convert::Into<wkt::Timestamp>,
6188 {
6189 self.cancel_time = v.map(|x| x.into());
6190 self
6191 }
6192
6193 /// Sets the value of [end_time][crate::model::CreateInstancePartitionMetadata::end_time].
6194 ///
6195 /// # Example
6196 /// ```ignore,no_run
6197 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6198 /// use wkt::Timestamp;
6199 /// let x = CreateInstancePartitionMetadata::new().set_end_time(Timestamp::default()/* use setters */);
6200 /// ```
6201 pub fn set_end_time<T>(mut self, v: T) -> Self
6202 where
6203 T: std::convert::Into<wkt::Timestamp>,
6204 {
6205 self.end_time = std::option::Option::Some(v.into());
6206 self
6207 }
6208
6209 /// Sets or clears the value of [end_time][crate::model::CreateInstancePartitionMetadata::end_time].
6210 ///
6211 /// # Example
6212 /// ```ignore,no_run
6213 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionMetadata;
6214 /// use wkt::Timestamp;
6215 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
6216 /// let x = CreateInstancePartitionMetadata::new().set_or_clear_end_time(None::<Timestamp>);
6217 /// ```
6218 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
6219 where
6220 T: std::convert::Into<wkt::Timestamp>,
6221 {
6222 self.end_time = v.map(|x| x.into());
6223 self
6224 }
6225}
6226
6227impl wkt::message::Message for CreateInstancePartitionMetadata {
6228 fn typename() -> &'static str {
6229 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata"
6230 }
6231}
6232
6233/// The request for
6234/// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
6235///
6236/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]: crate::client::InstanceAdmin::create_instance_partition
6237#[derive(Clone, Default, PartialEq)]
6238#[non_exhaustive]
6239pub struct CreateInstancePartitionRequest {
6240 /// Required. The name of the instance in which to create the instance
6241 /// partition. Values are of the form
6242 /// `projects/<project>/instances/<instance>`.
6243 pub parent: std::string::String,
6244
6245 /// Required. The ID of the instance partition to create. Valid identifiers are
6246 /// of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
6247 /// characters in length.
6248 pub instance_partition_id: std::string::String,
6249
6250 /// Required. The instance partition to create. The instance_partition.name may
6251 /// be omitted, but if specified must be
6252 /// `<parent>/instancePartitions/<instance_partition_id>`.
6253 pub instance_partition: std::option::Option<crate::model::InstancePartition>,
6254
6255 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6256}
6257
6258impl CreateInstancePartitionRequest {
6259 pub fn new() -> Self {
6260 std::default::Default::default()
6261 }
6262
6263 /// Sets the value of [parent][crate::model::CreateInstancePartitionRequest::parent].
6264 ///
6265 /// # Example
6266 /// ```ignore,no_run
6267 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionRequest;
6268 /// let x = CreateInstancePartitionRequest::new().set_parent("example");
6269 /// ```
6270 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6271 self.parent = v.into();
6272 self
6273 }
6274
6275 /// Sets the value of [instance_partition_id][crate::model::CreateInstancePartitionRequest::instance_partition_id].
6276 ///
6277 /// # Example
6278 /// ```ignore,no_run
6279 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionRequest;
6280 /// let x = CreateInstancePartitionRequest::new().set_instance_partition_id("example");
6281 /// ```
6282 pub fn set_instance_partition_id<T: std::convert::Into<std::string::String>>(
6283 mut self,
6284 v: T,
6285 ) -> Self {
6286 self.instance_partition_id = v.into();
6287 self
6288 }
6289
6290 /// Sets the value of [instance_partition][crate::model::CreateInstancePartitionRequest::instance_partition].
6291 ///
6292 /// # Example
6293 /// ```ignore,no_run
6294 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionRequest;
6295 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6296 /// let x = CreateInstancePartitionRequest::new().set_instance_partition(InstancePartition::default()/* use setters */);
6297 /// ```
6298 pub fn set_instance_partition<T>(mut self, v: T) -> Self
6299 where
6300 T: std::convert::Into<crate::model::InstancePartition>,
6301 {
6302 self.instance_partition = std::option::Option::Some(v.into());
6303 self
6304 }
6305
6306 /// Sets or clears the value of [instance_partition][crate::model::CreateInstancePartitionRequest::instance_partition].
6307 ///
6308 /// # Example
6309 /// ```ignore,no_run
6310 /// # use google_cloud_spanner_admin_instance_v1::model::CreateInstancePartitionRequest;
6311 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6312 /// let x = CreateInstancePartitionRequest::new().set_or_clear_instance_partition(Some(InstancePartition::default()/* use setters */));
6313 /// let x = CreateInstancePartitionRequest::new().set_or_clear_instance_partition(None::<InstancePartition>);
6314 /// ```
6315 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
6316 where
6317 T: std::convert::Into<crate::model::InstancePartition>,
6318 {
6319 self.instance_partition = v.map(|x| x.into());
6320 self
6321 }
6322}
6323
6324impl wkt::message::Message for CreateInstancePartitionRequest {
6325 fn typename() -> &'static str {
6326 "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionRequest"
6327 }
6328}
6329
6330/// The request for
6331/// [DeleteInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition].
6332///
6333/// [google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition]: crate::client::InstanceAdmin::delete_instance_partition
6334#[derive(Clone, Default, PartialEq)]
6335#[non_exhaustive]
6336pub struct DeleteInstancePartitionRequest {
6337 /// Required. The name of the instance partition to be deleted.
6338 /// Values are of the form
6339 /// `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
6340 pub name: std::string::String,
6341
6342 /// Optional. If not empty, the API only deletes the instance partition when
6343 /// the etag provided matches the current status of the requested instance
6344 /// partition. Otherwise, deletes the instance partition without checking the
6345 /// current status of the requested instance partition.
6346 pub etag: std::string::String,
6347
6348 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6349}
6350
6351impl DeleteInstancePartitionRequest {
6352 pub fn new() -> Self {
6353 std::default::Default::default()
6354 }
6355
6356 /// Sets the value of [name][crate::model::DeleteInstancePartitionRequest::name].
6357 ///
6358 /// # Example
6359 /// ```ignore,no_run
6360 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstancePartitionRequest;
6361 /// let x = DeleteInstancePartitionRequest::new().set_name("example");
6362 /// ```
6363 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6364 self.name = v.into();
6365 self
6366 }
6367
6368 /// Sets the value of [etag][crate::model::DeleteInstancePartitionRequest::etag].
6369 ///
6370 /// # Example
6371 /// ```ignore,no_run
6372 /// # use google_cloud_spanner_admin_instance_v1::model::DeleteInstancePartitionRequest;
6373 /// let x = DeleteInstancePartitionRequest::new().set_etag("example");
6374 /// ```
6375 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6376 self.etag = v.into();
6377 self
6378 }
6379}
6380
6381impl wkt::message::Message for DeleteInstancePartitionRequest {
6382 fn typename() -> &'static str {
6383 "type.googleapis.com/google.spanner.admin.instance.v1.DeleteInstancePartitionRequest"
6384 }
6385}
6386
6387/// The request for
6388/// [GetInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition].
6389///
6390/// [google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition]: crate::client::InstanceAdmin::get_instance_partition
6391#[derive(Clone, Default, PartialEq)]
6392#[non_exhaustive]
6393pub struct GetInstancePartitionRequest {
6394 /// Required. The name of the requested instance partition. Values are of
6395 /// the form
6396 /// `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
6397 pub name: std::string::String,
6398
6399 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6400}
6401
6402impl GetInstancePartitionRequest {
6403 pub fn new() -> Self {
6404 std::default::Default::default()
6405 }
6406
6407 /// Sets the value of [name][crate::model::GetInstancePartitionRequest::name].
6408 ///
6409 /// # Example
6410 /// ```ignore,no_run
6411 /// # use google_cloud_spanner_admin_instance_v1::model::GetInstancePartitionRequest;
6412 /// let x = GetInstancePartitionRequest::new().set_name("example");
6413 /// ```
6414 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6415 self.name = v.into();
6416 self
6417 }
6418}
6419
6420impl wkt::message::Message for GetInstancePartitionRequest {
6421 fn typename() -> &'static str {
6422 "type.googleapis.com/google.spanner.admin.instance.v1.GetInstancePartitionRequest"
6423 }
6424}
6425
6426/// The request for
6427/// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
6428///
6429/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]: crate::client::InstanceAdmin::update_instance_partition
6430#[derive(Clone, Default, PartialEq)]
6431#[non_exhaustive]
6432pub struct UpdateInstancePartitionRequest {
6433 /// Required. The instance partition to update, which must always include the
6434 /// instance partition name. Otherwise, only fields mentioned in
6435 /// [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
6436 /// need be included.
6437 ///
6438 /// [google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]: crate::model::UpdateInstancePartitionRequest::field_mask
6439 pub instance_partition: std::option::Option<crate::model::InstancePartition>,
6440
6441 /// Required. A mask specifying which fields in
6442 /// [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
6443 /// should be updated. The field mask must always be specified; this prevents
6444 /// any future fields in
6445 /// [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
6446 /// from being erased accidentally by clients that do not know about them.
6447 ///
6448 /// [google.spanner.admin.instance.v1.InstancePartition]: crate::model::InstancePartition
6449 pub field_mask: std::option::Option<wkt::FieldMask>,
6450
6451 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6452}
6453
6454impl UpdateInstancePartitionRequest {
6455 pub fn new() -> Self {
6456 std::default::Default::default()
6457 }
6458
6459 /// Sets the value of [instance_partition][crate::model::UpdateInstancePartitionRequest::instance_partition].
6460 ///
6461 /// # Example
6462 /// ```ignore,no_run
6463 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionRequest;
6464 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6465 /// let x = UpdateInstancePartitionRequest::new().set_instance_partition(InstancePartition::default()/* use setters */);
6466 /// ```
6467 pub fn set_instance_partition<T>(mut self, v: T) -> Self
6468 where
6469 T: std::convert::Into<crate::model::InstancePartition>,
6470 {
6471 self.instance_partition = std::option::Option::Some(v.into());
6472 self
6473 }
6474
6475 /// Sets or clears the value of [instance_partition][crate::model::UpdateInstancePartitionRequest::instance_partition].
6476 ///
6477 /// # Example
6478 /// ```ignore,no_run
6479 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionRequest;
6480 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6481 /// let x = UpdateInstancePartitionRequest::new().set_or_clear_instance_partition(Some(InstancePartition::default()/* use setters */));
6482 /// let x = UpdateInstancePartitionRequest::new().set_or_clear_instance_partition(None::<InstancePartition>);
6483 /// ```
6484 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
6485 where
6486 T: std::convert::Into<crate::model::InstancePartition>,
6487 {
6488 self.instance_partition = v.map(|x| x.into());
6489 self
6490 }
6491
6492 /// Sets the value of [field_mask][crate::model::UpdateInstancePartitionRequest::field_mask].
6493 ///
6494 /// # Example
6495 /// ```ignore,no_run
6496 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionRequest;
6497 /// use wkt::FieldMask;
6498 /// let x = UpdateInstancePartitionRequest::new().set_field_mask(FieldMask::default()/* use setters */);
6499 /// ```
6500 pub fn set_field_mask<T>(mut self, v: T) -> Self
6501 where
6502 T: std::convert::Into<wkt::FieldMask>,
6503 {
6504 self.field_mask = std::option::Option::Some(v.into());
6505 self
6506 }
6507
6508 /// Sets or clears the value of [field_mask][crate::model::UpdateInstancePartitionRequest::field_mask].
6509 ///
6510 /// # Example
6511 /// ```ignore,no_run
6512 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionRequest;
6513 /// use wkt::FieldMask;
6514 /// let x = UpdateInstancePartitionRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
6515 /// let x = UpdateInstancePartitionRequest::new().set_or_clear_field_mask(None::<FieldMask>);
6516 /// ```
6517 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
6518 where
6519 T: std::convert::Into<wkt::FieldMask>,
6520 {
6521 self.field_mask = v.map(|x| x.into());
6522 self
6523 }
6524}
6525
6526impl wkt::message::Message for UpdateInstancePartitionRequest {
6527 fn typename() -> &'static str {
6528 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstancePartitionRequest"
6529 }
6530}
6531
6532/// Metadata type for the operation returned by
6533/// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
6534///
6535/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]: crate::client::InstanceAdmin::update_instance_partition
6536#[derive(Clone, Default, PartialEq)]
6537#[non_exhaustive]
6538pub struct UpdateInstancePartitionMetadata {
6539 /// The desired end state of the update.
6540 pub instance_partition: std::option::Option<crate::model::InstancePartition>,
6541
6542 /// The time at which
6543 /// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
6544 /// request was received.
6545 ///
6546 /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]: crate::client::InstanceAdmin::update_instance_partition
6547 pub start_time: std::option::Option<wkt::Timestamp>,
6548
6549 /// The time at which this operation was cancelled. If set, this operation is
6550 /// in the process of undoing itself (which is guaranteed to succeed) and
6551 /// cannot be cancelled again.
6552 pub cancel_time: std::option::Option<wkt::Timestamp>,
6553
6554 /// The time at which this operation failed or was completed successfully.
6555 pub end_time: std::option::Option<wkt::Timestamp>,
6556
6557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6558}
6559
6560impl UpdateInstancePartitionMetadata {
6561 pub fn new() -> Self {
6562 std::default::Default::default()
6563 }
6564
6565 /// Sets the value of [instance_partition][crate::model::UpdateInstancePartitionMetadata::instance_partition].
6566 ///
6567 /// # Example
6568 /// ```ignore,no_run
6569 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6570 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6571 /// let x = UpdateInstancePartitionMetadata::new().set_instance_partition(InstancePartition::default()/* use setters */);
6572 /// ```
6573 pub fn set_instance_partition<T>(mut self, v: T) -> Self
6574 where
6575 T: std::convert::Into<crate::model::InstancePartition>,
6576 {
6577 self.instance_partition = std::option::Option::Some(v.into());
6578 self
6579 }
6580
6581 /// Sets or clears the value of [instance_partition][crate::model::UpdateInstancePartitionMetadata::instance_partition].
6582 ///
6583 /// # Example
6584 /// ```ignore,no_run
6585 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6586 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6587 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_instance_partition(Some(InstancePartition::default()/* use setters */));
6588 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_instance_partition(None::<InstancePartition>);
6589 /// ```
6590 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
6591 where
6592 T: std::convert::Into<crate::model::InstancePartition>,
6593 {
6594 self.instance_partition = v.map(|x| x.into());
6595 self
6596 }
6597
6598 /// Sets the value of [start_time][crate::model::UpdateInstancePartitionMetadata::start_time].
6599 ///
6600 /// # Example
6601 /// ```ignore,no_run
6602 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6603 /// use wkt::Timestamp;
6604 /// let x = UpdateInstancePartitionMetadata::new().set_start_time(Timestamp::default()/* use setters */);
6605 /// ```
6606 pub fn set_start_time<T>(mut self, v: T) -> Self
6607 where
6608 T: std::convert::Into<wkt::Timestamp>,
6609 {
6610 self.start_time = std::option::Option::Some(v.into());
6611 self
6612 }
6613
6614 /// Sets or clears the value of [start_time][crate::model::UpdateInstancePartitionMetadata::start_time].
6615 ///
6616 /// # Example
6617 /// ```ignore,no_run
6618 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6619 /// use wkt::Timestamp;
6620 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
6621 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_start_time(None::<Timestamp>);
6622 /// ```
6623 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6624 where
6625 T: std::convert::Into<wkt::Timestamp>,
6626 {
6627 self.start_time = v.map(|x| x.into());
6628 self
6629 }
6630
6631 /// Sets the value of [cancel_time][crate::model::UpdateInstancePartitionMetadata::cancel_time].
6632 ///
6633 /// # Example
6634 /// ```ignore,no_run
6635 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6636 /// use wkt::Timestamp;
6637 /// let x = UpdateInstancePartitionMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
6638 /// ```
6639 pub fn set_cancel_time<T>(mut self, v: T) -> Self
6640 where
6641 T: std::convert::Into<wkt::Timestamp>,
6642 {
6643 self.cancel_time = std::option::Option::Some(v.into());
6644 self
6645 }
6646
6647 /// Sets or clears the value of [cancel_time][crate::model::UpdateInstancePartitionMetadata::cancel_time].
6648 ///
6649 /// # Example
6650 /// ```ignore,no_run
6651 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6652 /// use wkt::Timestamp;
6653 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
6654 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
6655 /// ```
6656 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
6657 where
6658 T: std::convert::Into<wkt::Timestamp>,
6659 {
6660 self.cancel_time = v.map(|x| x.into());
6661 self
6662 }
6663
6664 /// Sets the value of [end_time][crate::model::UpdateInstancePartitionMetadata::end_time].
6665 ///
6666 /// # Example
6667 /// ```ignore,no_run
6668 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6669 /// use wkt::Timestamp;
6670 /// let x = UpdateInstancePartitionMetadata::new().set_end_time(Timestamp::default()/* use setters */);
6671 /// ```
6672 pub fn set_end_time<T>(mut self, v: T) -> Self
6673 where
6674 T: std::convert::Into<wkt::Timestamp>,
6675 {
6676 self.end_time = std::option::Option::Some(v.into());
6677 self
6678 }
6679
6680 /// Sets or clears the value of [end_time][crate::model::UpdateInstancePartitionMetadata::end_time].
6681 ///
6682 /// # Example
6683 /// ```ignore,no_run
6684 /// # use google_cloud_spanner_admin_instance_v1::model::UpdateInstancePartitionMetadata;
6685 /// use wkt::Timestamp;
6686 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
6687 /// let x = UpdateInstancePartitionMetadata::new().set_or_clear_end_time(None::<Timestamp>);
6688 /// ```
6689 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
6690 where
6691 T: std::convert::Into<wkt::Timestamp>,
6692 {
6693 self.end_time = v.map(|x| x.into());
6694 self
6695 }
6696}
6697
6698impl wkt::message::Message for UpdateInstancePartitionMetadata {
6699 fn typename() -> &'static str {
6700 "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata"
6701 }
6702}
6703
6704/// The request for
6705/// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
6706///
6707/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]: crate::client::InstanceAdmin::list_instance_partitions
6708#[derive(Clone, Default, PartialEq)]
6709#[non_exhaustive]
6710pub struct ListInstancePartitionsRequest {
6711 /// Required. The instance whose instance partitions should be listed. Values
6712 /// are of the form `projects/<project>/instances/<instance>`. Use `{instance}
6713 /// = '-'` to list instance partitions for all Instances in a project, e.g.,
6714 /// `projects/myproject/instances/-`.
6715 pub parent: std::string::String,
6716
6717 /// Number of instance partitions to be returned in the response. If 0 or less,
6718 /// defaults to the server's maximum allowed page size.
6719 pub page_size: i32,
6720
6721 /// If non-empty, `page_token` should contain a
6722 /// [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
6723 /// from a previous
6724 /// [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
6725 ///
6726 /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse]: crate::model::ListInstancePartitionsResponse
6727 /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]: crate::model::ListInstancePartitionsResponse::next_page_token
6728 pub page_token: std::string::String,
6729
6730 /// Optional. Deadline used while retrieving metadata for instance partitions.
6731 /// Instance partitions whose metadata cannot be retrieved within this deadline
6732 /// will be added to
6733 /// [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
6734 /// in
6735 /// [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
6736 ///
6737 /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse]: crate::model::ListInstancePartitionsResponse
6738 /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]: crate::model::ListInstancePartitionsResponse::unreachable
6739 pub instance_partition_deadline: std::option::Option<wkt::Timestamp>,
6740
6741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6742}
6743
6744impl ListInstancePartitionsRequest {
6745 pub fn new() -> Self {
6746 std::default::Default::default()
6747 }
6748
6749 /// Sets the value of [parent][crate::model::ListInstancePartitionsRequest::parent].
6750 ///
6751 /// # Example
6752 /// ```ignore,no_run
6753 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6754 /// let x = ListInstancePartitionsRequest::new().set_parent("example");
6755 /// ```
6756 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6757 self.parent = v.into();
6758 self
6759 }
6760
6761 /// Sets the value of [page_size][crate::model::ListInstancePartitionsRequest::page_size].
6762 ///
6763 /// # Example
6764 /// ```ignore,no_run
6765 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6766 /// let x = ListInstancePartitionsRequest::new().set_page_size(42);
6767 /// ```
6768 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6769 self.page_size = v.into();
6770 self
6771 }
6772
6773 /// Sets the value of [page_token][crate::model::ListInstancePartitionsRequest::page_token].
6774 ///
6775 /// # Example
6776 /// ```ignore,no_run
6777 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6778 /// let x = ListInstancePartitionsRequest::new().set_page_token("example");
6779 /// ```
6780 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6781 self.page_token = v.into();
6782 self
6783 }
6784
6785 /// Sets the value of [instance_partition_deadline][crate::model::ListInstancePartitionsRequest::instance_partition_deadline].
6786 ///
6787 /// # Example
6788 /// ```ignore,no_run
6789 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6790 /// use wkt::Timestamp;
6791 /// let x = ListInstancePartitionsRequest::new().set_instance_partition_deadline(Timestamp::default()/* use setters */);
6792 /// ```
6793 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
6794 where
6795 T: std::convert::Into<wkt::Timestamp>,
6796 {
6797 self.instance_partition_deadline = std::option::Option::Some(v.into());
6798 self
6799 }
6800
6801 /// Sets or clears the value of [instance_partition_deadline][crate::model::ListInstancePartitionsRequest::instance_partition_deadline].
6802 ///
6803 /// # Example
6804 /// ```ignore,no_run
6805 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsRequest;
6806 /// use wkt::Timestamp;
6807 /// let x = ListInstancePartitionsRequest::new().set_or_clear_instance_partition_deadline(Some(Timestamp::default()/* use setters */));
6808 /// let x = ListInstancePartitionsRequest::new().set_or_clear_instance_partition_deadline(None::<Timestamp>);
6809 /// ```
6810 pub fn set_or_clear_instance_partition_deadline<T>(mut self, v: std::option::Option<T>) -> Self
6811 where
6812 T: std::convert::Into<wkt::Timestamp>,
6813 {
6814 self.instance_partition_deadline = v.map(|x| x.into());
6815 self
6816 }
6817}
6818
6819impl wkt::message::Message for ListInstancePartitionsRequest {
6820 fn typename() -> &'static str {
6821 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionsRequest"
6822 }
6823}
6824
6825/// The response for
6826/// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
6827///
6828/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]: crate::client::InstanceAdmin::list_instance_partitions
6829#[derive(Clone, Default, PartialEq)]
6830#[non_exhaustive]
6831pub struct ListInstancePartitionsResponse {
6832 /// The list of requested instancePartitions.
6833 pub instance_partitions: std::vec::Vec<crate::model::InstancePartition>,
6834
6835 /// `next_page_token` can be sent in a subsequent
6836 /// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
6837 /// call to fetch more of the matching instance partitions.
6838 ///
6839 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]: crate::client::InstanceAdmin::list_instance_partitions
6840 pub next_page_token: std::string::String,
6841
6842 /// The list of unreachable instances or instance partitions.
6843 /// It includes the names of instances or instance partitions whose metadata
6844 /// could not be retrieved within
6845 /// [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
6846 ///
6847 /// [google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]: crate::model::ListInstancePartitionsRequest::instance_partition_deadline
6848 pub unreachable: std::vec::Vec<std::string::String>,
6849
6850 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6851}
6852
6853impl ListInstancePartitionsResponse {
6854 pub fn new() -> Self {
6855 std::default::Default::default()
6856 }
6857
6858 /// Sets the value of [instance_partitions][crate::model::ListInstancePartitionsResponse::instance_partitions].
6859 ///
6860 /// # Example
6861 /// ```ignore,no_run
6862 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsResponse;
6863 /// use google_cloud_spanner_admin_instance_v1::model::InstancePartition;
6864 /// let x = ListInstancePartitionsResponse::new()
6865 /// .set_instance_partitions([
6866 /// InstancePartition::default()/* use setters */,
6867 /// InstancePartition::default()/* use (different) setters */,
6868 /// ]);
6869 /// ```
6870 pub fn set_instance_partitions<T, V>(mut self, v: T) -> Self
6871 where
6872 T: std::iter::IntoIterator<Item = V>,
6873 V: std::convert::Into<crate::model::InstancePartition>,
6874 {
6875 use std::iter::Iterator;
6876 self.instance_partitions = v.into_iter().map(|i| i.into()).collect();
6877 self
6878 }
6879
6880 /// Sets the value of [next_page_token][crate::model::ListInstancePartitionsResponse::next_page_token].
6881 ///
6882 /// # Example
6883 /// ```ignore,no_run
6884 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsResponse;
6885 /// let x = ListInstancePartitionsResponse::new().set_next_page_token("example");
6886 /// ```
6887 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6888 self.next_page_token = v.into();
6889 self
6890 }
6891
6892 /// Sets the value of [unreachable][crate::model::ListInstancePartitionsResponse::unreachable].
6893 ///
6894 /// # Example
6895 /// ```ignore,no_run
6896 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionsResponse;
6897 /// let x = ListInstancePartitionsResponse::new().set_unreachable(["a", "b", "c"]);
6898 /// ```
6899 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6900 where
6901 T: std::iter::IntoIterator<Item = V>,
6902 V: std::convert::Into<std::string::String>,
6903 {
6904 use std::iter::Iterator;
6905 self.unreachable = v.into_iter().map(|i| i.into()).collect();
6906 self
6907 }
6908}
6909
6910impl wkt::message::Message for ListInstancePartitionsResponse {
6911 fn typename() -> &'static str {
6912 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionsResponse"
6913 }
6914}
6915
6916#[doc(hidden)]
6917impl gax::paginator::internal::PageableResponse for ListInstancePartitionsResponse {
6918 type PageItem = crate::model::InstancePartition;
6919
6920 fn items(self) -> std::vec::Vec<Self::PageItem> {
6921 self.instance_partitions
6922 }
6923
6924 fn next_page_token(&self) -> std::string::String {
6925 use std::clone::Clone;
6926 self.next_page_token.clone()
6927 }
6928}
6929
6930/// The request for
6931/// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
6932///
6933/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]: crate::client::InstanceAdmin::list_instance_partition_operations
6934#[derive(Clone, Default, PartialEq)]
6935#[non_exhaustive]
6936pub struct ListInstancePartitionOperationsRequest {
6937 /// Required. The parent instance of the instance partition operations.
6938 /// Values are of the form `projects/<project>/instances/<instance>`.
6939 pub parent: std::string::String,
6940
6941 /// Optional. An expression that filters the list of returned operations.
6942 ///
6943 /// A filter expression consists of a field name, a
6944 /// comparison operator, and a value for filtering.
6945 /// The value must be a string, a number, or a boolean. The comparison operator
6946 /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
6947 /// Colon `:` is the contains operator. Filter rules are not case sensitive.
6948 ///
6949 /// The following fields in the Operation are eligible for filtering:
6950 ///
6951 /// * `name` - The name of the long-running operation
6952 /// * `done` - False if the operation is in progress, else true.
6953 /// * `metadata.@type` - the type of metadata. For example, the type string
6954 /// for
6955 /// [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
6956 /// is
6957 /// `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
6958 /// * `metadata.<field_name>` - any field in metadata.value.
6959 /// `metadata.@type` must be specified first, if filtering on metadata
6960 /// fields.
6961 /// * `error` - Error associated with the long-running operation.
6962 /// * `response.@type` - the type of response.
6963 /// * `response.<field_name>` - any field in response.value.
6964 ///
6965 /// You can combine multiple expressions by enclosing each expression in
6966 /// parentheses. By default, expressions are combined with AND logic. However,
6967 /// you can specify AND, OR, and NOT logic explicitly.
6968 ///
6969 /// Here are a few examples:
6970 ///
6971 /// * `done:true` - The operation is complete.
6972 /// * `(metadata.@type=` \
6973 /// `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
6974 /// AND` \
6975 /// `(metadata.instance_partition.name:custom-instance-partition) AND` \
6976 /// `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
6977 /// `(error:*)` - Return operations where:
6978 /// * The operation's metadata type is
6979 /// [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
6980 /// * The instance partition name contains "custom-instance-partition".
6981 /// * The operation started before 2021-03-28T14:50:00Z.
6982 /// * The operation resulted in an error.
6983 ///
6984 /// [google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]: crate::model::CreateInstancePartitionMetadata
6985 pub filter: std::string::String,
6986
6987 /// Optional. Number of operations to be returned in the response. If 0 or
6988 /// less, defaults to the server's maximum allowed page size.
6989 pub page_size: i32,
6990
6991 /// Optional. If non-empty, `page_token` should contain a
6992 /// [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
6993 /// from a previous
6994 /// [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
6995 /// to the same `parent` and with the same `filter`.
6996 ///
6997 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]: crate::model::ListInstancePartitionOperationsResponse
6998 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]: crate::model::ListInstancePartitionOperationsResponse::next_page_token
6999 pub page_token: std::string::String,
7000
7001 /// Optional. Deadline used while retrieving metadata for instance partition
7002 /// operations. Instance partitions whose operation metadata cannot be
7003 /// retrieved within this deadline will be added to
7004 /// [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions]
7005 /// in
7006 /// [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
7007 ///
7008 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]: crate::model::ListInstancePartitionOperationsResponse
7009 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions]: crate::model::ListInstancePartitionOperationsResponse::unreachable_instance_partitions
7010 pub instance_partition_deadline: std::option::Option<wkt::Timestamp>,
7011
7012 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7013}
7014
7015impl ListInstancePartitionOperationsRequest {
7016 pub fn new() -> Self {
7017 std::default::Default::default()
7018 }
7019
7020 /// Sets the value of [parent][crate::model::ListInstancePartitionOperationsRequest::parent].
7021 ///
7022 /// # Example
7023 /// ```ignore,no_run
7024 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
7025 /// let x = ListInstancePartitionOperationsRequest::new().set_parent("example");
7026 /// ```
7027 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7028 self.parent = v.into();
7029 self
7030 }
7031
7032 /// Sets the value of [filter][crate::model::ListInstancePartitionOperationsRequest::filter].
7033 ///
7034 /// # Example
7035 /// ```ignore,no_run
7036 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
7037 /// let x = ListInstancePartitionOperationsRequest::new().set_filter("example");
7038 /// ```
7039 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7040 self.filter = v.into();
7041 self
7042 }
7043
7044 /// Sets the value of [page_size][crate::model::ListInstancePartitionOperationsRequest::page_size].
7045 ///
7046 /// # Example
7047 /// ```ignore,no_run
7048 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
7049 /// let x = ListInstancePartitionOperationsRequest::new().set_page_size(42);
7050 /// ```
7051 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7052 self.page_size = v.into();
7053 self
7054 }
7055
7056 /// Sets the value of [page_token][crate::model::ListInstancePartitionOperationsRequest::page_token].
7057 ///
7058 /// # Example
7059 /// ```ignore,no_run
7060 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
7061 /// let x = ListInstancePartitionOperationsRequest::new().set_page_token("example");
7062 /// ```
7063 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7064 self.page_token = v.into();
7065 self
7066 }
7067
7068 /// Sets the value of [instance_partition_deadline][crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline].
7069 ///
7070 /// # Example
7071 /// ```ignore,no_run
7072 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
7073 /// use wkt::Timestamp;
7074 /// let x = ListInstancePartitionOperationsRequest::new().set_instance_partition_deadline(Timestamp::default()/* use setters */);
7075 /// ```
7076 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
7077 where
7078 T: std::convert::Into<wkt::Timestamp>,
7079 {
7080 self.instance_partition_deadline = std::option::Option::Some(v.into());
7081 self
7082 }
7083
7084 /// Sets or clears the value of [instance_partition_deadline][crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline].
7085 ///
7086 /// # Example
7087 /// ```ignore,no_run
7088 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsRequest;
7089 /// use wkt::Timestamp;
7090 /// let x = ListInstancePartitionOperationsRequest::new().set_or_clear_instance_partition_deadline(Some(Timestamp::default()/* use setters */));
7091 /// let x = ListInstancePartitionOperationsRequest::new().set_or_clear_instance_partition_deadline(None::<Timestamp>);
7092 /// ```
7093 pub fn set_or_clear_instance_partition_deadline<T>(mut self, v: std::option::Option<T>) -> Self
7094 where
7095 T: std::convert::Into<wkt::Timestamp>,
7096 {
7097 self.instance_partition_deadline = v.map(|x| x.into());
7098 self
7099 }
7100}
7101
7102impl wkt::message::Message for ListInstancePartitionOperationsRequest {
7103 fn typename() -> &'static str {
7104 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest"
7105 }
7106}
7107
7108/// The response for
7109/// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
7110///
7111/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]: crate::client::InstanceAdmin::list_instance_partition_operations
7112#[derive(Clone, Default, PartialEq)]
7113#[non_exhaustive]
7114pub struct ListInstancePartitionOperationsResponse {
7115 /// The list of matching instance partition long-running operations. Each
7116 /// operation's name will be
7117 /// prefixed by the instance partition's name. The operation's
7118 /// metadata field type
7119 /// `metadata.type_url` describes the type of the metadata.
7120 pub operations: std::vec::Vec<longrunning::model::Operation>,
7121
7122 /// `next_page_token` can be sent in a subsequent
7123 /// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
7124 /// call to fetch more of the matching metadata.
7125 ///
7126 /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]: crate::client::InstanceAdmin::list_instance_partition_operations
7127 pub next_page_token: std::string::String,
7128
7129 /// The list of unreachable instance partitions.
7130 /// It includes the names of instance partitions whose operation metadata could
7131 /// not be retrieved within
7132 /// [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
7133 ///
7134 /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]: crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline
7135 pub unreachable_instance_partitions: std::vec::Vec<std::string::String>,
7136
7137 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7138}
7139
7140impl ListInstancePartitionOperationsResponse {
7141 pub fn new() -> Self {
7142 std::default::Default::default()
7143 }
7144
7145 /// Sets the value of [operations][crate::model::ListInstancePartitionOperationsResponse::operations].
7146 ///
7147 /// # Example
7148 /// ```ignore,no_run
7149 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsResponse;
7150 /// use longrunning::model::Operation;
7151 /// let x = ListInstancePartitionOperationsResponse::new()
7152 /// .set_operations([
7153 /// Operation::default()/* use setters */,
7154 /// Operation::default()/* use (different) setters */,
7155 /// ]);
7156 /// ```
7157 pub fn set_operations<T, V>(mut self, v: T) -> Self
7158 where
7159 T: std::iter::IntoIterator<Item = V>,
7160 V: std::convert::Into<longrunning::model::Operation>,
7161 {
7162 use std::iter::Iterator;
7163 self.operations = v.into_iter().map(|i| i.into()).collect();
7164 self
7165 }
7166
7167 /// Sets the value of [next_page_token][crate::model::ListInstancePartitionOperationsResponse::next_page_token].
7168 ///
7169 /// # Example
7170 /// ```ignore,no_run
7171 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsResponse;
7172 /// let x = ListInstancePartitionOperationsResponse::new().set_next_page_token("example");
7173 /// ```
7174 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7175 self.next_page_token = v.into();
7176 self
7177 }
7178
7179 /// Sets the value of [unreachable_instance_partitions][crate::model::ListInstancePartitionOperationsResponse::unreachable_instance_partitions].
7180 ///
7181 /// # Example
7182 /// ```ignore,no_run
7183 /// # use google_cloud_spanner_admin_instance_v1::model::ListInstancePartitionOperationsResponse;
7184 /// let x = ListInstancePartitionOperationsResponse::new().set_unreachable_instance_partitions(["a", "b", "c"]);
7185 /// ```
7186 pub fn set_unreachable_instance_partitions<T, V>(mut self, v: T) -> Self
7187 where
7188 T: std::iter::IntoIterator<Item = V>,
7189 V: std::convert::Into<std::string::String>,
7190 {
7191 use std::iter::Iterator;
7192 self.unreachable_instance_partitions = v.into_iter().map(|i| i.into()).collect();
7193 self
7194 }
7195}
7196
7197impl wkt::message::Message for ListInstancePartitionOperationsResponse {
7198 fn typename() -> &'static str {
7199 "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse"
7200 }
7201}
7202
7203#[doc(hidden)]
7204impl gax::paginator::internal::PageableResponse for ListInstancePartitionOperationsResponse {
7205 type PageItem = longrunning::model::Operation;
7206
7207 fn items(self) -> std::vec::Vec<Self::PageItem> {
7208 self.operations
7209 }
7210
7211 fn next_page_token(&self) -> std::string::String {
7212 use std::clone::Clone;
7213 self.next_page_token.clone()
7214 }
7215}
7216
7217/// The request for
7218/// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
7219///
7220/// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
7221#[derive(Clone, Default, PartialEq)]
7222#[non_exhaustive]
7223pub struct MoveInstanceRequest {
7224 /// Required. The instance to move.
7225 /// Values are of the form `projects/<project>/instances/<instance>`.
7226 pub name: std::string::String,
7227
7228 /// Required. The target instance configuration where to move the instance.
7229 /// Values are of the form `projects/<project>/instanceConfigs/<config>`.
7230 pub target_config: std::string::String,
7231
7232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7233}
7234
7235impl MoveInstanceRequest {
7236 pub fn new() -> Self {
7237 std::default::Default::default()
7238 }
7239
7240 /// Sets the value of [name][crate::model::MoveInstanceRequest::name].
7241 ///
7242 /// # Example
7243 /// ```ignore,no_run
7244 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceRequest;
7245 /// let x = MoveInstanceRequest::new().set_name("example");
7246 /// ```
7247 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7248 self.name = v.into();
7249 self
7250 }
7251
7252 /// Sets the value of [target_config][crate::model::MoveInstanceRequest::target_config].
7253 ///
7254 /// # Example
7255 /// ```ignore,no_run
7256 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceRequest;
7257 /// let x = MoveInstanceRequest::new().set_target_config("example");
7258 /// ```
7259 pub fn set_target_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7260 self.target_config = v.into();
7261 self
7262 }
7263}
7264
7265impl wkt::message::Message for MoveInstanceRequest {
7266 fn typename() -> &'static str {
7267 "type.googleapis.com/google.spanner.admin.instance.v1.MoveInstanceRequest"
7268 }
7269}
7270
7271/// The response for
7272/// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
7273///
7274/// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
7275#[derive(Clone, Default, PartialEq)]
7276#[non_exhaustive]
7277pub struct MoveInstanceResponse {
7278 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7279}
7280
7281impl MoveInstanceResponse {
7282 pub fn new() -> Self {
7283 std::default::Default::default()
7284 }
7285}
7286
7287impl wkt::message::Message for MoveInstanceResponse {
7288 fn typename() -> &'static str {
7289 "type.googleapis.com/google.spanner.admin.instance.v1.MoveInstanceResponse"
7290 }
7291}
7292
7293/// Metadata type for the operation returned by
7294/// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
7295///
7296/// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
7297#[derive(Clone, Default, PartialEq)]
7298#[non_exhaustive]
7299pub struct MoveInstanceMetadata {
7300 /// The target instance configuration where to move the instance.
7301 /// Values are of the form `projects/<project>/instanceConfigs/<config>`.
7302 pub target_config: std::string::String,
7303
7304 /// The progress of the
7305 /// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]
7306 /// operation.
7307 /// [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent]
7308 /// is reset when cancellation is requested.
7309 ///
7310 /// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
7311 /// [google.spanner.admin.instance.v1.OperationProgress.progress_percent]: crate::model::OperationProgress::progress_percent
7312 pub progress: std::option::Option<crate::model::OperationProgress>,
7313
7314 /// The time at which this operation was cancelled.
7315 pub cancel_time: std::option::Option<wkt::Timestamp>,
7316
7317 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7318}
7319
7320impl MoveInstanceMetadata {
7321 pub fn new() -> Self {
7322 std::default::Default::default()
7323 }
7324
7325 /// Sets the value of [target_config][crate::model::MoveInstanceMetadata::target_config].
7326 ///
7327 /// # Example
7328 /// ```ignore,no_run
7329 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7330 /// let x = MoveInstanceMetadata::new().set_target_config("example");
7331 /// ```
7332 pub fn set_target_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7333 self.target_config = v.into();
7334 self
7335 }
7336
7337 /// Sets the value of [progress][crate::model::MoveInstanceMetadata::progress].
7338 ///
7339 /// # Example
7340 /// ```ignore,no_run
7341 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7342 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
7343 /// let x = MoveInstanceMetadata::new().set_progress(OperationProgress::default()/* use setters */);
7344 /// ```
7345 pub fn set_progress<T>(mut self, v: T) -> Self
7346 where
7347 T: std::convert::Into<crate::model::OperationProgress>,
7348 {
7349 self.progress = std::option::Option::Some(v.into());
7350 self
7351 }
7352
7353 /// Sets or clears the value of [progress][crate::model::MoveInstanceMetadata::progress].
7354 ///
7355 /// # Example
7356 /// ```ignore,no_run
7357 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7358 /// use google_cloud_spanner_admin_instance_v1::model::OperationProgress;
7359 /// let x = MoveInstanceMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
7360 /// let x = MoveInstanceMetadata::new().set_or_clear_progress(None::<OperationProgress>);
7361 /// ```
7362 pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
7363 where
7364 T: std::convert::Into<crate::model::OperationProgress>,
7365 {
7366 self.progress = v.map(|x| x.into());
7367 self
7368 }
7369
7370 /// Sets the value of [cancel_time][crate::model::MoveInstanceMetadata::cancel_time].
7371 ///
7372 /// # Example
7373 /// ```ignore,no_run
7374 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7375 /// use wkt::Timestamp;
7376 /// let x = MoveInstanceMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
7377 /// ```
7378 pub fn set_cancel_time<T>(mut self, v: T) -> Self
7379 where
7380 T: std::convert::Into<wkt::Timestamp>,
7381 {
7382 self.cancel_time = std::option::Option::Some(v.into());
7383 self
7384 }
7385
7386 /// Sets or clears the value of [cancel_time][crate::model::MoveInstanceMetadata::cancel_time].
7387 ///
7388 /// # Example
7389 /// ```ignore,no_run
7390 /// # use google_cloud_spanner_admin_instance_v1::model::MoveInstanceMetadata;
7391 /// use wkt::Timestamp;
7392 /// let x = MoveInstanceMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
7393 /// let x = MoveInstanceMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
7394 /// ```
7395 pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
7396 where
7397 T: std::convert::Into<wkt::Timestamp>,
7398 {
7399 self.cancel_time = v.map(|x| x.into());
7400 self
7401 }
7402}
7403
7404impl wkt::message::Message for MoveInstanceMetadata {
7405 fn typename() -> &'static str {
7406 "type.googleapis.com/google.spanner.admin.instance.v1.MoveInstanceMetadata"
7407 }
7408}
7409
7410/// Indicates the expected fulfillment period of an operation.
7411///
7412/// # Working with unknown values
7413///
7414/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7415/// additional enum variants at any time. Adding new variants is not considered
7416/// a breaking change. Applications should write their code in anticipation of:
7417///
7418/// - New values appearing in future releases of the client library, **and**
7419/// - New values received dynamically, without application changes.
7420///
7421/// Please consult the [Working with enums] section in the user guide for some
7422/// guidelines.
7423///
7424/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7425#[derive(Clone, Debug, PartialEq)]
7426#[non_exhaustive]
7427pub enum FulfillmentPeriod {
7428 /// Not specified.
7429 Unspecified,
7430 /// Normal fulfillment period. The operation is expected to complete within
7431 /// minutes.
7432 Normal,
7433 /// Extended fulfillment period. It can take up to an hour for the operation
7434 /// to complete.
7435 Extended,
7436 /// If set, the enum was initialized with an unknown value.
7437 ///
7438 /// Applications can examine the value using [FulfillmentPeriod::value] or
7439 /// [FulfillmentPeriod::name].
7440 UnknownValue(fulfillment_period::UnknownValue),
7441}
7442
7443#[doc(hidden)]
7444pub mod fulfillment_period {
7445 #[allow(unused_imports)]
7446 use super::*;
7447 #[derive(Clone, Debug, PartialEq)]
7448 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7449}
7450
7451impl FulfillmentPeriod {
7452 /// Gets the enum value.
7453 ///
7454 /// Returns `None` if the enum contains an unknown value deserialized from
7455 /// the string representation of enums.
7456 pub fn value(&self) -> std::option::Option<i32> {
7457 match self {
7458 Self::Unspecified => std::option::Option::Some(0),
7459 Self::Normal => std::option::Option::Some(1),
7460 Self::Extended => std::option::Option::Some(2),
7461 Self::UnknownValue(u) => u.0.value(),
7462 }
7463 }
7464
7465 /// Gets the enum value as a string.
7466 ///
7467 /// Returns `None` if the enum contains an unknown value deserialized from
7468 /// the integer representation of enums.
7469 pub fn name(&self) -> std::option::Option<&str> {
7470 match self {
7471 Self::Unspecified => std::option::Option::Some("FULFILLMENT_PERIOD_UNSPECIFIED"),
7472 Self::Normal => std::option::Option::Some("FULFILLMENT_PERIOD_NORMAL"),
7473 Self::Extended => std::option::Option::Some("FULFILLMENT_PERIOD_EXTENDED"),
7474 Self::UnknownValue(u) => u.0.name(),
7475 }
7476 }
7477}
7478
7479impl std::default::Default for FulfillmentPeriod {
7480 fn default() -> Self {
7481 use std::convert::From;
7482 Self::from(0)
7483 }
7484}
7485
7486impl std::fmt::Display for FulfillmentPeriod {
7487 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7488 wkt::internal::display_enum(f, self.name(), self.value())
7489 }
7490}
7491
7492impl std::convert::From<i32> for FulfillmentPeriod {
7493 fn from(value: i32) -> Self {
7494 match value {
7495 0 => Self::Unspecified,
7496 1 => Self::Normal,
7497 2 => Self::Extended,
7498 _ => Self::UnknownValue(fulfillment_period::UnknownValue(
7499 wkt::internal::UnknownEnumValue::Integer(value),
7500 )),
7501 }
7502 }
7503}
7504
7505impl std::convert::From<&str> for FulfillmentPeriod {
7506 fn from(value: &str) -> Self {
7507 use std::string::ToString;
7508 match value {
7509 "FULFILLMENT_PERIOD_UNSPECIFIED" => Self::Unspecified,
7510 "FULFILLMENT_PERIOD_NORMAL" => Self::Normal,
7511 "FULFILLMENT_PERIOD_EXTENDED" => Self::Extended,
7512 _ => Self::UnknownValue(fulfillment_period::UnknownValue(
7513 wkt::internal::UnknownEnumValue::String(value.to_string()),
7514 )),
7515 }
7516 }
7517}
7518
7519impl serde::ser::Serialize for FulfillmentPeriod {
7520 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7521 where
7522 S: serde::Serializer,
7523 {
7524 match self {
7525 Self::Unspecified => serializer.serialize_i32(0),
7526 Self::Normal => serializer.serialize_i32(1),
7527 Self::Extended => serializer.serialize_i32(2),
7528 Self::UnknownValue(u) => u.0.serialize(serializer),
7529 }
7530 }
7531}
7532
7533impl<'de> serde::de::Deserialize<'de> for FulfillmentPeriod {
7534 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7535 where
7536 D: serde::Deserializer<'de>,
7537 {
7538 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FulfillmentPeriod>::new(
7539 ".google.spanner.admin.instance.v1.FulfillmentPeriod",
7540 ))
7541 }
7542}