google_cloud_tpu_v2/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_rpc;
28extern crate google_cloud_type;
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/// A guest attributes.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct GuestAttributes {
44 /// The path to be queried. This can be the default namespace ('/') or a
45 /// nested namespace ('/\<namespace\>/') or a specified key
46 /// ('/\<namespace\>/\<key\>')
47 pub query_path: std::string::String,
48
49 /// The value of the requested queried path.
50 pub query_value: std::option::Option<crate::model::GuestAttributesValue>,
51
52 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
53}
54
55impl GuestAttributes {
56 pub fn new() -> Self {
57 std::default::Default::default()
58 }
59
60 /// Sets the value of [query_path][crate::model::GuestAttributes::query_path].
61 ///
62 /// # Example
63 /// ```ignore,no_run
64 /// # use google_cloud_tpu_v2::model::GuestAttributes;
65 /// let x = GuestAttributes::new().set_query_path("example");
66 /// ```
67 pub fn set_query_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
68 self.query_path = v.into();
69 self
70 }
71
72 /// Sets the value of [query_value][crate::model::GuestAttributes::query_value].
73 ///
74 /// # Example
75 /// ```ignore,no_run
76 /// # use google_cloud_tpu_v2::model::GuestAttributes;
77 /// use google_cloud_tpu_v2::model::GuestAttributesValue;
78 /// let x = GuestAttributes::new().set_query_value(GuestAttributesValue::default()/* use setters */);
79 /// ```
80 pub fn set_query_value<T>(mut self, v: T) -> Self
81 where
82 T: std::convert::Into<crate::model::GuestAttributesValue>,
83 {
84 self.query_value = std::option::Option::Some(v.into());
85 self
86 }
87
88 /// Sets or clears the value of [query_value][crate::model::GuestAttributes::query_value].
89 ///
90 /// # Example
91 /// ```ignore,no_run
92 /// # use google_cloud_tpu_v2::model::GuestAttributes;
93 /// use google_cloud_tpu_v2::model::GuestAttributesValue;
94 /// let x = GuestAttributes::new().set_or_clear_query_value(Some(GuestAttributesValue::default()/* use setters */));
95 /// let x = GuestAttributes::new().set_or_clear_query_value(None::<GuestAttributesValue>);
96 /// ```
97 pub fn set_or_clear_query_value<T>(mut self, v: std::option::Option<T>) -> Self
98 where
99 T: std::convert::Into<crate::model::GuestAttributesValue>,
100 {
101 self.query_value = v.map(|x| x.into());
102 self
103 }
104}
105
106impl wkt::message::Message for GuestAttributes {
107 fn typename() -> &'static str {
108 "type.googleapis.com/google.cloud.tpu.v2.GuestAttributes"
109 }
110}
111
112/// Array of guest attribute namespace/key/value tuples.
113#[derive(Clone, Default, PartialEq)]
114#[non_exhaustive]
115pub struct GuestAttributesValue {
116 /// The list of guest attributes entries.
117 pub items: std::vec::Vec<crate::model::GuestAttributesEntry>,
118
119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
120}
121
122impl GuestAttributesValue {
123 pub fn new() -> Self {
124 std::default::Default::default()
125 }
126
127 /// Sets the value of [items][crate::model::GuestAttributesValue::items].
128 ///
129 /// # Example
130 /// ```ignore,no_run
131 /// # use google_cloud_tpu_v2::model::GuestAttributesValue;
132 /// use google_cloud_tpu_v2::model::GuestAttributesEntry;
133 /// let x = GuestAttributesValue::new()
134 /// .set_items([
135 /// GuestAttributesEntry::default()/* use setters */,
136 /// GuestAttributesEntry::default()/* use (different) setters */,
137 /// ]);
138 /// ```
139 pub fn set_items<T, V>(mut self, v: T) -> Self
140 where
141 T: std::iter::IntoIterator<Item = V>,
142 V: std::convert::Into<crate::model::GuestAttributesEntry>,
143 {
144 use std::iter::Iterator;
145 self.items = v.into_iter().map(|i| i.into()).collect();
146 self
147 }
148}
149
150impl wkt::message::Message for GuestAttributesValue {
151 fn typename() -> &'static str {
152 "type.googleapis.com/google.cloud.tpu.v2.GuestAttributesValue"
153 }
154}
155
156/// A guest attributes namespace/key/value entry.
157#[derive(Clone, Default, PartialEq)]
158#[non_exhaustive]
159pub struct GuestAttributesEntry {
160 /// Namespace for the guest attribute entry.
161 pub namespace: std::string::String,
162
163 /// Key for the guest attribute entry.
164 pub key: std::string::String,
165
166 /// Value for the guest attribute entry.
167 pub value: std::string::String,
168
169 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
170}
171
172impl GuestAttributesEntry {
173 pub fn new() -> Self {
174 std::default::Default::default()
175 }
176
177 /// Sets the value of [namespace][crate::model::GuestAttributesEntry::namespace].
178 ///
179 /// # Example
180 /// ```ignore,no_run
181 /// # use google_cloud_tpu_v2::model::GuestAttributesEntry;
182 /// let x = GuestAttributesEntry::new().set_namespace("example");
183 /// ```
184 pub fn set_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
185 self.namespace = v.into();
186 self
187 }
188
189 /// Sets the value of [key][crate::model::GuestAttributesEntry::key].
190 ///
191 /// # Example
192 /// ```ignore,no_run
193 /// # use google_cloud_tpu_v2::model::GuestAttributesEntry;
194 /// let x = GuestAttributesEntry::new().set_key("example");
195 /// ```
196 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
197 self.key = v.into();
198 self
199 }
200
201 /// Sets the value of [value][crate::model::GuestAttributesEntry::value].
202 ///
203 /// # Example
204 /// ```ignore,no_run
205 /// # use google_cloud_tpu_v2::model::GuestAttributesEntry;
206 /// let x = GuestAttributesEntry::new().set_value("example");
207 /// ```
208 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
209 self.value = v.into();
210 self
211 }
212}
213
214impl wkt::message::Message for GuestAttributesEntry {
215 fn typename() -> &'static str {
216 "type.googleapis.com/google.cloud.tpu.v2.GuestAttributesEntry"
217 }
218}
219
220/// A node-attached disk resource.
221/// Next ID: 8;
222#[derive(Clone, Default, PartialEq)]
223#[non_exhaustive]
224pub struct AttachedDisk {
225 /// Specifies the full path to an existing disk.
226 /// For example: "projects/my-project/zones/us-central1-c/disks/my-disk".
227 pub source_disk: std::string::String,
228
229 /// The mode in which to attach this disk.
230 /// If not specified, the default is READ_WRITE mode.
231 /// Only applicable to data_disks.
232 pub mode: crate::model::attached_disk::DiskMode,
233
234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
235}
236
237impl AttachedDisk {
238 pub fn new() -> Self {
239 std::default::Default::default()
240 }
241
242 /// Sets the value of [source_disk][crate::model::AttachedDisk::source_disk].
243 ///
244 /// # Example
245 /// ```ignore,no_run
246 /// # use google_cloud_tpu_v2::model::AttachedDisk;
247 /// let x = AttachedDisk::new().set_source_disk("example");
248 /// ```
249 pub fn set_source_disk<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
250 self.source_disk = v.into();
251 self
252 }
253
254 /// Sets the value of [mode][crate::model::AttachedDisk::mode].
255 ///
256 /// # Example
257 /// ```ignore,no_run
258 /// # use google_cloud_tpu_v2::model::AttachedDisk;
259 /// use google_cloud_tpu_v2::model::attached_disk::DiskMode;
260 /// let x0 = AttachedDisk::new().set_mode(DiskMode::ReadWrite);
261 /// let x1 = AttachedDisk::new().set_mode(DiskMode::ReadOnly);
262 /// ```
263 pub fn set_mode<T: std::convert::Into<crate::model::attached_disk::DiskMode>>(
264 mut self,
265 v: T,
266 ) -> Self {
267 self.mode = v.into();
268 self
269 }
270}
271
272impl wkt::message::Message for AttachedDisk {
273 fn typename() -> &'static str {
274 "type.googleapis.com/google.cloud.tpu.v2.AttachedDisk"
275 }
276}
277
278/// Defines additional types related to [AttachedDisk].
279pub mod attached_disk {
280 #[allow(unused_imports)]
281 use super::*;
282
283 /// The different mode of the attached disk.
284 ///
285 /// # Working with unknown values
286 ///
287 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
288 /// additional enum variants at any time. Adding new variants is not considered
289 /// a breaking change. Applications should write their code in anticipation of:
290 ///
291 /// - New values appearing in future releases of the client library, **and**
292 /// - New values received dynamically, without application changes.
293 ///
294 /// Please consult the [Working with enums] section in the user guide for some
295 /// guidelines.
296 ///
297 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
298 #[derive(Clone, Debug, PartialEq)]
299 #[non_exhaustive]
300 pub enum DiskMode {
301 /// The disk mode is not known/set.
302 Unspecified,
303 /// Attaches the disk in read-write mode. Only one TPU node can attach a disk
304 /// in read-write mode at a time.
305 ReadWrite,
306 /// Attaches the disk in read-only mode. Multiple TPU nodes can attach
307 /// a disk in read-only mode at a time.
308 ReadOnly,
309 /// If set, the enum was initialized with an unknown value.
310 ///
311 /// Applications can examine the value using [DiskMode::value] or
312 /// [DiskMode::name].
313 UnknownValue(disk_mode::UnknownValue),
314 }
315
316 #[doc(hidden)]
317 pub mod disk_mode {
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 DiskMode {
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::Unspecified => std::option::Option::Some(0),
332 Self::ReadWrite => std::option::Option::Some(1),
333 Self::ReadOnly => std::option::Option::Some(2),
334 Self::UnknownValue(u) => u.0.value(),
335 }
336 }
337
338 /// Gets the enum value as a string.
339 ///
340 /// Returns `None` if the enum contains an unknown value deserialized from
341 /// the integer representation of enums.
342 pub fn name(&self) -> std::option::Option<&str> {
343 match self {
344 Self::Unspecified => std::option::Option::Some("DISK_MODE_UNSPECIFIED"),
345 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
346 Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
347 Self::UnknownValue(u) => u.0.name(),
348 }
349 }
350 }
351
352 impl std::default::Default for DiskMode {
353 fn default() -> Self {
354 use std::convert::From;
355 Self::from(0)
356 }
357 }
358
359 impl std::fmt::Display for DiskMode {
360 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
361 wkt::internal::display_enum(f, self.name(), self.value())
362 }
363 }
364
365 impl std::convert::From<i32> for DiskMode {
366 fn from(value: i32) -> Self {
367 match value {
368 0 => Self::Unspecified,
369 1 => Self::ReadWrite,
370 2 => Self::ReadOnly,
371 _ => Self::UnknownValue(disk_mode::UnknownValue(
372 wkt::internal::UnknownEnumValue::Integer(value),
373 )),
374 }
375 }
376 }
377
378 impl std::convert::From<&str> for DiskMode {
379 fn from(value: &str) -> Self {
380 use std::string::ToString;
381 match value {
382 "DISK_MODE_UNSPECIFIED" => Self::Unspecified,
383 "READ_WRITE" => Self::ReadWrite,
384 "READ_ONLY" => Self::ReadOnly,
385 _ => Self::UnknownValue(disk_mode::UnknownValue(
386 wkt::internal::UnknownEnumValue::String(value.to_string()),
387 )),
388 }
389 }
390 }
391
392 impl serde::ser::Serialize for DiskMode {
393 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
394 where
395 S: serde::Serializer,
396 {
397 match self {
398 Self::Unspecified => serializer.serialize_i32(0),
399 Self::ReadWrite => serializer.serialize_i32(1),
400 Self::ReadOnly => serializer.serialize_i32(2),
401 Self::UnknownValue(u) => u.0.serialize(serializer),
402 }
403 }
404 }
405
406 impl<'de> serde::de::Deserialize<'de> for DiskMode {
407 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
408 where
409 D: serde::Deserializer<'de>,
410 {
411 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiskMode>::new(
412 ".google.cloud.tpu.v2.AttachedDisk.DiskMode",
413 ))
414 }
415 }
416}
417
418/// Sets the scheduling options for this node.
419#[derive(Clone, Default, PartialEq)]
420#[non_exhaustive]
421pub struct SchedulingConfig {
422 /// Defines whether the node is preemptible.
423 pub preemptible: bool,
424
425 /// Whether the node is created under a reservation.
426 pub reserved: bool,
427
428 /// Optional. Defines whether the node is Spot VM.
429 pub spot: bool,
430
431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
432}
433
434impl SchedulingConfig {
435 pub fn new() -> Self {
436 std::default::Default::default()
437 }
438
439 /// Sets the value of [preemptible][crate::model::SchedulingConfig::preemptible].
440 ///
441 /// # Example
442 /// ```ignore,no_run
443 /// # use google_cloud_tpu_v2::model::SchedulingConfig;
444 /// let x = SchedulingConfig::new().set_preemptible(true);
445 /// ```
446 pub fn set_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
447 self.preemptible = v.into();
448 self
449 }
450
451 /// Sets the value of [reserved][crate::model::SchedulingConfig::reserved].
452 ///
453 /// # Example
454 /// ```ignore,no_run
455 /// # use google_cloud_tpu_v2::model::SchedulingConfig;
456 /// let x = SchedulingConfig::new().set_reserved(true);
457 /// ```
458 pub fn set_reserved<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
459 self.reserved = v.into();
460 self
461 }
462
463 /// Sets the value of [spot][crate::model::SchedulingConfig::spot].
464 ///
465 /// # Example
466 /// ```ignore,no_run
467 /// # use google_cloud_tpu_v2::model::SchedulingConfig;
468 /// let x = SchedulingConfig::new().set_spot(true);
469 /// ```
470 pub fn set_spot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
471 self.spot = v.into();
472 self
473 }
474}
475
476impl wkt::message::Message for SchedulingConfig {
477 fn typename() -> &'static str {
478 "type.googleapis.com/google.cloud.tpu.v2.SchedulingConfig"
479 }
480}
481
482/// A network endpoint over which a TPU worker can be reached.
483#[derive(Clone, Default, PartialEq)]
484#[non_exhaustive]
485pub struct NetworkEndpoint {
486 /// The internal IP address of this network endpoint.
487 pub ip_address: std::string::String,
488
489 /// The port of this network endpoint.
490 pub port: i32,
491
492 /// The access config for the TPU worker.
493 pub access_config: std::option::Option<crate::model::AccessConfig>,
494
495 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
496}
497
498impl NetworkEndpoint {
499 pub fn new() -> Self {
500 std::default::Default::default()
501 }
502
503 /// Sets the value of [ip_address][crate::model::NetworkEndpoint::ip_address].
504 ///
505 /// # Example
506 /// ```ignore,no_run
507 /// # use google_cloud_tpu_v2::model::NetworkEndpoint;
508 /// let x = NetworkEndpoint::new().set_ip_address("example");
509 /// ```
510 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
511 self.ip_address = v.into();
512 self
513 }
514
515 /// Sets the value of [port][crate::model::NetworkEndpoint::port].
516 ///
517 /// # Example
518 /// ```ignore,no_run
519 /// # use google_cloud_tpu_v2::model::NetworkEndpoint;
520 /// let x = NetworkEndpoint::new().set_port(42);
521 /// ```
522 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
523 self.port = v.into();
524 self
525 }
526
527 /// Sets the value of [access_config][crate::model::NetworkEndpoint::access_config].
528 ///
529 /// # Example
530 /// ```ignore,no_run
531 /// # use google_cloud_tpu_v2::model::NetworkEndpoint;
532 /// use google_cloud_tpu_v2::model::AccessConfig;
533 /// let x = NetworkEndpoint::new().set_access_config(AccessConfig::default()/* use setters */);
534 /// ```
535 pub fn set_access_config<T>(mut self, v: T) -> Self
536 where
537 T: std::convert::Into<crate::model::AccessConfig>,
538 {
539 self.access_config = std::option::Option::Some(v.into());
540 self
541 }
542
543 /// Sets or clears the value of [access_config][crate::model::NetworkEndpoint::access_config].
544 ///
545 /// # Example
546 /// ```ignore,no_run
547 /// # use google_cloud_tpu_v2::model::NetworkEndpoint;
548 /// use google_cloud_tpu_v2::model::AccessConfig;
549 /// let x = NetworkEndpoint::new().set_or_clear_access_config(Some(AccessConfig::default()/* use setters */));
550 /// let x = NetworkEndpoint::new().set_or_clear_access_config(None::<AccessConfig>);
551 /// ```
552 pub fn set_or_clear_access_config<T>(mut self, v: std::option::Option<T>) -> Self
553 where
554 T: std::convert::Into<crate::model::AccessConfig>,
555 {
556 self.access_config = v.map(|x| x.into());
557 self
558 }
559}
560
561impl wkt::message::Message for NetworkEndpoint {
562 fn typename() -> &'static str {
563 "type.googleapis.com/google.cloud.tpu.v2.NetworkEndpoint"
564 }
565}
566
567/// An access config attached to the TPU worker.
568#[derive(Clone, Default, PartialEq)]
569#[non_exhaustive]
570pub struct AccessConfig {
571 /// Output only. An external IP address associated with the TPU worker.
572 pub external_ip: std::string::String,
573
574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
575}
576
577impl AccessConfig {
578 pub fn new() -> Self {
579 std::default::Default::default()
580 }
581
582 /// Sets the value of [external_ip][crate::model::AccessConfig::external_ip].
583 ///
584 /// # Example
585 /// ```ignore,no_run
586 /// # use google_cloud_tpu_v2::model::AccessConfig;
587 /// let x = AccessConfig::new().set_external_ip("example");
588 /// ```
589 pub fn set_external_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
590 self.external_ip = v.into();
591 self
592 }
593}
594
595impl wkt::message::Message for AccessConfig {
596 fn typename() -> &'static str {
597 "type.googleapis.com/google.cloud.tpu.v2.AccessConfig"
598 }
599}
600
601/// Network related configurations.
602#[derive(Clone, Default, PartialEq)]
603#[non_exhaustive]
604pub struct NetworkConfig {
605 /// The name of the network for the TPU node. It must be a preexisting Google
606 /// Compute Engine network. If none is provided, "default" will be used.
607 pub network: std::string::String,
608
609 /// The name of the subnetwork for the TPU node. It must be a preexisting
610 /// Google Compute Engine subnetwork. If none is provided, "default" will be
611 /// used.
612 pub subnetwork: std::string::String,
613
614 /// Indicates that external IP addresses would be associated with the TPU
615 /// workers. If set to false, the specified subnetwork or network should have
616 /// Private Google Access enabled.
617 pub enable_external_ips: bool,
618
619 /// Allows the TPU node to send and receive packets with non-matching
620 /// destination or source IPs. This is required if you plan to use the TPU
621 /// workers to forward routes.
622 pub can_ip_forward: bool,
623
624 /// Optional. Specifies networking queue count for TPU VM instance's network
625 /// interface.
626 pub queue_count: i32,
627
628 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
629}
630
631impl NetworkConfig {
632 pub fn new() -> Self {
633 std::default::Default::default()
634 }
635
636 /// Sets the value of [network][crate::model::NetworkConfig::network].
637 ///
638 /// # Example
639 /// ```ignore,no_run
640 /// # use google_cloud_tpu_v2::model::NetworkConfig;
641 /// let x = NetworkConfig::new().set_network("example");
642 /// ```
643 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
644 self.network = v.into();
645 self
646 }
647
648 /// Sets the value of [subnetwork][crate::model::NetworkConfig::subnetwork].
649 ///
650 /// # Example
651 /// ```ignore,no_run
652 /// # use google_cloud_tpu_v2::model::NetworkConfig;
653 /// let x = NetworkConfig::new().set_subnetwork("example");
654 /// ```
655 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
656 self.subnetwork = v.into();
657 self
658 }
659
660 /// Sets the value of [enable_external_ips][crate::model::NetworkConfig::enable_external_ips].
661 ///
662 /// # Example
663 /// ```ignore,no_run
664 /// # use google_cloud_tpu_v2::model::NetworkConfig;
665 /// let x = NetworkConfig::new().set_enable_external_ips(true);
666 /// ```
667 pub fn set_enable_external_ips<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
668 self.enable_external_ips = v.into();
669 self
670 }
671
672 /// Sets the value of [can_ip_forward][crate::model::NetworkConfig::can_ip_forward].
673 ///
674 /// # Example
675 /// ```ignore,no_run
676 /// # use google_cloud_tpu_v2::model::NetworkConfig;
677 /// let x = NetworkConfig::new().set_can_ip_forward(true);
678 /// ```
679 pub fn set_can_ip_forward<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
680 self.can_ip_forward = v.into();
681 self
682 }
683
684 /// Sets the value of [queue_count][crate::model::NetworkConfig::queue_count].
685 ///
686 /// # Example
687 /// ```ignore,no_run
688 /// # use google_cloud_tpu_v2::model::NetworkConfig;
689 /// let x = NetworkConfig::new().set_queue_count(42);
690 /// ```
691 pub fn set_queue_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
692 self.queue_count = v.into();
693 self
694 }
695}
696
697impl wkt::message::Message for NetworkConfig {
698 fn typename() -> &'static str {
699 "type.googleapis.com/google.cloud.tpu.v2.NetworkConfig"
700 }
701}
702
703/// A service account.
704#[derive(Clone, Default, PartialEq)]
705#[non_exhaustive]
706pub struct ServiceAccount {
707 /// Email address of the service account. If empty, default Compute service
708 /// account will be used.
709 pub email: std::string::String,
710
711 /// The list of scopes to be made available for this service account. If empty,
712 /// access to all Cloud APIs will be allowed.
713 pub scope: std::vec::Vec<std::string::String>,
714
715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
716}
717
718impl ServiceAccount {
719 pub fn new() -> Self {
720 std::default::Default::default()
721 }
722
723 /// Sets the value of [email][crate::model::ServiceAccount::email].
724 ///
725 /// # Example
726 /// ```ignore,no_run
727 /// # use google_cloud_tpu_v2::model::ServiceAccount;
728 /// let x = ServiceAccount::new().set_email("example");
729 /// ```
730 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
731 self.email = v.into();
732 self
733 }
734
735 /// Sets the value of [scope][crate::model::ServiceAccount::scope].
736 ///
737 /// # Example
738 /// ```ignore,no_run
739 /// # use google_cloud_tpu_v2::model::ServiceAccount;
740 /// let x = ServiceAccount::new().set_scope(["a", "b", "c"]);
741 /// ```
742 pub fn set_scope<T, V>(mut self, v: T) -> Self
743 where
744 T: std::iter::IntoIterator<Item = V>,
745 V: std::convert::Into<std::string::String>,
746 {
747 use std::iter::Iterator;
748 self.scope = v.into_iter().map(|i| i.into()).collect();
749 self
750 }
751}
752
753impl wkt::message::Message for ServiceAccount {
754 fn typename() -> &'static str {
755 "type.googleapis.com/google.cloud.tpu.v2.ServiceAccount"
756 }
757}
758
759/// A TPU instance.
760#[derive(Clone, Default, PartialEq)]
761#[non_exhaustive]
762pub struct Node {
763 /// Output only. Immutable. The name of the TPU.
764 pub name: std::string::String,
765
766 /// The user-supplied description of the TPU. Maximum of 512 characters.
767 pub description: std::string::String,
768
769 /// Optional. The type of hardware accelerators associated with this node.
770 pub accelerator_type: std::string::String,
771
772 /// Output only. The current state for the TPU Node.
773 pub state: crate::model::node::State,
774
775 /// Output only. If this field is populated, it contains a description of why
776 /// the TPU Node is unhealthy.
777 pub health_description: std::string::String,
778
779 /// Required. The runtime version running in the Node.
780 pub runtime_version: std::string::String,
781
782 /// Network configurations for the TPU node. network_config and network_configs
783 /// are mutually exclusive, you can only specify one of them. If both are
784 /// specified, an error will be returned.
785 pub network_config: std::option::Option<crate::model::NetworkConfig>,
786
787 /// Optional. Repeated network configurations for the TPU node. This field is
788 /// used to specify multiple networks configs for the TPU node. network_config
789 /// and network_configs are mutually exclusive, you can only specify one of
790 /// them. If both are specified, an error will be returned.
791 pub network_configs: std::vec::Vec<crate::model::NetworkConfig>,
792
793 /// The CIDR block that the TPU node will use when selecting an IP address.
794 /// This CIDR block must be a /29 block; the Compute Engine networks API
795 /// forbids a smaller block, and using a larger block would be wasteful (a
796 /// node can only consume one IP address). Errors will occur if the CIDR block
797 /// has already been used for a currently existing TPU node, the CIDR block
798 /// conflicts with any subnetworks in the user's provided network, or the
799 /// provided network is peered with another network that is using that CIDR
800 /// block.
801 pub cidr_block: std::string::String,
802
803 /// The Google Cloud Platform Service Account to be used by the TPU node VMs.
804 /// If None is specified, the default compute service account will be used.
805 pub service_account: std::option::Option<crate::model::ServiceAccount>,
806
807 /// Output only. The time when the node was created.
808 pub create_time: std::option::Option<wkt::Timestamp>,
809
810 /// The scheduling options for this node.
811 pub scheduling_config: std::option::Option<crate::model::SchedulingConfig>,
812
813 /// Output only. The network endpoints where TPU workers can be accessed and
814 /// sent work. It is recommended that runtime clients of the node reach out
815 /// to the 0th entry in this map first.
816 pub network_endpoints: std::vec::Vec<crate::model::NetworkEndpoint>,
817
818 /// The health status of the TPU node.
819 pub health: crate::model::node::Health,
820
821 /// Resource labels to represent user-provided metadata.
822 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
823
824 /// Custom metadata to apply to the TPU Node.
825 /// Can set startup-script and shutdown-script
826 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
827
828 /// Tags to apply to the TPU Node. Tags are used to identify valid sources or
829 /// targets for network firewalls.
830 pub tags: std::vec::Vec<std::string::String>,
831
832 /// Output only. The unique identifier for the TPU Node.
833 pub id: i64,
834
835 /// The additional data disks for the Node.
836 pub data_disks: std::vec::Vec<crate::model::AttachedDisk>,
837
838 /// Output only. The API version that created this Node.
839 pub api_version: crate::model::node::ApiVersion,
840
841 /// Output only. The Symptoms that have occurred to the TPU Node.
842 pub symptoms: std::vec::Vec<crate::model::Symptom>,
843
844 /// Shielded Instance options.
845 pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
846
847 /// The AccleratorConfig for the TPU Node.
848 pub accelerator_config: std::option::Option<crate::model::AcceleratorConfig>,
849
850 /// Output only. The qualified name of the QueuedResource that requested this
851 /// Node.
852 pub queued_resource: std::string::String,
853
854 /// Output only. Whether the Node belongs to a Multislice group.
855 pub multislice_node: bool,
856
857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
858}
859
860impl Node {
861 pub fn new() -> Self {
862 std::default::Default::default()
863 }
864
865 /// Sets the value of [name][crate::model::Node::name].
866 ///
867 /// # Example
868 /// ```ignore,no_run
869 /// # use google_cloud_tpu_v2::model::Node;
870 /// let x = Node::new().set_name("example");
871 /// ```
872 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
873 self.name = v.into();
874 self
875 }
876
877 /// Sets the value of [description][crate::model::Node::description].
878 ///
879 /// # Example
880 /// ```ignore,no_run
881 /// # use google_cloud_tpu_v2::model::Node;
882 /// let x = Node::new().set_description("example");
883 /// ```
884 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
885 self.description = v.into();
886 self
887 }
888
889 /// Sets the value of [accelerator_type][crate::model::Node::accelerator_type].
890 ///
891 /// # Example
892 /// ```ignore,no_run
893 /// # use google_cloud_tpu_v2::model::Node;
894 /// let x = Node::new().set_accelerator_type("example");
895 /// ```
896 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
897 mut self,
898 v: T,
899 ) -> Self {
900 self.accelerator_type = v.into();
901 self
902 }
903
904 /// Sets the value of [state][crate::model::Node::state].
905 ///
906 /// # Example
907 /// ```ignore,no_run
908 /// # use google_cloud_tpu_v2::model::Node;
909 /// use google_cloud_tpu_v2::model::node::State;
910 /// let x0 = Node::new().set_state(State::Creating);
911 /// let x1 = Node::new().set_state(State::Ready);
912 /// let x2 = Node::new().set_state(State::Restarting);
913 /// ```
914 pub fn set_state<T: std::convert::Into<crate::model::node::State>>(mut self, v: T) -> Self {
915 self.state = v.into();
916 self
917 }
918
919 /// Sets the value of [health_description][crate::model::Node::health_description].
920 ///
921 /// # Example
922 /// ```ignore,no_run
923 /// # use google_cloud_tpu_v2::model::Node;
924 /// let x = Node::new().set_health_description("example");
925 /// ```
926 pub fn set_health_description<T: std::convert::Into<std::string::String>>(
927 mut self,
928 v: T,
929 ) -> Self {
930 self.health_description = v.into();
931 self
932 }
933
934 /// Sets the value of [runtime_version][crate::model::Node::runtime_version].
935 ///
936 /// # Example
937 /// ```ignore,no_run
938 /// # use google_cloud_tpu_v2::model::Node;
939 /// let x = Node::new().set_runtime_version("example");
940 /// ```
941 pub fn set_runtime_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
942 self.runtime_version = v.into();
943 self
944 }
945
946 /// Sets the value of [network_config][crate::model::Node::network_config].
947 ///
948 /// # Example
949 /// ```ignore,no_run
950 /// # use google_cloud_tpu_v2::model::Node;
951 /// use google_cloud_tpu_v2::model::NetworkConfig;
952 /// let x = Node::new().set_network_config(NetworkConfig::default()/* use setters */);
953 /// ```
954 pub fn set_network_config<T>(mut self, v: T) -> Self
955 where
956 T: std::convert::Into<crate::model::NetworkConfig>,
957 {
958 self.network_config = std::option::Option::Some(v.into());
959 self
960 }
961
962 /// Sets or clears the value of [network_config][crate::model::Node::network_config].
963 ///
964 /// # Example
965 /// ```ignore,no_run
966 /// # use google_cloud_tpu_v2::model::Node;
967 /// use google_cloud_tpu_v2::model::NetworkConfig;
968 /// let x = Node::new().set_or_clear_network_config(Some(NetworkConfig::default()/* use setters */));
969 /// let x = Node::new().set_or_clear_network_config(None::<NetworkConfig>);
970 /// ```
971 pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
972 where
973 T: std::convert::Into<crate::model::NetworkConfig>,
974 {
975 self.network_config = v.map(|x| x.into());
976 self
977 }
978
979 /// Sets the value of [network_configs][crate::model::Node::network_configs].
980 ///
981 /// # Example
982 /// ```ignore,no_run
983 /// # use google_cloud_tpu_v2::model::Node;
984 /// use google_cloud_tpu_v2::model::NetworkConfig;
985 /// let x = Node::new()
986 /// .set_network_configs([
987 /// NetworkConfig::default()/* use setters */,
988 /// NetworkConfig::default()/* use (different) setters */,
989 /// ]);
990 /// ```
991 pub fn set_network_configs<T, V>(mut self, v: T) -> Self
992 where
993 T: std::iter::IntoIterator<Item = V>,
994 V: std::convert::Into<crate::model::NetworkConfig>,
995 {
996 use std::iter::Iterator;
997 self.network_configs = v.into_iter().map(|i| i.into()).collect();
998 self
999 }
1000
1001 /// Sets the value of [cidr_block][crate::model::Node::cidr_block].
1002 ///
1003 /// # Example
1004 /// ```ignore,no_run
1005 /// # use google_cloud_tpu_v2::model::Node;
1006 /// let x = Node::new().set_cidr_block("example");
1007 /// ```
1008 pub fn set_cidr_block<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1009 self.cidr_block = v.into();
1010 self
1011 }
1012
1013 /// Sets the value of [service_account][crate::model::Node::service_account].
1014 ///
1015 /// # Example
1016 /// ```ignore,no_run
1017 /// # use google_cloud_tpu_v2::model::Node;
1018 /// use google_cloud_tpu_v2::model::ServiceAccount;
1019 /// let x = Node::new().set_service_account(ServiceAccount::default()/* use setters */);
1020 /// ```
1021 pub fn set_service_account<T>(mut self, v: T) -> Self
1022 where
1023 T: std::convert::Into<crate::model::ServiceAccount>,
1024 {
1025 self.service_account = std::option::Option::Some(v.into());
1026 self
1027 }
1028
1029 /// Sets or clears the value of [service_account][crate::model::Node::service_account].
1030 ///
1031 /// # Example
1032 /// ```ignore,no_run
1033 /// # use google_cloud_tpu_v2::model::Node;
1034 /// use google_cloud_tpu_v2::model::ServiceAccount;
1035 /// let x = Node::new().set_or_clear_service_account(Some(ServiceAccount::default()/* use setters */));
1036 /// let x = Node::new().set_or_clear_service_account(None::<ServiceAccount>);
1037 /// ```
1038 pub fn set_or_clear_service_account<T>(mut self, v: std::option::Option<T>) -> Self
1039 where
1040 T: std::convert::Into<crate::model::ServiceAccount>,
1041 {
1042 self.service_account = v.map(|x| x.into());
1043 self
1044 }
1045
1046 /// Sets the value of [create_time][crate::model::Node::create_time].
1047 ///
1048 /// # Example
1049 /// ```ignore,no_run
1050 /// # use google_cloud_tpu_v2::model::Node;
1051 /// use wkt::Timestamp;
1052 /// let x = Node::new().set_create_time(Timestamp::default()/* use setters */);
1053 /// ```
1054 pub fn set_create_time<T>(mut self, v: T) -> Self
1055 where
1056 T: std::convert::Into<wkt::Timestamp>,
1057 {
1058 self.create_time = std::option::Option::Some(v.into());
1059 self
1060 }
1061
1062 /// Sets or clears the value of [create_time][crate::model::Node::create_time].
1063 ///
1064 /// # Example
1065 /// ```ignore,no_run
1066 /// # use google_cloud_tpu_v2::model::Node;
1067 /// use wkt::Timestamp;
1068 /// let x = Node::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1069 /// let x = Node::new().set_or_clear_create_time(None::<Timestamp>);
1070 /// ```
1071 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1072 where
1073 T: std::convert::Into<wkt::Timestamp>,
1074 {
1075 self.create_time = v.map(|x| x.into());
1076 self
1077 }
1078
1079 /// Sets the value of [scheduling_config][crate::model::Node::scheduling_config].
1080 ///
1081 /// # Example
1082 /// ```ignore,no_run
1083 /// # use google_cloud_tpu_v2::model::Node;
1084 /// use google_cloud_tpu_v2::model::SchedulingConfig;
1085 /// let x = Node::new().set_scheduling_config(SchedulingConfig::default()/* use setters */);
1086 /// ```
1087 pub fn set_scheduling_config<T>(mut self, v: T) -> Self
1088 where
1089 T: std::convert::Into<crate::model::SchedulingConfig>,
1090 {
1091 self.scheduling_config = std::option::Option::Some(v.into());
1092 self
1093 }
1094
1095 /// Sets or clears the value of [scheduling_config][crate::model::Node::scheduling_config].
1096 ///
1097 /// # Example
1098 /// ```ignore,no_run
1099 /// # use google_cloud_tpu_v2::model::Node;
1100 /// use google_cloud_tpu_v2::model::SchedulingConfig;
1101 /// let x = Node::new().set_or_clear_scheduling_config(Some(SchedulingConfig::default()/* use setters */));
1102 /// let x = Node::new().set_or_clear_scheduling_config(None::<SchedulingConfig>);
1103 /// ```
1104 pub fn set_or_clear_scheduling_config<T>(mut self, v: std::option::Option<T>) -> Self
1105 where
1106 T: std::convert::Into<crate::model::SchedulingConfig>,
1107 {
1108 self.scheduling_config = v.map(|x| x.into());
1109 self
1110 }
1111
1112 /// Sets the value of [network_endpoints][crate::model::Node::network_endpoints].
1113 ///
1114 /// # Example
1115 /// ```ignore,no_run
1116 /// # use google_cloud_tpu_v2::model::Node;
1117 /// use google_cloud_tpu_v2::model::NetworkEndpoint;
1118 /// let x = Node::new()
1119 /// .set_network_endpoints([
1120 /// NetworkEndpoint::default()/* use setters */,
1121 /// NetworkEndpoint::default()/* use (different) setters */,
1122 /// ]);
1123 /// ```
1124 pub fn set_network_endpoints<T, V>(mut self, v: T) -> Self
1125 where
1126 T: std::iter::IntoIterator<Item = V>,
1127 V: std::convert::Into<crate::model::NetworkEndpoint>,
1128 {
1129 use std::iter::Iterator;
1130 self.network_endpoints = v.into_iter().map(|i| i.into()).collect();
1131 self
1132 }
1133
1134 /// Sets the value of [health][crate::model::Node::health].
1135 ///
1136 /// # Example
1137 /// ```ignore,no_run
1138 /// # use google_cloud_tpu_v2::model::Node;
1139 /// use google_cloud_tpu_v2::model::node::Health;
1140 /// let x0 = Node::new().set_health(Health::Healthy);
1141 /// let x1 = Node::new().set_health(Health::Timeout);
1142 /// let x2 = Node::new().set_health(Health::UnhealthyTensorflow);
1143 /// ```
1144 pub fn set_health<T: std::convert::Into<crate::model::node::Health>>(mut self, v: T) -> Self {
1145 self.health = v.into();
1146 self
1147 }
1148
1149 /// Sets the value of [labels][crate::model::Node::labels].
1150 ///
1151 /// # Example
1152 /// ```ignore,no_run
1153 /// # use google_cloud_tpu_v2::model::Node;
1154 /// let x = Node::new().set_labels([
1155 /// ("key0", "abc"),
1156 /// ("key1", "xyz"),
1157 /// ]);
1158 /// ```
1159 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1160 where
1161 T: std::iter::IntoIterator<Item = (K, V)>,
1162 K: std::convert::Into<std::string::String>,
1163 V: std::convert::Into<std::string::String>,
1164 {
1165 use std::iter::Iterator;
1166 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1167 self
1168 }
1169
1170 /// Sets the value of [metadata][crate::model::Node::metadata].
1171 ///
1172 /// # Example
1173 /// ```ignore,no_run
1174 /// # use google_cloud_tpu_v2::model::Node;
1175 /// let x = Node::new().set_metadata([
1176 /// ("key0", "abc"),
1177 /// ("key1", "xyz"),
1178 /// ]);
1179 /// ```
1180 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
1181 where
1182 T: std::iter::IntoIterator<Item = (K, V)>,
1183 K: std::convert::Into<std::string::String>,
1184 V: std::convert::Into<std::string::String>,
1185 {
1186 use std::iter::Iterator;
1187 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1188 self
1189 }
1190
1191 /// Sets the value of [tags][crate::model::Node::tags].
1192 ///
1193 /// # Example
1194 /// ```ignore,no_run
1195 /// # use google_cloud_tpu_v2::model::Node;
1196 /// let x = Node::new().set_tags(["a", "b", "c"]);
1197 /// ```
1198 pub fn set_tags<T, V>(mut self, v: T) -> Self
1199 where
1200 T: std::iter::IntoIterator<Item = V>,
1201 V: std::convert::Into<std::string::String>,
1202 {
1203 use std::iter::Iterator;
1204 self.tags = v.into_iter().map(|i| i.into()).collect();
1205 self
1206 }
1207
1208 /// Sets the value of [id][crate::model::Node::id].
1209 ///
1210 /// # Example
1211 /// ```ignore,no_run
1212 /// # use google_cloud_tpu_v2::model::Node;
1213 /// let x = Node::new().set_id(42);
1214 /// ```
1215 pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1216 self.id = v.into();
1217 self
1218 }
1219
1220 /// Sets the value of [data_disks][crate::model::Node::data_disks].
1221 ///
1222 /// # Example
1223 /// ```ignore,no_run
1224 /// # use google_cloud_tpu_v2::model::Node;
1225 /// use google_cloud_tpu_v2::model::AttachedDisk;
1226 /// let x = Node::new()
1227 /// .set_data_disks([
1228 /// AttachedDisk::default()/* use setters */,
1229 /// AttachedDisk::default()/* use (different) setters */,
1230 /// ]);
1231 /// ```
1232 pub fn set_data_disks<T, V>(mut self, v: T) -> Self
1233 where
1234 T: std::iter::IntoIterator<Item = V>,
1235 V: std::convert::Into<crate::model::AttachedDisk>,
1236 {
1237 use std::iter::Iterator;
1238 self.data_disks = v.into_iter().map(|i| i.into()).collect();
1239 self
1240 }
1241
1242 /// Sets the value of [api_version][crate::model::Node::api_version].
1243 ///
1244 /// # Example
1245 /// ```ignore,no_run
1246 /// # use google_cloud_tpu_v2::model::Node;
1247 /// use google_cloud_tpu_v2::model::node::ApiVersion;
1248 /// let x0 = Node::new().set_api_version(ApiVersion::V1Alpha1);
1249 /// let x1 = Node::new().set_api_version(ApiVersion::V1);
1250 /// let x2 = Node::new().set_api_version(ApiVersion::V2Alpha1);
1251 /// ```
1252 pub fn set_api_version<T: std::convert::Into<crate::model::node::ApiVersion>>(
1253 mut self,
1254 v: T,
1255 ) -> Self {
1256 self.api_version = v.into();
1257 self
1258 }
1259
1260 /// Sets the value of [symptoms][crate::model::Node::symptoms].
1261 ///
1262 /// # Example
1263 /// ```ignore,no_run
1264 /// # use google_cloud_tpu_v2::model::Node;
1265 /// use google_cloud_tpu_v2::model::Symptom;
1266 /// let x = Node::new()
1267 /// .set_symptoms([
1268 /// Symptom::default()/* use setters */,
1269 /// Symptom::default()/* use (different) setters */,
1270 /// ]);
1271 /// ```
1272 pub fn set_symptoms<T, V>(mut self, v: T) -> Self
1273 where
1274 T: std::iter::IntoIterator<Item = V>,
1275 V: std::convert::Into<crate::model::Symptom>,
1276 {
1277 use std::iter::Iterator;
1278 self.symptoms = v.into_iter().map(|i| i.into()).collect();
1279 self
1280 }
1281
1282 /// Sets the value of [shielded_instance_config][crate::model::Node::shielded_instance_config].
1283 ///
1284 /// # Example
1285 /// ```ignore,no_run
1286 /// # use google_cloud_tpu_v2::model::Node;
1287 /// use google_cloud_tpu_v2::model::ShieldedInstanceConfig;
1288 /// let x = Node::new().set_shielded_instance_config(ShieldedInstanceConfig::default()/* use setters */);
1289 /// ```
1290 pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
1291 where
1292 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
1293 {
1294 self.shielded_instance_config = std::option::Option::Some(v.into());
1295 self
1296 }
1297
1298 /// Sets or clears the value of [shielded_instance_config][crate::model::Node::shielded_instance_config].
1299 ///
1300 /// # Example
1301 /// ```ignore,no_run
1302 /// # use google_cloud_tpu_v2::model::Node;
1303 /// use google_cloud_tpu_v2::model::ShieldedInstanceConfig;
1304 /// let x = Node::new().set_or_clear_shielded_instance_config(Some(ShieldedInstanceConfig::default()/* use setters */));
1305 /// let x = Node::new().set_or_clear_shielded_instance_config(None::<ShieldedInstanceConfig>);
1306 /// ```
1307 pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
1308 where
1309 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
1310 {
1311 self.shielded_instance_config = v.map(|x| x.into());
1312 self
1313 }
1314
1315 /// Sets the value of [accelerator_config][crate::model::Node::accelerator_config].
1316 ///
1317 /// # Example
1318 /// ```ignore,no_run
1319 /// # use google_cloud_tpu_v2::model::Node;
1320 /// use google_cloud_tpu_v2::model::AcceleratorConfig;
1321 /// let x = Node::new().set_accelerator_config(AcceleratorConfig::default()/* use setters */);
1322 /// ```
1323 pub fn set_accelerator_config<T>(mut self, v: T) -> Self
1324 where
1325 T: std::convert::Into<crate::model::AcceleratorConfig>,
1326 {
1327 self.accelerator_config = std::option::Option::Some(v.into());
1328 self
1329 }
1330
1331 /// Sets or clears the value of [accelerator_config][crate::model::Node::accelerator_config].
1332 ///
1333 /// # Example
1334 /// ```ignore,no_run
1335 /// # use google_cloud_tpu_v2::model::Node;
1336 /// use google_cloud_tpu_v2::model::AcceleratorConfig;
1337 /// let x = Node::new().set_or_clear_accelerator_config(Some(AcceleratorConfig::default()/* use setters */));
1338 /// let x = Node::new().set_or_clear_accelerator_config(None::<AcceleratorConfig>);
1339 /// ```
1340 pub fn set_or_clear_accelerator_config<T>(mut self, v: std::option::Option<T>) -> Self
1341 where
1342 T: std::convert::Into<crate::model::AcceleratorConfig>,
1343 {
1344 self.accelerator_config = v.map(|x| x.into());
1345 self
1346 }
1347
1348 /// Sets the value of [queued_resource][crate::model::Node::queued_resource].
1349 ///
1350 /// # Example
1351 /// ```ignore,no_run
1352 /// # use google_cloud_tpu_v2::model::Node;
1353 /// let x = Node::new().set_queued_resource("example");
1354 /// ```
1355 pub fn set_queued_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1356 self.queued_resource = v.into();
1357 self
1358 }
1359
1360 /// Sets the value of [multislice_node][crate::model::Node::multislice_node].
1361 ///
1362 /// # Example
1363 /// ```ignore,no_run
1364 /// # use google_cloud_tpu_v2::model::Node;
1365 /// let x = Node::new().set_multislice_node(true);
1366 /// ```
1367 pub fn set_multislice_node<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1368 self.multislice_node = v.into();
1369 self
1370 }
1371}
1372
1373impl wkt::message::Message for Node {
1374 fn typename() -> &'static str {
1375 "type.googleapis.com/google.cloud.tpu.v2.Node"
1376 }
1377}
1378
1379/// Defines additional types related to [Node].
1380pub mod node {
1381 #[allow(unused_imports)]
1382 use super::*;
1383
1384 /// Represents the different states of a TPU node during its lifecycle.
1385 ///
1386 /// # Working with unknown values
1387 ///
1388 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1389 /// additional enum variants at any time. Adding new variants is not considered
1390 /// a breaking change. Applications should write their code in anticipation of:
1391 ///
1392 /// - New values appearing in future releases of the client library, **and**
1393 /// - New values received dynamically, without application changes.
1394 ///
1395 /// Please consult the [Working with enums] section in the user guide for some
1396 /// guidelines.
1397 ///
1398 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1399 #[derive(Clone, Debug, PartialEq)]
1400 #[non_exhaustive]
1401 pub enum State {
1402 /// TPU node state is not known/set.
1403 Unspecified,
1404 /// TPU node is being created.
1405 Creating,
1406 /// TPU node has been created.
1407 Ready,
1408 /// TPU node is restarting.
1409 Restarting,
1410 /// TPU node is undergoing reimaging.
1411 Reimaging,
1412 /// TPU node is being deleted.
1413 Deleting,
1414 /// TPU node is being repaired and may be unusable. Details can be
1415 /// found in the 'help_description' field.
1416 Repairing,
1417 /// TPU node is stopped.
1418 Stopped,
1419 /// TPU node is currently stopping.
1420 Stopping,
1421 /// TPU node is currently starting.
1422 Starting,
1423 /// TPU node has been preempted. Only applies to Preemptible TPU Nodes.
1424 Preempted,
1425 /// TPU node has been terminated due to maintenance or has reached the end of
1426 /// its life cycle (for preemptible nodes).
1427 Terminated,
1428 /// TPU node is currently hiding.
1429 Hiding,
1430 /// TPU node has been hidden.
1431 Hidden,
1432 /// TPU node is currently unhiding.
1433 Unhiding,
1434 /// TPU node has unknown state after a failed repair.
1435 Unknown,
1436 /// If set, the enum was initialized with an unknown value.
1437 ///
1438 /// Applications can examine the value using [State::value] or
1439 /// [State::name].
1440 UnknownValue(state::UnknownValue),
1441 }
1442
1443 #[doc(hidden)]
1444 pub mod state {
1445 #[allow(unused_imports)]
1446 use super::*;
1447 #[derive(Clone, Debug, PartialEq)]
1448 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1449 }
1450
1451 impl State {
1452 /// Gets the enum value.
1453 ///
1454 /// Returns `None` if the enum contains an unknown value deserialized from
1455 /// the string representation of enums.
1456 pub fn value(&self) -> std::option::Option<i32> {
1457 match self {
1458 Self::Unspecified => std::option::Option::Some(0),
1459 Self::Creating => std::option::Option::Some(1),
1460 Self::Ready => std::option::Option::Some(2),
1461 Self::Restarting => std::option::Option::Some(3),
1462 Self::Reimaging => std::option::Option::Some(4),
1463 Self::Deleting => std::option::Option::Some(5),
1464 Self::Repairing => std::option::Option::Some(6),
1465 Self::Stopped => std::option::Option::Some(8),
1466 Self::Stopping => std::option::Option::Some(9),
1467 Self::Starting => std::option::Option::Some(10),
1468 Self::Preempted => std::option::Option::Some(11),
1469 Self::Terminated => std::option::Option::Some(12),
1470 Self::Hiding => std::option::Option::Some(13),
1471 Self::Hidden => std::option::Option::Some(14),
1472 Self::Unhiding => std::option::Option::Some(15),
1473 Self::Unknown => std::option::Option::Some(16),
1474 Self::UnknownValue(u) => u.0.value(),
1475 }
1476 }
1477
1478 /// Gets the enum value as a string.
1479 ///
1480 /// Returns `None` if the enum contains an unknown value deserialized from
1481 /// the integer representation of enums.
1482 pub fn name(&self) -> std::option::Option<&str> {
1483 match self {
1484 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1485 Self::Creating => std::option::Option::Some("CREATING"),
1486 Self::Ready => std::option::Option::Some("READY"),
1487 Self::Restarting => std::option::Option::Some("RESTARTING"),
1488 Self::Reimaging => std::option::Option::Some("REIMAGING"),
1489 Self::Deleting => std::option::Option::Some("DELETING"),
1490 Self::Repairing => std::option::Option::Some("REPAIRING"),
1491 Self::Stopped => std::option::Option::Some("STOPPED"),
1492 Self::Stopping => std::option::Option::Some("STOPPING"),
1493 Self::Starting => std::option::Option::Some("STARTING"),
1494 Self::Preempted => std::option::Option::Some("PREEMPTED"),
1495 Self::Terminated => std::option::Option::Some("TERMINATED"),
1496 Self::Hiding => std::option::Option::Some("HIDING"),
1497 Self::Hidden => std::option::Option::Some("HIDDEN"),
1498 Self::Unhiding => std::option::Option::Some("UNHIDING"),
1499 Self::Unknown => std::option::Option::Some("UNKNOWN"),
1500 Self::UnknownValue(u) => u.0.name(),
1501 }
1502 }
1503 }
1504
1505 impl std::default::Default for State {
1506 fn default() -> Self {
1507 use std::convert::From;
1508 Self::from(0)
1509 }
1510 }
1511
1512 impl std::fmt::Display for State {
1513 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1514 wkt::internal::display_enum(f, self.name(), self.value())
1515 }
1516 }
1517
1518 impl std::convert::From<i32> for State {
1519 fn from(value: i32) -> Self {
1520 match value {
1521 0 => Self::Unspecified,
1522 1 => Self::Creating,
1523 2 => Self::Ready,
1524 3 => Self::Restarting,
1525 4 => Self::Reimaging,
1526 5 => Self::Deleting,
1527 6 => Self::Repairing,
1528 8 => Self::Stopped,
1529 9 => Self::Stopping,
1530 10 => Self::Starting,
1531 11 => Self::Preempted,
1532 12 => Self::Terminated,
1533 13 => Self::Hiding,
1534 14 => Self::Hidden,
1535 15 => Self::Unhiding,
1536 16 => Self::Unknown,
1537 _ => Self::UnknownValue(state::UnknownValue(
1538 wkt::internal::UnknownEnumValue::Integer(value),
1539 )),
1540 }
1541 }
1542 }
1543
1544 impl std::convert::From<&str> for State {
1545 fn from(value: &str) -> Self {
1546 use std::string::ToString;
1547 match value {
1548 "STATE_UNSPECIFIED" => Self::Unspecified,
1549 "CREATING" => Self::Creating,
1550 "READY" => Self::Ready,
1551 "RESTARTING" => Self::Restarting,
1552 "REIMAGING" => Self::Reimaging,
1553 "DELETING" => Self::Deleting,
1554 "REPAIRING" => Self::Repairing,
1555 "STOPPED" => Self::Stopped,
1556 "STOPPING" => Self::Stopping,
1557 "STARTING" => Self::Starting,
1558 "PREEMPTED" => Self::Preempted,
1559 "TERMINATED" => Self::Terminated,
1560 "HIDING" => Self::Hiding,
1561 "HIDDEN" => Self::Hidden,
1562 "UNHIDING" => Self::Unhiding,
1563 "UNKNOWN" => Self::Unknown,
1564 _ => Self::UnknownValue(state::UnknownValue(
1565 wkt::internal::UnknownEnumValue::String(value.to_string()),
1566 )),
1567 }
1568 }
1569 }
1570
1571 impl serde::ser::Serialize for State {
1572 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1573 where
1574 S: serde::Serializer,
1575 {
1576 match self {
1577 Self::Unspecified => serializer.serialize_i32(0),
1578 Self::Creating => serializer.serialize_i32(1),
1579 Self::Ready => serializer.serialize_i32(2),
1580 Self::Restarting => serializer.serialize_i32(3),
1581 Self::Reimaging => serializer.serialize_i32(4),
1582 Self::Deleting => serializer.serialize_i32(5),
1583 Self::Repairing => serializer.serialize_i32(6),
1584 Self::Stopped => serializer.serialize_i32(8),
1585 Self::Stopping => serializer.serialize_i32(9),
1586 Self::Starting => serializer.serialize_i32(10),
1587 Self::Preempted => serializer.serialize_i32(11),
1588 Self::Terminated => serializer.serialize_i32(12),
1589 Self::Hiding => serializer.serialize_i32(13),
1590 Self::Hidden => serializer.serialize_i32(14),
1591 Self::Unhiding => serializer.serialize_i32(15),
1592 Self::Unknown => serializer.serialize_i32(16),
1593 Self::UnknownValue(u) => u.0.serialize(serializer),
1594 }
1595 }
1596 }
1597
1598 impl<'de> serde::de::Deserialize<'de> for State {
1599 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1600 where
1601 D: serde::Deserializer<'de>,
1602 {
1603 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1604 ".google.cloud.tpu.v2.Node.State",
1605 ))
1606 }
1607 }
1608
1609 /// Health defines the status of a TPU node as reported by
1610 /// Health Monitor.
1611 ///
1612 /// # Working with unknown values
1613 ///
1614 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1615 /// additional enum variants at any time. Adding new variants is not considered
1616 /// a breaking change. Applications should write their code in anticipation of:
1617 ///
1618 /// - New values appearing in future releases of the client library, **and**
1619 /// - New values received dynamically, without application changes.
1620 ///
1621 /// Please consult the [Working with enums] section in the user guide for some
1622 /// guidelines.
1623 ///
1624 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1625 #[derive(Clone, Debug, PartialEq)]
1626 #[non_exhaustive]
1627 pub enum Health {
1628 /// Health status is unknown: not initialized or failed to retrieve.
1629 Unspecified,
1630 /// The resource is healthy.
1631 Healthy,
1632 /// The resource is unresponsive.
1633 Timeout,
1634 /// The in-guest ML stack is unhealthy.
1635 UnhealthyTensorflow,
1636 /// The node is under maintenance/priority boost caused rescheduling and
1637 /// will resume running once rescheduled.
1638 UnhealthyMaintenance,
1639 /// If set, the enum was initialized with an unknown value.
1640 ///
1641 /// Applications can examine the value using [Health::value] or
1642 /// [Health::name].
1643 UnknownValue(health::UnknownValue),
1644 }
1645
1646 #[doc(hidden)]
1647 pub mod health {
1648 #[allow(unused_imports)]
1649 use super::*;
1650 #[derive(Clone, Debug, PartialEq)]
1651 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1652 }
1653
1654 impl Health {
1655 /// Gets the enum value.
1656 ///
1657 /// Returns `None` if the enum contains an unknown value deserialized from
1658 /// the string representation of enums.
1659 pub fn value(&self) -> std::option::Option<i32> {
1660 match self {
1661 Self::Unspecified => std::option::Option::Some(0),
1662 Self::Healthy => std::option::Option::Some(1),
1663 Self::Timeout => std::option::Option::Some(3),
1664 Self::UnhealthyTensorflow => std::option::Option::Some(4),
1665 Self::UnhealthyMaintenance => std::option::Option::Some(5),
1666 Self::UnknownValue(u) => u.0.value(),
1667 }
1668 }
1669
1670 /// Gets the enum value as a string.
1671 ///
1672 /// Returns `None` if the enum contains an unknown value deserialized from
1673 /// the integer representation of enums.
1674 pub fn name(&self) -> std::option::Option<&str> {
1675 match self {
1676 Self::Unspecified => std::option::Option::Some("HEALTH_UNSPECIFIED"),
1677 Self::Healthy => std::option::Option::Some("HEALTHY"),
1678 Self::Timeout => std::option::Option::Some("TIMEOUT"),
1679 Self::UnhealthyTensorflow => std::option::Option::Some("UNHEALTHY_TENSORFLOW"),
1680 Self::UnhealthyMaintenance => std::option::Option::Some("UNHEALTHY_MAINTENANCE"),
1681 Self::UnknownValue(u) => u.0.name(),
1682 }
1683 }
1684 }
1685
1686 impl std::default::Default for Health {
1687 fn default() -> Self {
1688 use std::convert::From;
1689 Self::from(0)
1690 }
1691 }
1692
1693 impl std::fmt::Display for Health {
1694 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1695 wkt::internal::display_enum(f, self.name(), self.value())
1696 }
1697 }
1698
1699 impl std::convert::From<i32> for Health {
1700 fn from(value: i32) -> Self {
1701 match value {
1702 0 => Self::Unspecified,
1703 1 => Self::Healthy,
1704 3 => Self::Timeout,
1705 4 => Self::UnhealthyTensorflow,
1706 5 => Self::UnhealthyMaintenance,
1707 _ => Self::UnknownValue(health::UnknownValue(
1708 wkt::internal::UnknownEnumValue::Integer(value),
1709 )),
1710 }
1711 }
1712 }
1713
1714 impl std::convert::From<&str> for Health {
1715 fn from(value: &str) -> Self {
1716 use std::string::ToString;
1717 match value {
1718 "HEALTH_UNSPECIFIED" => Self::Unspecified,
1719 "HEALTHY" => Self::Healthy,
1720 "TIMEOUT" => Self::Timeout,
1721 "UNHEALTHY_TENSORFLOW" => Self::UnhealthyTensorflow,
1722 "UNHEALTHY_MAINTENANCE" => Self::UnhealthyMaintenance,
1723 _ => Self::UnknownValue(health::UnknownValue(
1724 wkt::internal::UnknownEnumValue::String(value.to_string()),
1725 )),
1726 }
1727 }
1728 }
1729
1730 impl serde::ser::Serialize for Health {
1731 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1732 where
1733 S: serde::Serializer,
1734 {
1735 match self {
1736 Self::Unspecified => serializer.serialize_i32(0),
1737 Self::Healthy => serializer.serialize_i32(1),
1738 Self::Timeout => serializer.serialize_i32(3),
1739 Self::UnhealthyTensorflow => serializer.serialize_i32(4),
1740 Self::UnhealthyMaintenance => serializer.serialize_i32(5),
1741 Self::UnknownValue(u) => u.0.serialize(serializer),
1742 }
1743 }
1744 }
1745
1746 impl<'de> serde::de::Deserialize<'de> for Health {
1747 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1748 where
1749 D: serde::Deserializer<'de>,
1750 {
1751 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Health>::new(
1752 ".google.cloud.tpu.v2.Node.Health",
1753 ))
1754 }
1755 }
1756
1757 /// TPU API Version.
1758 ///
1759 /// # Working with unknown values
1760 ///
1761 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1762 /// additional enum variants at any time. Adding new variants is not considered
1763 /// a breaking change. Applications should write their code in anticipation of:
1764 ///
1765 /// - New values appearing in future releases of the client library, **and**
1766 /// - New values received dynamically, without application changes.
1767 ///
1768 /// Please consult the [Working with enums] section in the user guide for some
1769 /// guidelines.
1770 ///
1771 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1772 #[derive(Clone, Debug, PartialEq)]
1773 #[non_exhaustive]
1774 pub enum ApiVersion {
1775 /// API version is unknown.
1776 Unspecified,
1777 /// TPU API V1Alpha1 version.
1778 V1Alpha1,
1779 /// TPU API V1 version.
1780 V1,
1781 /// TPU API V2Alpha1 version.
1782 V2Alpha1,
1783 /// TPU API V2 version.
1784 V2,
1785 /// If set, the enum was initialized with an unknown value.
1786 ///
1787 /// Applications can examine the value using [ApiVersion::value] or
1788 /// [ApiVersion::name].
1789 UnknownValue(api_version::UnknownValue),
1790 }
1791
1792 #[doc(hidden)]
1793 pub mod api_version {
1794 #[allow(unused_imports)]
1795 use super::*;
1796 #[derive(Clone, Debug, PartialEq)]
1797 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1798 }
1799
1800 impl ApiVersion {
1801 /// Gets the enum value.
1802 ///
1803 /// Returns `None` if the enum contains an unknown value deserialized from
1804 /// the string representation of enums.
1805 pub fn value(&self) -> std::option::Option<i32> {
1806 match self {
1807 Self::Unspecified => std::option::Option::Some(0),
1808 Self::V1Alpha1 => std::option::Option::Some(1),
1809 Self::V1 => std::option::Option::Some(2),
1810 Self::V2Alpha1 => std::option::Option::Some(3),
1811 Self::V2 => std::option::Option::Some(4),
1812 Self::UnknownValue(u) => u.0.value(),
1813 }
1814 }
1815
1816 /// Gets the enum value as a string.
1817 ///
1818 /// Returns `None` if the enum contains an unknown value deserialized from
1819 /// the integer representation of enums.
1820 pub fn name(&self) -> std::option::Option<&str> {
1821 match self {
1822 Self::Unspecified => std::option::Option::Some("API_VERSION_UNSPECIFIED"),
1823 Self::V1Alpha1 => std::option::Option::Some("V1_ALPHA1"),
1824 Self::V1 => std::option::Option::Some("V1"),
1825 Self::V2Alpha1 => std::option::Option::Some("V2_ALPHA1"),
1826 Self::V2 => std::option::Option::Some("V2"),
1827 Self::UnknownValue(u) => u.0.name(),
1828 }
1829 }
1830 }
1831
1832 impl std::default::Default for ApiVersion {
1833 fn default() -> Self {
1834 use std::convert::From;
1835 Self::from(0)
1836 }
1837 }
1838
1839 impl std::fmt::Display for ApiVersion {
1840 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1841 wkt::internal::display_enum(f, self.name(), self.value())
1842 }
1843 }
1844
1845 impl std::convert::From<i32> for ApiVersion {
1846 fn from(value: i32) -> Self {
1847 match value {
1848 0 => Self::Unspecified,
1849 1 => Self::V1Alpha1,
1850 2 => Self::V1,
1851 3 => Self::V2Alpha1,
1852 4 => Self::V2,
1853 _ => Self::UnknownValue(api_version::UnknownValue(
1854 wkt::internal::UnknownEnumValue::Integer(value),
1855 )),
1856 }
1857 }
1858 }
1859
1860 impl std::convert::From<&str> for ApiVersion {
1861 fn from(value: &str) -> Self {
1862 use std::string::ToString;
1863 match value {
1864 "API_VERSION_UNSPECIFIED" => Self::Unspecified,
1865 "V1_ALPHA1" => Self::V1Alpha1,
1866 "V1" => Self::V1,
1867 "V2_ALPHA1" => Self::V2Alpha1,
1868 "V2" => Self::V2,
1869 _ => Self::UnknownValue(api_version::UnknownValue(
1870 wkt::internal::UnknownEnumValue::String(value.to_string()),
1871 )),
1872 }
1873 }
1874 }
1875
1876 impl serde::ser::Serialize for ApiVersion {
1877 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1878 where
1879 S: serde::Serializer,
1880 {
1881 match self {
1882 Self::Unspecified => serializer.serialize_i32(0),
1883 Self::V1Alpha1 => serializer.serialize_i32(1),
1884 Self::V1 => serializer.serialize_i32(2),
1885 Self::V2Alpha1 => serializer.serialize_i32(3),
1886 Self::V2 => serializer.serialize_i32(4),
1887 Self::UnknownValue(u) => u.0.serialize(serializer),
1888 }
1889 }
1890 }
1891
1892 impl<'de> serde::de::Deserialize<'de> for ApiVersion {
1893 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1894 where
1895 D: serde::Deserializer<'de>,
1896 {
1897 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ApiVersion>::new(
1898 ".google.cloud.tpu.v2.Node.ApiVersion",
1899 ))
1900 }
1901 }
1902}
1903
1904/// A QueuedResource represents a request for resources that will be placed
1905/// in a queue and fulfilled when the necessary resources are available.
1906#[derive(Clone, Default, PartialEq)]
1907#[non_exhaustive]
1908pub struct QueuedResource {
1909 /// Output only. Immutable. The name of the QueuedResource.
1910 pub name: std::string::String,
1911
1912 /// Output only. The time when the QueuedResource was created.
1913 pub create_time: std::option::Option<wkt::Timestamp>,
1914
1915 /// Optional. The queueing policy of the QueuedRequest.
1916 pub queueing_policy: std::option::Option<crate::model::queued_resource::QueueingPolicy>,
1917
1918 /// Output only. State of the QueuedResource request.
1919 pub state: std::option::Option<crate::model::QueuedResourceState>,
1920
1921 /// Optional. Name of the reservation in which the resource should be
1922 /// provisioned. Format:
1923 /// projects/{project}/locations/{zone}/reservations/{reservation}
1924 pub reservation_name: std::string::String,
1925
1926 /// Resource specification.
1927 pub resource: std::option::Option<crate::model::queued_resource::Resource>,
1928
1929 /// Tier specifies the required tier.
1930 pub tier: std::option::Option<crate::model::queued_resource::Tier>,
1931
1932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1933}
1934
1935impl QueuedResource {
1936 pub fn new() -> Self {
1937 std::default::Default::default()
1938 }
1939
1940 /// Sets the value of [name][crate::model::QueuedResource::name].
1941 ///
1942 /// # Example
1943 /// ```ignore,no_run
1944 /// # use google_cloud_tpu_v2::model::QueuedResource;
1945 /// let x = QueuedResource::new().set_name("example");
1946 /// ```
1947 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1948 self.name = v.into();
1949 self
1950 }
1951
1952 /// Sets the value of [create_time][crate::model::QueuedResource::create_time].
1953 ///
1954 /// # Example
1955 /// ```ignore,no_run
1956 /// # use google_cloud_tpu_v2::model::QueuedResource;
1957 /// use wkt::Timestamp;
1958 /// let x = QueuedResource::new().set_create_time(Timestamp::default()/* use setters */);
1959 /// ```
1960 pub fn set_create_time<T>(mut self, v: T) -> Self
1961 where
1962 T: std::convert::Into<wkt::Timestamp>,
1963 {
1964 self.create_time = std::option::Option::Some(v.into());
1965 self
1966 }
1967
1968 /// Sets or clears the value of [create_time][crate::model::QueuedResource::create_time].
1969 ///
1970 /// # Example
1971 /// ```ignore,no_run
1972 /// # use google_cloud_tpu_v2::model::QueuedResource;
1973 /// use wkt::Timestamp;
1974 /// let x = QueuedResource::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1975 /// let x = QueuedResource::new().set_or_clear_create_time(None::<Timestamp>);
1976 /// ```
1977 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1978 where
1979 T: std::convert::Into<wkt::Timestamp>,
1980 {
1981 self.create_time = v.map(|x| x.into());
1982 self
1983 }
1984
1985 /// Sets the value of [queueing_policy][crate::model::QueuedResource::queueing_policy].
1986 ///
1987 /// # Example
1988 /// ```ignore,no_run
1989 /// # use google_cloud_tpu_v2::model::QueuedResource;
1990 /// use google_cloud_tpu_v2::model::queued_resource::QueueingPolicy;
1991 /// let x = QueuedResource::new().set_queueing_policy(QueueingPolicy::default()/* use setters */);
1992 /// ```
1993 pub fn set_queueing_policy<T>(mut self, v: T) -> Self
1994 where
1995 T: std::convert::Into<crate::model::queued_resource::QueueingPolicy>,
1996 {
1997 self.queueing_policy = std::option::Option::Some(v.into());
1998 self
1999 }
2000
2001 /// Sets or clears the value of [queueing_policy][crate::model::QueuedResource::queueing_policy].
2002 ///
2003 /// # Example
2004 /// ```ignore,no_run
2005 /// # use google_cloud_tpu_v2::model::QueuedResource;
2006 /// use google_cloud_tpu_v2::model::queued_resource::QueueingPolicy;
2007 /// let x = QueuedResource::new().set_or_clear_queueing_policy(Some(QueueingPolicy::default()/* use setters */));
2008 /// let x = QueuedResource::new().set_or_clear_queueing_policy(None::<QueueingPolicy>);
2009 /// ```
2010 pub fn set_or_clear_queueing_policy<T>(mut self, v: std::option::Option<T>) -> Self
2011 where
2012 T: std::convert::Into<crate::model::queued_resource::QueueingPolicy>,
2013 {
2014 self.queueing_policy = v.map(|x| x.into());
2015 self
2016 }
2017
2018 /// Sets the value of [state][crate::model::QueuedResource::state].
2019 ///
2020 /// # Example
2021 /// ```ignore,no_run
2022 /// # use google_cloud_tpu_v2::model::QueuedResource;
2023 /// use google_cloud_tpu_v2::model::QueuedResourceState;
2024 /// let x = QueuedResource::new().set_state(QueuedResourceState::default()/* use setters */);
2025 /// ```
2026 pub fn set_state<T>(mut self, v: T) -> Self
2027 where
2028 T: std::convert::Into<crate::model::QueuedResourceState>,
2029 {
2030 self.state = std::option::Option::Some(v.into());
2031 self
2032 }
2033
2034 /// Sets or clears the value of [state][crate::model::QueuedResource::state].
2035 ///
2036 /// # Example
2037 /// ```ignore,no_run
2038 /// # use google_cloud_tpu_v2::model::QueuedResource;
2039 /// use google_cloud_tpu_v2::model::QueuedResourceState;
2040 /// let x = QueuedResource::new().set_or_clear_state(Some(QueuedResourceState::default()/* use setters */));
2041 /// let x = QueuedResource::new().set_or_clear_state(None::<QueuedResourceState>);
2042 /// ```
2043 pub fn set_or_clear_state<T>(mut self, v: std::option::Option<T>) -> Self
2044 where
2045 T: std::convert::Into<crate::model::QueuedResourceState>,
2046 {
2047 self.state = v.map(|x| x.into());
2048 self
2049 }
2050
2051 /// Sets the value of [reservation_name][crate::model::QueuedResource::reservation_name].
2052 ///
2053 /// # Example
2054 /// ```ignore,no_run
2055 /// # use google_cloud_tpu_v2::model::QueuedResource;
2056 /// let x = QueuedResource::new().set_reservation_name("example");
2057 /// ```
2058 pub fn set_reservation_name<T: std::convert::Into<std::string::String>>(
2059 mut self,
2060 v: T,
2061 ) -> Self {
2062 self.reservation_name = v.into();
2063 self
2064 }
2065
2066 /// Sets the value of [resource][crate::model::QueuedResource::resource].
2067 ///
2068 /// Note that all the setters affecting `resource` are mutually
2069 /// exclusive.
2070 ///
2071 /// # Example
2072 /// ```ignore,no_run
2073 /// # use google_cloud_tpu_v2::model::QueuedResource;
2074 /// use google_cloud_tpu_v2::model::queued_resource::Tpu;
2075 /// let x = QueuedResource::new().set_resource(Some(
2076 /// google_cloud_tpu_v2::model::queued_resource::Resource::Tpu(Tpu::default().into())));
2077 /// ```
2078 pub fn set_resource<
2079 T: std::convert::Into<std::option::Option<crate::model::queued_resource::Resource>>,
2080 >(
2081 mut self,
2082 v: T,
2083 ) -> Self {
2084 self.resource = v.into();
2085 self
2086 }
2087
2088 /// The value of [resource][crate::model::QueuedResource::resource]
2089 /// if it holds a `Tpu`, `None` if the field is not set or
2090 /// holds a different branch.
2091 pub fn tpu(&self) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource::Tpu>> {
2092 #[allow(unreachable_patterns)]
2093 self.resource.as_ref().and_then(|v| match v {
2094 crate::model::queued_resource::Resource::Tpu(v) => std::option::Option::Some(v),
2095 _ => std::option::Option::None,
2096 })
2097 }
2098
2099 /// Sets the value of [resource][crate::model::QueuedResource::resource]
2100 /// to hold a `Tpu`.
2101 ///
2102 /// Note that all the setters affecting `resource` are
2103 /// mutually exclusive.
2104 ///
2105 /// # Example
2106 /// ```ignore,no_run
2107 /// # use google_cloud_tpu_v2::model::QueuedResource;
2108 /// use google_cloud_tpu_v2::model::queued_resource::Tpu;
2109 /// let x = QueuedResource::new().set_tpu(Tpu::default()/* use setters */);
2110 /// assert!(x.tpu().is_some());
2111 /// ```
2112 pub fn set_tpu<T: std::convert::Into<std::boxed::Box<crate::model::queued_resource::Tpu>>>(
2113 mut self,
2114 v: T,
2115 ) -> Self {
2116 self.resource =
2117 std::option::Option::Some(crate::model::queued_resource::Resource::Tpu(v.into()));
2118 self
2119 }
2120
2121 /// Sets the value of [tier][crate::model::QueuedResource::tier].
2122 ///
2123 /// Note that all the setters affecting `tier` are mutually
2124 /// exclusive.
2125 ///
2126 /// # Example
2127 /// ```ignore,no_run
2128 /// # use google_cloud_tpu_v2::model::QueuedResource;
2129 /// use google_cloud_tpu_v2::model::queued_resource::Spot;
2130 /// let x = QueuedResource::new().set_tier(Some(
2131 /// google_cloud_tpu_v2::model::queued_resource::Tier::Spot(Spot::default().into())));
2132 /// ```
2133 pub fn set_tier<
2134 T: std::convert::Into<std::option::Option<crate::model::queued_resource::Tier>>,
2135 >(
2136 mut self,
2137 v: T,
2138 ) -> Self {
2139 self.tier = v.into();
2140 self
2141 }
2142
2143 /// The value of [tier][crate::model::QueuedResource::tier]
2144 /// if it holds a `Spot`, `None` if the field is not set or
2145 /// holds a different branch.
2146 pub fn spot(
2147 &self,
2148 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource::Spot>> {
2149 #[allow(unreachable_patterns)]
2150 self.tier.as_ref().and_then(|v| match v {
2151 crate::model::queued_resource::Tier::Spot(v) => std::option::Option::Some(v),
2152 _ => std::option::Option::None,
2153 })
2154 }
2155
2156 /// Sets the value of [tier][crate::model::QueuedResource::tier]
2157 /// to hold a `Spot`.
2158 ///
2159 /// Note that all the setters affecting `tier` are
2160 /// mutually exclusive.
2161 ///
2162 /// # Example
2163 /// ```ignore,no_run
2164 /// # use google_cloud_tpu_v2::model::QueuedResource;
2165 /// use google_cloud_tpu_v2::model::queued_resource::Spot;
2166 /// let x = QueuedResource::new().set_spot(Spot::default()/* use setters */);
2167 /// assert!(x.spot().is_some());
2168 /// assert!(x.guaranteed().is_none());
2169 /// ```
2170 pub fn set_spot<T: std::convert::Into<std::boxed::Box<crate::model::queued_resource::Spot>>>(
2171 mut self,
2172 v: T,
2173 ) -> Self {
2174 self.tier = std::option::Option::Some(crate::model::queued_resource::Tier::Spot(v.into()));
2175 self
2176 }
2177
2178 /// The value of [tier][crate::model::QueuedResource::tier]
2179 /// if it holds a `Guaranteed`, `None` if the field is not set or
2180 /// holds a different branch.
2181 pub fn guaranteed(
2182 &self,
2183 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource::Guaranteed>> {
2184 #[allow(unreachable_patterns)]
2185 self.tier.as_ref().and_then(|v| match v {
2186 crate::model::queued_resource::Tier::Guaranteed(v) => std::option::Option::Some(v),
2187 _ => std::option::Option::None,
2188 })
2189 }
2190
2191 /// Sets the value of [tier][crate::model::QueuedResource::tier]
2192 /// to hold a `Guaranteed`.
2193 ///
2194 /// Note that all the setters affecting `tier` are
2195 /// mutually exclusive.
2196 ///
2197 /// # Example
2198 /// ```ignore,no_run
2199 /// # use google_cloud_tpu_v2::model::QueuedResource;
2200 /// use google_cloud_tpu_v2::model::queued_resource::Guaranteed;
2201 /// let x = QueuedResource::new().set_guaranteed(Guaranteed::default()/* use setters */);
2202 /// assert!(x.guaranteed().is_some());
2203 /// assert!(x.spot().is_none());
2204 /// ```
2205 pub fn set_guaranteed<
2206 T: std::convert::Into<std::boxed::Box<crate::model::queued_resource::Guaranteed>>,
2207 >(
2208 mut self,
2209 v: T,
2210 ) -> Self {
2211 self.tier =
2212 std::option::Option::Some(crate::model::queued_resource::Tier::Guaranteed(v.into()));
2213 self
2214 }
2215}
2216
2217impl wkt::message::Message for QueuedResource {
2218 fn typename() -> &'static str {
2219 "type.googleapis.com/google.cloud.tpu.v2.QueuedResource"
2220 }
2221}
2222
2223/// Defines additional types related to [QueuedResource].
2224pub mod queued_resource {
2225 #[allow(unused_imports)]
2226 use super::*;
2227
2228 /// Details of the TPU resource(s) being requested.
2229 #[derive(Clone, Default, PartialEq)]
2230 #[non_exhaustive]
2231 pub struct Tpu {
2232 /// Optional. The TPU node(s) being requested.
2233 pub node_spec: std::vec::Vec<crate::model::queued_resource::tpu::NodeSpec>,
2234
2235 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2236 }
2237
2238 impl Tpu {
2239 pub fn new() -> Self {
2240 std::default::Default::default()
2241 }
2242
2243 /// Sets the value of [node_spec][crate::model::queued_resource::Tpu::node_spec].
2244 ///
2245 /// # Example
2246 /// ```ignore,no_run
2247 /// # use google_cloud_tpu_v2::model::queued_resource::Tpu;
2248 /// use google_cloud_tpu_v2::model::queued_resource::tpu::NodeSpec;
2249 /// let x = Tpu::new()
2250 /// .set_node_spec([
2251 /// NodeSpec::default()/* use setters */,
2252 /// NodeSpec::default()/* use (different) setters */,
2253 /// ]);
2254 /// ```
2255 pub fn set_node_spec<T, V>(mut self, v: T) -> Self
2256 where
2257 T: std::iter::IntoIterator<Item = V>,
2258 V: std::convert::Into<crate::model::queued_resource::tpu::NodeSpec>,
2259 {
2260 use std::iter::Iterator;
2261 self.node_spec = v.into_iter().map(|i| i.into()).collect();
2262 self
2263 }
2264 }
2265
2266 impl wkt::message::Message for Tpu {
2267 fn typename() -> &'static str {
2268 "type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Tpu"
2269 }
2270 }
2271
2272 /// Defines additional types related to [Tpu].
2273 pub mod tpu {
2274 #[allow(unused_imports)]
2275 use super::*;
2276
2277 /// Details of the TPU node(s) being requested. Users can request either a
2278 /// single node or multiple nodes.
2279 /// NodeSpec provides the specification for node(s) to be created.
2280 #[derive(Clone, Default, PartialEq)]
2281 #[non_exhaustive]
2282 pub struct NodeSpec {
2283 /// Required. The parent resource name.
2284 pub parent: std::string::String,
2285
2286 /// Required. The node.
2287 pub node: std::option::Option<crate::model::Node>,
2288
2289 /// Either a node_id or multislice_params.
2290 pub name_strategy:
2291 std::option::Option<crate::model::queued_resource::tpu::node_spec::NameStrategy>,
2292
2293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2294 }
2295
2296 impl NodeSpec {
2297 pub fn new() -> Self {
2298 std::default::Default::default()
2299 }
2300
2301 /// Sets the value of [parent][crate::model::queued_resource::tpu::NodeSpec::parent].
2302 ///
2303 /// # Example
2304 /// ```ignore,no_run
2305 /// # use google_cloud_tpu_v2::model::queued_resource::tpu::NodeSpec;
2306 /// let x = NodeSpec::new().set_parent("example");
2307 /// ```
2308 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2309 self.parent = v.into();
2310 self
2311 }
2312
2313 /// Sets the value of [node][crate::model::queued_resource::tpu::NodeSpec::node].
2314 ///
2315 /// # Example
2316 /// ```ignore,no_run
2317 /// # use google_cloud_tpu_v2::model::queued_resource::tpu::NodeSpec;
2318 /// use google_cloud_tpu_v2::model::Node;
2319 /// let x = NodeSpec::new().set_node(Node::default()/* use setters */);
2320 /// ```
2321 pub fn set_node<T>(mut self, v: T) -> Self
2322 where
2323 T: std::convert::Into<crate::model::Node>,
2324 {
2325 self.node = std::option::Option::Some(v.into());
2326 self
2327 }
2328
2329 /// Sets or clears the value of [node][crate::model::queued_resource::tpu::NodeSpec::node].
2330 ///
2331 /// # Example
2332 /// ```ignore,no_run
2333 /// # use google_cloud_tpu_v2::model::queued_resource::tpu::NodeSpec;
2334 /// use google_cloud_tpu_v2::model::Node;
2335 /// let x = NodeSpec::new().set_or_clear_node(Some(Node::default()/* use setters */));
2336 /// let x = NodeSpec::new().set_or_clear_node(None::<Node>);
2337 /// ```
2338 pub fn set_or_clear_node<T>(mut self, v: std::option::Option<T>) -> Self
2339 where
2340 T: std::convert::Into<crate::model::Node>,
2341 {
2342 self.node = v.map(|x| x.into());
2343 self
2344 }
2345
2346 /// Sets the value of [name_strategy][crate::model::queued_resource::tpu::NodeSpec::name_strategy].
2347 ///
2348 /// Note that all the setters affecting `name_strategy` are mutually
2349 /// exclusive.
2350 ///
2351 /// # Example
2352 /// ```ignore,no_run
2353 /// # use google_cloud_tpu_v2::model::queued_resource::tpu::NodeSpec;
2354 /// use google_cloud_tpu_v2::model::queued_resource::tpu::node_spec::NameStrategy;
2355 /// let x = NodeSpec::new().set_name_strategy(Some(NameStrategy::NodeId("example".to_string())));
2356 /// ```
2357 pub fn set_name_strategy<
2358 T: std::convert::Into<
2359 std::option::Option<
2360 crate::model::queued_resource::tpu::node_spec::NameStrategy,
2361 >,
2362 >,
2363 >(
2364 mut self,
2365 v: T,
2366 ) -> Self {
2367 self.name_strategy = v.into();
2368 self
2369 }
2370
2371 /// The value of [name_strategy][crate::model::queued_resource::tpu::NodeSpec::name_strategy]
2372 /// if it holds a `NodeId`, `None` if the field is not set or
2373 /// holds a different branch.
2374 pub fn node_id(&self) -> std::option::Option<&std::string::String> {
2375 #[allow(unreachable_patterns)]
2376 self.name_strategy.as_ref().and_then(|v| match v {
2377 crate::model::queued_resource::tpu::node_spec::NameStrategy::NodeId(v) => {
2378 std::option::Option::Some(v)
2379 }
2380 _ => std::option::Option::None,
2381 })
2382 }
2383
2384 /// Sets the value of [name_strategy][crate::model::queued_resource::tpu::NodeSpec::name_strategy]
2385 /// to hold a `NodeId`.
2386 ///
2387 /// Note that all the setters affecting `name_strategy` are
2388 /// mutually exclusive.
2389 ///
2390 /// # Example
2391 /// ```ignore,no_run
2392 /// # use google_cloud_tpu_v2::model::queued_resource::tpu::NodeSpec;
2393 /// let x = NodeSpec::new().set_node_id("example");
2394 /// assert!(x.node_id().is_some());
2395 /// assert!(x.multislice_params().is_none());
2396 /// ```
2397 pub fn set_node_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2398 self.name_strategy = std::option::Option::Some(
2399 crate::model::queued_resource::tpu::node_spec::NameStrategy::NodeId(v.into()),
2400 );
2401 self
2402 }
2403
2404 /// The value of [name_strategy][crate::model::queued_resource::tpu::NodeSpec::name_strategy]
2405 /// if it holds a `MultisliceParams`, `None` if the field is not set or
2406 /// holds a different branch.
2407 pub fn multislice_params(
2408 &self,
2409 ) -> std::option::Option<
2410 &std::boxed::Box<crate::model::queued_resource::tpu::node_spec::MultisliceParams>,
2411 > {
2412 #[allow(unreachable_patterns)]
2413 self.name_strategy.as_ref().and_then(|v| match v {
2414 crate::model::queued_resource::tpu::node_spec::NameStrategy::MultisliceParams(v) => std::option::Option::Some(v),
2415 _ => std::option::Option::None,
2416 })
2417 }
2418
2419 /// Sets the value of [name_strategy][crate::model::queued_resource::tpu::NodeSpec::name_strategy]
2420 /// to hold a `MultisliceParams`.
2421 ///
2422 /// Note that all the setters affecting `name_strategy` are
2423 /// mutually exclusive.
2424 ///
2425 /// # Example
2426 /// ```ignore,no_run
2427 /// # use google_cloud_tpu_v2::model::queued_resource::tpu::NodeSpec;
2428 /// use google_cloud_tpu_v2::model::queued_resource::tpu::node_spec::MultisliceParams;
2429 /// let x = NodeSpec::new().set_multislice_params(MultisliceParams::default()/* use setters */);
2430 /// assert!(x.multislice_params().is_some());
2431 /// assert!(x.node_id().is_none());
2432 /// ```
2433 pub fn set_multislice_params<
2434 T: std::convert::Into<
2435 std::boxed::Box<
2436 crate::model::queued_resource::tpu::node_spec::MultisliceParams,
2437 >,
2438 >,
2439 >(
2440 mut self,
2441 v: T,
2442 ) -> Self {
2443 self.name_strategy = std::option::Option::Some(
2444 crate::model::queued_resource::tpu::node_spec::NameStrategy::MultisliceParams(
2445 v.into(),
2446 ),
2447 );
2448 self
2449 }
2450 }
2451
2452 impl wkt::message::Message for NodeSpec {
2453 fn typename() -> &'static str {
2454 "type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Tpu.NodeSpec"
2455 }
2456 }
2457
2458 /// Defines additional types related to [NodeSpec].
2459 pub mod node_spec {
2460 #[allow(unused_imports)]
2461 use super::*;
2462
2463 /// Parameters to specify for multislice QueuedResource requests. This
2464 /// message must be populated in case of multislice requests instead of
2465 /// node_id.
2466 #[derive(Clone, Default, PartialEq)]
2467 #[non_exhaustive]
2468 pub struct MultisliceParams {
2469 /// Required. Number of nodes with this spec. The system will attempt
2470 /// to provision "node_count" nodes as part of the request.
2471 /// This needs to be > 1.
2472 pub node_count: i32,
2473
2474 /// Optional. Prefix of node_ids in case of multislice request.
2475 /// Should follow the `^[A-Za-z0-9_.~+%-]+$` regex format.
2476 /// If node_count = 3 and node_id_prefix = "np", node ids of nodes
2477 /// created will be "np-0", "np-1", "np-2". If this field is not
2478 /// provided we use queued_resource_id as the node_id_prefix.
2479 pub node_id_prefix: std::string::String,
2480
2481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2482 }
2483
2484 impl MultisliceParams {
2485 pub fn new() -> Self {
2486 std::default::Default::default()
2487 }
2488
2489 /// Sets the value of [node_count][crate::model::queued_resource::tpu::node_spec::MultisliceParams::node_count].
2490 ///
2491 /// # Example
2492 /// ```ignore,no_run
2493 /// # use google_cloud_tpu_v2::model::queued_resource::tpu::node_spec::MultisliceParams;
2494 /// let x = MultisliceParams::new().set_node_count(42);
2495 /// ```
2496 pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2497 self.node_count = v.into();
2498 self
2499 }
2500
2501 /// Sets the value of [node_id_prefix][crate::model::queued_resource::tpu::node_spec::MultisliceParams::node_id_prefix].
2502 ///
2503 /// # Example
2504 /// ```ignore,no_run
2505 /// # use google_cloud_tpu_v2::model::queued_resource::tpu::node_spec::MultisliceParams;
2506 /// let x = MultisliceParams::new().set_node_id_prefix("example");
2507 /// ```
2508 pub fn set_node_id_prefix<T: std::convert::Into<std::string::String>>(
2509 mut self,
2510 v: T,
2511 ) -> Self {
2512 self.node_id_prefix = v.into();
2513 self
2514 }
2515 }
2516
2517 impl wkt::message::Message for MultisliceParams {
2518 fn typename() -> &'static str {
2519 "type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Tpu.NodeSpec.MultisliceParams"
2520 }
2521 }
2522
2523 /// Either a node_id or multislice_params.
2524 #[derive(Clone, Debug, PartialEq)]
2525 #[non_exhaustive]
2526 pub enum NameStrategy {
2527 /// Optional. The unqualified resource name. Should follow the
2528 /// `^[A-Za-z0-9_.~+%-]+$` regex format. This is only specified when
2529 /// requesting a single node. In case of multislice requests,
2530 /// multislice_params must be populated instead.
2531 NodeId(std::string::String),
2532 /// Optional. Fields to specify in case of multislice request.
2533 MultisliceParams(
2534 std::boxed::Box<
2535 crate::model::queued_resource::tpu::node_spec::MultisliceParams,
2536 >,
2537 ),
2538 }
2539 }
2540 }
2541
2542 /// Spot tier definition.
2543 #[derive(Clone, Default, PartialEq)]
2544 #[non_exhaustive]
2545 pub struct Spot {
2546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2547 }
2548
2549 impl Spot {
2550 pub fn new() -> Self {
2551 std::default::Default::default()
2552 }
2553 }
2554
2555 impl wkt::message::Message for Spot {
2556 fn typename() -> &'static str {
2557 "type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Spot"
2558 }
2559 }
2560
2561 /// Guaranteed tier definition.
2562 #[derive(Clone, Default, PartialEq)]
2563 #[non_exhaustive]
2564 pub struct Guaranteed {
2565 /// Optional. Defines the minimum duration of the guarantee. If specified,
2566 /// the requested resources will only be provisioned if they can be
2567 /// allocated for at least the given duration.
2568 pub min_duration: std::option::Option<wkt::Duration>,
2569
2570 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2571 }
2572
2573 impl Guaranteed {
2574 pub fn new() -> Self {
2575 std::default::Default::default()
2576 }
2577
2578 /// Sets the value of [min_duration][crate::model::queued_resource::Guaranteed::min_duration].
2579 ///
2580 /// # Example
2581 /// ```ignore,no_run
2582 /// # use google_cloud_tpu_v2::model::queued_resource::Guaranteed;
2583 /// use wkt::Duration;
2584 /// let x = Guaranteed::new().set_min_duration(Duration::default()/* use setters */);
2585 /// ```
2586 pub fn set_min_duration<T>(mut self, v: T) -> Self
2587 where
2588 T: std::convert::Into<wkt::Duration>,
2589 {
2590 self.min_duration = std::option::Option::Some(v.into());
2591 self
2592 }
2593
2594 /// Sets or clears the value of [min_duration][crate::model::queued_resource::Guaranteed::min_duration].
2595 ///
2596 /// # Example
2597 /// ```ignore,no_run
2598 /// # use google_cloud_tpu_v2::model::queued_resource::Guaranteed;
2599 /// use wkt::Duration;
2600 /// let x = Guaranteed::new().set_or_clear_min_duration(Some(Duration::default()/* use setters */));
2601 /// let x = Guaranteed::new().set_or_clear_min_duration(None::<Duration>);
2602 /// ```
2603 pub fn set_or_clear_min_duration<T>(mut self, v: std::option::Option<T>) -> Self
2604 where
2605 T: std::convert::Into<wkt::Duration>,
2606 {
2607 self.min_duration = v.map(|x| x.into());
2608 self
2609 }
2610 }
2611
2612 impl wkt::message::Message for Guaranteed {
2613 fn typename() -> &'static str {
2614 "type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Guaranteed"
2615 }
2616 }
2617
2618 /// Defines the policy of the QueuedRequest.
2619 #[derive(Clone, Default, PartialEq)]
2620 #[non_exhaustive]
2621 pub struct QueueingPolicy {
2622 /// Time flexibility specification.
2623 pub start_timing_constraints: std::option::Option<
2624 crate::model::queued_resource::queueing_policy::StartTimingConstraints,
2625 >,
2626
2627 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2628 }
2629
2630 impl QueueingPolicy {
2631 pub fn new() -> Self {
2632 std::default::Default::default()
2633 }
2634
2635 /// Sets the value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints].
2636 ///
2637 /// Note that all the setters affecting `start_timing_constraints` are mutually
2638 /// exclusive.
2639 ///
2640 /// # Example
2641 /// ```ignore,no_run
2642 /// # use google_cloud_tpu_v2::model::queued_resource::QueueingPolicy;
2643 /// use wkt::Duration;
2644 /// let x = QueueingPolicy::new().set_start_timing_constraints(Some(
2645 /// google_cloud_tpu_v2::model::queued_resource::queueing_policy::StartTimingConstraints::ValidUntilDuration(Duration::default().into())));
2646 /// ```
2647 pub fn set_start_timing_constraints<
2648 T: std::convert::Into<
2649 std::option::Option<
2650 crate::model::queued_resource::queueing_policy::StartTimingConstraints,
2651 >,
2652 >,
2653 >(
2654 mut self,
2655 v: T,
2656 ) -> Self {
2657 self.start_timing_constraints = v.into();
2658 self
2659 }
2660
2661 /// The value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2662 /// if it holds a `ValidUntilDuration`, `None` if the field is not set or
2663 /// holds a different branch.
2664 pub fn valid_until_duration(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
2665 #[allow(unreachable_patterns)]
2666 self.start_timing_constraints.as_ref().and_then(|v| match v {
2667 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidUntilDuration(v) => std::option::Option::Some(v),
2668 _ => std::option::Option::None,
2669 })
2670 }
2671
2672 /// Sets the value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2673 /// to hold a `ValidUntilDuration`.
2674 ///
2675 /// Note that all the setters affecting `start_timing_constraints` are
2676 /// mutually exclusive.
2677 ///
2678 /// # Example
2679 /// ```ignore,no_run
2680 /// # use google_cloud_tpu_v2::model::queued_resource::QueueingPolicy;
2681 /// use wkt::Duration;
2682 /// let x = QueueingPolicy::new().set_valid_until_duration(Duration::default()/* use setters */);
2683 /// assert!(x.valid_until_duration().is_some());
2684 /// assert!(x.valid_until_time().is_none());
2685 /// assert!(x.valid_after_duration().is_none());
2686 /// assert!(x.valid_after_time().is_none());
2687 /// assert!(x.valid_interval().is_none());
2688 /// ```
2689 pub fn set_valid_until_duration<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
2690 mut self,
2691 v: T,
2692 ) -> Self {
2693 self.start_timing_constraints = std::option::Option::Some(
2694 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidUntilDuration(
2695 v.into()
2696 )
2697 );
2698 self
2699 }
2700
2701 /// The value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2702 /// if it holds a `ValidUntilTime`, `None` if the field is not set or
2703 /// holds a different branch.
2704 pub fn valid_until_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
2705 #[allow(unreachable_patterns)]
2706 self.start_timing_constraints.as_ref().and_then(|v| match v {
2707 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidUntilTime(v) => std::option::Option::Some(v),
2708 _ => std::option::Option::None,
2709 })
2710 }
2711
2712 /// Sets the value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2713 /// to hold a `ValidUntilTime`.
2714 ///
2715 /// Note that all the setters affecting `start_timing_constraints` are
2716 /// mutually exclusive.
2717 ///
2718 /// # Example
2719 /// ```ignore,no_run
2720 /// # use google_cloud_tpu_v2::model::queued_resource::QueueingPolicy;
2721 /// use wkt::Timestamp;
2722 /// let x = QueueingPolicy::new().set_valid_until_time(Timestamp::default()/* use setters */);
2723 /// assert!(x.valid_until_time().is_some());
2724 /// assert!(x.valid_until_duration().is_none());
2725 /// assert!(x.valid_after_duration().is_none());
2726 /// assert!(x.valid_after_time().is_none());
2727 /// assert!(x.valid_interval().is_none());
2728 /// ```
2729 pub fn set_valid_until_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2730 mut self,
2731 v: T,
2732 ) -> Self {
2733 self.start_timing_constraints = std::option::Option::Some(
2734 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidUntilTime(
2735 v.into()
2736 )
2737 );
2738 self
2739 }
2740
2741 /// The value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2742 /// if it holds a `ValidAfterDuration`, `None` if the field is not set or
2743 /// holds a different branch.
2744 pub fn valid_after_duration(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
2745 #[allow(unreachable_patterns)]
2746 self.start_timing_constraints.as_ref().and_then(|v| match v {
2747 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidAfterDuration(v) => std::option::Option::Some(v),
2748 _ => std::option::Option::None,
2749 })
2750 }
2751
2752 /// Sets the value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2753 /// to hold a `ValidAfterDuration`.
2754 ///
2755 /// Note that all the setters affecting `start_timing_constraints` are
2756 /// mutually exclusive.
2757 ///
2758 /// # Example
2759 /// ```ignore,no_run
2760 /// # use google_cloud_tpu_v2::model::queued_resource::QueueingPolicy;
2761 /// use wkt::Duration;
2762 /// let x = QueueingPolicy::new().set_valid_after_duration(Duration::default()/* use setters */);
2763 /// assert!(x.valid_after_duration().is_some());
2764 /// assert!(x.valid_until_duration().is_none());
2765 /// assert!(x.valid_until_time().is_none());
2766 /// assert!(x.valid_after_time().is_none());
2767 /// assert!(x.valid_interval().is_none());
2768 /// ```
2769 pub fn set_valid_after_duration<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
2770 mut self,
2771 v: T,
2772 ) -> Self {
2773 self.start_timing_constraints = std::option::Option::Some(
2774 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidAfterDuration(
2775 v.into()
2776 )
2777 );
2778 self
2779 }
2780
2781 /// The value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2782 /// if it holds a `ValidAfterTime`, `None` if the field is not set or
2783 /// holds a different branch.
2784 pub fn valid_after_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
2785 #[allow(unreachable_patterns)]
2786 self.start_timing_constraints.as_ref().and_then(|v| match v {
2787 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidAfterTime(v) => std::option::Option::Some(v),
2788 _ => std::option::Option::None,
2789 })
2790 }
2791
2792 /// Sets the value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2793 /// to hold a `ValidAfterTime`.
2794 ///
2795 /// Note that all the setters affecting `start_timing_constraints` are
2796 /// mutually exclusive.
2797 ///
2798 /// # Example
2799 /// ```ignore,no_run
2800 /// # use google_cloud_tpu_v2::model::queued_resource::QueueingPolicy;
2801 /// use wkt::Timestamp;
2802 /// let x = QueueingPolicy::new().set_valid_after_time(Timestamp::default()/* use setters */);
2803 /// assert!(x.valid_after_time().is_some());
2804 /// assert!(x.valid_until_duration().is_none());
2805 /// assert!(x.valid_until_time().is_none());
2806 /// assert!(x.valid_after_duration().is_none());
2807 /// assert!(x.valid_interval().is_none());
2808 /// ```
2809 pub fn set_valid_after_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2810 mut self,
2811 v: T,
2812 ) -> Self {
2813 self.start_timing_constraints = std::option::Option::Some(
2814 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidAfterTime(
2815 v.into()
2816 )
2817 );
2818 self
2819 }
2820
2821 /// The value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2822 /// if it holds a `ValidInterval`, `None` if the field is not set or
2823 /// holds a different branch.
2824 pub fn valid_interval(
2825 &self,
2826 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Interval>> {
2827 #[allow(unreachable_patterns)]
2828 self.start_timing_constraints.as_ref().and_then(|v| match v {
2829 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidInterval(v) => std::option::Option::Some(v),
2830 _ => std::option::Option::None,
2831 })
2832 }
2833
2834 /// Sets the value of [start_timing_constraints][crate::model::queued_resource::QueueingPolicy::start_timing_constraints]
2835 /// to hold a `ValidInterval`.
2836 ///
2837 /// Note that all the setters affecting `start_timing_constraints` are
2838 /// mutually exclusive.
2839 ///
2840 /// # Example
2841 /// ```ignore,no_run
2842 /// # use google_cloud_tpu_v2::model::queued_resource::QueueingPolicy;
2843 /// use google_cloud_type::model::Interval;
2844 /// let x = QueueingPolicy::new().set_valid_interval(Interval::default()/* use setters */);
2845 /// assert!(x.valid_interval().is_some());
2846 /// assert!(x.valid_until_duration().is_none());
2847 /// assert!(x.valid_until_time().is_none());
2848 /// assert!(x.valid_after_duration().is_none());
2849 /// assert!(x.valid_after_time().is_none());
2850 /// ```
2851 pub fn set_valid_interval<
2852 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Interval>>,
2853 >(
2854 mut self,
2855 v: T,
2856 ) -> Self {
2857 self.start_timing_constraints = std::option::Option::Some(
2858 crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidInterval(
2859 v.into()
2860 )
2861 );
2862 self
2863 }
2864 }
2865
2866 impl wkt::message::Message for QueueingPolicy {
2867 fn typename() -> &'static str {
2868 "type.googleapis.com/google.cloud.tpu.v2.QueuedResource.QueueingPolicy"
2869 }
2870 }
2871
2872 /// Defines additional types related to [QueueingPolicy].
2873 pub mod queueing_policy {
2874 #[allow(unused_imports)]
2875 use super::*;
2876
2877 /// Time flexibility specification.
2878 #[derive(Clone, Debug, PartialEq)]
2879 #[non_exhaustive]
2880 pub enum StartTimingConstraints {
2881 /// Optional. A relative time after which resources should not be created.
2882 /// If the request cannot be fulfilled by this time the request will be
2883 /// failed.
2884 ValidUntilDuration(std::boxed::Box<wkt::Duration>),
2885 /// Optional. An absolute time after which resources should not be created.
2886 /// If the request cannot be fulfilled by this time the request will be
2887 /// failed.
2888 ValidUntilTime(std::boxed::Box<wkt::Timestamp>),
2889 /// Optional. A relative time after which resources may be created.
2890 ValidAfterDuration(std::boxed::Box<wkt::Duration>),
2891 /// Optional. An absolute time after which resources may be created.
2892 ValidAfterTime(std::boxed::Box<wkt::Timestamp>),
2893 /// Optional. An absolute time interval within which resources may be
2894 /// created.
2895 ValidInterval(std::boxed::Box<google_cloud_type::model::Interval>),
2896 }
2897 }
2898
2899 /// Resource specification.
2900 #[derive(Clone, Debug, PartialEq)]
2901 #[non_exhaustive]
2902 pub enum Resource {
2903 /// Optional. Defines a TPU resource.
2904 Tpu(std::boxed::Box<crate::model::queued_resource::Tpu>),
2905 }
2906
2907 /// Tier specifies the required tier.
2908 #[derive(Clone, Debug, PartialEq)]
2909 #[non_exhaustive]
2910 pub enum Tier {
2911 /// Optional. The Spot tier.
2912 Spot(std::boxed::Box<crate::model::queued_resource::Spot>),
2913 /// Optional. The Guaranteed tier
2914 Guaranteed(std::boxed::Box<crate::model::queued_resource::Guaranteed>),
2915 }
2916}
2917
2918/// QueuedResourceState defines the details of the QueuedResource request.
2919#[derive(Clone, Default, PartialEq)]
2920#[non_exhaustive]
2921pub struct QueuedResourceState {
2922 /// Output only. State of the QueuedResource request.
2923 pub state: crate::model::queued_resource_state::State,
2924
2925 /// Output only. The initiator of the QueuedResources's current state. Used to
2926 /// indicate whether the SUSPENDING/SUSPENDED state was initiated by the user
2927 /// or the service.
2928 pub state_initiator: crate::model::queued_resource_state::StateInitiator,
2929
2930 /// Further data for the state.
2931 pub state_data: std::option::Option<crate::model::queued_resource_state::StateData>,
2932
2933 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2934}
2935
2936impl QueuedResourceState {
2937 pub fn new() -> Self {
2938 std::default::Default::default()
2939 }
2940
2941 /// Sets the value of [state][crate::model::QueuedResourceState::state].
2942 ///
2943 /// # Example
2944 /// ```ignore,no_run
2945 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
2946 /// use google_cloud_tpu_v2::model::queued_resource_state::State;
2947 /// let x0 = QueuedResourceState::new().set_state(State::Creating);
2948 /// let x1 = QueuedResourceState::new().set_state(State::Accepted);
2949 /// let x2 = QueuedResourceState::new().set_state(State::Provisioning);
2950 /// ```
2951 pub fn set_state<T: std::convert::Into<crate::model::queued_resource_state::State>>(
2952 mut self,
2953 v: T,
2954 ) -> Self {
2955 self.state = v.into();
2956 self
2957 }
2958
2959 /// Sets the value of [state_initiator][crate::model::QueuedResourceState::state_initiator].
2960 ///
2961 /// # Example
2962 /// ```ignore,no_run
2963 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
2964 /// use google_cloud_tpu_v2::model::queued_resource_state::StateInitiator;
2965 /// let x0 = QueuedResourceState::new().set_state_initiator(StateInitiator::User);
2966 /// let x1 = QueuedResourceState::new().set_state_initiator(StateInitiator::Service);
2967 /// ```
2968 pub fn set_state_initiator<
2969 T: std::convert::Into<crate::model::queued_resource_state::StateInitiator>,
2970 >(
2971 mut self,
2972 v: T,
2973 ) -> Self {
2974 self.state_initiator = v.into();
2975 self
2976 }
2977
2978 /// Sets the value of [state_data][crate::model::QueuedResourceState::state_data].
2979 ///
2980 /// Note that all the setters affecting `state_data` are mutually
2981 /// exclusive.
2982 ///
2983 /// # Example
2984 /// ```ignore,no_run
2985 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
2986 /// use google_cloud_tpu_v2::model::queued_resource_state::CreatingData;
2987 /// let x = QueuedResourceState::new().set_state_data(Some(
2988 /// google_cloud_tpu_v2::model::queued_resource_state::StateData::CreatingData(CreatingData::default().into())));
2989 /// ```
2990 pub fn set_state_data<
2991 T: std::convert::Into<std::option::Option<crate::model::queued_resource_state::StateData>>,
2992 >(
2993 mut self,
2994 v: T,
2995 ) -> Self {
2996 self.state_data = v.into();
2997 self
2998 }
2999
3000 /// The value of [state_data][crate::model::QueuedResourceState::state_data]
3001 /// if it holds a `CreatingData`, `None` if the field is not set or
3002 /// holds a different branch.
3003 pub fn creating_data(
3004 &self,
3005 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::CreatingData>>
3006 {
3007 #[allow(unreachable_patterns)]
3008 self.state_data.as_ref().and_then(|v| match v {
3009 crate::model::queued_resource_state::StateData::CreatingData(v) => {
3010 std::option::Option::Some(v)
3011 }
3012 _ => std::option::Option::None,
3013 })
3014 }
3015
3016 /// Sets the value of [state_data][crate::model::QueuedResourceState::state_data]
3017 /// to hold a `CreatingData`.
3018 ///
3019 /// Note that all the setters affecting `state_data` are
3020 /// mutually exclusive.
3021 ///
3022 /// # Example
3023 /// ```ignore,no_run
3024 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
3025 /// use google_cloud_tpu_v2::model::queued_resource_state::CreatingData;
3026 /// let x = QueuedResourceState::new().set_creating_data(CreatingData::default()/* use setters */);
3027 /// assert!(x.creating_data().is_some());
3028 /// assert!(x.accepted_data().is_none());
3029 /// assert!(x.provisioning_data().is_none());
3030 /// assert!(x.failed_data().is_none());
3031 /// assert!(x.deleting_data().is_none());
3032 /// assert!(x.active_data().is_none());
3033 /// assert!(x.suspending_data().is_none());
3034 /// assert!(x.suspended_data().is_none());
3035 /// ```
3036 pub fn set_creating_data<
3037 T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::CreatingData>>,
3038 >(
3039 mut self,
3040 v: T,
3041 ) -> Self {
3042 self.state_data = std::option::Option::Some(
3043 crate::model::queued_resource_state::StateData::CreatingData(v.into()),
3044 );
3045 self
3046 }
3047
3048 /// The value of [state_data][crate::model::QueuedResourceState::state_data]
3049 /// if it holds a `AcceptedData`, `None` if the field is not set or
3050 /// holds a different branch.
3051 pub fn accepted_data(
3052 &self,
3053 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::AcceptedData>>
3054 {
3055 #[allow(unreachable_patterns)]
3056 self.state_data.as_ref().and_then(|v| match v {
3057 crate::model::queued_resource_state::StateData::AcceptedData(v) => {
3058 std::option::Option::Some(v)
3059 }
3060 _ => std::option::Option::None,
3061 })
3062 }
3063
3064 /// Sets the value of [state_data][crate::model::QueuedResourceState::state_data]
3065 /// to hold a `AcceptedData`.
3066 ///
3067 /// Note that all the setters affecting `state_data` are
3068 /// mutually exclusive.
3069 ///
3070 /// # Example
3071 /// ```ignore,no_run
3072 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
3073 /// use google_cloud_tpu_v2::model::queued_resource_state::AcceptedData;
3074 /// let x = QueuedResourceState::new().set_accepted_data(AcceptedData::default()/* use setters */);
3075 /// assert!(x.accepted_data().is_some());
3076 /// assert!(x.creating_data().is_none());
3077 /// assert!(x.provisioning_data().is_none());
3078 /// assert!(x.failed_data().is_none());
3079 /// assert!(x.deleting_data().is_none());
3080 /// assert!(x.active_data().is_none());
3081 /// assert!(x.suspending_data().is_none());
3082 /// assert!(x.suspended_data().is_none());
3083 /// ```
3084 pub fn set_accepted_data<
3085 T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::AcceptedData>>,
3086 >(
3087 mut self,
3088 v: T,
3089 ) -> Self {
3090 self.state_data = std::option::Option::Some(
3091 crate::model::queued_resource_state::StateData::AcceptedData(v.into()),
3092 );
3093 self
3094 }
3095
3096 /// The value of [state_data][crate::model::QueuedResourceState::state_data]
3097 /// if it holds a `ProvisioningData`, `None` if the field is not set or
3098 /// holds a different branch.
3099 pub fn provisioning_data(
3100 &self,
3101 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::ProvisioningData>>
3102 {
3103 #[allow(unreachable_patterns)]
3104 self.state_data.as_ref().and_then(|v| match v {
3105 crate::model::queued_resource_state::StateData::ProvisioningData(v) => {
3106 std::option::Option::Some(v)
3107 }
3108 _ => std::option::Option::None,
3109 })
3110 }
3111
3112 /// Sets the value of [state_data][crate::model::QueuedResourceState::state_data]
3113 /// to hold a `ProvisioningData`.
3114 ///
3115 /// Note that all the setters affecting `state_data` are
3116 /// mutually exclusive.
3117 ///
3118 /// # Example
3119 /// ```ignore,no_run
3120 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
3121 /// use google_cloud_tpu_v2::model::queued_resource_state::ProvisioningData;
3122 /// let x = QueuedResourceState::new().set_provisioning_data(ProvisioningData::default()/* use setters */);
3123 /// assert!(x.provisioning_data().is_some());
3124 /// assert!(x.creating_data().is_none());
3125 /// assert!(x.accepted_data().is_none());
3126 /// assert!(x.failed_data().is_none());
3127 /// assert!(x.deleting_data().is_none());
3128 /// assert!(x.active_data().is_none());
3129 /// assert!(x.suspending_data().is_none());
3130 /// assert!(x.suspended_data().is_none());
3131 /// ```
3132 pub fn set_provisioning_data<
3133 T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::ProvisioningData>>,
3134 >(
3135 mut self,
3136 v: T,
3137 ) -> Self {
3138 self.state_data = std::option::Option::Some(
3139 crate::model::queued_resource_state::StateData::ProvisioningData(v.into()),
3140 );
3141 self
3142 }
3143
3144 /// The value of [state_data][crate::model::QueuedResourceState::state_data]
3145 /// if it holds a `FailedData`, `None` if the field is not set or
3146 /// holds a different branch.
3147 pub fn failed_data(
3148 &self,
3149 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::FailedData>>
3150 {
3151 #[allow(unreachable_patterns)]
3152 self.state_data.as_ref().and_then(|v| match v {
3153 crate::model::queued_resource_state::StateData::FailedData(v) => {
3154 std::option::Option::Some(v)
3155 }
3156 _ => std::option::Option::None,
3157 })
3158 }
3159
3160 /// Sets the value of [state_data][crate::model::QueuedResourceState::state_data]
3161 /// to hold a `FailedData`.
3162 ///
3163 /// Note that all the setters affecting `state_data` are
3164 /// mutually exclusive.
3165 ///
3166 /// # Example
3167 /// ```ignore,no_run
3168 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
3169 /// use google_cloud_tpu_v2::model::queued_resource_state::FailedData;
3170 /// let x = QueuedResourceState::new().set_failed_data(FailedData::default()/* use setters */);
3171 /// assert!(x.failed_data().is_some());
3172 /// assert!(x.creating_data().is_none());
3173 /// assert!(x.accepted_data().is_none());
3174 /// assert!(x.provisioning_data().is_none());
3175 /// assert!(x.deleting_data().is_none());
3176 /// assert!(x.active_data().is_none());
3177 /// assert!(x.suspending_data().is_none());
3178 /// assert!(x.suspended_data().is_none());
3179 /// ```
3180 pub fn set_failed_data<
3181 T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::FailedData>>,
3182 >(
3183 mut self,
3184 v: T,
3185 ) -> Self {
3186 self.state_data = std::option::Option::Some(
3187 crate::model::queued_resource_state::StateData::FailedData(v.into()),
3188 );
3189 self
3190 }
3191
3192 /// The value of [state_data][crate::model::QueuedResourceState::state_data]
3193 /// if it holds a `DeletingData`, `None` if the field is not set or
3194 /// holds a different branch.
3195 pub fn deleting_data(
3196 &self,
3197 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::DeletingData>>
3198 {
3199 #[allow(unreachable_patterns)]
3200 self.state_data.as_ref().and_then(|v| match v {
3201 crate::model::queued_resource_state::StateData::DeletingData(v) => {
3202 std::option::Option::Some(v)
3203 }
3204 _ => std::option::Option::None,
3205 })
3206 }
3207
3208 /// Sets the value of [state_data][crate::model::QueuedResourceState::state_data]
3209 /// to hold a `DeletingData`.
3210 ///
3211 /// Note that all the setters affecting `state_data` are
3212 /// mutually exclusive.
3213 ///
3214 /// # Example
3215 /// ```ignore,no_run
3216 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
3217 /// use google_cloud_tpu_v2::model::queued_resource_state::DeletingData;
3218 /// let x = QueuedResourceState::new().set_deleting_data(DeletingData::default()/* use setters */);
3219 /// assert!(x.deleting_data().is_some());
3220 /// assert!(x.creating_data().is_none());
3221 /// assert!(x.accepted_data().is_none());
3222 /// assert!(x.provisioning_data().is_none());
3223 /// assert!(x.failed_data().is_none());
3224 /// assert!(x.active_data().is_none());
3225 /// assert!(x.suspending_data().is_none());
3226 /// assert!(x.suspended_data().is_none());
3227 /// ```
3228 pub fn set_deleting_data<
3229 T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::DeletingData>>,
3230 >(
3231 mut self,
3232 v: T,
3233 ) -> Self {
3234 self.state_data = std::option::Option::Some(
3235 crate::model::queued_resource_state::StateData::DeletingData(v.into()),
3236 );
3237 self
3238 }
3239
3240 /// The value of [state_data][crate::model::QueuedResourceState::state_data]
3241 /// if it holds a `ActiveData`, `None` if the field is not set or
3242 /// holds a different branch.
3243 pub fn active_data(
3244 &self,
3245 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::ActiveData>>
3246 {
3247 #[allow(unreachable_patterns)]
3248 self.state_data.as_ref().and_then(|v| match v {
3249 crate::model::queued_resource_state::StateData::ActiveData(v) => {
3250 std::option::Option::Some(v)
3251 }
3252 _ => std::option::Option::None,
3253 })
3254 }
3255
3256 /// Sets the value of [state_data][crate::model::QueuedResourceState::state_data]
3257 /// to hold a `ActiveData`.
3258 ///
3259 /// Note that all the setters affecting `state_data` are
3260 /// mutually exclusive.
3261 ///
3262 /// # Example
3263 /// ```ignore,no_run
3264 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
3265 /// use google_cloud_tpu_v2::model::queued_resource_state::ActiveData;
3266 /// let x = QueuedResourceState::new().set_active_data(ActiveData::default()/* use setters */);
3267 /// assert!(x.active_data().is_some());
3268 /// assert!(x.creating_data().is_none());
3269 /// assert!(x.accepted_data().is_none());
3270 /// assert!(x.provisioning_data().is_none());
3271 /// assert!(x.failed_data().is_none());
3272 /// assert!(x.deleting_data().is_none());
3273 /// assert!(x.suspending_data().is_none());
3274 /// assert!(x.suspended_data().is_none());
3275 /// ```
3276 pub fn set_active_data<
3277 T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::ActiveData>>,
3278 >(
3279 mut self,
3280 v: T,
3281 ) -> Self {
3282 self.state_data = std::option::Option::Some(
3283 crate::model::queued_resource_state::StateData::ActiveData(v.into()),
3284 );
3285 self
3286 }
3287
3288 /// The value of [state_data][crate::model::QueuedResourceState::state_data]
3289 /// if it holds a `SuspendingData`, `None` if the field is not set or
3290 /// holds a different branch.
3291 pub fn suspending_data(
3292 &self,
3293 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::SuspendingData>>
3294 {
3295 #[allow(unreachable_patterns)]
3296 self.state_data.as_ref().and_then(|v| match v {
3297 crate::model::queued_resource_state::StateData::SuspendingData(v) => {
3298 std::option::Option::Some(v)
3299 }
3300 _ => std::option::Option::None,
3301 })
3302 }
3303
3304 /// Sets the value of [state_data][crate::model::QueuedResourceState::state_data]
3305 /// to hold a `SuspendingData`.
3306 ///
3307 /// Note that all the setters affecting `state_data` are
3308 /// mutually exclusive.
3309 ///
3310 /// # Example
3311 /// ```ignore,no_run
3312 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
3313 /// use google_cloud_tpu_v2::model::queued_resource_state::SuspendingData;
3314 /// let x = QueuedResourceState::new().set_suspending_data(SuspendingData::default()/* use setters */);
3315 /// assert!(x.suspending_data().is_some());
3316 /// assert!(x.creating_data().is_none());
3317 /// assert!(x.accepted_data().is_none());
3318 /// assert!(x.provisioning_data().is_none());
3319 /// assert!(x.failed_data().is_none());
3320 /// assert!(x.deleting_data().is_none());
3321 /// assert!(x.active_data().is_none());
3322 /// assert!(x.suspended_data().is_none());
3323 /// ```
3324 pub fn set_suspending_data<
3325 T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::SuspendingData>>,
3326 >(
3327 mut self,
3328 v: T,
3329 ) -> Self {
3330 self.state_data = std::option::Option::Some(
3331 crate::model::queued_resource_state::StateData::SuspendingData(v.into()),
3332 );
3333 self
3334 }
3335
3336 /// The value of [state_data][crate::model::QueuedResourceState::state_data]
3337 /// if it holds a `SuspendedData`, `None` if the field is not set or
3338 /// holds a different branch.
3339 pub fn suspended_data(
3340 &self,
3341 ) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::SuspendedData>>
3342 {
3343 #[allow(unreachable_patterns)]
3344 self.state_data.as_ref().and_then(|v| match v {
3345 crate::model::queued_resource_state::StateData::SuspendedData(v) => {
3346 std::option::Option::Some(v)
3347 }
3348 _ => std::option::Option::None,
3349 })
3350 }
3351
3352 /// Sets the value of [state_data][crate::model::QueuedResourceState::state_data]
3353 /// to hold a `SuspendedData`.
3354 ///
3355 /// Note that all the setters affecting `state_data` are
3356 /// mutually exclusive.
3357 ///
3358 /// # Example
3359 /// ```ignore,no_run
3360 /// # use google_cloud_tpu_v2::model::QueuedResourceState;
3361 /// use google_cloud_tpu_v2::model::queued_resource_state::SuspendedData;
3362 /// let x = QueuedResourceState::new().set_suspended_data(SuspendedData::default()/* use setters */);
3363 /// assert!(x.suspended_data().is_some());
3364 /// assert!(x.creating_data().is_none());
3365 /// assert!(x.accepted_data().is_none());
3366 /// assert!(x.provisioning_data().is_none());
3367 /// assert!(x.failed_data().is_none());
3368 /// assert!(x.deleting_data().is_none());
3369 /// assert!(x.active_data().is_none());
3370 /// assert!(x.suspending_data().is_none());
3371 /// ```
3372 pub fn set_suspended_data<
3373 T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::SuspendedData>>,
3374 >(
3375 mut self,
3376 v: T,
3377 ) -> Self {
3378 self.state_data = std::option::Option::Some(
3379 crate::model::queued_resource_state::StateData::SuspendedData(v.into()),
3380 );
3381 self
3382 }
3383}
3384
3385impl wkt::message::Message for QueuedResourceState {
3386 fn typename() -> &'static str {
3387 "type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState"
3388 }
3389}
3390
3391/// Defines additional types related to [QueuedResourceState].
3392pub mod queued_resource_state {
3393 #[allow(unused_imports)]
3394 use super::*;
3395
3396 /// Further data for the creating state.
3397 #[derive(Clone, Default, PartialEq)]
3398 #[non_exhaustive]
3399 pub struct CreatingData {
3400 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3401 }
3402
3403 impl CreatingData {
3404 pub fn new() -> Self {
3405 std::default::Default::default()
3406 }
3407 }
3408
3409 impl wkt::message::Message for CreatingData {
3410 fn typename() -> &'static str {
3411 "type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.CreatingData"
3412 }
3413 }
3414
3415 /// Further data for the accepted state.
3416 #[derive(Clone, Default, PartialEq)]
3417 #[non_exhaustive]
3418 pub struct AcceptedData {
3419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3420 }
3421
3422 impl AcceptedData {
3423 pub fn new() -> Self {
3424 std::default::Default::default()
3425 }
3426 }
3427
3428 impl wkt::message::Message for AcceptedData {
3429 fn typename() -> &'static str {
3430 "type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.AcceptedData"
3431 }
3432 }
3433
3434 /// Further data for the provisioning state.
3435 #[derive(Clone, Default, PartialEq)]
3436 #[non_exhaustive]
3437 pub struct ProvisioningData {
3438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3439 }
3440
3441 impl ProvisioningData {
3442 pub fn new() -> Self {
3443 std::default::Default::default()
3444 }
3445 }
3446
3447 impl wkt::message::Message for ProvisioningData {
3448 fn typename() -> &'static str {
3449 "type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.ProvisioningData"
3450 }
3451 }
3452
3453 /// Further data for the failed state.
3454 #[derive(Clone, Default, PartialEq)]
3455 #[non_exhaustive]
3456 pub struct FailedData {
3457 /// Output only. The error that caused the queued resource to enter the
3458 /// FAILED state.
3459 pub error: std::option::Option<google_cloud_rpc::model::Status>,
3460
3461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3462 }
3463
3464 impl FailedData {
3465 pub fn new() -> Self {
3466 std::default::Default::default()
3467 }
3468
3469 /// Sets the value of [error][crate::model::queued_resource_state::FailedData::error].
3470 ///
3471 /// # Example
3472 /// ```ignore,no_run
3473 /// # use google_cloud_tpu_v2::model::queued_resource_state::FailedData;
3474 /// use google_cloud_rpc::model::Status;
3475 /// let x = FailedData::new().set_error(Status::default()/* use setters */);
3476 /// ```
3477 pub fn set_error<T>(mut self, v: T) -> Self
3478 where
3479 T: std::convert::Into<google_cloud_rpc::model::Status>,
3480 {
3481 self.error = std::option::Option::Some(v.into());
3482 self
3483 }
3484
3485 /// Sets or clears the value of [error][crate::model::queued_resource_state::FailedData::error].
3486 ///
3487 /// # Example
3488 /// ```ignore,no_run
3489 /// # use google_cloud_tpu_v2::model::queued_resource_state::FailedData;
3490 /// use google_cloud_rpc::model::Status;
3491 /// let x = FailedData::new().set_or_clear_error(Some(Status::default()/* use setters */));
3492 /// let x = FailedData::new().set_or_clear_error(None::<Status>);
3493 /// ```
3494 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
3495 where
3496 T: std::convert::Into<google_cloud_rpc::model::Status>,
3497 {
3498 self.error = v.map(|x| x.into());
3499 self
3500 }
3501 }
3502
3503 impl wkt::message::Message for FailedData {
3504 fn typename() -> &'static str {
3505 "type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.FailedData"
3506 }
3507 }
3508
3509 /// Further data for the deleting state.
3510 #[derive(Clone, Default, PartialEq)]
3511 #[non_exhaustive]
3512 pub struct DeletingData {
3513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3514 }
3515
3516 impl DeletingData {
3517 pub fn new() -> Self {
3518 std::default::Default::default()
3519 }
3520 }
3521
3522 impl wkt::message::Message for DeletingData {
3523 fn typename() -> &'static str {
3524 "type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.DeletingData"
3525 }
3526 }
3527
3528 /// Further data for the active state.
3529 #[derive(Clone, Default, PartialEq)]
3530 #[non_exhaustive]
3531 pub struct ActiveData {
3532 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3533 }
3534
3535 impl ActiveData {
3536 pub fn new() -> Self {
3537 std::default::Default::default()
3538 }
3539 }
3540
3541 impl wkt::message::Message for ActiveData {
3542 fn typename() -> &'static str {
3543 "type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.ActiveData"
3544 }
3545 }
3546
3547 /// Further data for the suspending state.
3548 #[derive(Clone, Default, PartialEq)]
3549 #[non_exhaustive]
3550 pub struct SuspendingData {
3551 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3552 }
3553
3554 impl SuspendingData {
3555 pub fn new() -> Self {
3556 std::default::Default::default()
3557 }
3558 }
3559
3560 impl wkt::message::Message for SuspendingData {
3561 fn typename() -> &'static str {
3562 "type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.SuspendingData"
3563 }
3564 }
3565
3566 /// Further data for the suspended state.
3567 #[derive(Clone, Default, PartialEq)]
3568 #[non_exhaustive]
3569 pub struct SuspendedData {
3570 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3571 }
3572
3573 impl SuspendedData {
3574 pub fn new() -> Self {
3575 std::default::Default::default()
3576 }
3577 }
3578
3579 impl wkt::message::Message for SuspendedData {
3580 fn typename() -> &'static str {
3581 "type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.SuspendedData"
3582 }
3583 }
3584
3585 /// Output only state of the request
3586 ///
3587 /// # Working with unknown values
3588 ///
3589 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3590 /// additional enum variants at any time. Adding new variants is not considered
3591 /// a breaking change. Applications should write their code in anticipation of:
3592 ///
3593 /// - New values appearing in future releases of the client library, **and**
3594 /// - New values received dynamically, without application changes.
3595 ///
3596 /// Please consult the [Working with enums] section in the user guide for some
3597 /// guidelines.
3598 ///
3599 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3600 #[derive(Clone, Debug, PartialEq)]
3601 #[non_exhaustive]
3602 pub enum State {
3603 /// State of the QueuedResource request is not known/set.
3604 Unspecified,
3605 /// The QueuedResource request has been received. We're still working on
3606 /// determining if we will be able to honor this request.
3607 Creating,
3608 /// The QueuedResource request has passed initial validation/admission
3609 /// control and has been persisted in the queue.
3610 Accepted,
3611 /// The QueuedResource request has been selected. The
3612 /// associated resources are currently being provisioned (or very soon
3613 /// will begin provisioning).
3614 Provisioning,
3615 /// The request could not be completed. This may be due to some
3616 /// late-discovered problem with the request itself, or due to
3617 /// unavailability of resources within the constraints of the request
3618 /// (e.g., the 'valid until' start timing constraint expired).
3619 Failed,
3620 /// The QueuedResource is being deleted.
3621 Deleting,
3622 /// The resources specified in the QueuedResource request have been
3623 /// provisioned and are ready for use by the end-user/consumer.
3624 Active,
3625 /// The resources specified in the QueuedResource request are being
3626 /// deleted. This may have been initiated by the user, or
3627 /// the Cloud TPU service. Inspect the state data for more details.
3628 Suspending,
3629 /// The resources specified in the QueuedResource request have been
3630 /// deleted.
3631 Suspended,
3632 /// The QueuedResource request has passed initial validation and has been
3633 /// persisted in the queue. It will remain in this state until there are
3634 /// sufficient free resources to begin provisioning your request. Wait times
3635 /// will vary significantly depending on demand levels. When demand is high,
3636 /// not all requests can be immediately provisioned. If you
3637 /// need more reliable obtainability of TPUs consider purchasing a
3638 /// reservation. To put a limit on how long you are willing to wait, use
3639 /// [timing
3640 /// constraints](https://cloud.google.com/tpu/docs/queued-resources#request_a_queued_resource_before_a_specified_time).
3641 WaitingForResources,
3642 /// If set, the enum was initialized with an unknown value.
3643 ///
3644 /// Applications can examine the value using [State::value] or
3645 /// [State::name].
3646 UnknownValue(state::UnknownValue),
3647 }
3648
3649 #[doc(hidden)]
3650 pub mod state {
3651 #[allow(unused_imports)]
3652 use super::*;
3653 #[derive(Clone, Debug, PartialEq)]
3654 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3655 }
3656
3657 impl State {
3658 /// Gets the enum value.
3659 ///
3660 /// Returns `None` if the enum contains an unknown value deserialized from
3661 /// the string representation of enums.
3662 pub fn value(&self) -> std::option::Option<i32> {
3663 match self {
3664 Self::Unspecified => std::option::Option::Some(0),
3665 Self::Creating => std::option::Option::Some(1),
3666 Self::Accepted => std::option::Option::Some(2),
3667 Self::Provisioning => std::option::Option::Some(3),
3668 Self::Failed => std::option::Option::Some(4),
3669 Self::Deleting => std::option::Option::Some(5),
3670 Self::Active => std::option::Option::Some(6),
3671 Self::Suspending => std::option::Option::Some(7),
3672 Self::Suspended => std::option::Option::Some(8),
3673 Self::WaitingForResources => std::option::Option::Some(9),
3674 Self::UnknownValue(u) => u.0.value(),
3675 }
3676 }
3677
3678 /// Gets the enum value as a string.
3679 ///
3680 /// Returns `None` if the enum contains an unknown value deserialized from
3681 /// the integer representation of enums.
3682 pub fn name(&self) -> std::option::Option<&str> {
3683 match self {
3684 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3685 Self::Creating => std::option::Option::Some("CREATING"),
3686 Self::Accepted => std::option::Option::Some("ACCEPTED"),
3687 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3688 Self::Failed => std::option::Option::Some("FAILED"),
3689 Self::Deleting => std::option::Option::Some("DELETING"),
3690 Self::Active => std::option::Option::Some("ACTIVE"),
3691 Self::Suspending => std::option::Option::Some("SUSPENDING"),
3692 Self::Suspended => std::option::Option::Some("SUSPENDED"),
3693 Self::WaitingForResources => std::option::Option::Some("WAITING_FOR_RESOURCES"),
3694 Self::UnknownValue(u) => u.0.name(),
3695 }
3696 }
3697 }
3698
3699 impl std::default::Default for State {
3700 fn default() -> Self {
3701 use std::convert::From;
3702 Self::from(0)
3703 }
3704 }
3705
3706 impl std::fmt::Display for State {
3707 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3708 wkt::internal::display_enum(f, self.name(), self.value())
3709 }
3710 }
3711
3712 impl std::convert::From<i32> for State {
3713 fn from(value: i32) -> Self {
3714 match value {
3715 0 => Self::Unspecified,
3716 1 => Self::Creating,
3717 2 => Self::Accepted,
3718 3 => Self::Provisioning,
3719 4 => Self::Failed,
3720 5 => Self::Deleting,
3721 6 => Self::Active,
3722 7 => Self::Suspending,
3723 8 => Self::Suspended,
3724 9 => Self::WaitingForResources,
3725 _ => Self::UnknownValue(state::UnknownValue(
3726 wkt::internal::UnknownEnumValue::Integer(value),
3727 )),
3728 }
3729 }
3730 }
3731
3732 impl std::convert::From<&str> for State {
3733 fn from(value: &str) -> Self {
3734 use std::string::ToString;
3735 match value {
3736 "STATE_UNSPECIFIED" => Self::Unspecified,
3737 "CREATING" => Self::Creating,
3738 "ACCEPTED" => Self::Accepted,
3739 "PROVISIONING" => Self::Provisioning,
3740 "FAILED" => Self::Failed,
3741 "DELETING" => Self::Deleting,
3742 "ACTIVE" => Self::Active,
3743 "SUSPENDING" => Self::Suspending,
3744 "SUSPENDED" => Self::Suspended,
3745 "WAITING_FOR_RESOURCES" => Self::WaitingForResources,
3746 _ => Self::UnknownValue(state::UnknownValue(
3747 wkt::internal::UnknownEnumValue::String(value.to_string()),
3748 )),
3749 }
3750 }
3751 }
3752
3753 impl serde::ser::Serialize for State {
3754 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3755 where
3756 S: serde::Serializer,
3757 {
3758 match self {
3759 Self::Unspecified => serializer.serialize_i32(0),
3760 Self::Creating => serializer.serialize_i32(1),
3761 Self::Accepted => serializer.serialize_i32(2),
3762 Self::Provisioning => serializer.serialize_i32(3),
3763 Self::Failed => serializer.serialize_i32(4),
3764 Self::Deleting => serializer.serialize_i32(5),
3765 Self::Active => serializer.serialize_i32(6),
3766 Self::Suspending => serializer.serialize_i32(7),
3767 Self::Suspended => serializer.serialize_i32(8),
3768 Self::WaitingForResources => serializer.serialize_i32(9),
3769 Self::UnknownValue(u) => u.0.serialize(serializer),
3770 }
3771 }
3772 }
3773
3774 impl<'de> serde::de::Deserialize<'de> for State {
3775 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3776 where
3777 D: serde::Deserializer<'de>,
3778 {
3779 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3780 ".google.cloud.tpu.v2.QueuedResourceState.State",
3781 ))
3782 }
3783 }
3784
3785 /// The initiator of the QueuedResource's SUSPENDING/SUSPENDED state.
3786 ///
3787 /// # Working with unknown values
3788 ///
3789 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3790 /// additional enum variants at any time. Adding new variants is not considered
3791 /// a breaking change. Applications should write their code in anticipation of:
3792 ///
3793 /// - New values appearing in future releases of the client library, **and**
3794 /// - New values received dynamically, without application changes.
3795 ///
3796 /// Please consult the [Working with enums] section in the user guide for some
3797 /// guidelines.
3798 ///
3799 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3800 #[derive(Clone, Debug, PartialEq)]
3801 #[non_exhaustive]
3802 pub enum StateInitiator {
3803 /// The state initiator is unspecified.
3804 Unspecified,
3805 /// The current QueuedResource state was initiated by the user.
3806 User,
3807 /// The current QueuedResource state was initiated by the service.
3808 Service,
3809 /// If set, the enum was initialized with an unknown value.
3810 ///
3811 /// Applications can examine the value using [StateInitiator::value] or
3812 /// [StateInitiator::name].
3813 UnknownValue(state_initiator::UnknownValue),
3814 }
3815
3816 #[doc(hidden)]
3817 pub mod state_initiator {
3818 #[allow(unused_imports)]
3819 use super::*;
3820 #[derive(Clone, Debug, PartialEq)]
3821 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3822 }
3823
3824 impl StateInitiator {
3825 /// Gets the enum value.
3826 ///
3827 /// Returns `None` if the enum contains an unknown value deserialized from
3828 /// the string representation of enums.
3829 pub fn value(&self) -> std::option::Option<i32> {
3830 match self {
3831 Self::Unspecified => std::option::Option::Some(0),
3832 Self::User => std::option::Option::Some(1),
3833 Self::Service => std::option::Option::Some(2),
3834 Self::UnknownValue(u) => u.0.value(),
3835 }
3836 }
3837
3838 /// Gets the enum value as a string.
3839 ///
3840 /// Returns `None` if the enum contains an unknown value deserialized from
3841 /// the integer representation of enums.
3842 pub fn name(&self) -> std::option::Option<&str> {
3843 match self {
3844 Self::Unspecified => std::option::Option::Some("STATE_INITIATOR_UNSPECIFIED"),
3845 Self::User => std::option::Option::Some("USER"),
3846 Self::Service => std::option::Option::Some("SERVICE"),
3847 Self::UnknownValue(u) => u.0.name(),
3848 }
3849 }
3850 }
3851
3852 impl std::default::Default for StateInitiator {
3853 fn default() -> Self {
3854 use std::convert::From;
3855 Self::from(0)
3856 }
3857 }
3858
3859 impl std::fmt::Display for StateInitiator {
3860 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3861 wkt::internal::display_enum(f, self.name(), self.value())
3862 }
3863 }
3864
3865 impl std::convert::From<i32> for StateInitiator {
3866 fn from(value: i32) -> Self {
3867 match value {
3868 0 => Self::Unspecified,
3869 1 => Self::User,
3870 2 => Self::Service,
3871 _ => Self::UnknownValue(state_initiator::UnknownValue(
3872 wkt::internal::UnknownEnumValue::Integer(value),
3873 )),
3874 }
3875 }
3876 }
3877
3878 impl std::convert::From<&str> for StateInitiator {
3879 fn from(value: &str) -> Self {
3880 use std::string::ToString;
3881 match value {
3882 "STATE_INITIATOR_UNSPECIFIED" => Self::Unspecified,
3883 "USER" => Self::User,
3884 "SERVICE" => Self::Service,
3885 _ => Self::UnknownValue(state_initiator::UnknownValue(
3886 wkt::internal::UnknownEnumValue::String(value.to_string()),
3887 )),
3888 }
3889 }
3890 }
3891
3892 impl serde::ser::Serialize for StateInitiator {
3893 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3894 where
3895 S: serde::Serializer,
3896 {
3897 match self {
3898 Self::Unspecified => serializer.serialize_i32(0),
3899 Self::User => serializer.serialize_i32(1),
3900 Self::Service => serializer.serialize_i32(2),
3901 Self::UnknownValue(u) => u.0.serialize(serializer),
3902 }
3903 }
3904 }
3905
3906 impl<'de> serde::de::Deserialize<'de> for StateInitiator {
3907 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3908 where
3909 D: serde::Deserializer<'de>,
3910 {
3911 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StateInitiator>::new(
3912 ".google.cloud.tpu.v2.QueuedResourceState.StateInitiator",
3913 ))
3914 }
3915 }
3916
3917 /// Further data for the state.
3918 #[derive(Clone, Debug, PartialEq)]
3919 #[non_exhaustive]
3920 pub enum StateData {
3921 /// Output only. Further data for the creating state.
3922 CreatingData(std::boxed::Box<crate::model::queued_resource_state::CreatingData>),
3923 /// Output only. Further data for the accepted state.
3924 AcceptedData(std::boxed::Box<crate::model::queued_resource_state::AcceptedData>),
3925 /// Output only. Further data for the provisioning state.
3926 ProvisioningData(std::boxed::Box<crate::model::queued_resource_state::ProvisioningData>),
3927 /// Output only. Further data for the failed state.
3928 FailedData(std::boxed::Box<crate::model::queued_resource_state::FailedData>),
3929 /// Output only. Further data for the deleting state.
3930 DeletingData(std::boxed::Box<crate::model::queued_resource_state::DeletingData>),
3931 /// Output only. Further data for the active state.
3932 ActiveData(std::boxed::Box<crate::model::queued_resource_state::ActiveData>),
3933 /// Output only. Further data for the suspending state.
3934 SuspendingData(std::boxed::Box<crate::model::queued_resource_state::SuspendingData>),
3935 /// Output only. Further data for the suspended state.
3936 SuspendedData(std::boxed::Box<crate::model::queued_resource_state::SuspendedData>),
3937 }
3938}
3939
3940/// Request for [ListNodes][google.cloud.tpu.v2.Tpu.ListNodes].
3941///
3942/// [google.cloud.tpu.v2.Tpu.ListNodes]: crate::client::Tpu::list_nodes
3943#[derive(Clone, Default, PartialEq)]
3944#[non_exhaustive]
3945pub struct ListNodesRequest {
3946 /// Required. The parent resource name.
3947 pub parent: std::string::String,
3948
3949 /// The maximum number of items to return.
3950 pub page_size: i32,
3951
3952 /// The next_page_token value returned from a previous List request, if any.
3953 pub page_token: std::string::String,
3954
3955 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3956}
3957
3958impl ListNodesRequest {
3959 pub fn new() -> Self {
3960 std::default::Default::default()
3961 }
3962
3963 /// Sets the value of [parent][crate::model::ListNodesRequest::parent].
3964 ///
3965 /// # Example
3966 /// ```ignore,no_run
3967 /// # use google_cloud_tpu_v2::model::ListNodesRequest;
3968 /// let x = ListNodesRequest::new().set_parent("example");
3969 /// ```
3970 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3971 self.parent = v.into();
3972 self
3973 }
3974
3975 /// Sets the value of [page_size][crate::model::ListNodesRequest::page_size].
3976 ///
3977 /// # Example
3978 /// ```ignore,no_run
3979 /// # use google_cloud_tpu_v2::model::ListNodesRequest;
3980 /// let x = ListNodesRequest::new().set_page_size(42);
3981 /// ```
3982 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3983 self.page_size = v.into();
3984 self
3985 }
3986
3987 /// Sets the value of [page_token][crate::model::ListNodesRequest::page_token].
3988 ///
3989 /// # Example
3990 /// ```ignore,no_run
3991 /// # use google_cloud_tpu_v2::model::ListNodesRequest;
3992 /// let x = ListNodesRequest::new().set_page_token("example");
3993 /// ```
3994 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3995 self.page_token = v.into();
3996 self
3997 }
3998}
3999
4000impl wkt::message::Message for ListNodesRequest {
4001 fn typename() -> &'static str {
4002 "type.googleapis.com/google.cloud.tpu.v2.ListNodesRequest"
4003 }
4004}
4005
4006/// Response for [ListNodes][google.cloud.tpu.v2.Tpu.ListNodes].
4007///
4008/// [google.cloud.tpu.v2.Tpu.ListNodes]: crate::client::Tpu::list_nodes
4009#[derive(Clone, Default, PartialEq)]
4010#[non_exhaustive]
4011pub struct ListNodesResponse {
4012 /// The listed nodes.
4013 pub nodes: std::vec::Vec<crate::model::Node>,
4014
4015 /// The next page token or empty if none.
4016 pub next_page_token: std::string::String,
4017
4018 /// Locations that could not be reached.
4019 pub unreachable: std::vec::Vec<std::string::String>,
4020
4021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4022}
4023
4024impl ListNodesResponse {
4025 pub fn new() -> Self {
4026 std::default::Default::default()
4027 }
4028
4029 /// Sets the value of [nodes][crate::model::ListNodesResponse::nodes].
4030 ///
4031 /// # Example
4032 /// ```ignore,no_run
4033 /// # use google_cloud_tpu_v2::model::ListNodesResponse;
4034 /// use google_cloud_tpu_v2::model::Node;
4035 /// let x = ListNodesResponse::new()
4036 /// .set_nodes([
4037 /// Node::default()/* use setters */,
4038 /// Node::default()/* use (different) setters */,
4039 /// ]);
4040 /// ```
4041 pub fn set_nodes<T, V>(mut self, v: T) -> Self
4042 where
4043 T: std::iter::IntoIterator<Item = V>,
4044 V: std::convert::Into<crate::model::Node>,
4045 {
4046 use std::iter::Iterator;
4047 self.nodes = v.into_iter().map(|i| i.into()).collect();
4048 self
4049 }
4050
4051 /// Sets the value of [next_page_token][crate::model::ListNodesResponse::next_page_token].
4052 ///
4053 /// # Example
4054 /// ```ignore,no_run
4055 /// # use google_cloud_tpu_v2::model::ListNodesResponse;
4056 /// let x = ListNodesResponse::new().set_next_page_token("example");
4057 /// ```
4058 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4059 self.next_page_token = v.into();
4060 self
4061 }
4062
4063 /// Sets the value of [unreachable][crate::model::ListNodesResponse::unreachable].
4064 ///
4065 /// # Example
4066 /// ```ignore,no_run
4067 /// # use google_cloud_tpu_v2::model::ListNodesResponse;
4068 /// let x = ListNodesResponse::new().set_unreachable(["a", "b", "c"]);
4069 /// ```
4070 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4071 where
4072 T: std::iter::IntoIterator<Item = V>,
4073 V: std::convert::Into<std::string::String>,
4074 {
4075 use std::iter::Iterator;
4076 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4077 self
4078 }
4079}
4080
4081impl wkt::message::Message for ListNodesResponse {
4082 fn typename() -> &'static str {
4083 "type.googleapis.com/google.cloud.tpu.v2.ListNodesResponse"
4084 }
4085}
4086
4087#[doc(hidden)]
4088impl google_cloud_gax::paginator::internal::PageableResponse for ListNodesResponse {
4089 type PageItem = crate::model::Node;
4090
4091 fn items(self) -> std::vec::Vec<Self::PageItem> {
4092 self.nodes
4093 }
4094
4095 fn next_page_token(&self) -> std::string::String {
4096 use std::clone::Clone;
4097 self.next_page_token.clone()
4098 }
4099}
4100
4101/// Request for [GetNode][google.cloud.tpu.v2.Tpu.GetNode].
4102///
4103/// [google.cloud.tpu.v2.Tpu.GetNode]: crate::client::Tpu::get_node
4104#[derive(Clone, Default, PartialEq)]
4105#[non_exhaustive]
4106pub struct GetNodeRequest {
4107 /// Required. The resource name.
4108 pub name: std::string::String,
4109
4110 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4111}
4112
4113impl GetNodeRequest {
4114 pub fn new() -> Self {
4115 std::default::Default::default()
4116 }
4117
4118 /// Sets the value of [name][crate::model::GetNodeRequest::name].
4119 ///
4120 /// # Example
4121 /// ```ignore,no_run
4122 /// # use google_cloud_tpu_v2::model::GetNodeRequest;
4123 /// let x = GetNodeRequest::new().set_name("example");
4124 /// ```
4125 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4126 self.name = v.into();
4127 self
4128 }
4129}
4130
4131impl wkt::message::Message for GetNodeRequest {
4132 fn typename() -> &'static str {
4133 "type.googleapis.com/google.cloud.tpu.v2.GetNodeRequest"
4134 }
4135}
4136
4137/// Request for [CreateNode][google.cloud.tpu.v2.Tpu.CreateNode].
4138///
4139/// [google.cloud.tpu.v2.Tpu.CreateNode]: crate::client::Tpu::create_node
4140#[derive(Clone, Default, PartialEq)]
4141#[non_exhaustive]
4142pub struct CreateNodeRequest {
4143 /// Required. The parent resource name.
4144 pub parent: std::string::String,
4145
4146 /// The unqualified resource name.
4147 pub node_id: std::string::String,
4148
4149 /// Required. The node.
4150 pub node: std::option::Option<crate::model::Node>,
4151
4152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4153}
4154
4155impl CreateNodeRequest {
4156 pub fn new() -> Self {
4157 std::default::Default::default()
4158 }
4159
4160 /// Sets the value of [parent][crate::model::CreateNodeRequest::parent].
4161 ///
4162 /// # Example
4163 /// ```ignore,no_run
4164 /// # use google_cloud_tpu_v2::model::CreateNodeRequest;
4165 /// let x = CreateNodeRequest::new().set_parent("example");
4166 /// ```
4167 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4168 self.parent = v.into();
4169 self
4170 }
4171
4172 /// Sets the value of [node_id][crate::model::CreateNodeRequest::node_id].
4173 ///
4174 /// # Example
4175 /// ```ignore,no_run
4176 /// # use google_cloud_tpu_v2::model::CreateNodeRequest;
4177 /// let x = CreateNodeRequest::new().set_node_id("example");
4178 /// ```
4179 pub fn set_node_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4180 self.node_id = v.into();
4181 self
4182 }
4183
4184 /// Sets the value of [node][crate::model::CreateNodeRequest::node].
4185 ///
4186 /// # Example
4187 /// ```ignore,no_run
4188 /// # use google_cloud_tpu_v2::model::CreateNodeRequest;
4189 /// use google_cloud_tpu_v2::model::Node;
4190 /// let x = CreateNodeRequest::new().set_node(Node::default()/* use setters */);
4191 /// ```
4192 pub fn set_node<T>(mut self, v: T) -> Self
4193 where
4194 T: std::convert::Into<crate::model::Node>,
4195 {
4196 self.node = std::option::Option::Some(v.into());
4197 self
4198 }
4199
4200 /// Sets or clears the value of [node][crate::model::CreateNodeRequest::node].
4201 ///
4202 /// # Example
4203 /// ```ignore,no_run
4204 /// # use google_cloud_tpu_v2::model::CreateNodeRequest;
4205 /// use google_cloud_tpu_v2::model::Node;
4206 /// let x = CreateNodeRequest::new().set_or_clear_node(Some(Node::default()/* use setters */));
4207 /// let x = CreateNodeRequest::new().set_or_clear_node(None::<Node>);
4208 /// ```
4209 pub fn set_or_clear_node<T>(mut self, v: std::option::Option<T>) -> Self
4210 where
4211 T: std::convert::Into<crate::model::Node>,
4212 {
4213 self.node = v.map(|x| x.into());
4214 self
4215 }
4216}
4217
4218impl wkt::message::Message for CreateNodeRequest {
4219 fn typename() -> &'static str {
4220 "type.googleapis.com/google.cloud.tpu.v2.CreateNodeRequest"
4221 }
4222}
4223
4224/// Request for [DeleteNode][google.cloud.tpu.v2.Tpu.DeleteNode].
4225///
4226/// [google.cloud.tpu.v2.Tpu.DeleteNode]: crate::client::Tpu::delete_node
4227#[derive(Clone, Default, PartialEq)]
4228#[non_exhaustive]
4229pub struct DeleteNodeRequest {
4230 /// Required. The resource name.
4231 pub name: std::string::String,
4232
4233 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4234}
4235
4236impl DeleteNodeRequest {
4237 pub fn new() -> Self {
4238 std::default::Default::default()
4239 }
4240
4241 /// Sets the value of [name][crate::model::DeleteNodeRequest::name].
4242 ///
4243 /// # Example
4244 /// ```ignore,no_run
4245 /// # use google_cloud_tpu_v2::model::DeleteNodeRequest;
4246 /// let x = DeleteNodeRequest::new().set_name("example");
4247 /// ```
4248 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4249 self.name = v.into();
4250 self
4251 }
4252}
4253
4254impl wkt::message::Message for DeleteNodeRequest {
4255 fn typename() -> &'static str {
4256 "type.googleapis.com/google.cloud.tpu.v2.DeleteNodeRequest"
4257 }
4258}
4259
4260/// Request for [StopNode][google.cloud.tpu.v2.Tpu.StopNode].
4261///
4262/// [google.cloud.tpu.v2.Tpu.StopNode]: crate::client::Tpu::stop_node
4263#[derive(Clone, Default, PartialEq)]
4264#[non_exhaustive]
4265pub struct StopNodeRequest {
4266 /// Required. The resource name.
4267 pub name: std::string::String,
4268
4269 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4270}
4271
4272impl StopNodeRequest {
4273 pub fn new() -> Self {
4274 std::default::Default::default()
4275 }
4276
4277 /// Sets the value of [name][crate::model::StopNodeRequest::name].
4278 ///
4279 /// # Example
4280 /// ```ignore,no_run
4281 /// # use google_cloud_tpu_v2::model::StopNodeRequest;
4282 /// let x = StopNodeRequest::new().set_name("example");
4283 /// ```
4284 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4285 self.name = v.into();
4286 self
4287 }
4288}
4289
4290impl wkt::message::Message for StopNodeRequest {
4291 fn typename() -> &'static str {
4292 "type.googleapis.com/google.cloud.tpu.v2.StopNodeRequest"
4293 }
4294}
4295
4296/// Request for [StartNode][google.cloud.tpu.v2.Tpu.StartNode].
4297///
4298/// [google.cloud.tpu.v2.Tpu.StartNode]: crate::client::Tpu::start_node
4299#[derive(Clone, Default, PartialEq)]
4300#[non_exhaustive]
4301pub struct StartNodeRequest {
4302 /// Required. The resource name.
4303 pub name: std::string::String,
4304
4305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4306}
4307
4308impl StartNodeRequest {
4309 pub fn new() -> Self {
4310 std::default::Default::default()
4311 }
4312
4313 /// Sets the value of [name][crate::model::StartNodeRequest::name].
4314 ///
4315 /// # Example
4316 /// ```ignore,no_run
4317 /// # use google_cloud_tpu_v2::model::StartNodeRequest;
4318 /// let x = StartNodeRequest::new().set_name("example");
4319 /// ```
4320 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4321 self.name = v.into();
4322 self
4323 }
4324}
4325
4326impl wkt::message::Message for StartNodeRequest {
4327 fn typename() -> &'static str {
4328 "type.googleapis.com/google.cloud.tpu.v2.StartNodeRequest"
4329 }
4330}
4331
4332/// Request for [UpdateNode][google.cloud.tpu.v2.Tpu.UpdateNode].
4333///
4334/// [google.cloud.tpu.v2.Tpu.UpdateNode]: crate::client::Tpu::update_node
4335#[derive(Clone, Default, PartialEq)]
4336#[non_exhaustive]
4337pub struct UpdateNodeRequest {
4338 /// Required. Mask of fields from [Node][Tpu.Node] to update.
4339 /// Supported fields: [description, tags, labels, metadata,
4340 /// network_config.enable_external_ips].
4341 pub update_mask: std::option::Option<wkt::FieldMask>,
4342
4343 /// Required. The node. Only fields specified in update_mask are updated.
4344 pub node: std::option::Option<crate::model::Node>,
4345
4346 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4347}
4348
4349impl UpdateNodeRequest {
4350 pub fn new() -> Self {
4351 std::default::Default::default()
4352 }
4353
4354 /// Sets the value of [update_mask][crate::model::UpdateNodeRequest::update_mask].
4355 ///
4356 /// # Example
4357 /// ```ignore,no_run
4358 /// # use google_cloud_tpu_v2::model::UpdateNodeRequest;
4359 /// use wkt::FieldMask;
4360 /// let x = UpdateNodeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4361 /// ```
4362 pub fn set_update_mask<T>(mut self, v: T) -> Self
4363 where
4364 T: std::convert::Into<wkt::FieldMask>,
4365 {
4366 self.update_mask = std::option::Option::Some(v.into());
4367 self
4368 }
4369
4370 /// Sets or clears the value of [update_mask][crate::model::UpdateNodeRequest::update_mask].
4371 ///
4372 /// # Example
4373 /// ```ignore,no_run
4374 /// # use google_cloud_tpu_v2::model::UpdateNodeRequest;
4375 /// use wkt::FieldMask;
4376 /// let x = UpdateNodeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4377 /// let x = UpdateNodeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4378 /// ```
4379 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4380 where
4381 T: std::convert::Into<wkt::FieldMask>,
4382 {
4383 self.update_mask = v.map(|x| x.into());
4384 self
4385 }
4386
4387 /// Sets the value of [node][crate::model::UpdateNodeRequest::node].
4388 ///
4389 /// # Example
4390 /// ```ignore,no_run
4391 /// # use google_cloud_tpu_v2::model::UpdateNodeRequest;
4392 /// use google_cloud_tpu_v2::model::Node;
4393 /// let x = UpdateNodeRequest::new().set_node(Node::default()/* use setters */);
4394 /// ```
4395 pub fn set_node<T>(mut self, v: T) -> Self
4396 where
4397 T: std::convert::Into<crate::model::Node>,
4398 {
4399 self.node = std::option::Option::Some(v.into());
4400 self
4401 }
4402
4403 /// Sets or clears the value of [node][crate::model::UpdateNodeRequest::node].
4404 ///
4405 /// # Example
4406 /// ```ignore,no_run
4407 /// # use google_cloud_tpu_v2::model::UpdateNodeRequest;
4408 /// use google_cloud_tpu_v2::model::Node;
4409 /// let x = UpdateNodeRequest::new().set_or_clear_node(Some(Node::default()/* use setters */));
4410 /// let x = UpdateNodeRequest::new().set_or_clear_node(None::<Node>);
4411 /// ```
4412 pub fn set_or_clear_node<T>(mut self, v: std::option::Option<T>) -> Self
4413 where
4414 T: std::convert::Into<crate::model::Node>,
4415 {
4416 self.node = v.map(|x| x.into());
4417 self
4418 }
4419}
4420
4421impl wkt::message::Message for UpdateNodeRequest {
4422 fn typename() -> &'static str {
4423 "type.googleapis.com/google.cloud.tpu.v2.UpdateNodeRequest"
4424 }
4425}
4426
4427/// Request for
4428/// [ListQueuedResources][google.cloud.tpu.v2.Tpu.ListQueuedResources].
4429///
4430/// [google.cloud.tpu.v2.Tpu.ListQueuedResources]: crate::client::Tpu::list_queued_resources
4431#[derive(Clone, Default, PartialEq)]
4432#[non_exhaustive]
4433pub struct ListQueuedResourcesRequest {
4434 /// Required. The parent resource name.
4435 pub parent: std::string::String,
4436
4437 /// Optional. The maximum number of items to return.
4438 pub page_size: i32,
4439
4440 /// Optional. The next_page_token value returned from a previous List request,
4441 /// if any.
4442 pub page_token: std::string::String,
4443
4444 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4445}
4446
4447impl ListQueuedResourcesRequest {
4448 pub fn new() -> Self {
4449 std::default::Default::default()
4450 }
4451
4452 /// Sets the value of [parent][crate::model::ListQueuedResourcesRequest::parent].
4453 ///
4454 /// # Example
4455 /// ```ignore,no_run
4456 /// # use google_cloud_tpu_v2::model::ListQueuedResourcesRequest;
4457 /// let x = ListQueuedResourcesRequest::new().set_parent("example");
4458 /// ```
4459 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4460 self.parent = v.into();
4461 self
4462 }
4463
4464 /// Sets the value of [page_size][crate::model::ListQueuedResourcesRequest::page_size].
4465 ///
4466 /// # Example
4467 /// ```ignore,no_run
4468 /// # use google_cloud_tpu_v2::model::ListQueuedResourcesRequest;
4469 /// let x = ListQueuedResourcesRequest::new().set_page_size(42);
4470 /// ```
4471 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4472 self.page_size = v.into();
4473 self
4474 }
4475
4476 /// Sets the value of [page_token][crate::model::ListQueuedResourcesRequest::page_token].
4477 ///
4478 /// # Example
4479 /// ```ignore,no_run
4480 /// # use google_cloud_tpu_v2::model::ListQueuedResourcesRequest;
4481 /// let x = ListQueuedResourcesRequest::new().set_page_token("example");
4482 /// ```
4483 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4484 self.page_token = v.into();
4485 self
4486 }
4487}
4488
4489impl wkt::message::Message for ListQueuedResourcesRequest {
4490 fn typename() -> &'static str {
4491 "type.googleapis.com/google.cloud.tpu.v2.ListQueuedResourcesRequest"
4492 }
4493}
4494
4495/// Response for
4496/// [ListQueuedResources][google.cloud.tpu.v2.Tpu.ListQueuedResources].
4497///
4498/// [google.cloud.tpu.v2.Tpu.ListQueuedResources]: crate::client::Tpu::list_queued_resources
4499#[derive(Clone, Default, PartialEq)]
4500#[non_exhaustive]
4501pub struct ListQueuedResourcesResponse {
4502 /// The listed queued resources.
4503 pub queued_resources: std::vec::Vec<crate::model::QueuedResource>,
4504
4505 /// The next page token or empty if none.
4506 pub next_page_token: std::string::String,
4507
4508 /// Locations that could not be reached.
4509 pub unreachable: std::vec::Vec<std::string::String>,
4510
4511 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4512}
4513
4514impl ListQueuedResourcesResponse {
4515 pub fn new() -> Self {
4516 std::default::Default::default()
4517 }
4518
4519 /// Sets the value of [queued_resources][crate::model::ListQueuedResourcesResponse::queued_resources].
4520 ///
4521 /// # Example
4522 /// ```ignore,no_run
4523 /// # use google_cloud_tpu_v2::model::ListQueuedResourcesResponse;
4524 /// use google_cloud_tpu_v2::model::QueuedResource;
4525 /// let x = ListQueuedResourcesResponse::new()
4526 /// .set_queued_resources([
4527 /// QueuedResource::default()/* use setters */,
4528 /// QueuedResource::default()/* use (different) setters */,
4529 /// ]);
4530 /// ```
4531 pub fn set_queued_resources<T, V>(mut self, v: T) -> Self
4532 where
4533 T: std::iter::IntoIterator<Item = V>,
4534 V: std::convert::Into<crate::model::QueuedResource>,
4535 {
4536 use std::iter::Iterator;
4537 self.queued_resources = v.into_iter().map(|i| i.into()).collect();
4538 self
4539 }
4540
4541 /// Sets the value of [next_page_token][crate::model::ListQueuedResourcesResponse::next_page_token].
4542 ///
4543 /// # Example
4544 /// ```ignore,no_run
4545 /// # use google_cloud_tpu_v2::model::ListQueuedResourcesResponse;
4546 /// let x = ListQueuedResourcesResponse::new().set_next_page_token("example");
4547 /// ```
4548 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4549 self.next_page_token = v.into();
4550 self
4551 }
4552
4553 /// Sets the value of [unreachable][crate::model::ListQueuedResourcesResponse::unreachable].
4554 ///
4555 /// # Example
4556 /// ```ignore,no_run
4557 /// # use google_cloud_tpu_v2::model::ListQueuedResourcesResponse;
4558 /// let x = ListQueuedResourcesResponse::new().set_unreachable(["a", "b", "c"]);
4559 /// ```
4560 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4561 where
4562 T: std::iter::IntoIterator<Item = V>,
4563 V: std::convert::Into<std::string::String>,
4564 {
4565 use std::iter::Iterator;
4566 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4567 self
4568 }
4569}
4570
4571impl wkt::message::Message for ListQueuedResourcesResponse {
4572 fn typename() -> &'static str {
4573 "type.googleapis.com/google.cloud.tpu.v2.ListQueuedResourcesResponse"
4574 }
4575}
4576
4577#[doc(hidden)]
4578impl google_cloud_gax::paginator::internal::PageableResponse for ListQueuedResourcesResponse {
4579 type PageItem = crate::model::QueuedResource;
4580
4581 fn items(self) -> std::vec::Vec<Self::PageItem> {
4582 self.queued_resources
4583 }
4584
4585 fn next_page_token(&self) -> std::string::String {
4586 use std::clone::Clone;
4587 self.next_page_token.clone()
4588 }
4589}
4590
4591/// Request for [GetQueuedResource][google.cloud.tpu.v2.Tpu.GetQueuedResource]
4592///
4593/// [google.cloud.tpu.v2.Tpu.GetQueuedResource]: crate::client::Tpu::get_queued_resource
4594#[derive(Clone, Default, PartialEq)]
4595#[non_exhaustive]
4596pub struct GetQueuedResourceRequest {
4597 /// Required. The resource name.
4598 pub name: std::string::String,
4599
4600 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4601}
4602
4603impl GetQueuedResourceRequest {
4604 pub fn new() -> Self {
4605 std::default::Default::default()
4606 }
4607
4608 /// Sets the value of [name][crate::model::GetQueuedResourceRequest::name].
4609 ///
4610 /// # Example
4611 /// ```ignore,no_run
4612 /// # use google_cloud_tpu_v2::model::GetQueuedResourceRequest;
4613 /// let x = GetQueuedResourceRequest::new().set_name("example");
4614 /// ```
4615 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4616 self.name = v.into();
4617 self
4618 }
4619}
4620
4621impl wkt::message::Message for GetQueuedResourceRequest {
4622 fn typename() -> &'static str {
4623 "type.googleapis.com/google.cloud.tpu.v2.GetQueuedResourceRequest"
4624 }
4625}
4626
4627/// Request for
4628/// [CreateQueuedResource][google.cloud.tpu.v2.Tpu.CreateQueuedResource].
4629///
4630/// [google.cloud.tpu.v2.Tpu.CreateQueuedResource]: crate::client::Tpu::create_queued_resource
4631#[derive(Clone, Default, PartialEq)]
4632#[non_exhaustive]
4633pub struct CreateQueuedResourceRequest {
4634 /// Required. The parent resource name.
4635 pub parent: std::string::String,
4636
4637 /// Optional. The unqualified resource name. Should follow the
4638 /// `^[A-Za-z0-9_.~+%-]+$` regex format.
4639 pub queued_resource_id: std::string::String,
4640
4641 /// Required. The queued resource.
4642 pub queued_resource: std::option::Option<crate::model::QueuedResource>,
4643
4644 /// Optional. Idempotent request UUID.
4645 pub request_id: std::string::String,
4646
4647 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4648}
4649
4650impl CreateQueuedResourceRequest {
4651 pub fn new() -> Self {
4652 std::default::Default::default()
4653 }
4654
4655 /// Sets the value of [parent][crate::model::CreateQueuedResourceRequest::parent].
4656 ///
4657 /// # Example
4658 /// ```ignore,no_run
4659 /// # use google_cloud_tpu_v2::model::CreateQueuedResourceRequest;
4660 /// let x = CreateQueuedResourceRequest::new().set_parent("example");
4661 /// ```
4662 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4663 self.parent = v.into();
4664 self
4665 }
4666
4667 /// Sets the value of [queued_resource_id][crate::model::CreateQueuedResourceRequest::queued_resource_id].
4668 ///
4669 /// # Example
4670 /// ```ignore,no_run
4671 /// # use google_cloud_tpu_v2::model::CreateQueuedResourceRequest;
4672 /// let x = CreateQueuedResourceRequest::new().set_queued_resource_id("example");
4673 /// ```
4674 pub fn set_queued_resource_id<T: std::convert::Into<std::string::String>>(
4675 mut self,
4676 v: T,
4677 ) -> Self {
4678 self.queued_resource_id = v.into();
4679 self
4680 }
4681
4682 /// Sets the value of [queued_resource][crate::model::CreateQueuedResourceRequest::queued_resource].
4683 ///
4684 /// # Example
4685 /// ```ignore,no_run
4686 /// # use google_cloud_tpu_v2::model::CreateQueuedResourceRequest;
4687 /// use google_cloud_tpu_v2::model::QueuedResource;
4688 /// let x = CreateQueuedResourceRequest::new().set_queued_resource(QueuedResource::default()/* use setters */);
4689 /// ```
4690 pub fn set_queued_resource<T>(mut self, v: T) -> Self
4691 where
4692 T: std::convert::Into<crate::model::QueuedResource>,
4693 {
4694 self.queued_resource = std::option::Option::Some(v.into());
4695 self
4696 }
4697
4698 /// Sets or clears the value of [queued_resource][crate::model::CreateQueuedResourceRequest::queued_resource].
4699 ///
4700 /// # Example
4701 /// ```ignore,no_run
4702 /// # use google_cloud_tpu_v2::model::CreateQueuedResourceRequest;
4703 /// use google_cloud_tpu_v2::model::QueuedResource;
4704 /// let x = CreateQueuedResourceRequest::new().set_or_clear_queued_resource(Some(QueuedResource::default()/* use setters */));
4705 /// let x = CreateQueuedResourceRequest::new().set_or_clear_queued_resource(None::<QueuedResource>);
4706 /// ```
4707 pub fn set_or_clear_queued_resource<T>(mut self, v: std::option::Option<T>) -> Self
4708 where
4709 T: std::convert::Into<crate::model::QueuedResource>,
4710 {
4711 self.queued_resource = v.map(|x| x.into());
4712 self
4713 }
4714
4715 /// Sets the value of [request_id][crate::model::CreateQueuedResourceRequest::request_id].
4716 ///
4717 /// # Example
4718 /// ```ignore,no_run
4719 /// # use google_cloud_tpu_v2::model::CreateQueuedResourceRequest;
4720 /// let x = CreateQueuedResourceRequest::new().set_request_id("example");
4721 /// ```
4722 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4723 self.request_id = v.into();
4724 self
4725 }
4726}
4727
4728impl wkt::message::Message for CreateQueuedResourceRequest {
4729 fn typename() -> &'static str {
4730 "type.googleapis.com/google.cloud.tpu.v2.CreateQueuedResourceRequest"
4731 }
4732}
4733
4734/// Request for
4735/// [DeleteQueuedResource][google.cloud.tpu.v2.Tpu.DeleteQueuedResource].
4736///
4737/// [google.cloud.tpu.v2.Tpu.DeleteQueuedResource]: crate::client::Tpu::delete_queued_resource
4738#[derive(Clone, Default, PartialEq)]
4739#[non_exhaustive]
4740pub struct DeleteQueuedResourceRequest {
4741 /// Required. The resource name.
4742 pub name: std::string::String,
4743
4744 /// Optional. Idempotent request UUID.
4745 pub request_id: std::string::String,
4746
4747 /// Optional. If set to true, all running nodes belonging to this queued
4748 /// resource will be deleted first and then the queued resource will be
4749 /// deleted. Otherwise (i.e. force=false), the queued resource will only be
4750 /// deleted if its nodes have already been deleted or the queued resource is in
4751 /// the ACCEPTED, FAILED, or SUSPENDED state.
4752 pub force: bool,
4753
4754 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4755}
4756
4757impl DeleteQueuedResourceRequest {
4758 pub fn new() -> Self {
4759 std::default::Default::default()
4760 }
4761
4762 /// Sets the value of [name][crate::model::DeleteQueuedResourceRequest::name].
4763 ///
4764 /// # Example
4765 /// ```ignore,no_run
4766 /// # use google_cloud_tpu_v2::model::DeleteQueuedResourceRequest;
4767 /// let x = DeleteQueuedResourceRequest::new().set_name("example");
4768 /// ```
4769 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4770 self.name = v.into();
4771 self
4772 }
4773
4774 /// Sets the value of [request_id][crate::model::DeleteQueuedResourceRequest::request_id].
4775 ///
4776 /// # Example
4777 /// ```ignore,no_run
4778 /// # use google_cloud_tpu_v2::model::DeleteQueuedResourceRequest;
4779 /// let x = DeleteQueuedResourceRequest::new().set_request_id("example");
4780 /// ```
4781 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4782 self.request_id = v.into();
4783 self
4784 }
4785
4786 /// Sets the value of [force][crate::model::DeleteQueuedResourceRequest::force].
4787 ///
4788 /// # Example
4789 /// ```ignore,no_run
4790 /// # use google_cloud_tpu_v2::model::DeleteQueuedResourceRequest;
4791 /// let x = DeleteQueuedResourceRequest::new().set_force(true);
4792 /// ```
4793 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4794 self.force = v.into();
4795 self
4796 }
4797}
4798
4799impl wkt::message::Message for DeleteQueuedResourceRequest {
4800 fn typename() -> &'static str {
4801 "type.googleapis.com/google.cloud.tpu.v2.DeleteQueuedResourceRequest"
4802 }
4803}
4804
4805/// Request for
4806/// [ResetQueuedResource][google.cloud.tpu.v2.Tpu.ResetQueuedResource].
4807///
4808/// [google.cloud.tpu.v2.Tpu.ResetQueuedResource]: crate::client::Tpu::reset_queued_resource
4809#[derive(Clone, Default, PartialEq)]
4810#[non_exhaustive]
4811pub struct ResetQueuedResourceRequest {
4812 /// Required. The name of the queued resource.
4813 pub name: std::string::String,
4814
4815 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4816}
4817
4818impl ResetQueuedResourceRequest {
4819 pub fn new() -> Self {
4820 std::default::Default::default()
4821 }
4822
4823 /// Sets the value of [name][crate::model::ResetQueuedResourceRequest::name].
4824 ///
4825 /// # Example
4826 /// ```ignore,no_run
4827 /// # use google_cloud_tpu_v2::model::ResetQueuedResourceRequest;
4828 /// let x = ResetQueuedResourceRequest::new().set_name("example");
4829 /// ```
4830 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4831 self.name = v.into();
4832 self
4833 }
4834}
4835
4836impl wkt::message::Message for ResetQueuedResourceRequest {
4837 fn typename() -> &'static str {
4838 "type.googleapis.com/google.cloud.tpu.v2.ResetQueuedResourceRequest"
4839 }
4840}
4841
4842/// The per-product per-project service identity for Cloud TPU service.
4843#[derive(Clone, Default, PartialEq)]
4844#[non_exhaustive]
4845pub struct ServiceIdentity {
4846 /// The email address of the service identity.
4847 pub email: std::string::String,
4848
4849 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4850}
4851
4852impl ServiceIdentity {
4853 pub fn new() -> Self {
4854 std::default::Default::default()
4855 }
4856
4857 /// Sets the value of [email][crate::model::ServiceIdentity::email].
4858 ///
4859 /// # Example
4860 /// ```ignore,no_run
4861 /// # use google_cloud_tpu_v2::model::ServiceIdentity;
4862 /// let x = ServiceIdentity::new().set_email("example");
4863 /// ```
4864 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4865 self.email = v.into();
4866 self
4867 }
4868}
4869
4870impl wkt::message::Message for ServiceIdentity {
4871 fn typename() -> &'static str {
4872 "type.googleapis.com/google.cloud.tpu.v2.ServiceIdentity"
4873 }
4874}
4875
4876/// Request for
4877/// [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity].
4878///
4879/// [google.cloud.tpu.v2.Tpu.GenerateServiceIdentity]: crate::client::Tpu::generate_service_identity
4880#[derive(Clone, Default, PartialEq)]
4881#[non_exhaustive]
4882pub struct GenerateServiceIdentityRequest {
4883 /// Required. The parent resource name.
4884 pub parent: std::string::String,
4885
4886 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4887}
4888
4889impl GenerateServiceIdentityRequest {
4890 pub fn new() -> Self {
4891 std::default::Default::default()
4892 }
4893
4894 /// Sets the value of [parent][crate::model::GenerateServiceIdentityRequest::parent].
4895 ///
4896 /// # Example
4897 /// ```ignore,no_run
4898 /// # use google_cloud_tpu_v2::model::GenerateServiceIdentityRequest;
4899 /// let x = GenerateServiceIdentityRequest::new().set_parent("example");
4900 /// ```
4901 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4902 self.parent = v.into();
4903 self
4904 }
4905}
4906
4907impl wkt::message::Message for GenerateServiceIdentityRequest {
4908 fn typename() -> &'static str {
4909 "type.googleapis.com/google.cloud.tpu.v2.GenerateServiceIdentityRequest"
4910 }
4911}
4912
4913/// Response for
4914/// [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity].
4915///
4916/// [google.cloud.tpu.v2.Tpu.GenerateServiceIdentity]: crate::client::Tpu::generate_service_identity
4917#[derive(Clone, Default, PartialEq)]
4918#[non_exhaustive]
4919pub struct GenerateServiceIdentityResponse {
4920 /// ServiceIdentity that was created or retrieved.
4921 pub identity: std::option::Option<crate::model::ServiceIdentity>,
4922
4923 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4924}
4925
4926impl GenerateServiceIdentityResponse {
4927 pub fn new() -> Self {
4928 std::default::Default::default()
4929 }
4930
4931 /// Sets the value of [identity][crate::model::GenerateServiceIdentityResponse::identity].
4932 ///
4933 /// # Example
4934 /// ```ignore,no_run
4935 /// # use google_cloud_tpu_v2::model::GenerateServiceIdentityResponse;
4936 /// use google_cloud_tpu_v2::model::ServiceIdentity;
4937 /// let x = GenerateServiceIdentityResponse::new().set_identity(ServiceIdentity::default()/* use setters */);
4938 /// ```
4939 pub fn set_identity<T>(mut self, v: T) -> Self
4940 where
4941 T: std::convert::Into<crate::model::ServiceIdentity>,
4942 {
4943 self.identity = std::option::Option::Some(v.into());
4944 self
4945 }
4946
4947 /// Sets or clears the value of [identity][crate::model::GenerateServiceIdentityResponse::identity].
4948 ///
4949 /// # Example
4950 /// ```ignore,no_run
4951 /// # use google_cloud_tpu_v2::model::GenerateServiceIdentityResponse;
4952 /// use google_cloud_tpu_v2::model::ServiceIdentity;
4953 /// let x = GenerateServiceIdentityResponse::new().set_or_clear_identity(Some(ServiceIdentity::default()/* use setters */));
4954 /// let x = GenerateServiceIdentityResponse::new().set_or_clear_identity(None::<ServiceIdentity>);
4955 /// ```
4956 pub fn set_or_clear_identity<T>(mut self, v: std::option::Option<T>) -> Self
4957 where
4958 T: std::convert::Into<crate::model::ServiceIdentity>,
4959 {
4960 self.identity = v.map(|x| x.into());
4961 self
4962 }
4963}
4964
4965impl wkt::message::Message for GenerateServiceIdentityResponse {
4966 fn typename() -> &'static str {
4967 "type.googleapis.com/google.cloud.tpu.v2.GenerateServiceIdentityResponse"
4968 }
4969}
4970
4971/// A accelerator type that a Node can be configured with.
4972#[derive(Clone, Default, PartialEq)]
4973#[non_exhaustive]
4974pub struct AcceleratorType {
4975 /// The resource name.
4976 pub name: std::string::String,
4977
4978 /// The accelerator type.
4979 pub r#type: std::string::String,
4980
4981 /// The accelerator config.
4982 pub accelerator_configs: std::vec::Vec<crate::model::AcceleratorConfig>,
4983
4984 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4985}
4986
4987impl AcceleratorType {
4988 pub fn new() -> Self {
4989 std::default::Default::default()
4990 }
4991
4992 /// Sets the value of [name][crate::model::AcceleratorType::name].
4993 ///
4994 /// # Example
4995 /// ```ignore,no_run
4996 /// # use google_cloud_tpu_v2::model::AcceleratorType;
4997 /// let x = AcceleratorType::new().set_name("example");
4998 /// ```
4999 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5000 self.name = v.into();
5001 self
5002 }
5003
5004 /// Sets the value of [r#type][crate::model::AcceleratorType::type].
5005 ///
5006 /// # Example
5007 /// ```ignore,no_run
5008 /// # use google_cloud_tpu_v2::model::AcceleratorType;
5009 /// let x = AcceleratorType::new().set_type("example");
5010 /// ```
5011 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5012 self.r#type = v.into();
5013 self
5014 }
5015
5016 /// Sets the value of [accelerator_configs][crate::model::AcceleratorType::accelerator_configs].
5017 ///
5018 /// # Example
5019 /// ```ignore,no_run
5020 /// # use google_cloud_tpu_v2::model::AcceleratorType;
5021 /// use google_cloud_tpu_v2::model::AcceleratorConfig;
5022 /// let x = AcceleratorType::new()
5023 /// .set_accelerator_configs([
5024 /// AcceleratorConfig::default()/* use setters */,
5025 /// AcceleratorConfig::default()/* use (different) setters */,
5026 /// ]);
5027 /// ```
5028 pub fn set_accelerator_configs<T, V>(mut self, v: T) -> Self
5029 where
5030 T: std::iter::IntoIterator<Item = V>,
5031 V: std::convert::Into<crate::model::AcceleratorConfig>,
5032 {
5033 use std::iter::Iterator;
5034 self.accelerator_configs = v.into_iter().map(|i| i.into()).collect();
5035 self
5036 }
5037}
5038
5039impl wkt::message::Message for AcceleratorType {
5040 fn typename() -> &'static str {
5041 "type.googleapis.com/google.cloud.tpu.v2.AcceleratorType"
5042 }
5043}
5044
5045/// Request for [GetAcceleratorType][google.cloud.tpu.v2.Tpu.GetAcceleratorType].
5046///
5047/// [google.cloud.tpu.v2.Tpu.GetAcceleratorType]: crate::client::Tpu::get_accelerator_type
5048#[derive(Clone, Default, PartialEq)]
5049#[non_exhaustive]
5050pub struct GetAcceleratorTypeRequest {
5051 /// Required. The resource name.
5052 pub name: std::string::String,
5053
5054 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5055}
5056
5057impl GetAcceleratorTypeRequest {
5058 pub fn new() -> Self {
5059 std::default::Default::default()
5060 }
5061
5062 /// Sets the value of [name][crate::model::GetAcceleratorTypeRequest::name].
5063 ///
5064 /// # Example
5065 /// ```ignore,no_run
5066 /// # use google_cloud_tpu_v2::model::GetAcceleratorTypeRequest;
5067 /// let x = GetAcceleratorTypeRequest::new().set_name("example");
5068 /// ```
5069 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5070 self.name = v.into();
5071 self
5072 }
5073}
5074
5075impl wkt::message::Message for GetAcceleratorTypeRequest {
5076 fn typename() -> &'static str {
5077 "type.googleapis.com/google.cloud.tpu.v2.GetAcceleratorTypeRequest"
5078 }
5079}
5080
5081/// Request for
5082/// [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes].
5083///
5084/// [google.cloud.tpu.v2.Tpu.ListAcceleratorTypes]: crate::client::Tpu::list_accelerator_types
5085#[derive(Clone, Default, PartialEq)]
5086#[non_exhaustive]
5087pub struct ListAcceleratorTypesRequest {
5088 /// Required. The parent resource name.
5089 pub parent: std::string::String,
5090
5091 /// The maximum number of items to return.
5092 pub page_size: i32,
5093
5094 /// The next_page_token value returned from a previous List request, if any.
5095 pub page_token: std::string::String,
5096
5097 /// List filter.
5098 pub filter: std::string::String,
5099
5100 /// Sort results.
5101 pub order_by: std::string::String,
5102
5103 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5104}
5105
5106impl ListAcceleratorTypesRequest {
5107 pub fn new() -> Self {
5108 std::default::Default::default()
5109 }
5110
5111 /// Sets the value of [parent][crate::model::ListAcceleratorTypesRequest::parent].
5112 ///
5113 /// # Example
5114 /// ```ignore,no_run
5115 /// # use google_cloud_tpu_v2::model::ListAcceleratorTypesRequest;
5116 /// let x = ListAcceleratorTypesRequest::new().set_parent("example");
5117 /// ```
5118 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5119 self.parent = v.into();
5120 self
5121 }
5122
5123 /// Sets the value of [page_size][crate::model::ListAcceleratorTypesRequest::page_size].
5124 ///
5125 /// # Example
5126 /// ```ignore,no_run
5127 /// # use google_cloud_tpu_v2::model::ListAcceleratorTypesRequest;
5128 /// let x = ListAcceleratorTypesRequest::new().set_page_size(42);
5129 /// ```
5130 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5131 self.page_size = v.into();
5132 self
5133 }
5134
5135 /// Sets the value of [page_token][crate::model::ListAcceleratorTypesRequest::page_token].
5136 ///
5137 /// # Example
5138 /// ```ignore,no_run
5139 /// # use google_cloud_tpu_v2::model::ListAcceleratorTypesRequest;
5140 /// let x = ListAcceleratorTypesRequest::new().set_page_token("example");
5141 /// ```
5142 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5143 self.page_token = v.into();
5144 self
5145 }
5146
5147 /// Sets the value of [filter][crate::model::ListAcceleratorTypesRequest::filter].
5148 ///
5149 /// # Example
5150 /// ```ignore,no_run
5151 /// # use google_cloud_tpu_v2::model::ListAcceleratorTypesRequest;
5152 /// let x = ListAcceleratorTypesRequest::new().set_filter("example");
5153 /// ```
5154 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5155 self.filter = v.into();
5156 self
5157 }
5158
5159 /// Sets the value of [order_by][crate::model::ListAcceleratorTypesRequest::order_by].
5160 ///
5161 /// # Example
5162 /// ```ignore,no_run
5163 /// # use google_cloud_tpu_v2::model::ListAcceleratorTypesRequest;
5164 /// let x = ListAcceleratorTypesRequest::new().set_order_by("example");
5165 /// ```
5166 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5167 self.order_by = v.into();
5168 self
5169 }
5170}
5171
5172impl wkt::message::Message for ListAcceleratorTypesRequest {
5173 fn typename() -> &'static str {
5174 "type.googleapis.com/google.cloud.tpu.v2.ListAcceleratorTypesRequest"
5175 }
5176}
5177
5178/// Response for
5179/// [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes].
5180///
5181/// [google.cloud.tpu.v2.Tpu.ListAcceleratorTypes]: crate::client::Tpu::list_accelerator_types
5182#[derive(Clone, Default, PartialEq)]
5183#[non_exhaustive]
5184pub struct ListAcceleratorTypesResponse {
5185 /// The listed nodes.
5186 pub accelerator_types: std::vec::Vec<crate::model::AcceleratorType>,
5187
5188 /// The next page token or empty if none.
5189 pub next_page_token: std::string::String,
5190
5191 /// Locations that could not be reached.
5192 pub unreachable: std::vec::Vec<std::string::String>,
5193
5194 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5195}
5196
5197impl ListAcceleratorTypesResponse {
5198 pub fn new() -> Self {
5199 std::default::Default::default()
5200 }
5201
5202 /// Sets the value of [accelerator_types][crate::model::ListAcceleratorTypesResponse::accelerator_types].
5203 ///
5204 /// # Example
5205 /// ```ignore,no_run
5206 /// # use google_cloud_tpu_v2::model::ListAcceleratorTypesResponse;
5207 /// use google_cloud_tpu_v2::model::AcceleratorType;
5208 /// let x = ListAcceleratorTypesResponse::new()
5209 /// .set_accelerator_types([
5210 /// AcceleratorType::default()/* use setters */,
5211 /// AcceleratorType::default()/* use (different) setters */,
5212 /// ]);
5213 /// ```
5214 pub fn set_accelerator_types<T, V>(mut self, v: T) -> Self
5215 where
5216 T: std::iter::IntoIterator<Item = V>,
5217 V: std::convert::Into<crate::model::AcceleratorType>,
5218 {
5219 use std::iter::Iterator;
5220 self.accelerator_types = v.into_iter().map(|i| i.into()).collect();
5221 self
5222 }
5223
5224 /// Sets the value of [next_page_token][crate::model::ListAcceleratorTypesResponse::next_page_token].
5225 ///
5226 /// # Example
5227 /// ```ignore,no_run
5228 /// # use google_cloud_tpu_v2::model::ListAcceleratorTypesResponse;
5229 /// let x = ListAcceleratorTypesResponse::new().set_next_page_token("example");
5230 /// ```
5231 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5232 self.next_page_token = v.into();
5233 self
5234 }
5235
5236 /// Sets the value of [unreachable][crate::model::ListAcceleratorTypesResponse::unreachable].
5237 ///
5238 /// # Example
5239 /// ```ignore,no_run
5240 /// # use google_cloud_tpu_v2::model::ListAcceleratorTypesResponse;
5241 /// let x = ListAcceleratorTypesResponse::new().set_unreachable(["a", "b", "c"]);
5242 /// ```
5243 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5244 where
5245 T: std::iter::IntoIterator<Item = V>,
5246 V: std::convert::Into<std::string::String>,
5247 {
5248 use std::iter::Iterator;
5249 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5250 self
5251 }
5252}
5253
5254impl wkt::message::Message for ListAcceleratorTypesResponse {
5255 fn typename() -> &'static str {
5256 "type.googleapis.com/google.cloud.tpu.v2.ListAcceleratorTypesResponse"
5257 }
5258}
5259
5260#[doc(hidden)]
5261impl google_cloud_gax::paginator::internal::PageableResponse for ListAcceleratorTypesResponse {
5262 type PageItem = crate::model::AcceleratorType;
5263
5264 fn items(self) -> std::vec::Vec<Self::PageItem> {
5265 self.accelerator_types
5266 }
5267
5268 fn next_page_token(&self) -> std::string::String {
5269 use std::clone::Clone;
5270 self.next_page_token.clone()
5271 }
5272}
5273
5274/// A runtime version that a Node can be configured with.
5275#[derive(Clone, Default, PartialEq)]
5276#[non_exhaustive]
5277pub struct RuntimeVersion {
5278 /// The resource name.
5279 pub name: std::string::String,
5280
5281 /// The runtime version.
5282 pub version: std::string::String,
5283
5284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5285}
5286
5287impl RuntimeVersion {
5288 pub fn new() -> Self {
5289 std::default::Default::default()
5290 }
5291
5292 /// Sets the value of [name][crate::model::RuntimeVersion::name].
5293 ///
5294 /// # Example
5295 /// ```ignore,no_run
5296 /// # use google_cloud_tpu_v2::model::RuntimeVersion;
5297 /// let x = RuntimeVersion::new().set_name("example");
5298 /// ```
5299 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5300 self.name = v.into();
5301 self
5302 }
5303
5304 /// Sets the value of [version][crate::model::RuntimeVersion::version].
5305 ///
5306 /// # Example
5307 /// ```ignore,no_run
5308 /// # use google_cloud_tpu_v2::model::RuntimeVersion;
5309 /// let x = RuntimeVersion::new().set_version("example");
5310 /// ```
5311 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5312 self.version = v.into();
5313 self
5314 }
5315}
5316
5317impl wkt::message::Message for RuntimeVersion {
5318 fn typename() -> &'static str {
5319 "type.googleapis.com/google.cloud.tpu.v2.RuntimeVersion"
5320 }
5321}
5322
5323/// Request for [GetRuntimeVersion][google.cloud.tpu.v2.Tpu.GetRuntimeVersion].
5324///
5325/// [google.cloud.tpu.v2.Tpu.GetRuntimeVersion]: crate::client::Tpu::get_runtime_version
5326#[derive(Clone, Default, PartialEq)]
5327#[non_exhaustive]
5328pub struct GetRuntimeVersionRequest {
5329 /// Required. The resource name.
5330 pub name: std::string::String,
5331
5332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5333}
5334
5335impl GetRuntimeVersionRequest {
5336 pub fn new() -> Self {
5337 std::default::Default::default()
5338 }
5339
5340 /// Sets the value of [name][crate::model::GetRuntimeVersionRequest::name].
5341 ///
5342 /// # Example
5343 /// ```ignore,no_run
5344 /// # use google_cloud_tpu_v2::model::GetRuntimeVersionRequest;
5345 /// let x = GetRuntimeVersionRequest::new().set_name("example");
5346 /// ```
5347 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5348 self.name = v.into();
5349 self
5350 }
5351}
5352
5353impl wkt::message::Message for GetRuntimeVersionRequest {
5354 fn typename() -> &'static str {
5355 "type.googleapis.com/google.cloud.tpu.v2.GetRuntimeVersionRequest"
5356 }
5357}
5358
5359/// Request for
5360/// [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions].
5361///
5362/// [google.cloud.tpu.v2.Tpu.ListRuntimeVersions]: crate::client::Tpu::list_runtime_versions
5363#[derive(Clone, Default, PartialEq)]
5364#[non_exhaustive]
5365pub struct ListRuntimeVersionsRequest {
5366 /// Required. The parent resource name.
5367 pub parent: std::string::String,
5368
5369 /// The maximum number of items to return.
5370 pub page_size: i32,
5371
5372 /// The next_page_token value returned from a previous List request, if any.
5373 pub page_token: std::string::String,
5374
5375 /// List filter.
5376 pub filter: std::string::String,
5377
5378 /// Sort results.
5379 pub order_by: std::string::String,
5380
5381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5382}
5383
5384impl ListRuntimeVersionsRequest {
5385 pub fn new() -> Self {
5386 std::default::Default::default()
5387 }
5388
5389 /// Sets the value of [parent][crate::model::ListRuntimeVersionsRequest::parent].
5390 ///
5391 /// # Example
5392 /// ```ignore,no_run
5393 /// # use google_cloud_tpu_v2::model::ListRuntimeVersionsRequest;
5394 /// let x = ListRuntimeVersionsRequest::new().set_parent("example");
5395 /// ```
5396 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5397 self.parent = v.into();
5398 self
5399 }
5400
5401 /// Sets the value of [page_size][crate::model::ListRuntimeVersionsRequest::page_size].
5402 ///
5403 /// # Example
5404 /// ```ignore,no_run
5405 /// # use google_cloud_tpu_v2::model::ListRuntimeVersionsRequest;
5406 /// let x = ListRuntimeVersionsRequest::new().set_page_size(42);
5407 /// ```
5408 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5409 self.page_size = v.into();
5410 self
5411 }
5412
5413 /// Sets the value of [page_token][crate::model::ListRuntimeVersionsRequest::page_token].
5414 ///
5415 /// # Example
5416 /// ```ignore,no_run
5417 /// # use google_cloud_tpu_v2::model::ListRuntimeVersionsRequest;
5418 /// let x = ListRuntimeVersionsRequest::new().set_page_token("example");
5419 /// ```
5420 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5421 self.page_token = v.into();
5422 self
5423 }
5424
5425 /// Sets the value of [filter][crate::model::ListRuntimeVersionsRequest::filter].
5426 ///
5427 /// # Example
5428 /// ```ignore,no_run
5429 /// # use google_cloud_tpu_v2::model::ListRuntimeVersionsRequest;
5430 /// let x = ListRuntimeVersionsRequest::new().set_filter("example");
5431 /// ```
5432 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5433 self.filter = v.into();
5434 self
5435 }
5436
5437 /// Sets the value of [order_by][crate::model::ListRuntimeVersionsRequest::order_by].
5438 ///
5439 /// # Example
5440 /// ```ignore,no_run
5441 /// # use google_cloud_tpu_v2::model::ListRuntimeVersionsRequest;
5442 /// let x = ListRuntimeVersionsRequest::new().set_order_by("example");
5443 /// ```
5444 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5445 self.order_by = v.into();
5446 self
5447 }
5448}
5449
5450impl wkt::message::Message for ListRuntimeVersionsRequest {
5451 fn typename() -> &'static str {
5452 "type.googleapis.com/google.cloud.tpu.v2.ListRuntimeVersionsRequest"
5453 }
5454}
5455
5456/// Response for
5457/// [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions].
5458///
5459/// [google.cloud.tpu.v2.Tpu.ListRuntimeVersions]: crate::client::Tpu::list_runtime_versions
5460#[derive(Clone, Default, PartialEq)]
5461#[non_exhaustive]
5462pub struct ListRuntimeVersionsResponse {
5463 /// The listed nodes.
5464 pub runtime_versions: std::vec::Vec<crate::model::RuntimeVersion>,
5465
5466 /// The next page token or empty if none.
5467 pub next_page_token: std::string::String,
5468
5469 /// Locations that could not be reached.
5470 pub unreachable: std::vec::Vec<std::string::String>,
5471
5472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5473}
5474
5475impl ListRuntimeVersionsResponse {
5476 pub fn new() -> Self {
5477 std::default::Default::default()
5478 }
5479
5480 /// Sets the value of [runtime_versions][crate::model::ListRuntimeVersionsResponse::runtime_versions].
5481 ///
5482 /// # Example
5483 /// ```ignore,no_run
5484 /// # use google_cloud_tpu_v2::model::ListRuntimeVersionsResponse;
5485 /// use google_cloud_tpu_v2::model::RuntimeVersion;
5486 /// let x = ListRuntimeVersionsResponse::new()
5487 /// .set_runtime_versions([
5488 /// RuntimeVersion::default()/* use setters */,
5489 /// RuntimeVersion::default()/* use (different) setters */,
5490 /// ]);
5491 /// ```
5492 pub fn set_runtime_versions<T, V>(mut self, v: T) -> Self
5493 where
5494 T: std::iter::IntoIterator<Item = V>,
5495 V: std::convert::Into<crate::model::RuntimeVersion>,
5496 {
5497 use std::iter::Iterator;
5498 self.runtime_versions = v.into_iter().map(|i| i.into()).collect();
5499 self
5500 }
5501
5502 /// Sets the value of [next_page_token][crate::model::ListRuntimeVersionsResponse::next_page_token].
5503 ///
5504 /// # Example
5505 /// ```ignore,no_run
5506 /// # use google_cloud_tpu_v2::model::ListRuntimeVersionsResponse;
5507 /// let x = ListRuntimeVersionsResponse::new().set_next_page_token("example");
5508 /// ```
5509 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5510 self.next_page_token = v.into();
5511 self
5512 }
5513
5514 /// Sets the value of [unreachable][crate::model::ListRuntimeVersionsResponse::unreachable].
5515 ///
5516 /// # Example
5517 /// ```ignore,no_run
5518 /// # use google_cloud_tpu_v2::model::ListRuntimeVersionsResponse;
5519 /// let x = ListRuntimeVersionsResponse::new().set_unreachable(["a", "b", "c"]);
5520 /// ```
5521 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5522 where
5523 T: std::iter::IntoIterator<Item = V>,
5524 V: std::convert::Into<std::string::String>,
5525 {
5526 use std::iter::Iterator;
5527 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5528 self
5529 }
5530}
5531
5532impl wkt::message::Message for ListRuntimeVersionsResponse {
5533 fn typename() -> &'static str {
5534 "type.googleapis.com/google.cloud.tpu.v2.ListRuntimeVersionsResponse"
5535 }
5536}
5537
5538#[doc(hidden)]
5539impl google_cloud_gax::paginator::internal::PageableResponse for ListRuntimeVersionsResponse {
5540 type PageItem = crate::model::RuntimeVersion;
5541
5542 fn items(self) -> std::vec::Vec<Self::PageItem> {
5543 self.runtime_versions
5544 }
5545
5546 fn next_page_token(&self) -> std::string::String {
5547 use std::clone::Clone;
5548 self.next_page_token.clone()
5549 }
5550}
5551
5552/// Metadata describing an [Operation][google.longrunning.Operation]
5553///
5554/// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
5555#[derive(Clone, Default, PartialEq)]
5556#[non_exhaustive]
5557pub struct OperationMetadata {
5558 /// The time the operation was created.
5559 pub create_time: std::option::Option<wkt::Timestamp>,
5560
5561 /// The time the operation finished running.
5562 pub end_time: std::option::Option<wkt::Timestamp>,
5563
5564 /// Target of the operation - for example
5565 /// projects/project-1/connectivityTests/test-1
5566 pub target: std::string::String,
5567
5568 /// Name of the verb executed by the operation.
5569 pub verb: std::string::String,
5570
5571 /// Human-readable status of the operation, if any.
5572 pub status_detail: std::string::String,
5573
5574 /// Specifies if cancellation was requested for the operation.
5575 pub cancel_requested: bool,
5576
5577 /// API version.
5578 pub api_version: std::string::String,
5579
5580 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5581}
5582
5583impl OperationMetadata {
5584 pub fn new() -> Self {
5585 std::default::Default::default()
5586 }
5587
5588 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
5589 ///
5590 /// # Example
5591 /// ```ignore,no_run
5592 /// # use google_cloud_tpu_v2::model::OperationMetadata;
5593 /// use wkt::Timestamp;
5594 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
5595 /// ```
5596 pub fn set_create_time<T>(mut self, v: T) -> Self
5597 where
5598 T: std::convert::Into<wkt::Timestamp>,
5599 {
5600 self.create_time = std::option::Option::Some(v.into());
5601 self
5602 }
5603
5604 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
5605 ///
5606 /// # Example
5607 /// ```ignore,no_run
5608 /// # use google_cloud_tpu_v2::model::OperationMetadata;
5609 /// use wkt::Timestamp;
5610 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5611 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
5612 /// ```
5613 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5614 where
5615 T: std::convert::Into<wkt::Timestamp>,
5616 {
5617 self.create_time = v.map(|x| x.into());
5618 self
5619 }
5620
5621 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
5622 ///
5623 /// # Example
5624 /// ```ignore,no_run
5625 /// # use google_cloud_tpu_v2::model::OperationMetadata;
5626 /// use wkt::Timestamp;
5627 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
5628 /// ```
5629 pub fn set_end_time<T>(mut self, v: T) -> Self
5630 where
5631 T: std::convert::Into<wkt::Timestamp>,
5632 {
5633 self.end_time = std::option::Option::Some(v.into());
5634 self
5635 }
5636
5637 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
5638 ///
5639 /// # Example
5640 /// ```ignore,no_run
5641 /// # use google_cloud_tpu_v2::model::OperationMetadata;
5642 /// use wkt::Timestamp;
5643 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
5644 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
5645 /// ```
5646 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5647 where
5648 T: std::convert::Into<wkt::Timestamp>,
5649 {
5650 self.end_time = v.map(|x| x.into());
5651 self
5652 }
5653
5654 /// Sets the value of [target][crate::model::OperationMetadata::target].
5655 ///
5656 /// # Example
5657 /// ```ignore,no_run
5658 /// # use google_cloud_tpu_v2::model::OperationMetadata;
5659 /// let x = OperationMetadata::new().set_target("example");
5660 /// ```
5661 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5662 self.target = v.into();
5663 self
5664 }
5665
5666 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
5667 ///
5668 /// # Example
5669 /// ```ignore,no_run
5670 /// # use google_cloud_tpu_v2::model::OperationMetadata;
5671 /// let x = OperationMetadata::new().set_verb("example");
5672 /// ```
5673 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5674 self.verb = v.into();
5675 self
5676 }
5677
5678 /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
5679 ///
5680 /// # Example
5681 /// ```ignore,no_run
5682 /// # use google_cloud_tpu_v2::model::OperationMetadata;
5683 /// let x = OperationMetadata::new().set_status_detail("example");
5684 /// ```
5685 pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5686 self.status_detail = v.into();
5687 self
5688 }
5689
5690 /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
5691 ///
5692 /// # Example
5693 /// ```ignore,no_run
5694 /// # use google_cloud_tpu_v2::model::OperationMetadata;
5695 /// let x = OperationMetadata::new().set_cancel_requested(true);
5696 /// ```
5697 pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5698 self.cancel_requested = v.into();
5699 self
5700 }
5701
5702 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
5703 ///
5704 /// # Example
5705 /// ```ignore,no_run
5706 /// # use google_cloud_tpu_v2::model::OperationMetadata;
5707 /// let x = OperationMetadata::new().set_api_version("example");
5708 /// ```
5709 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5710 self.api_version = v.into();
5711 self
5712 }
5713}
5714
5715impl wkt::message::Message for OperationMetadata {
5716 fn typename() -> &'static str {
5717 "type.googleapis.com/google.cloud.tpu.v2.OperationMetadata"
5718 }
5719}
5720
5721/// A Symptom instance.
5722#[derive(Clone, Default, PartialEq)]
5723#[non_exhaustive]
5724pub struct Symptom {
5725 /// Timestamp when the Symptom is created.
5726 pub create_time: std::option::Option<wkt::Timestamp>,
5727
5728 /// Type of the Symptom.
5729 pub symptom_type: crate::model::symptom::SymptomType,
5730
5731 /// Detailed information of the current Symptom.
5732 pub details: std::string::String,
5733
5734 /// A string used to uniquely distinguish a worker within a TPU node.
5735 pub worker_id: std::string::String,
5736
5737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5738}
5739
5740impl Symptom {
5741 pub fn new() -> Self {
5742 std::default::Default::default()
5743 }
5744
5745 /// Sets the value of [create_time][crate::model::Symptom::create_time].
5746 ///
5747 /// # Example
5748 /// ```ignore,no_run
5749 /// # use google_cloud_tpu_v2::model::Symptom;
5750 /// use wkt::Timestamp;
5751 /// let x = Symptom::new().set_create_time(Timestamp::default()/* use setters */);
5752 /// ```
5753 pub fn set_create_time<T>(mut self, v: T) -> Self
5754 where
5755 T: std::convert::Into<wkt::Timestamp>,
5756 {
5757 self.create_time = std::option::Option::Some(v.into());
5758 self
5759 }
5760
5761 /// Sets or clears the value of [create_time][crate::model::Symptom::create_time].
5762 ///
5763 /// # Example
5764 /// ```ignore,no_run
5765 /// # use google_cloud_tpu_v2::model::Symptom;
5766 /// use wkt::Timestamp;
5767 /// let x = Symptom::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5768 /// let x = Symptom::new().set_or_clear_create_time(None::<Timestamp>);
5769 /// ```
5770 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5771 where
5772 T: std::convert::Into<wkt::Timestamp>,
5773 {
5774 self.create_time = v.map(|x| x.into());
5775 self
5776 }
5777
5778 /// Sets the value of [symptom_type][crate::model::Symptom::symptom_type].
5779 ///
5780 /// # Example
5781 /// ```ignore,no_run
5782 /// # use google_cloud_tpu_v2::model::Symptom;
5783 /// use google_cloud_tpu_v2::model::symptom::SymptomType;
5784 /// let x0 = Symptom::new().set_symptom_type(SymptomType::LowMemory);
5785 /// let x1 = Symptom::new().set_symptom_type(SymptomType::OutOfMemory);
5786 /// let x2 = Symptom::new().set_symptom_type(SymptomType::ExecuteTimedOut);
5787 /// ```
5788 pub fn set_symptom_type<T: std::convert::Into<crate::model::symptom::SymptomType>>(
5789 mut self,
5790 v: T,
5791 ) -> Self {
5792 self.symptom_type = v.into();
5793 self
5794 }
5795
5796 /// Sets the value of [details][crate::model::Symptom::details].
5797 ///
5798 /// # Example
5799 /// ```ignore,no_run
5800 /// # use google_cloud_tpu_v2::model::Symptom;
5801 /// let x = Symptom::new().set_details("example");
5802 /// ```
5803 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5804 self.details = v.into();
5805 self
5806 }
5807
5808 /// Sets the value of [worker_id][crate::model::Symptom::worker_id].
5809 ///
5810 /// # Example
5811 /// ```ignore,no_run
5812 /// # use google_cloud_tpu_v2::model::Symptom;
5813 /// let x = Symptom::new().set_worker_id("example");
5814 /// ```
5815 pub fn set_worker_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5816 self.worker_id = v.into();
5817 self
5818 }
5819}
5820
5821impl wkt::message::Message for Symptom {
5822 fn typename() -> &'static str {
5823 "type.googleapis.com/google.cloud.tpu.v2.Symptom"
5824 }
5825}
5826
5827/// Defines additional types related to [Symptom].
5828pub mod symptom {
5829 #[allow(unused_imports)]
5830 use super::*;
5831
5832 /// SymptomType represents the different types of Symptoms that a TPU can be
5833 /// at.
5834 ///
5835 /// # Working with unknown values
5836 ///
5837 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5838 /// additional enum variants at any time. Adding new variants is not considered
5839 /// a breaking change. Applications should write their code in anticipation of:
5840 ///
5841 /// - New values appearing in future releases of the client library, **and**
5842 /// - New values received dynamically, without application changes.
5843 ///
5844 /// Please consult the [Working with enums] section in the user guide for some
5845 /// guidelines.
5846 ///
5847 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5848 #[derive(Clone, Debug, PartialEq)]
5849 #[non_exhaustive]
5850 pub enum SymptomType {
5851 /// Unspecified symptom.
5852 Unspecified,
5853 /// TPU VM memory is low.
5854 LowMemory,
5855 /// TPU runtime is out of memory.
5856 OutOfMemory,
5857 /// TPU runtime execution has timed out.
5858 ExecuteTimedOut,
5859 /// TPU runtime fails to construct a mesh that recognizes each TPU device's
5860 /// neighbors.
5861 MeshBuildFail,
5862 /// TPU HBM is out of memory.
5863 HbmOutOfMemory,
5864 /// Abusive behaviors have been identified on the current project.
5865 ProjectAbuse,
5866 /// If set, the enum was initialized with an unknown value.
5867 ///
5868 /// Applications can examine the value using [SymptomType::value] or
5869 /// [SymptomType::name].
5870 UnknownValue(symptom_type::UnknownValue),
5871 }
5872
5873 #[doc(hidden)]
5874 pub mod symptom_type {
5875 #[allow(unused_imports)]
5876 use super::*;
5877 #[derive(Clone, Debug, PartialEq)]
5878 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5879 }
5880
5881 impl SymptomType {
5882 /// Gets the enum value.
5883 ///
5884 /// Returns `None` if the enum contains an unknown value deserialized from
5885 /// the string representation of enums.
5886 pub fn value(&self) -> std::option::Option<i32> {
5887 match self {
5888 Self::Unspecified => std::option::Option::Some(0),
5889 Self::LowMemory => std::option::Option::Some(1),
5890 Self::OutOfMemory => std::option::Option::Some(2),
5891 Self::ExecuteTimedOut => std::option::Option::Some(3),
5892 Self::MeshBuildFail => std::option::Option::Some(4),
5893 Self::HbmOutOfMemory => std::option::Option::Some(5),
5894 Self::ProjectAbuse => std::option::Option::Some(6),
5895 Self::UnknownValue(u) => u.0.value(),
5896 }
5897 }
5898
5899 /// Gets the enum value as a string.
5900 ///
5901 /// Returns `None` if the enum contains an unknown value deserialized from
5902 /// the integer representation of enums.
5903 pub fn name(&self) -> std::option::Option<&str> {
5904 match self {
5905 Self::Unspecified => std::option::Option::Some("SYMPTOM_TYPE_UNSPECIFIED"),
5906 Self::LowMemory => std::option::Option::Some("LOW_MEMORY"),
5907 Self::OutOfMemory => std::option::Option::Some("OUT_OF_MEMORY"),
5908 Self::ExecuteTimedOut => std::option::Option::Some("EXECUTE_TIMED_OUT"),
5909 Self::MeshBuildFail => std::option::Option::Some("MESH_BUILD_FAIL"),
5910 Self::HbmOutOfMemory => std::option::Option::Some("HBM_OUT_OF_MEMORY"),
5911 Self::ProjectAbuse => std::option::Option::Some("PROJECT_ABUSE"),
5912 Self::UnknownValue(u) => u.0.name(),
5913 }
5914 }
5915 }
5916
5917 impl std::default::Default for SymptomType {
5918 fn default() -> Self {
5919 use std::convert::From;
5920 Self::from(0)
5921 }
5922 }
5923
5924 impl std::fmt::Display for SymptomType {
5925 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5926 wkt::internal::display_enum(f, self.name(), self.value())
5927 }
5928 }
5929
5930 impl std::convert::From<i32> for SymptomType {
5931 fn from(value: i32) -> Self {
5932 match value {
5933 0 => Self::Unspecified,
5934 1 => Self::LowMemory,
5935 2 => Self::OutOfMemory,
5936 3 => Self::ExecuteTimedOut,
5937 4 => Self::MeshBuildFail,
5938 5 => Self::HbmOutOfMemory,
5939 6 => Self::ProjectAbuse,
5940 _ => Self::UnknownValue(symptom_type::UnknownValue(
5941 wkt::internal::UnknownEnumValue::Integer(value),
5942 )),
5943 }
5944 }
5945 }
5946
5947 impl std::convert::From<&str> for SymptomType {
5948 fn from(value: &str) -> Self {
5949 use std::string::ToString;
5950 match value {
5951 "SYMPTOM_TYPE_UNSPECIFIED" => Self::Unspecified,
5952 "LOW_MEMORY" => Self::LowMemory,
5953 "OUT_OF_MEMORY" => Self::OutOfMemory,
5954 "EXECUTE_TIMED_OUT" => Self::ExecuteTimedOut,
5955 "MESH_BUILD_FAIL" => Self::MeshBuildFail,
5956 "HBM_OUT_OF_MEMORY" => Self::HbmOutOfMemory,
5957 "PROJECT_ABUSE" => Self::ProjectAbuse,
5958 _ => Self::UnknownValue(symptom_type::UnknownValue(
5959 wkt::internal::UnknownEnumValue::String(value.to_string()),
5960 )),
5961 }
5962 }
5963 }
5964
5965 impl serde::ser::Serialize for SymptomType {
5966 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5967 where
5968 S: serde::Serializer,
5969 {
5970 match self {
5971 Self::Unspecified => serializer.serialize_i32(0),
5972 Self::LowMemory => serializer.serialize_i32(1),
5973 Self::OutOfMemory => serializer.serialize_i32(2),
5974 Self::ExecuteTimedOut => serializer.serialize_i32(3),
5975 Self::MeshBuildFail => serializer.serialize_i32(4),
5976 Self::HbmOutOfMemory => serializer.serialize_i32(5),
5977 Self::ProjectAbuse => serializer.serialize_i32(6),
5978 Self::UnknownValue(u) => u.0.serialize(serializer),
5979 }
5980 }
5981 }
5982
5983 impl<'de> serde::de::Deserialize<'de> for SymptomType {
5984 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5985 where
5986 D: serde::Deserializer<'de>,
5987 {
5988 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SymptomType>::new(
5989 ".google.cloud.tpu.v2.Symptom.SymptomType",
5990 ))
5991 }
5992 }
5993}
5994
5995/// Request for [GetGuestAttributes][google.cloud.tpu.v2.Tpu.GetGuestAttributes].
5996///
5997/// [google.cloud.tpu.v2.Tpu.GetGuestAttributes]: crate::client::Tpu::get_guest_attributes
5998#[derive(Clone, Default, PartialEq)]
5999#[non_exhaustive]
6000pub struct GetGuestAttributesRequest {
6001 /// Required. The resource name.
6002 pub name: std::string::String,
6003
6004 /// The guest attributes path to be queried.
6005 pub query_path: std::string::String,
6006
6007 /// The 0-based worker ID. If it is empty, all workers' GuestAttributes will be
6008 /// returned.
6009 pub worker_ids: std::vec::Vec<std::string::String>,
6010
6011 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6012}
6013
6014impl GetGuestAttributesRequest {
6015 pub fn new() -> Self {
6016 std::default::Default::default()
6017 }
6018
6019 /// Sets the value of [name][crate::model::GetGuestAttributesRequest::name].
6020 ///
6021 /// # Example
6022 /// ```ignore,no_run
6023 /// # use google_cloud_tpu_v2::model::GetGuestAttributesRequest;
6024 /// let x = GetGuestAttributesRequest::new().set_name("example");
6025 /// ```
6026 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6027 self.name = v.into();
6028 self
6029 }
6030
6031 /// Sets the value of [query_path][crate::model::GetGuestAttributesRequest::query_path].
6032 ///
6033 /// # Example
6034 /// ```ignore,no_run
6035 /// # use google_cloud_tpu_v2::model::GetGuestAttributesRequest;
6036 /// let x = GetGuestAttributesRequest::new().set_query_path("example");
6037 /// ```
6038 pub fn set_query_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6039 self.query_path = v.into();
6040 self
6041 }
6042
6043 /// Sets the value of [worker_ids][crate::model::GetGuestAttributesRequest::worker_ids].
6044 ///
6045 /// # Example
6046 /// ```ignore,no_run
6047 /// # use google_cloud_tpu_v2::model::GetGuestAttributesRequest;
6048 /// let x = GetGuestAttributesRequest::new().set_worker_ids(["a", "b", "c"]);
6049 /// ```
6050 pub fn set_worker_ids<T, V>(mut self, v: T) -> Self
6051 where
6052 T: std::iter::IntoIterator<Item = V>,
6053 V: std::convert::Into<std::string::String>,
6054 {
6055 use std::iter::Iterator;
6056 self.worker_ids = v.into_iter().map(|i| i.into()).collect();
6057 self
6058 }
6059}
6060
6061impl wkt::message::Message for GetGuestAttributesRequest {
6062 fn typename() -> &'static str {
6063 "type.googleapis.com/google.cloud.tpu.v2.GetGuestAttributesRequest"
6064 }
6065}
6066
6067/// Response for
6068/// [GetGuestAttributes][google.cloud.tpu.v2.Tpu.GetGuestAttributes].
6069///
6070/// [google.cloud.tpu.v2.Tpu.GetGuestAttributes]: crate::client::Tpu::get_guest_attributes
6071#[derive(Clone, Default, PartialEq)]
6072#[non_exhaustive]
6073pub struct GetGuestAttributesResponse {
6074 /// The guest attributes for the TPU workers.
6075 pub guest_attributes: std::vec::Vec<crate::model::GuestAttributes>,
6076
6077 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6078}
6079
6080impl GetGuestAttributesResponse {
6081 pub fn new() -> Self {
6082 std::default::Default::default()
6083 }
6084
6085 /// Sets the value of [guest_attributes][crate::model::GetGuestAttributesResponse::guest_attributes].
6086 ///
6087 /// # Example
6088 /// ```ignore,no_run
6089 /// # use google_cloud_tpu_v2::model::GetGuestAttributesResponse;
6090 /// use google_cloud_tpu_v2::model::GuestAttributes;
6091 /// let x = GetGuestAttributesResponse::new()
6092 /// .set_guest_attributes([
6093 /// GuestAttributes::default()/* use setters */,
6094 /// GuestAttributes::default()/* use (different) setters */,
6095 /// ]);
6096 /// ```
6097 pub fn set_guest_attributes<T, V>(mut self, v: T) -> Self
6098 where
6099 T: std::iter::IntoIterator<Item = V>,
6100 V: std::convert::Into<crate::model::GuestAttributes>,
6101 {
6102 use std::iter::Iterator;
6103 self.guest_attributes = v.into_iter().map(|i| i.into()).collect();
6104 self
6105 }
6106}
6107
6108impl wkt::message::Message for GetGuestAttributesResponse {
6109 fn typename() -> &'static str {
6110 "type.googleapis.com/google.cloud.tpu.v2.GetGuestAttributesResponse"
6111 }
6112}
6113
6114/// A TPU accelerator configuration.
6115#[derive(Clone, Default, PartialEq)]
6116#[non_exhaustive]
6117pub struct AcceleratorConfig {
6118 /// Required. Type of TPU.
6119 pub r#type: crate::model::accelerator_config::Type,
6120
6121 /// Required. Topology of TPU in chips.
6122 pub topology: std::string::String,
6123
6124 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6125}
6126
6127impl AcceleratorConfig {
6128 pub fn new() -> Self {
6129 std::default::Default::default()
6130 }
6131
6132 /// Sets the value of [r#type][crate::model::AcceleratorConfig::type].
6133 ///
6134 /// # Example
6135 /// ```ignore,no_run
6136 /// # use google_cloud_tpu_v2::model::AcceleratorConfig;
6137 /// use google_cloud_tpu_v2::model::accelerator_config::Type;
6138 /// let x0 = AcceleratorConfig::new().set_type(Type::V2);
6139 /// let x1 = AcceleratorConfig::new().set_type(Type::V3);
6140 /// let x2 = AcceleratorConfig::new().set_type(Type::V4);
6141 /// ```
6142 pub fn set_type<T: std::convert::Into<crate::model::accelerator_config::Type>>(
6143 mut self,
6144 v: T,
6145 ) -> Self {
6146 self.r#type = v.into();
6147 self
6148 }
6149
6150 /// Sets the value of [topology][crate::model::AcceleratorConfig::topology].
6151 ///
6152 /// # Example
6153 /// ```ignore,no_run
6154 /// # use google_cloud_tpu_v2::model::AcceleratorConfig;
6155 /// let x = AcceleratorConfig::new().set_topology("example");
6156 /// ```
6157 pub fn set_topology<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6158 self.topology = v.into();
6159 self
6160 }
6161}
6162
6163impl wkt::message::Message for AcceleratorConfig {
6164 fn typename() -> &'static str {
6165 "type.googleapis.com/google.cloud.tpu.v2.AcceleratorConfig"
6166 }
6167}
6168
6169/// Defines additional types related to [AcceleratorConfig].
6170pub mod accelerator_config {
6171 #[allow(unused_imports)]
6172 use super::*;
6173
6174 /// TPU type.
6175 ///
6176 /// # Working with unknown values
6177 ///
6178 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6179 /// additional enum variants at any time. Adding new variants is not considered
6180 /// a breaking change. Applications should write their code in anticipation of:
6181 ///
6182 /// - New values appearing in future releases of the client library, **and**
6183 /// - New values received dynamically, without application changes.
6184 ///
6185 /// Please consult the [Working with enums] section in the user guide for some
6186 /// guidelines.
6187 ///
6188 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6189 #[derive(Clone, Debug, PartialEq)]
6190 #[non_exhaustive]
6191 pub enum Type {
6192 /// Unspecified version.
6193 Unspecified,
6194 /// TPU v2.
6195 V2,
6196 /// TPU v3.
6197 V3,
6198 /// TPU v4.
6199 V4,
6200 /// TPU v5lite pod.
6201 V5LitePod,
6202 /// TPU v5p.
6203 V5P,
6204 /// TPU v6e.
6205 V6E,
6206 /// If set, the enum was initialized with an unknown value.
6207 ///
6208 /// Applications can examine the value using [Type::value] or
6209 /// [Type::name].
6210 UnknownValue(r#type::UnknownValue),
6211 }
6212
6213 #[doc(hidden)]
6214 pub mod r#type {
6215 #[allow(unused_imports)]
6216 use super::*;
6217 #[derive(Clone, Debug, PartialEq)]
6218 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6219 }
6220
6221 impl Type {
6222 /// Gets the enum value.
6223 ///
6224 /// Returns `None` if the enum contains an unknown value deserialized from
6225 /// the string representation of enums.
6226 pub fn value(&self) -> std::option::Option<i32> {
6227 match self {
6228 Self::Unspecified => std::option::Option::Some(0),
6229 Self::V2 => std::option::Option::Some(2),
6230 Self::V3 => std::option::Option::Some(4),
6231 Self::V4 => std::option::Option::Some(7),
6232 Self::V5LitePod => std::option::Option::Some(9),
6233 Self::V5P => std::option::Option::Some(10),
6234 Self::V6E => std::option::Option::Some(11),
6235 Self::UnknownValue(u) => u.0.value(),
6236 }
6237 }
6238
6239 /// Gets the enum value as a string.
6240 ///
6241 /// Returns `None` if the enum contains an unknown value deserialized from
6242 /// the integer representation of enums.
6243 pub fn name(&self) -> std::option::Option<&str> {
6244 match self {
6245 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
6246 Self::V2 => std::option::Option::Some("V2"),
6247 Self::V3 => std::option::Option::Some("V3"),
6248 Self::V4 => std::option::Option::Some("V4"),
6249 Self::V5LitePod => std::option::Option::Some("V5LITE_POD"),
6250 Self::V5P => std::option::Option::Some("V5P"),
6251 Self::V6E => std::option::Option::Some("V6E"),
6252 Self::UnknownValue(u) => u.0.name(),
6253 }
6254 }
6255 }
6256
6257 impl std::default::Default for Type {
6258 fn default() -> Self {
6259 use std::convert::From;
6260 Self::from(0)
6261 }
6262 }
6263
6264 impl std::fmt::Display for Type {
6265 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6266 wkt::internal::display_enum(f, self.name(), self.value())
6267 }
6268 }
6269
6270 impl std::convert::From<i32> for Type {
6271 fn from(value: i32) -> Self {
6272 match value {
6273 0 => Self::Unspecified,
6274 2 => Self::V2,
6275 4 => Self::V3,
6276 7 => Self::V4,
6277 9 => Self::V5LitePod,
6278 10 => Self::V5P,
6279 11 => Self::V6E,
6280 _ => Self::UnknownValue(r#type::UnknownValue(
6281 wkt::internal::UnknownEnumValue::Integer(value),
6282 )),
6283 }
6284 }
6285 }
6286
6287 impl std::convert::From<&str> for Type {
6288 fn from(value: &str) -> Self {
6289 use std::string::ToString;
6290 match value {
6291 "TYPE_UNSPECIFIED" => Self::Unspecified,
6292 "V2" => Self::V2,
6293 "V3" => Self::V3,
6294 "V4" => Self::V4,
6295 "V5LITE_POD" => Self::V5LitePod,
6296 "V5P" => Self::V5P,
6297 "V6E" => Self::V6E,
6298 _ => Self::UnknownValue(r#type::UnknownValue(
6299 wkt::internal::UnknownEnumValue::String(value.to_string()),
6300 )),
6301 }
6302 }
6303 }
6304
6305 impl serde::ser::Serialize for Type {
6306 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6307 where
6308 S: serde::Serializer,
6309 {
6310 match self {
6311 Self::Unspecified => serializer.serialize_i32(0),
6312 Self::V2 => serializer.serialize_i32(2),
6313 Self::V3 => serializer.serialize_i32(4),
6314 Self::V4 => serializer.serialize_i32(7),
6315 Self::V5LitePod => serializer.serialize_i32(9),
6316 Self::V5P => serializer.serialize_i32(10),
6317 Self::V6E => serializer.serialize_i32(11),
6318 Self::UnknownValue(u) => u.0.serialize(serializer),
6319 }
6320 }
6321 }
6322
6323 impl<'de> serde::de::Deserialize<'de> for Type {
6324 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6325 where
6326 D: serde::Deserializer<'de>,
6327 {
6328 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
6329 ".google.cloud.tpu.v2.AcceleratorConfig.Type",
6330 ))
6331 }
6332 }
6333}
6334
6335/// A set of Shielded Instance options.
6336#[derive(Clone, Default, PartialEq)]
6337#[non_exhaustive]
6338pub struct ShieldedInstanceConfig {
6339 /// Defines whether the instance has Secure Boot enabled.
6340 pub enable_secure_boot: bool,
6341
6342 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6343}
6344
6345impl ShieldedInstanceConfig {
6346 pub fn new() -> Self {
6347 std::default::Default::default()
6348 }
6349
6350 /// Sets the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
6351 ///
6352 /// # Example
6353 /// ```ignore,no_run
6354 /// # use google_cloud_tpu_v2::model::ShieldedInstanceConfig;
6355 /// let x = ShieldedInstanceConfig::new().set_enable_secure_boot(true);
6356 /// ```
6357 pub fn set_enable_secure_boot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6358 self.enable_secure_boot = v.into();
6359 self
6360 }
6361}
6362
6363impl wkt::message::Message for ShieldedInstanceConfig {
6364 fn typename() -> &'static str {
6365 "type.googleapis.com/google.cloud.tpu.v2.ShieldedInstanceConfig"
6366 }
6367}