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