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