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