#![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_iam_v1;
extern crate google_cloud_location;
extern crate google_cloud_longrunning;
extern crate google_cloud_lro;
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 DiagnosticConfig {
pub gcs_bucket: std::string::String,
pub relative_path: std::string::String,
pub enable_repair_flag: bool,
pub enable_packet_capture_flag: bool,
pub enable_copy_home_files_flag: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DiagnosticConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_gcs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.gcs_bucket = v.into();
self
}
pub fn set_relative_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.relative_path = v.into();
self
}
pub fn set_enable_repair_flag<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_repair_flag = v.into();
self
}
pub fn set_enable_packet_capture_flag<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_packet_capture_flag = v.into();
self
}
pub fn set_enable_copy_home_files_flag<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_copy_home_files_flag = v.into();
self
}
}
impl wkt::message::Message for DiagnosticConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.DiagnosticConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Event {
pub report_time: std::option::Option<wkt::Timestamp>,
pub r#type: crate::model::event::EventType,
pub details: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Event {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_report_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.report_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_report_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.report_time = v.map(|x| x.into());
self
}
pub fn set_type<T: std::convert::Into<crate::model::event::EventType>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_details<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.details = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for Event {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.Event"
}
}
pub mod event {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EventType {
Unspecified,
Idle,
Heartbeat,
Health,
Maintenance,
MetadataChange,
UnknownValue(event_type::UnknownValue),
}
#[doc(hidden)]
pub mod event_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl EventType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Idle => std::option::Option::Some(1),
Self::Heartbeat => std::option::Option::Some(2),
Self::Health => std::option::Option::Some(3),
Self::Maintenance => std::option::Option::Some(4),
Self::MetadataChange => 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("EVENT_TYPE_UNSPECIFIED"),
Self::Idle => std::option::Option::Some("IDLE"),
Self::Heartbeat => std::option::Option::Some("HEARTBEAT"),
Self::Health => std::option::Option::Some("HEALTH"),
Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
Self::MetadataChange => std::option::Option::Some("METADATA_CHANGE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for EventType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for EventType {
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 EventType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Idle,
2 => Self::Heartbeat,
3 => Self::Health,
4 => Self::Maintenance,
5 => Self::MetadataChange,
_ => Self::UnknownValue(event_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for EventType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"EVENT_TYPE_UNSPECIFIED" => Self::Unspecified,
"IDLE" => Self::Idle,
"HEARTBEAT" => Self::Heartbeat,
"HEALTH" => Self::Health,
"MAINTENANCE" => Self::Maintenance,
"METADATA_CHANGE" => Self::MetadataChange,
_ => Self::UnknownValue(event_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for EventType {
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::Idle => serializer.serialize_i32(1),
Self::Heartbeat => serializer.serialize_i32(2),
Self::Health => serializer.serialize_i32(3),
Self::Maintenance => serializer.serialize_i32(4),
Self::MetadataChange => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for EventType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<EventType>::new(
".google.cloud.notebooks.v2.Event.EventType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NetworkInterface {
pub network: std::string::String,
pub subnet: std::string::String,
pub nic_type: crate::model::network_interface::NicType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl NetworkInterface {
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_subnet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.subnet = v.into();
self
}
pub fn set_nic_type<T: std::convert::Into<crate::model::network_interface::NicType>>(
mut self,
v: T,
) -> Self {
self.nic_type = v.into();
self
}
}
impl wkt::message::Message for NetworkInterface {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.NetworkInterface"
}
}
pub mod network_interface {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NicType {
Unspecified,
VirtioNet,
Gvnic,
UnknownValue(nic_type::UnknownValue),
}
#[doc(hidden)]
pub mod nic_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl NicType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::VirtioNet => std::option::Option::Some(1),
Self::Gvnic => 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("NIC_TYPE_UNSPECIFIED"),
Self::VirtioNet => std::option::Option::Some("VIRTIO_NET"),
Self::Gvnic => std::option::Option::Some("GVNIC"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for NicType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for NicType {
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 NicType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::VirtioNet,
2 => Self::Gvnic,
_ => Self::UnknownValue(nic_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for NicType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"NIC_TYPE_UNSPECIFIED" => Self::Unspecified,
"VIRTIO_NET" => Self::VirtioNet,
"GVNIC" => Self::Gvnic,
_ => Self::UnknownValue(nic_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for NicType {
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::VirtioNet => serializer.serialize_i32(1),
Self::Gvnic => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for NicType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<NicType>::new(
".google.cloud.notebooks.v2.NetworkInterface.NicType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VmImage {
pub project: std::string::String,
pub image: std::option::Option<crate::model::vm_image::Image>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VmImage {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project = v.into();
self
}
pub fn set_image<T: std::convert::Into<std::option::Option<crate::model::vm_image::Image>>>(
mut self,
v: T,
) -> Self {
self.image = v.into();
self
}
pub fn name(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.image.as_ref().and_then(|v| match v {
crate::model::vm_image::Image::Name(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.image = std::option::Option::Some(crate::model::vm_image::Image::Name(v.into()));
self
}
pub fn family(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.image.as_ref().and_then(|v| match v {
crate::model::vm_image::Image::Family(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.image = std::option::Option::Some(crate::model::vm_image::Image::Family(v.into()));
self
}
}
impl wkt::message::Message for VmImage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.VmImage"
}
}
pub mod vm_image {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Image {
Name(std::string::String),
Family(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ContainerImage {
pub repository: std::string::String,
pub tag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ContainerImage {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.repository = v.into();
self
}
pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.tag = v.into();
self
}
}
impl wkt::message::Message for ContainerImage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.ContainerImage"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AcceleratorConfig {
pub r#type: crate::model::accelerator_config::AcceleratorType,
pub core_count: i64,
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::AcceleratorType>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
pub fn set_core_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.core_count = v.into();
self
}
}
impl wkt::message::Message for AcceleratorConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.AcceleratorConfig"
}
}
pub mod accelerator_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AcceleratorType {
Unspecified,
NvidiaTeslaP100,
NvidiaTeslaV100,
NvidiaTeslaP4,
NvidiaTeslaT4,
NvidiaTeslaA100,
NvidiaA10080Gb,
NvidiaL4,
NvidiaTeslaT4Vws,
NvidiaTeslaP100Vws,
NvidiaTeslaP4Vws,
UnknownValue(accelerator_type::UnknownValue),
}
#[doc(hidden)]
pub mod accelerator_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AcceleratorType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NvidiaTeslaP100 => std::option::Option::Some(2),
Self::NvidiaTeslaV100 => std::option::Option::Some(3),
Self::NvidiaTeslaP4 => std::option::Option::Some(4),
Self::NvidiaTeslaT4 => std::option::Option::Some(5),
Self::NvidiaTeslaA100 => std::option::Option::Some(11),
Self::NvidiaA10080Gb => std::option::Option::Some(12),
Self::NvidiaL4 => std::option::Option::Some(13),
Self::NvidiaTeslaT4Vws => std::option::Option::Some(8),
Self::NvidiaTeslaP100Vws => std::option::Option::Some(9),
Self::NvidiaTeslaP4Vws => std::option::Option::Some(10),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ACCELERATOR_TYPE_UNSPECIFIED"),
Self::NvidiaTeslaP100 => std::option::Option::Some("NVIDIA_TESLA_P100"),
Self::NvidiaTeslaV100 => std::option::Option::Some("NVIDIA_TESLA_V100"),
Self::NvidiaTeslaP4 => std::option::Option::Some("NVIDIA_TESLA_P4"),
Self::NvidiaTeslaT4 => std::option::Option::Some("NVIDIA_TESLA_T4"),
Self::NvidiaTeslaA100 => std::option::Option::Some("NVIDIA_TESLA_A100"),
Self::NvidiaA10080Gb => std::option::Option::Some("NVIDIA_A100_80GB"),
Self::NvidiaL4 => std::option::Option::Some("NVIDIA_L4"),
Self::NvidiaTeslaT4Vws => std::option::Option::Some("NVIDIA_TESLA_T4_VWS"),
Self::NvidiaTeslaP100Vws => std::option::Option::Some("NVIDIA_TESLA_P100_VWS"),
Self::NvidiaTeslaP4Vws => std::option::Option::Some("NVIDIA_TESLA_P4_VWS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AcceleratorType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AcceleratorType {
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 AcceleratorType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::NvidiaTeslaP100,
3 => Self::NvidiaTeslaV100,
4 => Self::NvidiaTeslaP4,
5 => Self::NvidiaTeslaT4,
8 => Self::NvidiaTeslaT4Vws,
9 => Self::NvidiaTeslaP100Vws,
10 => Self::NvidiaTeslaP4Vws,
11 => Self::NvidiaTeslaA100,
12 => Self::NvidiaA10080Gb,
13 => Self::NvidiaL4,
_ => Self::UnknownValue(accelerator_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AcceleratorType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ACCELERATOR_TYPE_UNSPECIFIED" => Self::Unspecified,
"NVIDIA_TESLA_P100" => Self::NvidiaTeslaP100,
"NVIDIA_TESLA_V100" => Self::NvidiaTeslaV100,
"NVIDIA_TESLA_P4" => Self::NvidiaTeslaP4,
"NVIDIA_TESLA_T4" => Self::NvidiaTeslaT4,
"NVIDIA_TESLA_A100" => Self::NvidiaTeslaA100,
"NVIDIA_A100_80GB" => Self::NvidiaA10080Gb,
"NVIDIA_L4" => Self::NvidiaL4,
"NVIDIA_TESLA_T4_VWS" => Self::NvidiaTeslaT4Vws,
"NVIDIA_TESLA_P100_VWS" => Self::NvidiaTeslaP100Vws,
"NVIDIA_TESLA_P4_VWS" => Self::NvidiaTeslaP4Vws,
_ => Self::UnknownValue(accelerator_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AcceleratorType {
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::NvidiaTeslaP100 => serializer.serialize_i32(2),
Self::NvidiaTeslaV100 => serializer.serialize_i32(3),
Self::NvidiaTeslaP4 => serializer.serialize_i32(4),
Self::NvidiaTeslaT4 => serializer.serialize_i32(5),
Self::NvidiaTeslaA100 => serializer.serialize_i32(11),
Self::NvidiaA10080Gb => serializer.serialize_i32(12),
Self::NvidiaL4 => serializer.serialize_i32(13),
Self::NvidiaTeslaT4Vws => serializer.serialize_i32(8),
Self::NvidiaTeslaP100Vws => serializer.serialize_i32(9),
Self::NvidiaTeslaP4Vws => serializer.serialize_i32(10),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AcceleratorType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AcceleratorType>::new(
".google.cloud.notebooks.v2.AcceleratorConfig.AcceleratorType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ShieldedInstanceConfig {
pub enable_secure_boot: bool,
pub enable_vtpm: bool,
pub enable_integrity_monitoring: 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
}
pub fn set_enable_vtpm<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_vtpm = v.into();
self
}
pub fn set_enable_integrity_monitoring<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_integrity_monitoring = v.into();
self
}
}
impl wkt::message::Message for ShieldedInstanceConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.ShieldedInstanceConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GPUDriverConfig {
pub enable_gpu_driver: bool,
pub custom_gpu_driver_path: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GPUDriverConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_enable_gpu_driver<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_gpu_driver = v.into();
self
}
pub fn set_custom_gpu_driver_path<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.custom_gpu_driver_path = v.into();
self
}
}
impl wkt::message::Message for GPUDriverConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.GPUDriverConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataDisk {
pub disk_size_gb: i64,
pub disk_type: crate::model::DiskType,
pub disk_encryption: crate::model::DiskEncryption,
pub kms_key: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DataDisk {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.disk_size_gb = v.into();
self
}
pub fn set_disk_type<T: std::convert::Into<crate::model::DiskType>>(mut self, v: T) -> Self {
self.disk_type = v.into();
self
}
pub fn set_disk_encryption<T: std::convert::Into<crate::model::DiskEncryption>>(
mut self,
v: T,
) -> Self {
self.disk_encryption = v.into();
self
}
pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key = v.into();
self
}
}
impl wkt::message::Message for DataDisk {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.DataDisk"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BootDisk {
pub disk_size_gb: i64,
pub disk_type: crate::model::DiskType,
pub disk_encryption: crate::model::DiskEncryption,
pub kms_key: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BootDisk {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.disk_size_gb = v.into();
self
}
pub fn set_disk_type<T: std::convert::Into<crate::model::DiskType>>(mut self, v: T) -> Self {
self.disk_type = v.into();
self
}
pub fn set_disk_encryption<T: std::convert::Into<crate::model::DiskEncryption>>(
mut self,
v: T,
) -> Self {
self.disk_encryption = v.into();
self
}
pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key = v.into();
self
}
}
impl wkt::message::Message for BootDisk {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.BootDisk"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceAccount {
pub email: std::string::String,
pub scopes: 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_scopes<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.scopes = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ServiceAccount {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.ServiceAccount"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GceSetup {
pub machine_type: std::string::String,
pub accelerator_configs: std::vec::Vec<crate::model::AcceleratorConfig>,
pub service_accounts: std::vec::Vec<crate::model::ServiceAccount>,
pub boot_disk: std::option::Option<crate::model::BootDisk>,
pub data_disks: std::vec::Vec<crate::model::DataDisk>,
pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
pub network_interfaces: std::vec::Vec<crate::model::NetworkInterface>,
pub disable_public_ip: bool,
pub tags: std::vec::Vec<std::string::String>,
pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
pub enable_ip_forwarding: bool,
pub gpu_driver_config: std::option::Option<crate::model::GPUDriverConfig>,
pub image: std::option::Option<crate::model::gce_setup::Image>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GceSetup {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.machine_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
}
pub fn set_service_accounts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ServiceAccount>,
{
use std::iter::Iterator;
self.service_accounts = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_boot_disk<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BootDisk>,
{
self.boot_disk = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_boot_disk<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BootDisk>,
{
self.boot_disk = v.map(|x| x.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::DataDisk>,
{
use std::iter::Iterator;
self.data_disks = 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_network_interfaces<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::NetworkInterface>,
{
use std::iter::Iterator;
self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_disable_public_ip<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.disable_public_ip = v.into();
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_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_enable_ip_forwarding<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_ip_forwarding = v.into();
self
}
pub fn set_gpu_driver_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GPUDriverConfig>,
{
self.gpu_driver_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_gpu_driver_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GPUDriverConfig>,
{
self.gpu_driver_config = v.map(|x| x.into());
self
}
pub fn set_image<T: std::convert::Into<std::option::Option<crate::model::gce_setup::Image>>>(
mut self,
v: T,
) -> Self {
self.image = v.into();
self
}
pub fn vm_image(&self) -> std::option::Option<&std::boxed::Box<crate::model::VmImage>> {
#[allow(unreachable_patterns)]
self.image.as_ref().and_then(|v| match v {
crate::model::gce_setup::Image::VmImage(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_vm_image<T: std::convert::Into<std::boxed::Box<crate::model::VmImage>>>(
mut self,
v: T,
) -> Self {
self.image = std::option::Option::Some(crate::model::gce_setup::Image::VmImage(v.into()));
self
}
pub fn container_image(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ContainerImage>> {
#[allow(unreachable_patterns)]
self.image.as_ref().and_then(|v| match v {
crate::model::gce_setup::Image::ContainerImage(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_container_image<
T: std::convert::Into<std::boxed::Box<crate::model::ContainerImage>>,
>(
mut self,
v: T,
) -> Self {
self.image =
std::option::Option::Some(crate::model::gce_setup::Image::ContainerImage(v.into()));
self
}
}
impl wkt::message::Message for GceSetup {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.GceSetup"
}
}
pub mod gce_setup {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Image {
VmImage(std::boxed::Box<crate::model::VmImage>),
ContainerImage(std::boxed::Box<crate::model::ContainerImage>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpgradeHistoryEntry {
pub snapshot: std::string::String,
pub vm_image: std::string::String,
pub container_image: std::string::String,
pub framework: std::string::String,
pub version: std::string::String,
pub state: crate::model::upgrade_history_entry::State,
pub create_time: std::option::Option<wkt::Timestamp>,
pub action: crate::model::upgrade_history_entry::Action,
pub target_version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpgradeHistoryEntry {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.snapshot = v.into();
self
}
pub fn set_vm_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.vm_image = v.into();
self
}
pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.container_image = v.into();
self
}
pub fn set_framework<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.framework = v.into();
self
}
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::upgrade_history_entry::State>>(
mut self,
v: T,
) -> Self {
self.state = 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_action<T: std::convert::Into<crate::model::upgrade_history_entry::Action>>(
mut self,
v: T,
) -> Self {
self.action = v.into();
self
}
pub fn set_target_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.target_version = v.into();
self
}
}
impl wkt::message::Message for UpgradeHistoryEntry {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.UpgradeHistoryEntry"
}
}
pub mod upgrade_history_entry {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Started,
Succeeded,
Failed,
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::Started => std::option::Option::Some(1),
Self::Succeeded => std::option::Option::Some(2),
Self::Failed => std::option::Option::Some(3),
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::Started => std::option::Option::Some("STARTED"),
Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
Self::Failed => std::option::Option::Some("FAILED"),
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::Started,
2 => Self::Succeeded,
3 => Self::Failed,
_ => 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,
"STARTED" => Self::Started,
"SUCCEEDED" => Self::Succeeded,
"FAILED" => Self::Failed,
_ => 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::Started => serializer.serialize_i32(1),
Self::Succeeded => serializer.serialize_i32(2),
Self::Failed => serializer.serialize_i32(3),
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.notebooks.v2.UpgradeHistoryEntry.State",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Action {
Unspecified,
Upgrade,
Rollback,
UnknownValue(action::UnknownValue),
}
#[doc(hidden)]
pub mod action {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Action {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Upgrade => std::option::Option::Some(1),
Self::Rollback => 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("ACTION_UNSPECIFIED"),
Self::Upgrade => std::option::Option::Some("UPGRADE"),
Self::Rollback => std::option::Option::Some("ROLLBACK"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Action {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Action {
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 Action {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Upgrade,
2 => Self::Rollback,
_ => Self::UnknownValue(action::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Action {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ACTION_UNSPECIFIED" => Self::Unspecified,
"UPGRADE" => Self::Upgrade,
"ROLLBACK" => Self::Rollback,
_ => Self::UnknownValue(action::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Action {
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::Upgrade => serializer.serialize_i32(1),
Self::Rollback => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Action {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Action>::new(
".google.cloud.notebooks.v2.UpgradeHistoryEntry.Action",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Instance {
pub name: std::string::String,
pub proxy_uri: std::string::String,
pub instance_owners: std::vec::Vec<std::string::String>,
pub creator: std::string::String,
pub state: crate::model::State,
pub upgrade_history: std::vec::Vec<crate::model::UpgradeHistoryEntry>,
pub id: std::string::String,
pub health_state: crate::model::HealthState,
pub health_info: std::collections::HashMap<std::string::String, std::string::String>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub disable_proxy_access: bool,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub infrastructure: std::option::Option<crate::model::instance::Infrastructure>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Instance {
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_proxy_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.proxy_uri = v.into();
self
}
pub fn set_instance_owners<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.instance_owners = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.creator = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
pub fn set_upgrade_history<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::UpgradeHistoryEntry>,
{
use std::iter::Iterator;
self.upgrade_history = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_health_state<T: std::convert::Into<crate::model::HealthState>>(
mut self,
v: T,
) -> Self {
self.health_state = v.into();
self
}
pub fn set_health_info<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.health_info = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
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_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_disable_proxy_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.disable_proxy_access = 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_infrastructure<
T: std::convert::Into<std::option::Option<crate::model::instance::Infrastructure>>,
>(
mut self,
v: T,
) -> Self {
self.infrastructure = v.into();
self
}
pub fn gce_setup(&self) -> std::option::Option<&std::boxed::Box<crate::model::GceSetup>> {
#[allow(unreachable_patterns)]
self.infrastructure.as_ref().and_then(|v| match v {
crate::model::instance::Infrastructure::GceSetup(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_gce_setup<T: std::convert::Into<std::boxed::Box<crate::model::GceSetup>>>(
mut self,
v: T,
) -> Self {
self.infrastructure =
std::option::Option::Some(crate::model::instance::Infrastructure::GceSetup(v.into()));
self
}
}
impl wkt::message::Message for Instance {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.Instance"
}
}
pub mod instance {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Infrastructure {
GceSetup(std::boxed::Box<crate::model::GceSetup>),
}
}
#[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_message: std::string::String,
pub requested_cancellation: bool,
pub api_version: std::string::String,
pub endpoint: 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_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.status_message = v.into();
self
}
pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.requested_cancellation = 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
}
pub fn set_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.endpoint = v.into();
self
}
}
impl wkt::message::Message for OperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.OperationMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub order_by: std::string::String,
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListInstancesRequest {
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_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.order_by = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
impl wkt::message::Message for ListInstancesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.ListInstancesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesResponse {
pub instances: std::vec::Vec<crate::model::Instance>,
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 ListInstancesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_instances<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Instance>,
{
use std::iter::Iterator;
self.instances = 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 ListInstancesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.ListInstancesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
type PageItem = crate::model::Instance;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.instances
}
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 GetInstanceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetInstanceRequest {
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 GetInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.GetInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateInstanceRequest {
pub parent: std::string::String,
pub instance_id: std::string::String,
pub instance: std::option::Option<crate::model::Instance>,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateInstanceRequest {
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_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.instance_id = v.into();
self
}
pub fn set_instance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Instance>,
{
self.instance = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Instance>,
{
self.instance = 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 CreateInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.CreateInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateInstanceRequest {
pub instance: std::option::Option<crate::model::Instance>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateInstanceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_instance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Instance>,
{
self.instance = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Instance>,
{
self.instance = v.map(|x| x.into());
self
}
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_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 UpdateInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.UpdateInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteInstanceRequest {
pub name: std::string::String,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteInstanceRequest {
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
}
}
impl wkt::message::Message for DeleteInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.DeleteInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StartInstanceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StartInstanceRequest {
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 StartInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.StartInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StopInstanceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StopInstanceRequest {
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 StopInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.StopInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResetInstanceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResetInstanceRequest {
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 ResetInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.ResetInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CheckInstanceUpgradabilityRequest {
pub notebook_instance: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CheckInstanceUpgradabilityRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_notebook_instance<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.notebook_instance = v.into();
self
}
}
impl wkt::message::Message for CheckInstanceUpgradabilityRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.CheckInstanceUpgradabilityRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CheckInstanceUpgradabilityResponse {
pub upgradeable: bool,
pub upgrade_version: std::string::String,
pub upgrade_info: std::string::String,
pub upgrade_image: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CheckInstanceUpgradabilityResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_upgradeable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.upgradeable = v.into();
self
}
pub fn set_upgrade_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.upgrade_version = v.into();
self
}
pub fn set_upgrade_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.upgrade_info = v.into();
self
}
pub fn set_upgrade_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.upgrade_image = v.into();
self
}
}
impl wkt::message::Message for CheckInstanceUpgradabilityResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.CheckInstanceUpgradabilityResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpgradeInstanceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpgradeInstanceRequest {
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 UpgradeInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.UpgradeInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RollbackInstanceRequest {
pub name: std::string::String,
pub target_snapshot: std::string::String,
pub revision_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RollbackInstanceRequest {
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_target_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.target_snapshot = v.into();
self
}
pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision_id = v.into();
self
}
}
impl wkt::message::Message for RollbackInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.RollbackInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DiagnoseInstanceRequest {
pub name: std::string::String,
pub diagnostic_config: std::option::Option<crate::model::DiagnosticConfig>,
pub timeout_minutes: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DiagnoseInstanceRequest {
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_diagnostic_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DiagnosticConfig>,
{
self.diagnostic_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_diagnostic_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DiagnosticConfig>,
{
self.diagnostic_config = v.map(|x| x.into());
self
}
pub fn set_timeout_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.timeout_minutes = v.into();
self
}
}
impl wkt::message::Message for DiagnoseInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.notebooks.v2.DiagnoseInstanceRequest"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DiskEncryption {
Unspecified,
Gmek,
Cmek,
UnknownValue(disk_encryption::UnknownValue),
}
#[doc(hidden)]
pub mod disk_encryption {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DiskEncryption {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Gmek => std::option::Option::Some(1),
Self::Cmek => 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_ENCRYPTION_UNSPECIFIED"),
Self::Gmek => std::option::Option::Some("GMEK"),
Self::Cmek => std::option::Option::Some("CMEK"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DiskEncryption {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DiskEncryption {
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 DiskEncryption {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Gmek,
2 => Self::Cmek,
_ => Self::UnknownValue(disk_encryption::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DiskEncryption {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DISK_ENCRYPTION_UNSPECIFIED" => Self::Unspecified,
"GMEK" => Self::Gmek,
"CMEK" => Self::Cmek,
_ => Self::UnknownValue(disk_encryption::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DiskEncryption {
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::Gmek => serializer.serialize_i32(1),
Self::Cmek => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DiskEncryption {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiskEncryption>::new(
".google.cloud.notebooks.v2.DiskEncryption",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DiskType {
Unspecified,
PdStandard,
PdSsd,
PdBalanced,
PdExtreme,
UnknownValue(disk_type::UnknownValue),
}
#[doc(hidden)]
pub mod disk_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DiskType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::PdStandard => std::option::Option::Some(1),
Self::PdSsd => std::option::Option::Some(2),
Self::PdBalanced => std::option::Option::Some(3),
Self::PdExtreme => 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("DISK_TYPE_UNSPECIFIED"),
Self::PdStandard => std::option::Option::Some("PD_STANDARD"),
Self::PdSsd => std::option::Option::Some("PD_SSD"),
Self::PdBalanced => std::option::Option::Some("PD_BALANCED"),
Self::PdExtreme => std::option::Option::Some("PD_EXTREME"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DiskType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DiskType {
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 DiskType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::PdStandard,
2 => Self::PdSsd,
3 => Self::PdBalanced,
4 => Self::PdExtreme,
_ => Self::UnknownValue(disk_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DiskType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DISK_TYPE_UNSPECIFIED" => Self::Unspecified,
"PD_STANDARD" => Self::PdStandard,
"PD_SSD" => Self::PdSsd,
"PD_BALANCED" => Self::PdBalanced,
"PD_EXTREME" => Self::PdExtreme,
_ => Self::UnknownValue(disk_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DiskType {
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::PdStandard => serializer.serialize_i32(1),
Self::PdSsd => serializer.serialize_i32(2),
Self::PdBalanced => serializer.serialize_i32(3),
Self::PdExtreme => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DiskType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiskType>::new(
".google.cloud.notebooks.v2.DiskType",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Starting,
Provisioning,
Active,
Stopping,
Stopped,
Deleted,
Upgrading,
Initializing,
Suspending,
Suspended,
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::Starting => std::option::Option::Some(1),
Self::Provisioning => std::option::Option::Some(2),
Self::Active => std::option::Option::Some(3),
Self::Stopping => std::option::Option::Some(4),
Self::Stopped => std::option::Option::Some(5),
Self::Deleted => std::option::Option::Some(6),
Self::Upgrading => std::option::Option::Some(7),
Self::Initializing => std::option::Option::Some(8),
Self::Suspending => std::option::Option::Some(9),
Self::Suspended => std::option::Option::Some(10),
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::Starting => std::option::Option::Some("STARTING"),
Self::Provisioning => std::option::Option::Some("PROVISIONING"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Stopping => std::option::Option::Some("STOPPING"),
Self::Stopped => std::option::Option::Some("STOPPED"),
Self::Deleted => std::option::Option::Some("DELETED"),
Self::Upgrading => std::option::Option::Some("UPGRADING"),
Self::Initializing => std::option::Option::Some("INITIALIZING"),
Self::Suspending => std::option::Option::Some("SUSPENDING"),
Self::Suspended => std::option::Option::Some("SUSPENDED"),
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::Starting,
2 => Self::Provisioning,
3 => Self::Active,
4 => Self::Stopping,
5 => Self::Stopped,
6 => Self::Deleted,
7 => Self::Upgrading,
8 => Self::Initializing,
9 => Self::Suspending,
10 => Self::Suspended,
_ => 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,
"STARTING" => Self::Starting,
"PROVISIONING" => Self::Provisioning,
"ACTIVE" => Self::Active,
"STOPPING" => Self::Stopping,
"STOPPED" => Self::Stopped,
"DELETED" => Self::Deleted,
"UPGRADING" => Self::Upgrading,
"INITIALIZING" => Self::Initializing,
"SUSPENDING" => Self::Suspending,
"SUSPENDED" => Self::Suspended,
_ => 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::Starting => serializer.serialize_i32(1),
Self::Provisioning => serializer.serialize_i32(2),
Self::Active => serializer.serialize_i32(3),
Self::Stopping => serializer.serialize_i32(4),
Self::Stopped => serializer.serialize_i32(5),
Self::Deleted => serializer.serialize_i32(6),
Self::Upgrading => serializer.serialize_i32(7),
Self::Initializing => serializer.serialize_i32(8),
Self::Suspending => serializer.serialize_i32(9),
Self::Suspended => serializer.serialize_i32(10),
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.notebooks.v2.State",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HealthState {
Unspecified,
Healthy,
Unhealthy,
AgentNotInstalled,
AgentNotRunning,
UnknownValue(health_state::UnknownValue),
}
#[doc(hidden)]
pub mod health_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl HealthState {
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::Unhealthy => std::option::Option::Some(2),
Self::AgentNotInstalled => std::option::Option::Some(3),
Self::AgentNotRunning => 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("HEALTH_STATE_UNSPECIFIED"),
Self::Healthy => std::option::Option::Some("HEALTHY"),
Self::Unhealthy => std::option::Option::Some("UNHEALTHY"),
Self::AgentNotInstalled => std::option::Option::Some("AGENT_NOT_INSTALLED"),
Self::AgentNotRunning => std::option::Option::Some("AGENT_NOT_RUNNING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for HealthState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for HealthState {
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 HealthState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Healthy,
2 => Self::Unhealthy,
3 => Self::AgentNotInstalled,
4 => Self::AgentNotRunning,
_ => Self::UnknownValue(health_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for HealthState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"HEALTH_STATE_UNSPECIFIED" => Self::Unspecified,
"HEALTHY" => Self::Healthy,
"UNHEALTHY" => Self::Unhealthy,
"AGENT_NOT_INSTALLED" => Self::AgentNotInstalled,
"AGENT_NOT_RUNNING" => Self::AgentNotRunning,
_ => Self::UnknownValue(health_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for HealthState {
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::Unhealthy => serializer.serialize_i32(2),
Self::AgentNotInstalled => serializer.serialize_i32(3),
Self::AgentNotRunning => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for HealthState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<HealthState>::new(
".google.cloud.notebooks.v2.HealthState",
))
}
}