#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_location;
extern crate google_cloud_longrunning;
extern crate google_cloud_lro;
extern crate google_cloud_rpc;
extern crate google_cloud_type;
extern crate lazy_static;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GuestAttributes {
pub query_path: std::string::String,
pub query_value: std::option::Option<crate::model::GuestAttributesValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GuestAttributes {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_query_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query_path = v.into();
self
}
pub fn set_query_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GuestAttributesValue>,
{
self.query_value = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_query_value<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GuestAttributesValue>,
{
self.query_value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for GuestAttributes {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GuestAttributes"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GuestAttributesValue {
pub items: std::vec::Vec<crate::model::GuestAttributesEntry>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GuestAttributesValue {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::GuestAttributesEntry>,
{
use std::iter::Iterator;
self.items = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for GuestAttributesValue {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GuestAttributesValue"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GuestAttributesEntry {
pub namespace: std::string::String,
pub key: std::string::String,
pub value: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GuestAttributesEntry {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.namespace = v.into();
self
}
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
}
impl wkt::message::Message for GuestAttributesEntry {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GuestAttributesEntry"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AttachedDisk {
pub source_disk: std::string::String,
pub mode: crate::model::attached_disk::DiskMode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AttachedDisk {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_source_disk<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source_disk = v.into();
self
}
pub fn set_mode<T: std::convert::Into<crate::model::attached_disk::DiskMode>>(
mut self,
v: T,
) -> Self {
self.mode = v.into();
self
}
}
impl wkt::message::Message for AttachedDisk {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.AttachedDisk"
}
}
pub mod attached_disk {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DiskMode {
Unspecified,
ReadWrite,
ReadOnly,
UnknownValue(disk_mode::UnknownValue),
}
#[doc(hidden)]
pub mod disk_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DiskMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ReadWrite => std::option::Option::Some(1),
Self::ReadOnly => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DISK_MODE_UNSPECIFIED"),
Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DiskMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DiskMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DiskMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ReadWrite,
2 => Self::ReadOnly,
_ => Self::UnknownValue(disk_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DiskMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DISK_MODE_UNSPECIFIED" => Self::Unspecified,
"READ_WRITE" => Self::ReadWrite,
"READ_ONLY" => Self::ReadOnly,
_ => Self::UnknownValue(disk_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DiskMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ReadWrite => serializer.serialize_i32(1),
Self::ReadOnly => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DiskMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiskMode>::new(
".google.cloud.tpu.v2.AttachedDisk.DiskMode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SchedulingConfig {
pub preemptible: bool,
pub reserved: bool,
pub spot: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SchedulingConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.preemptible = v.into();
self
}
pub fn set_reserved<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.reserved = v.into();
self
}
pub fn set_spot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.spot = v.into();
self
}
}
impl wkt::message::Message for SchedulingConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.SchedulingConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NetworkEndpoint {
pub ip_address: std::string::String,
pub port: i32,
pub access_config: std::option::Option<crate::model::AccessConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl NetworkEndpoint {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.ip_address = v.into();
self
}
pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.port = v.into();
self
}
pub fn set_access_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AccessConfig>,
{
self.access_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_access_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AccessConfig>,
{
self.access_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for NetworkEndpoint {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.NetworkEndpoint"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AccessConfig {
pub external_ip: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AccessConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_external_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.external_ip = v.into();
self
}
}
impl wkt::message::Message for AccessConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.AccessConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NetworkConfig {
pub network: std::string::String,
pub subnetwork: std::string::String,
pub enable_external_ips: bool,
pub can_ip_forward: bool,
pub queue_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl NetworkConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.network = v.into();
self
}
pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.subnetwork = v.into();
self
}
pub fn set_enable_external_ips<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_external_ips = v.into();
self
}
pub fn set_can_ip_forward<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.can_ip_forward = v.into();
self
}
pub fn set_queue_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.queue_count = v.into();
self
}
}
impl wkt::message::Message for NetworkConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.NetworkConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceAccount {
pub email: std::string::String,
pub scope: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ServiceAccount {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.email = v.into();
self
}
pub fn set_scope<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.scope = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ServiceAccount {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ServiceAccount"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Node {
pub name: std::string::String,
pub description: std::string::String,
pub accelerator_type: std::string::String,
pub state: crate::model::node::State,
pub health_description: std::string::String,
pub runtime_version: std::string::String,
pub network_config: std::option::Option<crate::model::NetworkConfig>,
pub network_configs: std::vec::Vec<crate::model::NetworkConfig>,
pub cidr_block: std::string::String,
pub service_account: std::option::Option<crate::model::ServiceAccount>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub scheduling_config: std::option::Option<crate::model::SchedulingConfig>,
pub network_endpoints: std::vec::Vec<crate::model::NetworkEndpoint>,
pub health: crate::model::node::Health,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
pub tags: std::vec::Vec<std::string::String>,
pub id: i64,
pub data_disks: std::vec::Vec<crate::model::AttachedDisk>,
pub api_version: crate::model::node::ApiVersion,
pub symptoms: std::vec::Vec<crate::model::Symptom>,
pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
pub accelerator_config: std::option::Option<crate::model::AcceleratorConfig>,
pub queued_resource: std::string::String,
pub multislice_node: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Node {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.accelerator_type = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::node::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
pub fn set_health_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.health_description = v.into();
self
}
pub fn set_runtime_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.runtime_version = v.into();
self
}
pub fn set_network_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NetworkConfig>,
{
self.network_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::NetworkConfig>,
{
self.network_config = v.map(|x| x.into());
self
}
pub fn set_network_configs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::NetworkConfig>,
{
use std::iter::Iterator;
self.network_configs = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_cidr_block<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cidr_block = v.into();
self
}
pub fn set_service_account<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ServiceAccount>,
{
self.service_account = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_service_account<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ServiceAccount>,
{
self.service_account = v.map(|x| x.into());
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_scheduling_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SchedulingConfig>,
{
self.scheduling_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_scheduling_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SchedulingConfig>,
{
self.scheduling_config = v.map(|x| x.into());
self
}
pub fn set_network_endpoints<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::NetworkEndpoint>,
{
use std::iter::Iterator;
self.network_endpoints = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_health<T: std::convert::Into<crate::model::node::Health>>(mut self, v: T) -> Self {
self.health = v.into();
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_tags<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.tags = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_data_disks<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AttachedDisk>,
{
use std::iter::Iterator;
self.data_disks = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_api_version<T: std::convert::Into<crate::model::node::ApiVersion>>(
mut self,
v: T,
) -> Self {
self.api_version = v.into();
self
}
pub fn set_symptoms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Symptom>,
{
use std::iter::Iterator;
self.symptoms = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
{
self.shielded_instance_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
{
self.shielded_instance_config = v.map(|x| x.into());
self
}
pub fn set_accelerator_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AcceleratorConfig>,
{
self.accelerator_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_accelerator_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AcceleratorConfig>,
{
self.accelerator_config = v.map(|x| x.into());
self
}
pub fn set_queued_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.queued_resource = v.into();
self
}
pub fn set_multislice_node<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.multislice_node = v.into();
self
}
}
impl wkt::message::Message for Node {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.Node"
}
}
pub mod node {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Creating,
Ready,
Restarting,
Reimaging,
Deleting,
Repairing,
Stopped,
Stopping,
Starting,
Preempted,
Terminated,
Hiding,
Hidden,
Unhiding,
Unknown,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Creating => std::option::Option::Some(1),
Self::Ready => std::option::Option::Some(2),
Self::Restarting => std::option::Option::Some(3),
Self::Reimaging => std::option::Option::Some(4),
Self::Deleting => std::option::Option::Some(5),
Self::Repairing => std::option::Option::Some(6),
Self::Stopped => std::option::Option::Some(8),
Self::Stopping => std::option::Option::Some(9),
Self::Starting => std::option::Option::Some(10),
Self::Preempted => std::option::Option::Some(11),
Self::Terminated => std::option::Option::Some(12),
Self::Hiding => std::option::Option::Some(13),
Self::Hidden => std::option::Option::Some(14),
Self::Unhiding => std::option::Option::Some(15),
Self::Unknown => std::option::Option::Some(16),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Creating => std::option::Option::Some("CREATING"),
Self::Ready => std::option::Option::Some("READY"),
Self::Restarting => std::option::Option::Some("RESTARTING"),
Self::Reimaging => std::option::Option::Some("REIMAGING"),
Self::Deleting => std::option::Option::Some("DELETING"),
Self::Repairing => std::option::Option::Some("REPAIRING"),
Self::Stopped => std::option::Option::Some("STOPPED"),
Self::Stopping => std::option::Option::Some("STOPPING"),
Self::Starting => std::option::Option::Some("STARTING"),
Self::Preempted => std::option::Option::Some("PREEMPTED"),
Self::Terminated => std::option::Option::Some("TERMINATED"),
Self::Hiding => std::option::Option::Some("HIDING"),
Self::Hidden => std::option::Option::Some("HIDDEN"),
Self::Unhiding => std::option::Option::Some("UNHIDING"),
Self::Unknown => std::option::Option::Some("UNKNOWN"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Creating,
2 => Self::Ready,
3 => Self::Restarting,
4 => Self::Reimaging,
5 => Self::Deleting,
6 => Self::Repairing,
8 => Self::Stopped,
9 => Self::Stopping,
10 => Self::Starting,
11 => Self::Preempted,
12 => Self::Terminated,
13 => Self::Hiding,
14 => Self::Hidden,
15 => Self::Unhiding,
16 => Self::Unknown,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"CREATING" => Self::Creating,
"READY" => Self::Ready,
"RESTARTING" => Self::Restarting,
"REIMAGING" => Self::Reimaging,
"DELETING" => Self::Deleting,
"REPAIRING" => Self::Repairing,
"STOPPED" => Self::Stopped,
"STOPPING" => Self::Stopping,
"STARTING" => Self::Starting,
"PREEMPTED" => Self::Preempted,
"TERMINATED" => Self::Terminated,
"HIDING" => Self::Hiding,
"HIDDEN" => Self::Hidden,
"UNHIDING" => Self::Unhiding,
"UNKNOWN" => Self::Unknown,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Creating => serializer.serialize_i32(1),
Self::Ready => serializer.serialize_i32(2),
Self::Restarting => serializer.serialize_i32(3),
Self::Reimaging => serializer.serialize_i32(4),
Self::Deleting => serializer.serialize_i32(5),
Self::Repairing => serializer.serialize_i32(6),
Self::Stopped => serializer.serialize_i32(8),
Self::Stopping => serializer.serialize_i32(9),
Self::Starting => serializer.serialize_i32(10),
Self::Preempted => serializer.serialize_i32(11),
Self::Terminated => serializer.serialize_i32(12),
Self::Hiding => serializer.serialize_i32(13),
Self::Hidden => serializer.serialize_i32(14),
Self::Unhiding => serializer.serialize_i32(15),
Self::Unknown => serializer.serialize_i32(16),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.cloud.tpu.v2.Node.State",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Health {
Unspecified,
Healthy,
Timeout,
UnhealthyTensorflow,
UnhealthyMaintenance,
UnknownValue(health::UnknownValue),
}
#[doc(hidden)]
pub mod health {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Health {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Healthy => std::option::Option::Some(1),
Self::Timeout => std::option::Option::Some(3),
Self::UnhealthyTensorflow => std::option::Option::Some(4),
Self::UnhealthyMaintenance => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("HEALTH_UNSPECIFIED"),
Self::Healthy => std::option::Option::Some("HEALTHY"),
Self::Timeout => std::option::Option::Some("TIMEOUT"),
Self::UnhealthyTensorflow => std::option::Option::Some("UNHEALTHY_TENSORFLOW"),
Self::UnhealthyMaintenance => std::option::Option::Some("UNHEALTHY_MAINTENANCE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Health {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Health {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Health {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Healthy,
3 => Self::Timeout,
4 => Self::UnhealthyTensorflow,
5 => Self::UnhealthyMaintenance,
_ => Self::UnknownValue(health::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Health {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"HEALTH_UNSPECIFIED" => Self::Unspecified,
"HEALTHY" => Self::Healthy,
"TIMEOUT" => Self::Timeout,
"UNHEALTHY_TENSORFLOW" => Self::UnhealthyTensorflow,
"UNHEALTHY_MAINTENANCE" => Self::UnhealthyMaintenance,
_ => Self::UnknownValue(health::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Health {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Healthy => serializer.serialize_i32(1),
Self::Timeout => serializer.serialize_i32(3),
Self::UnhealthyTensorflow => serializer.serialize_i32(4),
Self::UnhealthyMaintenance => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Health {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Health>::new(
".google.cloud.tpu.v2.Node.Health",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ApiVersion {
Unspecified,
V1Alpha1,
V1,
V2Alpha1,
V2,
UnknownValue(api_version::UnknownValue),
}
#[doc(hidden)]
pub mod api_version {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ApiVersion {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::V1Alpha1 => std::option::Option::Some(1),
Self::V1 => std::option::Option::Some(2),
Self::V2Alpha1 => std::option::Option::Some(3),
Self::V2 => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("API_VERSION_UNSPECIFIED"),
Self::V1Alpha1 => std::option::Option::Some("V1_ALPHA1"),
Self::V1 => std::option::Option::Some("V1"),
Self::V2Alpha1 => std::option::Option::Some("V2_ALPHA1"),
Self::V2 => std::option::Option::Some("V2"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ApiVersion {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ApiVersion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ApiVersion {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::V1Alpha1,
2 => Self::V1,
3 => Self::V2Alpha1,
4 => Self::V2,
_ => Self::UnknownValue(api_version::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ApiVersion {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"API_VERSION_UNSPECIFIED" => Self::Unspecified,
"V1_ALPHA1" => Self::V1Alpha1,
"V1" => Self::V1,
"V2_ALPHA1" => Self::V2Alpha1,
"V2" => Self::V2,
_ => Self::UnknownValue(api_version::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ApiVersion {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::V1Alpha1 => serializer.serialize_i32(1),
Self::V1 => serializer.serialize_i32(2),
Self::V2Alpha1 => serializer.serialize_i32(3),
Self::V2 => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ApiVersion {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ApiVersion>::new(
".google.cloud.tpu.v2.Node.ApiVersion",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueuedResource {
pub name: std::string::String,
pub create_time: std::option::Option<wkt::Timestamp>,
pub queueing_policy: std::option::Option<crate::model::queued_resource::QueueingPolicy>,
pub state: std::option::Option<crate::model::QueuedResourceState>,
pub reservation_name: std::string::String,
pub resource: std::option::Option<crate::model::queued_resource::Resource>,
pub tier: std::option::Option<crate::model::queued_resource::Tier>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueuedResource {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_queueing_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::queued_resource::QueueingPolicy>,
{
self.queueing_policy = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_queueing_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::queued_resource::QueueingPolicy>,
{
self.queueing_policy = v.map(|x| x.into());
self
}
pub fn set_state<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueuedResourceState>,
{
self.state = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_state<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueuedResourceState>,
{
self.state = v.map(|x| x.into());
self
}
pub fn set_reservation_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.reservation_name = v.into();
self
}
pub fn set_resource<
T: std::convert::Into<std::option::Option<crate::model::queued_resource::Resource>>,
>(
mut self,
v: T,
) -> Self {
self.resource = v.into();
self
}
pub fn tpu(&self) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource::Tpu>> {
#[allow(unreachable_patterns)]
self.resource.as_ref().and_then(|v| match v {
crate::model::queued_resource::Resource::Tpu(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_tpu<T: std::convert::Into<std::boxed::Box<crate::model::queued_resource::Tpu>>>(
mut self,
v: T,
) -> Self {
self.resource =
std::option::Option::Some(crate::model::queued_resource::Resource::Tpu(v.into()));
self
}
pub fn set_tier<
T: std::convert::Into<std::option::Option<crate::model::queued_resource::Tier>>,
>(
mut self,
v: T,
) -> Self {
self.tier = v.into();
self
}
pub fn spot(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource::Spot>> {
#[allow(unreachable_patterns)]
self.tier.as_ref().and_then(|v| match v {
crate::model::queued_resource::Tier::Spot(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_spot<T: std::convert::Into<std::boxed::Box<crate::model::queued_resource::Spot>>>(
mut self,
v: T,
) -> Self {
self.tier = std::option::Option::Some(crate::model::queued_resource::Tier::Spot(v.into()));
self
}
pub fn guaranteed(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource::Guaranteed>> {
#[allow(unreachable_patterns)]
self.tier.as_ref().and_then(|v| match v {
crate::model::queued_resource::Tier::Guaranteed(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_guaranteed<
T: std::convert::Into<std::boxed::Box<crate::model::queued_resource::Guaranteed>>,
>(
mut self,
v: T,
) -> Self {
self.tier =
std::option::Option::Some(crate::model::queued_resource::Tier::Guaranteed(v.into()));
self
}
}
impl wkt::message::Message for QueuedResource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResource"
}
}
pub mod queued_resource {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Tpu {
pub node_spec: std::vec::Vec<crate::model::queued_resource::tpu::NodeSpec>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Tpu {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_node_spec<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::queued_resource::tpu::NodeSpec>,
{
use std::iter::Iterator;
self.node_spec = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Tpu {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Tpu"
}
}
pub mod tpu {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NodeSpec {
pub parent: std::string::String,
pub node: std::option::Option<crate::model::Node>,
pub name_strategy:
std::option::Option<crate::model::queued_resource::tpu::node_spec::NameStrategy>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl NodeSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_node<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Node>,
{
self.node = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_node<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Node>,
{
self.node = v.map(|x| x.into());
self
}
pub fn set_name_strategy<
T: std::convert::Into<
std::option::Option<
crate::model::queued_resource::tpu::node_spec::NameStrategy,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.name_strategy = v.into();
self
}
pub fn node_id(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.name_strategy.as_ref().and_then(|v| match v {
crate::model::queued_resource::tpu::node_spec::NameStrategy::NodeId(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_node_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name_strategy = std::option::Option::Some(
crate::model::queued_resource::tpu::node_spec::NameStrategy::NodeId(v.into()),
);
self
}
pub fn multislice_params(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::queued_resource::tpu::node_spec::MultisliceParams>,
> {
#[allow(unreachable_patterns)]
self.name_strategy.as_ref().and_then(|v| match v {
crate::model::queued_resource::tpu::node_spec::NameStrategy::MultisliceParams(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_multislice_params<
T: std::convert::Into<
std::boxed::Box<
crate::model::queued_resource::tpu::node_spec::MultisliceParams,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.name_strategy = std::option::Option::Some(
crate::model::queued_resource::tpu::node_spec::NameStrategy::MultisliceParams(
v.into(),
),
);
self
}
}
impl wkt::message::Message for NodeSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Tpu.NodeSpec"
}
}
pub mod node_spec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MultisliceParams {
pub node_count: i32,
pub node_id_prefix: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MultisliceParams {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.node_count = v.into();
self
}
pub fn set_node_id_prefix<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.node_id_prefix = v.into();
self
}
}
impl wkt::message::Message for MultisliceParams {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Tpu.NodeSpec.MultisliceParams"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NameStrategy {
NodeId(std::string::String),
MultisliceParams(
std::boxed::Box<
crate::model::queued_resource::tpu::node_spec::MultisliceParams,
>,
),
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Spot {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Spot {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for Spot {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Spot"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Guaranteed {
pub min_duration: std::option::Option<wkt::Duration>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Guaranteed {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_min_duration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.min_duration = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_min_duration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.min_duration = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Guaranteed {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResource.Guaranteed"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueueingPolicy {
pub start_timing_constraints: std::option::Option<
crate::model::queued_resource::queueing_policy::StartTimingConstraints,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueueingPolicy {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_start_timing_constraints<
T: std::convert::Into<
std::option::Option<
crate::model::queued_resource::queueing_policy::StartTimingConstraints,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.start_timing_constraints = v.into();
self
}
pub fn valid_until_duration(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
#[allow(unreachable_patterns)]
self.start_timing_constraints.as_ref().and_then(|v| match v {
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidUntilDuration(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_valid_until_duration<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
mut self,
v: T,
) -> Self {
self.start_timing_constraints = std::option::Option::Some(
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidUntilDuration(
v.into()
)
);
self
}
pub fn valid_until_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
#[allow(unreachable_patterns)]
self.start_timing_constraints.as_ref().and_then(|v| match v {
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidUntilTime(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_valid_until_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.start_timing_constraints = std::option::Option::Some(
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidUntilTime(
v.into()
)
);
self
}
pub fn valid_after_duration(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
#[allow(unreachable_patterns)]
self.start_timing_constraints.as_ref().and_then(|v| match v {
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidAfterDuration(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_valid_after_duration<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
mut self,
v: T,
) -> Self {
self.start_timing_constraints = std::option::Option::Some(
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidAfterDuration(
v.into()
)
);
self
}
pub fn valid_after_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
#[allow(unreachable_patterns)]
self.start_timing_constraints.as_ref().and_then(|v| match v {
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidAfterTime(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_valid_after_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.start_timing_constraints = std::option::Option::Some(
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidAfterTime(
v.into()
)
);
self
}
pub fn valid_interval(
&self,
) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Interval>> {
#[allow(unreachable_patterns)]
self.start_timing_constraints.as_ref().and_then(|v| match v {
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidInterval(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_valid_interval<
T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Interval>>,
>(
mut self,
v: T,
) -> Self {
self.start_timing_constraints = std::option::Option::Some(
crate::model::queued_resource::queueing_policy::StartTimingConstraints::ValidInterval(
v.into()
)
);
self
}
}
impl wkt::message::Message for QueueingPolicy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResource.QueueingPolicy"
}
}
pub mod queueing_policy {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum StartTimingConstraints {
ValidUntilDuration(std::boxed::Box<wkt::Duration>),
ValidUntilTime(std::boxed::Box<wkt::Timestamp>),
ValidAfterDuration(std::boxed::Box<wkt::Duration>),
ValidAfterTime(std::boxed::Box<wkt::Timestamp>),
ValidInterval(std::boxed::Box<google_cloud_type::model::Interval>),
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Resource {
Tpu(std::boxed::Box<crate::model::queued_resource::Tpu>),
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Tier {
Spot(std::boxed::Box<crate::model::queued_resource::Spot>),
Guaranteed(std::boxed::Box<crate::model::queued_resource::Guaranteed>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueuedResourceState {
pub state: crate::model::queued_resource_state::State,
pub state_initiator: crate::model::queued_resource_state::StateInitiator,
pub state_data: std::option::Option<crate::model::queued_resource_state::StateData>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueuedResourceState {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_state<T: std::convert::Into<crate::model::queued_resource_state::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
pub fn set_state_initiator<
T: std::convert::Into<crate::model::queued_resource_state::StateInitiator>,
>(
mut self,
v: T,
) -> Self {
self.state_initiator = v.into();
self
}
pub fn set_state_data<
T: std::convert::Into<std::option::Option<crate::model::queued_resource_state::StateData>>,
>(
mut self,
v: T,
) -> Self {
self.state_data = v.into();
self
}
pub fn creating_data(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::CreatingData>>
{
#[allow(unreachable_patterns)]
self.state_data.as_ref().and_then(|v| match v {
crate::model::queued_resource_state::StateData::CreatingData(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_creating_data<
T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::CreatingData>>,
>(
mut self,
v: T,
) -> Self {
self.state_data = std::option::Option::Some(
crate::model::queued_resource_state::StateData::CreatingData(v.into()),
);
self
}
pub fn accepted_data(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::AcceptedData>>
{
#[allow(unreachable_patterns)]
self.state_data.as_ref().and_then(|v| match v {
crate::model::queued_resource_state::StateData::AcceptedData(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_accepted_data<
T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::AcceptedData>>,
>(
mut self,
v: T,
) -> Self {
self.state_data = std::option::Option::Some(
crate::model::queued_resource_state::StateData::AcceptedData(v.into()),
);
self
}
pub fn provisioning_data(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::ProvisioningData>>
{
#[allow(unreachable_patterns)]
self.state_data.as_ref().and_then(|v| match v {
crate::model::queued_resource_state::StateData::ProvisioningData(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_provisioning_data<
T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::ProvisioningData>>,
>(
mut self,
v: T,
) -> Self {
self.state_data = std::option::Option::Some(
crate::model::queued_resource_state::StateData::ProvisioningData(v.into()),
);
self
}
pub fn failed_data(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::FailedData>>
{
#[allow(unreachable_patterns)]
self.state_data.as_ref().and_then(|v| match v {
crate::model::queued_resource_state::StateData::FailedData(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_failed_data<
T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::FailedData>>,
>(
mut self,
v: T,
) -> Self {
self.state_data = std::option::Option::Some(
crate::model::queued_resource_state::StateData::FailedData(v.into()),
);
self
}
pub fn deleting_data(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::DeletingData>>
{
#[allow(unreachable_patterns)]
self.state_data.as_ref().and_then(|v| match v {
crate::model::queued_resource_state::StateData::DeletingData(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_deleting_data<
T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::DeletingData>>,
>(
mut self,
v: T,
) -> Self {
self.state_data = std::option::Option::Some(
crate::model::queued_resource_state::StateData::DeletingData(v.into()),
);
self
}
pub fn active_data(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::ActiveData>>
{
#[allow(unreachable_patterns)]
self.state_data.as_ref().and_then(|v| match v {
crate::model::queued_resource_state::StateData::ActiveData(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_active_data<
T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::ActiveData>>,
>(
mut self,
v: T,
) -> Self {
self.state_data = std::option::Option::Some(
crate::model::queued_resource_state::StateData::ActiveData(v.into()),
);
self
}
pub fn suspending_data(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::SuspendingData>>
{
#[allow(unreachable_patterns)]
self.state_data.as_ref().and_then(|v| match v {
crate::model::queued_resource_state::StateData::SuspendingData(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_suspending_data<
T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::SuspendingData>>,
>(
mut self,
v: T,
) -> Self {
self.state_data = std::option::Option::Some(
crate::model::queued_resource_state::StateData::SuspendingData(v.into()),
);
self
}
pub fn suspended_data(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::queued_resource_state::SuspendedData>>
{
#[allow(unreachable_patterns)]
self.state_data.as_ref().and_then(|v| match v {
crate::model::queued_resource_state::StateData::SuspendedData(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_suspended_data<
T: std::convert::Into<std::boxed::Box<crate::model::queued_resource_state::SuspendedData>>,
>(
mut self,
v: T,
) -> Self {
self.state_data = std::option::Option::Some(
crate::model::queued_resource_state::StateData::SuspendedData(v.into()),
);
self
}
}
impl wkt::message::Message for QueuedResourceState {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState"
}
}
pub mod queued_resource_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreatingData {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreatingData {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for CreatingData {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.CreatingData"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AcceptedData {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AcceptedData {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for AcceptedData {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.AcceptedData"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProvisioningData {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProvisioningData {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for ProvisioningData {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.ProvisioningData"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FailedData {
pub error: std::option::Option<google_cloud_rpc::model::Status>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FailedData {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.error = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.error = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for FailedData {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.FailedData"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeletingData {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeletingData {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for DeletingData {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.DeletingData"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ActiveData {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ActiveData {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for ActiveData {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.ActiveData"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuspendingData {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SuspendingData {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for SuspendingData {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.SuspendingData"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuspendedData {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SuspendedData {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for SuspendedData {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.QueuedResourceState.SuspendedData"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Creating,
Accepted,
Provisioning,
Failed,
Deleting,
Active,
Suspending,
Suspended,
WaitingForResources,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Creating => std::option::Option::Some(1),
Self::Accepted => std::option::Option::Some(2),
Self::Provisioning => std::option::Option::Some(3),
Self::Failed => std::option::Option::Some(4),
Self::Deleting => std::option::Option::Some(5),
Self::Active => std::option::Option::Some(6),
Self::Suspending => std::option::Option::Some(7),
Self::Suspended => std::option::Option::Some(8),
Self::WaitingForResources => std::option::Option::Some(9),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Creating => std::option::Option::Some("CREATING"),
Self::Accepted => std::option::Option::Some("ACCEPTED"),
Self::Provisioning => std::option::Option::Some("PROVISIONING"),
Self::Failed => std::option::Option::Some("FAILED"),
Self::Deleting => std::option::Option::Some("DELETING"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Suspending => std::option::Option::Some("SUSPENDING"),
Self::Suspended => std::option::Option::Some("SUSPENDED"),
Self::WaitingForResources => std::option::Option::Some("WAITING_FOR_RESOURCES"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Creating,
2 => Self::Accepted,
3 => Self::Provisioning,
4 => Self::Failed,
5 => Self::Deleting,
6 => Self::Active,
7 => Self::Suspending,
8 => Self::Suspended,
9 => Self::WaitingForResources,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"CREATING" => Self::Creating,
"ACCEPTED" => Self::Accepted,
"PROVISIONING" => Self::Provisioning,
"FAILED" => Self::Failed,
"DELETING" => Self::Deleting,
"ACTIVE" => Self::Active,
"SUSPENDING" => Self::Suspending,
"SUSPENDED" => Self::Suspended,
"WAITING_FOR_RESOURCES" => Self::WaitingForResources,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Creating => serializer.serialize_i32(1),
Self::Accepted => serializer.serialize_i32(2),
Self::Provisioning => serializer.serialize_i32(3),
Self::Failed => serializer.serialize_i32(4),
Self::Deleting => serializer.serialize_i32(5),
Self::Active => serializer.serialize_i32(6),
Self::Suspending => serializer.serialize_i32(7),
Self::Suspended => serializer.serialize_i32(8),
Self::WaitingForResources => serializer.serialize_i32(9),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.cloud.tpu.v2.QueuedResourceState.State",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum StateInitiator {
Unspecified,
User,
Service,
UnknownValue(state_initiator::UnknownValue),
}
#[doc(hidden)]
pub mod state_initiator {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl StateInitiator {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::User => std::option::Option::Some(1),
Self::Service => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_INITIATOR_UNSPECIFIED"),
Self::User => std::option::Option::Some("USER"),
Self::Service => std::option::Option::Some("SERVICE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for StateInitiator {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for StateInitiator {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for StateInitiator {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::User,
2 => Self::Service,
_ => Self::UnknownValue(state_initiator::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for StateInitiator {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_INITIATOR_UNSPECIFIED" => Self::Unspecified,
"USER" => Self::User,
"SERVICE" => Self::Service,
_ => Self::UnknownValue(state_initiator::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for StateInitiator {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::User => serializer.serialize_i32(1),
Self::Service => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for StateInitiator {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<StateInitiator>::new(
".google.cloud.tpu.v2.QueuedResourceState.StateInitiator",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum StateData {
CreatingData(std::boxed::Box<crate::model::queued_resource_state::CreatingData>),
AcceptedData(std::boxed::Box<crate::model::queued_resource_state::AcceptedData>),
ProvisioningData(std::boxed::Box<crate::model::queued_resource_state::ProvisioningData>),
FailedData(std::boxed::Box<crate::model::queued_resource_state::FailedData>),
DeletingData(std::boxed::Box<crate::model::queued_resource_state::DeletingData>),
ActiveData(std::boxed::Box<crate::model::queued_resource_state::ActiveData>),
SuspendingData(std::boxed::Box<crate::model::queued_resource_state::SuspendingData>),
SuspendedData(std::boxed::Box<crate::model::queued_resource_state::SuspendedData>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNodesRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNodesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListNodesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ListNodesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNodesResponse {
pub nodes: std::vec::Vec<crate::model::Node>,
pub next_page_token: std::string::String,
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNodesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_nodes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Node>,
{
use std::iter::Iterator;
self.nodes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListNodesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ListNodesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListNodesResponse {
type PageItem = crate::model::Node;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.nodes
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetNodeRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetNodeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetNodeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GetNodeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateNodeRequest {
pub parent: std::string::String,
pub node_id: std::string::String,
pub node: std::option::Option<crate::model::Node>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateNodeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_node_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.node_id = v.into();
self
}
pub fn set_node<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Node>,
{
self.node = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_node<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Node>,
{
self.node = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateNodeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.CreateNodeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteNodeRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteNodeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteNodeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.DeleteNodeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StopNodeRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StopNodeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for StopNodeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.StopNodeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StartNodeRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StartNodeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for StartNodeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.StartNodeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateNodeRequest {
pub update_mask: std::option::Option<wkt::FieldMask>,
pub node: std::option::Option<crate::model::Node>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateNodeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
pub fn set_node<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Node>,
{
self.node = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_node<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Node>,
{
self.node = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateNodeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.UpdateNodeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListQueuedResourcesRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListQueuedResourcesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListQueuedResourcesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ListQueuedResourcesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListQueuedResourcesResponse {
pub queued_resources: std::vec::Vec<crate::model::QueuedResource>,
pub next_page_token: std::string::String,
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListQueuedResourcesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_queued_resources<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::QueuedResource>,
{
use std::iter::Iterator;
self.queued_resources = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListQueuedResourcesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ListQueuedResourcesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListQueuedResourcesResponse {
type PageItem = crate::model::QueuedResource;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.queued_resources
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetQueuedResourceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetQueuedResourceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetQueuedResourceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GetQueuedResourceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateQueuedResourceRequest {
pub parent: std::string::String,
pub queued_resource_id: std::string::String,
pub queued_resource: std::option::Option<crate::model::QueuedResource>,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateQueuedResourceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_queued_resource_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.queued_resource_id = v.into();
self
}
pub fn set_queued_resource<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueuedResource>,
{
self.queued_resource = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_queued_resource<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueuedResource>,
{
self.queued_resource = v.map(|x| x.into());
self
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
}
impl wkt::message::Message for CreateQueuedResourceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.CreateQueuedResourceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteQueuedResourceRequest {
pub name: std::string::String,
pub request_id: std::string::String,
pub force: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteQueuedResourceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.force = v.into();
self
}
}
impl wkt::message::Message for DeleteQueuedResourceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.DeleteQueuedResourceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResetQueuedResourceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResetQueuedResourceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for ResetQueuedResourceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ResetQueuedResourceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceIdentity {
pub email: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ServiceIdentity {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.email = v.into();
self
}
}
impl wkt::message::Message for ServiceIdentity {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ServiceIdentity"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateServiceIdentityRequest {
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenerateServiceIdentityRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
impl wkt::message::Message for GenerateServiceIdentityRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GenerateServiceIdentityRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateServiceIdentityResponse {
pub identity: std::option::Option<crate::model::ServiceIdentity>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenerateServiceIdentityResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_identity<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ServiceIdentity>,
{
self.identity = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_identity<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ServiceIdentity>,
{
self.identity = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for GenerateServiceIdentityResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GenerateServiceIdentityResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AcceleratorType {
pub name: std::string::String,
pub r#type: std::string::String,
pub accelerator_configs: std::vec::Vec<crate::model::AcceleratorConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AcceleratorType {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_accelerator_configs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AcceleratorConfig>,
{
use std::iter::Iterator;
self.accelerator_configs = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for AcceleratorType {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.AcceleratorType"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetAcceleratorTypeRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetAcceleratorTypeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetAcceleratorTypeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GetAcceleratorTypeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAcceleratorTypesRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub filter: std::string::String,
pub order_by: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListAcceleratorTypesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.order_by = v.into();
self
}
}
impl wkt::message::Message for ListAcceleratorTypesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ListAcceleratorTypesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAcceleratorTypesResponse {
pub accelerator_types: std::vec::Vec<crate::model::AcceleratorType>,
pub next_page_token: std::string::String,
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListAcceleratorTypesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_accelerator_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AcceleratorType>,
{
use std::iter::Iterator;
self.accelerator_types = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListAcceleratorTypesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ListAcceleratorTypesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListAcceleratorTypesResponse {
type PageItem = crate::model::AcceleratorType;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.accelerator_types
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RuntimeVersion {
pub name: std::string::String,
pub version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RuntimeVersion {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
}
impl wkt::message::Message for RuntimeVersion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.RuntimeVersion"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRuntimeVersionRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetRuntimeVersionRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetRuntimeVersionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GetRuntimeVersionRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuntimeVersionsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub filter: std::string::String,
pub order_by: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRuntimeVersionsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.order_by = v.into();
self
}
}
impl wkt::message::Message for ListRuntimeVersionsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ListRuntimeVersionsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuntimeVersionsResponse {
pub runtime_versions: std::vec::Vec<crate::model::RuntimeVersion>,
pub next_page_token: std::string::String,
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRuntimeVersionsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_runtime_versions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::RuntimeVersion>,
{
use std::iter::Iterator;
self.runtime_versions = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListRuntimeVersionsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ListRuntimeVersionsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListRuntimeVersionsResponse {
type PageItem = crate::model::RuntimeVersion;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.runtime_versions
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
pub create_time: std::option::Option<wkt::Timestamp>,
pub end_time: std::option::Option<wkt::Timestamp>,
pub target: std::string::String,
pub verb: std::string::String,
pub status_detail: std::string::String,
pub cancel_requested: bool,
pub api_version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OperationMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = v.map(|x| x.into());
self
}
pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.target = v.into();
self
}
pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.verb = v.into();
self
}
pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.status_detail = v.into();
self
}
pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.cancel_requested = v.into();
self
}
pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.api_version = v.into();
self
}
}
impl wkt::message::Message for OperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.OperationMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Symptom {
pub create_time: std::option::Option<wkt::Timestamp>,
pub symptom_type: crate::model::symptom::SymptomType,
pub details: std::string::String,
pub worker_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Symptom {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_symptom_type<T: std::convert::Into<crate::model::symptom::SymptomType>>(
mut self,
v: T,
) -> Self {
self.symptom_type = v.into();
self
}
pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.details = v.into();
self
}
pub fn set_worker_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.worker_id = v.into();
self
}
}
impl wkt::message::Message for Symptom {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.Symptom"
}
}
pub mod symptom {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SymptomType {
Unspecified,
LowMemory,
OutOfMemory,
ExecuteTimedOut,
MeshBuildFail,
HbmOutOfMemory,
ProjectAbuse,
UnknownValue(symptom_type::UnknownValue),
}
#[doc(hidden)]
pub mod symptom_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SymptomType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::LowMemory => std::option::Option::Some(1),
Self::OutOfMemory => std::option::Option::Some(2),
Self::ExecuteTimedOut => std::option::Option::Some(3),
Self::MeshBuildFail => std::option::Option::Some(4),
Self::HbmOutOfMemory => std::option::Option::Some(5),
Self::ProjectAbuse => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SYMPTOM_TYPE_UNSPECIFIED"),
Self::LowMemory => std::option::Option::Some("LOW_MEMORY"),
Self::OutOfMemory => std::option::Option::Some("OUT_OF_MEMORY"),
Self::ExecuteTimedOut => std::option::Option::Some("EXECUTE_TIMED_OUT"),
Self::MeshBuildFail => std::option::Option::Some("MESH_BUILD_FAIL"),
Self::HbmOutOfMemory => std::option::Option::Some("HBM_OUT_OF_MEMORY"),
Self::ProjectAbuse => std::option::Option::Some("PROJECT_ABUSE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SymptomType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SymptomType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SymptomType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::LowMemory,
2 => Self::OutOfMemory,
3 => Self::ExecuteTimedOut,
4 => Self::MeshBuildFail,
5 => Self::HbmOutOfMemory,
6 => Self::ProjectAbuse,
_ => Self::UnknownValue(symptom_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SymptomType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SYMPTOM_TYPE_UNSPECIFIED" => Self::Unspecified,
"LOW_MEMORY" => Self::LowMemory,
"OUT_OF_MEMORY" => Self::OutOfMemory,
"EXECUTE_TIMED_OUT" => Self::ExecuteTimedOut,
"MESH_BUILD_FAIL" => Self::MeshBuildFail,
"HBM_OUT_OF_MEMORY" => Self::HbmOutOfMemory,
"PROJECT_ABUSE" => Self::ProjectAbuse,
_ => Self::UnknownValue(symptom_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SymptomType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::LowMemory => serializer.serialize_i32(1),
Self::OutOfMemory => serializer.serialize_i32(2),
Self::ExecuteTimedOut => serializer.serialize_i32(3),
Self::MeshBuildFail => serializer.serialize_i32(4),
Self::HbmOutOfMemory => serializer.serialize_i32(5),
Self::ProjectAbuse => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SymptomType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SymptomType>::new(
".google.cloud.tpu.v2.Symptom.SymptomType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetGuestAttributesRequest {
pub name: std::string::String,
pub query_path: std::string::String,
pub worker_ids: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetGuestAttributesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_query_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query_path = v.into();
self
}
pub fn set_worker_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.worker_ids = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for GetGuestAttributesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GetGuestAttributesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetGuestAttributesResponse {
pub guest_attributes: std::vec::Vec<crate::model::GuestAttributes>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetGuestAttributesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_guest_attributes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::GuestAttributes>,
{
use std::iter::Iterator;
self.guest_attributes = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for GetGuestAttributesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.GetGuestAttributesResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AcceleratorConfig {
pub r#type: crate::model::accelerator_config::Type,
pub topology: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AcceleratorConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<crate::model::accelerator_config::Type>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
pub fn set_topology<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.topology = v.into();
self
}
}
impl wkt::message::Message for AcceleratorConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.AcceleratorConfig"
}
}
pub mod accelerator_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
Unspecified,
V2,
V3,
V4,
V5LitePod,
V5P,
V6E,
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Type {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::V2 => std::option::Option::Some(2),
Self::V3 => std::option::Option::Some(4),
Self::V4 => std::option::Option::Some(7),
Self::V5LitePod => std::option::Option::Some(9),
Self::V5P => std::option::Option::Some(10),
Self::V6E => std::option::Option::Some(11),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::V2 => std::option::Option::Some("V2"),
Self::V3 => std::option::Option::Some("V3"),
Self::V4 => std::option::Option::Some("V4"),
Self::V5LitePod => std::option::Option::Some("V5LITE_POD"),
Self::V5P => std::option::Option::Some("V5P"),
Self::V6E => std::option::Option::Some("V6E"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Type {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::V2,
4 => Self::V3,
7 => Self::V4,
9 => Self::V5LitePod,
10 => Self::V5P,
11 => Self::V6E,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"V2" => Self::V2,
"V3" => Self::V3,
"V4" => Self::V4,
"V5LITE_POD" => Self::V5LitePod,
"V5P" => Self::V5P,
"V6E" => Self::V6E,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Type {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::V2 => serializer.serialize_i32(2),
Self::V3 => serializer.serialize_i32(4),
Self::V4 => serializer.serialize_i32(7),
Self::V5LitePod => serializer.serialize_i32(9),
Self::V5P => serializer.serialize_i32(10),
Self::V6E => serializer.serialize_i32(11),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Type {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
".google.cloud.tpu.v2.AcceleratorConfig.Type",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ShieldedInstanceConfig {
pub enable_secure_boot: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ShieldedInstanceConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_enable_secure_boot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_secure_boot = v.into();
self
}
}
impl wkt::message::Message for ShieldedInstanceConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tpu.v2.ShieldedInstanceConfig"
}
}