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