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