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