google_cloud_notebooks_v2/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate iam_v1;
25extern crate lazy_static;
26extern crate location;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Defines flags that are used to run the diagnostic tool
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct DiagnosticConfig {
45    /// Required. User Cloud Storage bucket location (REQUIRED).
46    /// Must be formatted with path prefix (`gs://$GCS_BUCKET`).
47    ///
48    /// Permissions:
49    /// User Managed Notebooks:
50    ///
51    /// - storage.buckets.writer: Must be given to the project's service account
52    ///   attached to VM.
53    ///   Google Managed Notebooks:
54    /// - storage.buckets.writer: Must be given to the project's service account or
55    ///   user credentials attached to VM depending on authentication mode.
56    ///
57    /// Cloud Storage bucket Log file will be written to
58    /// `gs://$GCS_BUCKET/$RELATIVE_PATH/$VM_DATE_$TIME.tar.gz`
59    pub gcs_bucket: std::string::String,
60
61    /// Optional. Defines the relative storage path in the Cloud Storage bucket
62    /// where the diagnostic logs will be written: Default path will be the root
63    /// directory of the Cloud Storage bucket
64    /// (`gs://$GCS_BUCKET/$DATE_$TIME.tar.gz`) Example of full path where Log file
65    /// will be written: `gs://$GCS_BUCKET/$RELATIVE_PATH/`
66    pub relative_path: std::string::String,
67
68    /// Optional. Enables flag to repair service for instance
69    pub enable_repair_flag: bool,
70
71    /// Optional. Enables flag to capture packets from the instance for 30 seconds
72    pub enable_packet_capture_flag: bool,
73
74    /// Optional. Enables flag to copy all `/home/jupyter` folder contents
75    pub enable_copy_home_files_flag: bool,
76
77    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
78}
79
80impl DiagnosticConfig {
81    pub fn new() -> Self {
82        std::default::Default::default()
83    }
84
85    /// Sets the value of [gcs_bucket][crate::model::DiagnosticConfig::gcs_bucket].
86    pub fn set_gcs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
87        self.gcs_bucket = v.into();
88        self
89    }
90
91    /// Sets the value of [relative_path][crate::model::DiagnosticConfig::relative_path].
92    pub fn set_relative_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
93        self.relative_path = v.into();
94        self
95    }
96
97    /// Sets the value of [enable_repair_flag][crate::model::DiagnosticConfig::enable_repair_flag].
98    pub fn set_enable_repair_flag<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
99        self.enable_repair_flag = v.into();
100        self
101    }
102
103    /// Sets the value of [enable_packet_capture_flag][crate::model::DiagnosticConfig::enable_packet_capture_flag].
104    pub fn set_enable_packet_capture_flag<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
105        self.enable_packet_capture_flag = v.into();
106        self
107    }
108
109    /// Sets the value of [enable_copy_home_files_flag][crate::model::DiagnosticConfig::enable_copy_home_files_flag].
110    pub fn set_enable_copy_home_files_flag<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
111        self.enable_copy_home_files_flag = v.into();
112        self
113    }
114}
115
116impl wkt::message::Message for DiagnosticConfig {
117    fn typename() -> &'static str {
118        "type.googleapis.com/google.cloud.notebooks.v2.DiagnosticConfig"
119    }
120}
121
122/// The definition of an Event for a managed / semi-managed notebook instance.
123#[derive(Clone, Default, PartialEq)]
124#[non_exhaustive]
125pub struct Event {
126    /// Optional. Event report time.
127    pub report_time: std::option::Option<wkt::Timestamp>,
128
129    /// Optional. Event type.
130    pub r#type: crate::model::event::EventType,
131
132    /// Optional. Event details. This field is used to pass event information.
133    pub details: std::collections::HashMap<std::string::String, std::string::String>,
134
135    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
136}
137
138impl Event {
139    pub fn new() -> Self {
140        std::default::Default::default()
141    }
142
143    /// Sets the value of [report_time][crate::model::Event::report_time].
144    pub fn set_report_time<T>(mut self, v: T) -> Self
145    where
146        T: std::convert::Into<wkt::Timestamp>,
147    {
148        self.report_time = std::option::Option::Some(v.into());
149        self
150    }
151
152    /// Sets or clears the value of [report_time][crate::model::Event::report_time].
153    pub fn set_or_clear_report_time<T>(mut self, v: std::option::Option<T>) -> Self
154    where
155        T: std::convert::Into<wkt::Timestamp>,
156    {
157        self.report_time = v.map(|x| x.into());
158        self
159    }
160
161    /// Sets the value of [r#type][crate::model::Event::type].
162    pub fn set_type<T: std::convert::Into<crate::model::event::EventType>>(mut self, v: T) -> Self {
163        self.r#type = v.into();
164        self
165    }
166
167    /// Sets the value of [details][crate::model::Event::details].
168    pub fn set_details<T, K, V>(mut self, v: T) -> Self
169    where
170        T: std::iter::IntoIterator<Item = (K, V)>,
171        K: std::convert::Into<std::string::String>,
172        V: std::convert::Into<std::string::String>,
173    {
174        use std::iter::Iterator;
175        self.details = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
176        self
177    }
178}
179
180impl wkt::message::Message for Event {
181    fn typename() -> &'static str {
182        "type.googleapis.com/google.cloud.notebooks.v2.Event"
183    }
184}
185
186/// Defines additional types related to [Event].
187pub mod event {
188    #[allow(unused_imports)]
189    use super::*;
190
191    /// The definition of the event types.
192    ///
193    /// # Working with unknown values
194    ///
195    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
196    /// additional enum variants at any time. Adding new variants is not considered
197    /// a breaking change. Applications should write their code in anticipation of:
198    ///
199    /// - New values appearing in future releases of the client library, **and**
200    /// - New values received dynamically, without application changes.
201    ///
202    /// Please consult the [Working with enums] section in the user guide for some
203    /// guidelines.
204    ///
205    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
206    #[derive(Clone, Debug, PartialEq)]
207    #[non_exhaustive]
208    pub enum EventType {
209        /// Event is not specified.
210        Unspecified,
211        /// The instance / runtime is idle
212        Idle,
213        /// The instance / runtime is available.
214        /// This event indicates that instance / runtime underlying compute is
215        /// operational.
216        Heartbeat,
217        /// The instance / runtime health is available.
218        /// This event indicates that instance / runtime health information.
219        Health,
220        /// The instance / runtime is available.
221        /// This event allows instance / runtime to send Host maintenance
222        /// information to Control Plane.
223        /// <https://cloud.google.com/compute/docs/gpus/gpu-host-maintenance>
224        Maintenance,
225        /// The instance / runtime is available.
226        /// This event indicates that the instance had metadata that needs to be
227        /// modified.
228        MetadataChange,
229        /// If set, the enum was initialized with an unknown value.
230        ///
231        /// Applications can examine the value using [EventType::value] or
232        /// [EventType::name].
233        UnknownValue(event_type::UnknownValue),
234    }
235
236    #[doc(hidden)]
237    pub mod event_type {
238        #[allow(unused_imports)]
239        use super::*;
240        #[derive(Clone, Debug, PartialEq)]
241        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
242    }
243
244    impl EventType {
245        /// Gets the enum value.
246        ///
247        /// Returns `None` if the enum contains an unknown value deserialized from
248        /// the string representation of enums.
249        pub fn value(&self) -> std::option::Option<i32> {
250            match self {
251                Self::Unspecified => std::option::Option::Some(0),
252                Self::Idle => std::option::Option::Some(1),
253                Self::Heartbeat => std::option::Option::Some(2),
254                Self::Health => std::option::Option::Some(3),
255                Self::Maintenance => std::option::Option::Some(4),
256                Self::MetadataChange => std::option::Option::Some(5),
257                Self::UnknownValue(u) => u.0.value(),
258            }
259        }
260
261        /// Gets the enum value as a string.
262        ///
263        /// Returns `None` if the enum contains an unknown value deserialized from
264        /// the integer representation of enums.
265        pub fn name(&self) -> std::option::Option<&str> {
266            match self {
267                Self::Unspecified => std::option::Option::Some("EVENT_TYPE_UNSPECIFIED"),
268                Self::Idle => std::option::Option::Some("IDLE"),
269                Self::Heartbeat => std::option::Option::Some("HEARTBEAT"),
270                Self::Health => std::option::Option::Some("HEALTH"),
271                Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
272                Self::MetadataChange => std::option::Option::Some("METADATA_CHANGE"),
273                Self::UnknownValue(u) => u.0.name(),
274            }
275        }
276    }
277
278    impl std::default::Default for EventType {
279        fn default() -> Self {
280            use std::convert::From;
281            Self::from(0)
282        }
283    }
284
285    impl std::fmt::Display for EventType {
286        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
287            wkt::internal::display_enum(f, self.name(), self.value())
288        }
289    }
290
291    impl std::convert::From<i32> for EventType {
292        fn from(value: i32) -> Self {
293            match value {
294                0 => Self::Unspecified,
295                1 => Self::Idle,
296                2 => Self::Heartbeat,
297                3 => Self::Health,
298                4 => Self::Maintenance,
299                5 => Self::MetadataChange,
300                _ => Self::UnknownValue(event_type::UnknownValue(
301                    wkt::internal::UnknownEnumValue::Integer(value),
302                )),
303            }
304        }
305    }
306
307    impl std::convert::From<&str> for EventType {
308        fn from(value: &str) -> Self {
309            use std::string::ToString;
310            match value {
311                "EVENT_TYPE_UNSPECIFIED" => Self::Unspecified,
312                "IDLE" => Self::Idle,
313                "HEARTBEAT" => Self::Heartbeat,
314                "HEALTH" => Self::Health,
315                "MAINTENANCE" => Self::Maintenance,
316                "METADATA_CHANGE" => Self::MetadataChange,
317                _ => Self::UnknownValue(event_type::UnknownValue(
318                    wkt::internal::UnknownEnumValue::String(value.to_string()),
319                )),
320            }
321        }
322    }
323
324    impl serde::ser::Serialize for EventType {
325        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
326        where
327            S: serde::Serializer,
328        {
329            match self {
330                Self::Unspecified => serializer.serialize_i32(0),
331                Self::Idle => serializer.serialize_i32(1),
332                Self::Heartbeat => serializer.serialize_i32(2),
333                Self::Health => serializer.serialize_i32(3),
334                Self::Maintenance => serializer.serialize_i32(4),
335                Self::MetadataChange => serializer.serialize_i32(5),
336                Self::UnknownValue(u) => u.0.serialize(serializer),
337            }
338        }
339    }
340
341    impl<'de> serde::de::Deserialize<'de> for EventType {
342        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
343        where
344            D: serde::Deserializer<'de>,
345        {
346            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EventType>::new(
347                ".google.cloud.notebooks.v2.Event.EventType",
348            ))
349        }
350    }
351}
352
353/// The definition of a network interface resource attached to a VM.
354#[derive(Clone, Default, PartialEq)]
355#[non_exhaustive]
356pub struct NetworkInterface {
357    /// Optional. The name of the VPC that this VM instance is in.
358    /// Format:
359    /// `projects/{project_id}/global/networks/{network_id}`
360    pub network: std::string::String,
361
362    /// Optional. The name of the subnet that this VM instance is in.
363    /// Format:
364    /// `projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}`
365    pub subnet: std::string::String,
366
367    /// Optional. The type of vNIC to be used on this interface. This may be gVNIC
368    /// or VirtioNet.
369    pub nic_type: crate::model::network_interface::NicType,
370
371    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
372}
373
374impl NetworkInterface {
375    pub fn new() -> Self {
376        std::default::Default::default()
377    }
378
379    /// Sets the value of [network][crate::model::NetworkInterface::network].
380    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
381        self.network = v.into();
382        self
383    }
384
385    /// Sets the value of [subnet][crate::model::NetworkInterface::subnet].
386    pub fn set_subnet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
387        self.subnet = v.into();
388        self
389    }
390
391    /// Sets the value of [nic_type][crate::model::NetworkInterface::nic_type].
392    pub fn set_nic_type<T: std::convert::Into<crate::model::network_interface::NicType>>(
393        mut self,
394        v: T,
395    ) -> Self {
396        self.nic_type = v.into();
397        self
398    }
399}
400
401impl wkt::message::Message for NetworkInterface {
402    fn typename() -> &'static str {
403        "type.googleapis.com/google.cloud.notebooks.v2.NetworkInterface"
404    }
405}
406
407/// Defines additional types related to [NetworkInterface].
408pub mod network_interface {
409    #[allow(unused_imports)]
410    use super::*;
411
412    /// The type of vNIC driver.
413    /// Default should be NIC_TYPE_UNSPECIFIED.
414    ///
415    /// # Working with unknown values
416    ///
417    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
418    /// additional enum variants at any time. Adding new variants is not considered
419    /// a breaking change. Applications should write their code in anticipation of:
420    ///
421    /// - New values appearing in future releases of the client library, **and**
422    /// - New values received dynamically, without application changes.
423    ///
424    /// Please consult the [Working with enums] section in the user guide for some
425    /// guidelines.
426    ///
427    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
428    #[derive(Clone, Debug, PartialEq)]
429    #[non_exhaustive]
430    pub enum NicType {
431        /// No type specified.
432        Unspecified,
433        /// VIRTIO
434        VirtioNet,
435        /// GVNIC
436        Gvnic,
437        /// If set, the enum was initialized with an unknown value.
438        ///
439        /// Applications can examine the value using [NicType::value] or
440        /// [NicType::name].
441        UnknownValue(nic_type::UnknownValue),
442    }
443
444    #[doc(hidden)]
445    pub mod nic_type {
446        #[allow(unused_imports)]
447        use super::*;
448        #[derive(Clone, Debug, PartialEq)]
449        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
450    }
451
452    impl NicType {
453        /// Gets the enum value.
454        ///
455        /// Returns `None` if the enum contains an unknown value deserialized from
456        /// the string representation of enums.
457        pub fn value(&self) -> std::option::Option<i32> {
458            match self {
459                Self::Unspecified => std::option::Option::Some(0),
460                Self::VirtioNet => std::option::Option::Some(1),
461                Self::Gvnic => std::option::Option::Some(2),
462                Self::UnknownValue(u) => u.0.value(),
463            }
464        }
465
466        /// Gets the enum value as a string.
467        ///
468        /// Returns `None` if the enum contains an unknown value deserialized from
469        /// the integer representation of enums.
470        pub fn name(&self) -> std::option::Option<&str> {
471            match self {
472                Self::Unspecified => std::option::Option::Some("NIC_TYPE_UNSPECIFIED"),
473                Self::VirtioNet => std::option::Option::Some("VIRTIO_NET"),
474                Self::Gvnic => std::option::Option::Some("GVNIC"),
475                Self::UnknownValue(u) => u.0.name(),
476            }
477        }
478    }
479
480    impl std::default::Default for NicType {
481        fn default() -> Self {
482            use std::convert::From;
483            Self::from(0)
484        }
485    }
486
487    impl std::fmt::Display for NicType {
488        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
489            wkt::internal::display_enum(f, self.name(), self.value())
490        }
491    }
492
493    impl std::convert::From<i32> for NicType {
494        fn from(value: i32) -> Self {
495            match value {
496                0 => Self::Unspecified,
497                1 => Self::VirtioNet,
498                2 => Self::Gvnic,
499                _ => Self::UnknownValue(nic_type::UnknownValue(
500                    wkt::internal::UnknownEnumValue::Integer(value),
501                )),
502            }
503        }
504    }
505
506    impl std::convert::From<&str> for NicType {
507        fn from(value: &str) -> Self {
508            use std::string::ToString;
509            match value {
510                "NIC_TYPE_UNSPECIFIED" => Self::Unspecified,
511                "VIRTIO_NET" => Self::VirtioNet,
512                "GVNIC" => Self::Gvnic,
513                _ => Self::UnknownValue(nic_type::UnknownValue(
514                    wkt::internal::UnknownEnumValue::String(value.to_string()),
515                )),
516            }
517        }
518    }
519
520    impl serde::ser::Serialize for NicType {
521        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
522        where
523            S: serde::Serializer,
524        {
525            match self {
526                Self::Unspecified => serializer.serialize_i32(0),
527                Self::VirtioNet => serializer.serialize_i32(1),
528                Self::Gvnic => serializer.serialize_i32(2),
529                Self::UnknownValue(u) => u.0.serialize(serializer),
530            }
531        }
532    }
533
534    impl<'de> serde::de::Deserialize<'de> for NicType {
535        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
536        where
537            D: serde::Deserializer<'de>,
538        {
539            deserializer.deserialize_any(wkt::internal::EnumVisitor::<NicType>::new(
540                ".google.cloud.notebooks.v2.NetworkInterface.NicType",
541            ))
542        }
543    }
544}
545
546/// Definition of a custom Compute Engine virtual machine image for starting a
547/// notebook instance with the environment installed directly on the VM.
548#[derive(Clone, Default, PartialEq)]
549#[non_exhaustive]
550pub struct VmImage {
551    /// Required. The name of the Google Cloud project that this VM image belongs
552    /// to. Format: `{project_id}`
553    pub project: std::string::String,
554
555    /// The reference to an external Compute Engine VM image.
556    pub image: std::option::Option<crate::model::vm_image::Image>,
557
558    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
559}
560
561impl VmImage {
562    pub fn new() -> Self {
563        std::default::Default::default()
564    }
565
566    /// Sets the value of [project][crate::model::VmImage::project].
567    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
568        self.project = v.into();
569        self
570    }
571
572    /// Sets the value of [image][crate::model::VmImage::image].
573    ///
574    /// Note that all the setters affecting `image` are mutually
575    /// exclusive.
576    pub fn set_image<T: std::convert::Into<std::option::Option<crate::model::vm_image::Image>>>(
577        mut self,
578        v: T,
579    ) -> Self {
580        self.image = v.into();
581        self
582    }
583
584    /// The value of [image][crate::model::VmImage::image]
585    /// if it holds a `Name`, `None` if the field is not set or
586    /// holds a different branch.
587    pub fn name(&self) -> std::option::Option<&std::string::String> {
588        #[allow(unreachable_patterns)]
589        self.image.as_ref().and_then(|v| match v {
590            crate::model::vm_image::Image::Name(v) => std::option::Option::Some(v),
591            _ => std::option::Option::None,
592        })
593    }
594
595    /// Sets the value of [image][crate::model::VmImage::image]
596    /// to hold a `Name`.
597    ///
598    /// Note that all the setters affecting `image` are
599    /// mutually exclusive.
600    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
601        self.image = std::option::Option::Some(crate::model::vm_image::Image::Name(v.into()));
602        self
603    }
604
605    /// The value of [image][crate::model::VmImage::image]
606    /// if it holds a `Family`, `None` if the field is not set or
607    /// holds a different branch.
608    pub fn family(&self) -> std::option::Option<&std::string::String> {
609        #[allow(unreachable_patterns)]
610        self.image.as_ref().and_then(|v| match v {
611            crate::model::vm_image::Image::Family(v) => std::option::Option::Some(v),
612            _ => std::option::Option::None,
613        })
614    }
615
616    /// Sets the value of [image][crate::model::VmImage::image]
617    /// to hold a `Family`.
618    ///
619    /// Note that all the setters affecting `image` are
620    /// mutually exclusive.
621    pub fn set_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
622        self.image = std::option::Option::Some(crate::model::vm_image::Image::Family(v.into()));
623        self
624    }
625}
626
627impl wkt::message::Message for VmImage {
628    fn typename() -> &'static str {
629        "type.googleapis.com/google.cloud.notebooks.v2.VmImage"
630    }
631}
632
633/// Defines additional types related to [VmImage].
634pub mod vm_image {
635    #[allow(unused_imports)]
636    use super::*;
637
638    /// The reference to an external Compute Engine VM image.
639    #[derive(Clone, Debug, PartialEq)]
640    #[non_exhaustive]
641    pub enum Image {
642        /// Optional. Use VM image name to find the image.
643        Name(std::string::String),
644        /// Optional. Use this VM image family to find the image; the newest image in
645        /// this family will be used.
646        Family(std::string::String),
647    }
648}
649
650/// Definition of a container image for starting a notebook instance with the
651/// environment installed in a container.
652#[derive(Clone, Default, PartialEq)]
653#[non_exhaustive]
654pub struct ContainerImage {
655    /// Required. The path to the container image repository. For example:
656    /// `gcr.io/{project_id}/{image_name}`
657    pub repository: std::string::String,
658
659    /// Optional. The tag of the container image. If not specified, this defaults
660    /// to the latest tag.
661    pub tag: std::string::String,
662
663    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
664}
665
666impl ContainerImage {
667    pub fn new() -> Self {
668        std::default::Default::default()
669    }
670
671    /// Sets the value of [repository][crate::model::ContainerImage::repository].
672    pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
673        self.repository = v.into();
674        self
675    }
676
677    /// Sets the value of [tag][crate::model::ContainerImage::tag].
678    pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
679        self.tag = v.into();
680        self
681    }
682}
683
684impl wkt::message::Message for ContainerImage {
685    fn typename() -> &'static str {
686        "type.googleapis.com/google.cloud.notebooks.v2.ContainerImage"
687    }
688}
689
690/// An accelerator configuration for a VM instance
691/// Definition of a hardware accelerator. Note that there is no check on `type`
692/// and `core_count` combinations. TPUs are not supported.
693/// See [GPUs on Compute
694/// Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to find a
695/// valid combination.
696#[derive(Clone, Default, PartialEq)]
697#[non_exhaustive]
698pub struct AcceleratorConfig {
699    /// Optional. Type of this accelerator.
700    pub r#type: crate::model::accelerator_config::AcceleratorType,
701
702    /// Optional. Count of cores of this accelerator.
703    pub core_count: i64,
704
705    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
706}
707
708impl AcceleratorConfig {
709    pub fn new() -> Self {
710        std::default::Default::default()
711    }
712
713    /// Sets the value of [r#type][crate::model::AcceleratorConfig::type].
714    pub fn set_type<T: std::convert::Into<crate::model::accelerator_config::AcceleratorType>>(
715        mut self,
716        v: T,
717    ) -> Self {
718        self.r#type = v.into();
719        self
720    }
721
722    /// Sets the value of [core_count][crate::model::AcceleratorConfig::core_count].
723    pub fn set_core_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
724        self.core_count = v.into();
725        self
726    }
727}
728
729impl wkt::message::Message for AcceleratorConfig {
730    fn typename() -> &'static str {
731        "type.googleapis.com/google.cloud.notebooks.v2.AcceleratorConfig"
732    }
733}
734
735/// Defines additional types related to [AcceleratorConfig].
736pub mod accelerator_config {
737    #[allow(unused_imports)]
738    use super::*;
739
740    /// Definition of the types of hardware accelerators that can be used on
741    /// this instance.
742    ///
743    /// # Working with unknown values
744    ///
745    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
746    /// additional enum variants at any time. Adding new variants is not considered
747    /// a breaking change. Applications should write their code in anticipation of:
748    ///
749    /// - New values appearing in future releases of the client library, **and**
750    /// - New values received dynamically, without application changes.
751    ///
752    /// Please consult the [Working with enums] section in the user guide for some
753    /// guidelines.
754    ///
755    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
756    #[derive(Clone, Debug, PartialEq)]
757    #[non_exhaustive]
758    pub enum AcceleratorType {
759        /// Accelerator type is not specified.
760        Unspecified,
761        /// Accelerator type is Nvidia Tesla P100.
762        NvidiaTeslaP100,
763        /// Accelerator type is Nvidia Tesla V100.
764        NvidiaTeslaV100,
765        /// Accelerator type is Nvidia Tesla P4.
766        NvidiaTeslaP4,
767        /// Accelerator type is Nvidia Tesla T4.
768        NvidiaTeslaT4,
769        /// Accelerator type is Nvidia Tesla A100 - 40GB.
770        NvidiaTeslaA100,
771        /// Accelerator type is Nvidia Tesla A100 - 80GB.
772        NvidiaA10080Gb,
773        /// Accelerator type is Nvidia Tesla L4.
774        NvidiaL4,
775        /// Accelerator type is NVIDIA Tesla T4 Virtual Workstations.
776        NvidiaTeslaT4Vws,
777        /// Accelerator type is NVIDIA Tesla P100 Virtual Workstations.
778        NvidiaTeslaP100Vws,
779        /// Accelerator type is NVIDIA Tesla P4 Virtual Workstations.
780        NvidiaTeslaP4Vws,
781        /// If set, the enum was initialized with an unknown value.
782        ///
783        /// Applications can examine the value using [AcceleratorType::value] or
784        /// [AcceleratorType::name].
785        UnknownValue(accelerator_type::UnknownValue),
786    }
787
788    #[doc(hidden)]
789    pub mod accelerator_type {
790        #[allow(unused_imports)]
791        use super::*;
792        #[derive(Clone, Debug, PartialEq)]
793        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
794    }
795
796    impl AcceleratorType {
797        /// Gets the enum value.
798        ///
799        /// Returns `None` if the enum contains an unknown value deserialized from
800        /// the string representation of enums.
801        pub fn value(&self) -> std::option::Option<i32> {
802            match self {
803                Self::Unspecified => std::option::Option::Some(0),
804                Self::NvidiaTeslaP100 => std::option::Option::Some(2),
805                Self::NvidiaTeslaV100 => std::option::Option::Some(3),
806                Self::NvidiaTeslaP4 => std::option::Option::Some(4),
807                Self::NvidiaTeslaT4 => std::option::Option::Some(5),
808                Self::NvidiaTeslaA100 => std::option::Option::Some(11),
809                Self::NvidiaA10080Gb => std::option::Option::Some(12),
810                Self::NvidiaL4 => std::option::Option::Some(13),
811                Self::NvidiaTeslaT4Vws => std::option::Option::Some(8),
812                Self::NvidiaTeslaP100Vws => std::option::Option::Some(9),
813                Self::NvidiaTeslaP4Vws => std::option::Option::Some(10),
814                Self::UnknownValue(u) => u.0.value(),
815            }
816        }
817
818        /// Gets the enum value as a string.
819        ///
820        /// Returns `None` if the enum contains an unknown value deserialized from
821        /// the integer representation of enums.
822        pub fn name(&self) -> std::option::Option<&str> {
823            match self {
824                Self::Unspecified => std::option::Option::Some("ACCELERATOR_TYPE_UNSPECIFIED"),
825                Self::NvidiaTeslaP100 => std::option::Option::Some("NVIDIA_TESLA_P100"),
826                Self::NvidiaTeslaV100 => std::option::Option::Some("NVIDIA_TESLA_V100"),
827                Self::NvidiaTeslaP4 => std::option::Option::Some("NVIDIA_TESLA_P4"),
828                Self::NvidiaTeslaT4 => std::option::Option::Some("NVIDIA_TESLA_T4"),
829                Self::NvidiaTeslaA100 => std::option::Option::Some("NVIDIA_TESLA_A100"),
830                Self::NvidiaA10080Gb => std::option::Option::Some("NVIDIA_A100_80GB"),
831                Self::NvidiaL4 => std::option::Option::Some("NVIDIA_L4"),
832                Self::NvidiaTeslaT4Vws => std::option::Option::Some("NVIDIA_TESLA_T4_VWS"),
833                Self::NvidiaTeslaP100Vws => std::option::Option::Some("NVIDIA_TESLA_P100_VWS"),
834                Self::NvidiaTeslaP4Vws => std::option::Option::Some("NVIDIA_TESLA_P4_VWS"),
835                Self::UnknownValue(u) => u.0.name(),
836            }
837        }
838    }
839
840    impl std::default::Default for AcceleratorType {
841        fn default() -> Self {
842            use std::convert::From;
843            Self::from(0)
844        }
845    }
846
847    impl std::fmt::Display for AcceleratorType {
848        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
849            wkt::internal::display_enum(f, self.name(), self.value())
850        }
851    }
852
853    impl std::convert::From<i32> for AcceleratorType {
854        fn from(value: i32) -> Self {
855            match value {
856                0 => Self::Unspecified,
857                2 => Self::NvidiaTeslaP100,
858                3 => Self::NvidiaTeslaV100,
859                4 => Self::NvidiaTeslaP4,
860                5 => Self::NvidiaTeslaT4,
861                8 => Self::NvidiaTeslaT4Vws,
862                9 => Self::NvidiaTeslaP100Vws,
863                10 => Self::NvidiaTeslaP4Vws,
864                11 => Self::NvidiaTeslaA100,
865                12 => Self::NvidiaA10080Gb,
866                13 => Self::NvidiaL4,
867                _ => Self::UnknownValue(accelerator_type::UnknownValue(
868                    wkt::internal::UnknownEnumValue::Integer(value),
869                )),
870            }
871        }
872    }
873
874    impl std::convert::From<&str> for AcceleratorType {
875        fn from(value: &str) -> Self {
876            use std::string::ToString;
877            match value {
878                "ACCELERATOR_TYPE_UNSPECIFIED" => Self::Unspecified,
879                "NVIDIA_TESLA_P100" => Self::NvidiaTeslaP100,
880                "NVIDIA_TESLA_V100" => Self::NvidiaTeslaV100,
881                "NVIDIA_TESLA_P4" => Self::NvidiaTeslaP4,
882                "NVIDIA_TESLA_T4" => Self::NvidiaTeslaT4,
883                "NVIDIA_TESLA_A100" => Self::NvidiaTeslaA100,
884                "NVIDIA_A100_80GB" => Self::NvidiaA10080Gb,
885                "NVIDIA_L4" => Self::NvidiaL4,
886                "NVIDIA_TESLA_T4_VWS" => Self::NvidiaTeslaT4Vws,
887                "NVIDIA_TESLA_P100_VWS" => Self::NvidiaTeslaP100Vws,
888                "NVIDIA_TESLA_P4_VWS" => Self::NvidiaTeslaP4Vws,
889                _ => Self::UnknownValue(accelerator_type::UnknownValue(
890                    wkt::internal::UnknownEnumValue::String(value.to_string()),
891                )),
892            }
893        }
894    }
895
896    impl serde::ser::Serialize for AcceleratorType {
897        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
898        where
899            S: serde::Serializer,
900        {
901            match self {
902                Self::Unspecified => serializer.serialize_i32(0),
903                Self::NvidiaTeslaP100 => serializer.serialize_i32(2),
904                Self::NvidiaTeslaV100 => serializer.serialize_i32(3),
905                Self::NvidiaTeslaP4 => serializer.serialize_i32(4),
906                Self::NvidiaTeslaT4 => serializer.serialize_i32(5),
907                Self::NvidiaTeslaA100 => serializer.serialize_i32(11),
908                Self::NvidiaA10080Gb => serializer.serialize_i32(12),
909                Self::NvidiaL4 => serializer.serialize_i32(13),
910                Self::NvidiaTeslaT4Vws => serializer.serialize_i32(8),
911                Self::NvidiaTeslaP100Vws => serializer.serialize_i32(9),
912                Self::NvidiaTeslaP4Vws => serializer.serialize_i32(10),
913                Self::UnknownValue(u) => u.0.serialize(serializer),
914            }
915        }
916    }
917
918    impl<'de> serde::de::Deserialize<'de> for AcceleratorType {
919        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
920        where
921            D: serde::Deserializer<'de>,
922        {
923            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AcceleratorType>::new(
924                ".google.cloud.notebooks.v2.AcceleratorConfig.AcceleratorType",
925            ))
926        }
927    }
928}
929
930/// A set of Shielded Instance options.
931/// See [Images using supported Shielded VM
932/// features](https://cloud.google.com/compute/docs/instances/modifying-shielded-vm).
933/// Not all combinations are valid.
934#[derive(Clone, Default, PartialEq)]
935#[non_exhaustive]
936pub struct ShieldedInstanceConfig {
937    /// Optional. Defines whether the VM instance has Secure Boot enabled.
938    ///
939    /// Secure Boot helps ensure that the system only runs authentic software by
940    /// verifying the digital signature of all boot components, and halting the
941    /// boot process if signature verification fails. Disabled by default.
942    pub enable_secure_boot: bool,
943
944    /// Optional. Defines whether the VM instance has the vTPM enabled. Enabled by
945    /// default.
946    pub enable_vtpm: bool,
947
948    /// Optional. Defines whether the VM instance has integrity monitoring enabled.
949    ///
950    /// Enables monitoring and attestation of the boot integrity of the VM
951    /// instance. The attestation is performed against the integrity policy
952    /// baseline. This baseline is initially derived from the implicitly trusted
953    /// boot image when the VM instance is created. Enabled by default.
954    pub enable_integrity_monitoring: bool,
955
956    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
957}
958
959impl ShieldedInstanceConfig {
960    pub fn new() -> Self {
961        std::default::Default::default()
962    }
963
964    /// Sets the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
965    pub fn set_enable_secure_boot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
966        self.enable_secure_boot = v.into();
967        self
968    }
969
970    /// Sets the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
971    pub fn set_enable_vtpm<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
972        self.enable_vtpm = v.into();
973        self
974    }
975
976    /// Sets the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
977    pub fn set_enable_integrity_monitoring<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
978        self.enable_integrity_monitoring = v.into();
979        self
980    }
981}
982
983impl wkt::message::Message for ShieldedInstanceConfig {
984    fn typename() -> &'static str {
985        "type.googleapis.com/google.cloud.notebooks.v2.ShieldedInstanceConfig"
986    }
987}
988
989/// A GPU driver configuration
990#[derive(Clone, Default, PartialEq)]
991#[non_exhaustive]
992pub struct GPUDriverConfig {
993    /// Optional. Whether the end user authorizes Google Cloud to install GPU
994    /// driver on this VM instance. If this field is empty or set to false, the GPU
995    /// driver won't be installed. Only applicable to instances with GPUs.
996    pub enable_gpu_driver: bool,
997
998    /// Optional. Specify a custom Cloud Storage path where the GPU driver is
999    /// stored. If not specified, we'll automatically choose from official GPU
1000    /// drivers.
1001    pub custom_gpu_driver_path: std::string::String,
1002
1003    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1004}
1005
1006impl GPUDriverConfig {
1007    pub fn new() -> Self {
1008        std::default::Default::default()
1009    }
1010
1011    /// Sets the value of [enable_gpu_driver][crate::model::GPUDriverConfig::enable_gpu_driver].
1012    pub fn set_enable_gpu_driver<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1013        self.enable_gpu_driver = v.into();
1014        self
1015    }
1016
1017    /// Sets the value of [custom_gpu_driver_path][crate::model::GPUDriverConfig::custom_gpu_driver_path].
1018    pub fn set_custom_gpu_driver_path<T: std::convert::Into<std::string::String>>(
1019        mut self,
1020        v: T,
1021    ) -> Self {
1022        self.custom_gpu_driver_path = v.into();
1023        self
1024    }
1025}
1026
1027impl wkt::message::Message for GPUDriverConfig {
1028    fn typename() -> &'static str {
1029        "type.googleapis.com/google.cloud.notebooks.v2.GPUDriverConfig"
1030    }
1031}
1032
1033/// An instance-attached disk resource.
1034#[derive(Clone, Default, PartialEq)]
1035#[non_exhaustive]
1036pub struct DataDisk {
1037    /// Optional. The size of the disk in GB attached to this VM instance, up to a
1038    /// maximum of 64000 GB (64 TB). If not specified, this defaults to 100.
1039    pub disk_size_gb: i64,
1040
1041    /// Optional. Input only. Indicates the type of the disk.
1042    pub disk_type: crate::model::DiskType,
1043
1044    /// Optional. Input only. Disk encryption method used on the boot and data
1045    /// disks, defaults to GMEK.
1046    pub disk_encryption: crate::model::DiskEncryption,
1047
1048    /// Optional. Input only. The KMS key used to encrypt the disks, only
1049    /// applicable if disk_encryption is CMEK. Format:
1050    /// `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}`
1051    ///
1052    /// Learn more about using your own encryption keys.
1053    pub kms_key: std::string::String,
1054
1055    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1056}
1057
1058impl DataDisk {
1059    pub fn new() -> Self {
1060        std::default::Default::default()
1061    }
1062
1063    /// Sets the value of [disk_size_gb][crate::model::DataDisk::disk_size_gb].
1064    pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1065        self.disk_size_gb = v.into();
1066        self
1067    }
1068
1069    /// Sets the value of [disk_type][crate::model::DataDisk::disk_type].
1070    pub fn set_disk_type<T: std::convert::Into<crate::model::DiskType>>(mut self, v: T) -> Self {
1071        self.disk_type = v.into();
1072        self
1073    }
1074
1075    /// Sets the value of [disk_encryption][crate::model::DataDisk::disk_encryption].
1076    pub fn set_disk_encryption<T: std::convert::Into<crate::model::DiskEncryption>>(
1077        mut self,
1078        v: T,
1079    ) -> Self {
1080        self.disk_encryption = v.into();
1081        self
1082    }
1083
1084    /// Sets the value of [kms_key][crate::model::DataDisk::kms_key].
1085    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1086        self.kms_key = v.into();
1087        self
1088    }
1089}
1090
1091impl wkt::message::Message for DataDisk {
1092    fn typename() -> &'static str {
1093        "type.googleapis.com/google.cloud.notebooks.v2.DataDisk"
1094    }
1095}
1096
1097/// The definition of a boot disk.
1098#[derive(Clone, Default, PartialEq)]
1099#[non_exhaustive]
1100pub struct BootDisk {
1101    /// Optional. The size of the boot disk in GB attached to this instance, up to
1102    /// a maximum of 64000 GB (64 TB). If not specified, this defaults to the
1103    /// recommended value of 150GB.
1104    pub disk_size_gb: i64,
1105
1106    /// Optional. Indicates the type of the disk.
1107    pub disk_type: crate::model::DiskType,
1108
1109    /// Optional. Input only. Disk encryption method used on the boot and data
1110    /// disks, defaults to GMEK.
1111    pub disk_encryption: crate::model::DiskEncryption,
1112
1113    /// Optional. Input only. The KMS key used to encrypt the disks, only
1114    /// applicable if disk_encryption is CMEK. Format:
1115    /// `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}`
1116    ///
1117    /// Learn more about using your own encryption keys.
1118    pub kms_key: std::string::String,
1119
1120    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1121}
1122
1123impl BootDisk {
1124    pub fn new() -> Self {
1125        std::default::Default::default()
1126    }
1127
1128    /// Sets the value of [disk_size_gb][crate::model::BootDisk::disk_size_gb].
1129    pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1130        self.disk_size_gb = v.into();
1131        self
1132    }
1133
1134    /// Sets the value of [disk_type][crate::model::BootDisk::disk_type].
1135    pub fn set_disk_type<T: std::convert::Into<crate::model::DiskType>>(mut self, v: T) -> Self {
1136        self.disk_type = v.into();
1137        self
1138    }
1139
1140    /// Sets the value of [disk_encryption][crate::model::BootDisk::disk_encryption].
1141    pub fn set_disk_encryption<T: std::convert::Into<crate::model::DiskEncryption>>(
1142        mut self,
1143        v: T,
1144    ) -> Self {
1145        self.disk_encryption = v.into();
1146        self
1147    }
1148
1149    /// Sets the value of [kms_key][crate::model::BootDisk::kms_key].
1150    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1151        self.kms_key = v.into();
1152        self
1153    }
1154}
1155
1156impl wkt::message::Message for BootDisk {
1157    fn typename() -> &'static str {
1158        "type.googleapis.com/google.cloud.notebooks.v2.BootDisk"
1159    }
1160}
1161
1162/// A service account that acts as an identity.
1163#[derive(Clone, Default, PartialEq)]
1164#[non_exhaustive]
1165pub struct ServiceAccount {
1166    /// Optional. Email address of the service account.
1167    pub email: std::string::String,
1168
1169    /// Output only. The list of scopes to be made available for this service
1170    /// account. Set by the CLH to <https://www.googleapis.com/auth/cloud-platform>
1171    pub scopes: std::vec::Vec<std::string::String>,
1172
1173    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1174}
1175
1176impl ServiceAccount {
1177    pub fn new() -> Self {
1178        std::default::Default::default()
1179    }
1180
1181    /// Sets the value of [email][crate::model::ServiceAccount::email].
1182    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1183        self.email = v.into();
1184        self
1185    }
1186
1187    /// Sets the value of [scopes][crate::model::ServiceAccount::scopes].
1188    pub fn set_scopes<T, V>(mut self, v: T) -> Self
1189    where
1190        T: std::iter::IntoIterator<Item = V>,
1191        V: std::convert::Into<std::string::String>,
1192    {
1193        use std::iter::Iterator;
1194        self.scopes = v.into_iter().map(|i| i.into()).collect();
1195        self
1196    }
1197}
1198
1199impl wkt::message::Message for ServiceAccount {
1200    fn typename() -> &'static str {
1201        "type.googleapis.com/google.cloud.notebooks.v2.ServiceAccount"
1202    }
1203}
1204
1205/// The definition of how to configure a VM instance outside of Resources and
1206/// Identity.
1207#[derive(Clone, Default, PartialEq)]
1208#[non_exhaustive]
1209pub struct GceSetup {
1210    /// Optional. The machine type of the VM instance.
1211    /// <https://cloud.google.com/compute/docs/machine-resource>
1212    pub machine_type: std::string::String,
1213
1214    /// Optional. The hardware accelerators used on this instance. If you use
1215    /// accelerators, make sure that your configuration has
1216    /// [enough vCPUs and memory to support the `machine_type` you have
1217    /// selected](https://cloud.google.com/compute/docs/gpus/#gpus-list).
1218    /// Currently supports only one accelerator configuration.
1219    pub accelerator_configs: std::vec::Vec<crate::model::AcceleratorConfig>,
1220
1221    /// Optional. The service account that serves as an identity for the VM
1222    /// instance. Currently supports only one service account.
1223    pub service_accounts: std::vec::Vec<crate::model::ServiceAccount>,
1224
1225    /// Optional. The boot disk for the VM.
1226    pub boot_disk: std::option::Option<crate::model::BootDisk>,
1227
1228    /// Optional. Data disks attached to the VM instance.
1229    /// Currently supports only one data disk.
1230    pub data_disks: std::vec::Vec<crate::model::DataDisk>,
1231
1232    /// Optional. Shielded VM configuration.
1233    /// [Images using supported Shielded VM
1234    /// features](https://cloud.google.com/compute/docs/instances/modifying-shielded-vm).
1235    pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
1236
1237    /// Optional. The network interfaces for the VM.
1238    /// Supports only one interface.
1239    pub network_interfaces: std::vec::Vec<crate::model::NetworkInterface>,
1240
1241    /// Optional. If true, no external IP will be assigned to this VM instance.
1242    pub disable_public_ip: bool,
1243
1244    /// Optional. The Compute Engine tags to add to runtime (see [Tagging
1245    /// instances](https://cloud.google.com/compute/docs/label-or-tag-resources#tags)).
1246    pub tags: std::vec::Vec<std::string::String>,
1247
1248    /// Optional. Custom metadata to apply to this instance.
1249    pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
1250
1251    /// Optional. Flag to enable ip forwarding or not, default false/off.
1252    /// <https://cloud.google.com/vpc/docs/using-routes#canipforward>
1253    pub enable_ip_forwarding: bool,
1254
1255    /// Optional. Configuration for GPU drivers.
1256    pub gpu_driver_config: std::option::Option<crate::model::GPUDriverConfig>,
1257
1258    /// Type of the image; can be one of VM image, or container image.
1259    pub image: std::option::Option<crate::model::gce_setup::Image>,
1260
1261    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1262}
1263
1264impl GceSetup {
1265    pub fn new() -> Self {
1266        std::default::Default::default()
1267    }
1268
1269    /// Sets the value of [machine_type][crate::model::GceSetup::machine_type].
1270    pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1271        self.machine_type = v.into();
1272        self
1273    }
1274
1275    /// Sets the value of [accelerator_configs][crate::model::GceSetup::accelerator_configs].
1276    pub fn set_accelerator_configs<T, V>(mut self, v: T) -> Self
1277    where
1278        T: std::iter::IntoIterator<Item = V>,
1279        V: std::convert::Into<crate::model::AcceleratorConfig>,
1280    {
1281        use std::iter::Iterator;
1282        self.accelerator_configs = v.into_iter().map(|i| i.into()).collect();
1283        self
1284    }
1285
1286    /// Sets the value of [service_accounts][crate::model::GceSetup::service_accounts].
1287    pub fn set_service_accounts<T, V>(mut self, v: T) -> Self
1288    where
1289        T: std::iter::IntoIterator<Item = V>,
1290        V: std::convert::Into<crate::model::ServiceAccount>,
1291    {
1292        use std::iter::Iterator;
1293        self.service_accounts = v.into_iter().map(|i| i.into()).collect();
1294        self
1295    }
1296
1297    /// Sets the value of [boot_disk][crate::model::GceSetup::boot_disk].
1298    pub fn set_boot_disk<T>(mut self, v: T) -> Self
1299    where
1300        T: std::convert::Into<crate::model::BootDisk>,
1301    {
1302        self.boot_disk = std::option::Option::Some(v.into());
1303        self
1304    }
1305
1306    /// Sets or clears the value of [boot_disk][crate::model::GceSetup::boot_disk].
1307    pub fn set_or_clear_boot_disk<T>(mut self, v: std::option::Option<T>) -> Self
1308    where
1309        T: std::convert::Into<crate::model::BootDisk>,
1310    {
1311        self.boot_disk = v.map(|x| x.into());
1312        self
1313    }
1314
1315    /// Sets the value of [data_disks][crate::model::GceSetup::data_disks].
1316    pub fn set_data_disks<T, V>(mut self, v: T) -> Self
1317    where
1318        T: std::iter::IntoIterator<Item = V>,
1319        V: std::convert::Into<crate::model::DataDisk>,
1320    {
1321        use std::iter::Iterator;
1322        self.data_disks = v.into_iter().map(|i| i.into()).collect();
1323        self
1324    }
1325
1326    /// Sets the value of [shielded_instance_config][crate::model::GceSetup::shielded_instance_config].
1327    pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
1328    where
1329        T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
1330    {
1331        self.shielded_instance_config = std::option::Option::Some(v.into());
1332        self
1333    }
1334
1335    /// Sets or clears the value of [shielded_instance_config][crate::model::GceSetup::shielded_instance_config].
1336    pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
1337    where
1338        T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
1339    {
1340        self.shielded_instance_config = v.map(|x| x.into());
1341        self
1342    }
1343
1344    /// Sets the value of [network_interfaces][crate::model::GceSetup::network_interfaces].
1345    pub fn set_network_interfaces<T, V>(mut self, v: T) -> Self
1346    where
1347        T: std::iter::IntoIterator<Item = V>,
1348        V: std::convert::Into<crate::model::NetworkInterface>,
1349    {
1350        use std::iter::Iterator;
1351        self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
1352        self
1353    }
1354
1355    /// Sets the value of [disable_public_ip][crate::model::GceSetup::disable_public_ip].
1356    pub fn set_disable_public_ip<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1357        self.disable_public_ip = v.into();
1358        self
1359    }
1360
1361    /// Sets the value of [tags][crate::model::GceSetup::tags].
1362    pub fn set_tags<T, V>(mut self, v: T) -> Self
1363    where
1364        T: std::iter::IntoIterator<Item = V>,
1365        V: std::convert::Into<std::string::String>,
1366    {
1367        use std::iter::Iterator;
1368        self.tags = v.into_iter().map(|i| i.into()).collect();
1369        self
1370    }
1371
1372    /// Sets the value of [metadata][crate::model::GceSetup::metadata].
1373    pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
1374    where
1375        T: std::iter::IntoIterator<Item = (K, V)>,
1376        K: std::convert::Into<std::string::String>,
1377        V: std::convert::Into<std::string::String>,
1378    {
1379        use std::iter::Iterator;
1380        self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1381        self
1382    }
1383
1384    /// Sets the value of [enable_ip_forwarding][crate::model::GceSetup::enable_ip_forwarding].
1385    pub fn set_enable_ip_forwarding<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1386        self.enable_ip_forwarding = v.into();
1387        self
1388    }
1389
1390    /// Sets the value of [gpu_driver_config][crate::model::GceSetup::gpu_driver_config].
1391    pub fn set_gpu_driver_config<T>(mut self, v: T) -> Self
1392    where
1393        T: std::convert::Into<crate::model::GPUDriverConfig>,
1394    {
1395        self.gpu_driver_config = std::option::Option::Some(v.into());
1396        self
1397    }
1398
1399    /// Sets or clears the value of [gpu_driver_config][crate::model::GceSetup::gpu_driver_config].
1400    pub fn set_or_clear_gpu_driver_config<T>(mut self, v: std::option::Option<T>) -> Self
1401    where
1402        T: std::convert::Into<crate::model::GPUDriverConfig>,
1403    {
1404        self.gpu_driver_config = v.map(|x| x.into());
1405        self
1406    }
1407
1408    /// Sets the value of [image][crate::model::GceSetup::image].
1409    ///
1410    /// Note that all the setters affecting `image` are mutually
1411    /// exclusive.
1412    pub fn set_image<T: std::convert::Into<std::option::Option<crate::model::gce_setup::Image>>>(
1413        mut self,
1414        v: T,
1415    ) -> Self {
1416        self.image = v.into();
1417        self
1418    }
1419
1420    /// The value of [image][crate::model::GceSetup::image]
1421    /// if it holds a `VmImage`, `None` if the field is not set or
1422    /// holds a different branch.
1423    pub fn vm_image(&self) -> std::option::Option<&std::boxed::Box<crate::model::VmImage>> {
1424        #[allow(unreachable_patterns)]
1425        self.image.as_ref().and_then(|v| match v {
1426            crate::model::gce_setup::Image::VmImage(v) => std::option::Option::Some(v),
1427            _ => std::option::Option::None,
1428        })
1429    }
1430
1431    /// Sets the value of [image][crate::model::GceSetup::image]
1432    /// to hold a `VmImage`.
1433    ///
1434    /// Note that all the setters affecting `image` are
1435    /// mutually exclusive.
1436    pub fn set_vm_image<T: std::convert::Into<std::boxed::Box<crate::model::VmImage>>>(
1437        mut self,
1438        v: T,
1439    ) -> Self {
1440        self.image = std::option::Option::Some(crate::model::gce_setup::Image::VmImage(v.into()));
1441        self
1442    }
1443
1444    /// The value of [image][crate::model::GceSetup::image]
1445    /// if it holds a `ContainerImage`, `None` if the field is not set or
1446    /// holds a different branch.
1447    pub fn container_image(
1448        &self,
1449    ) -> std::option::Option<&std::boxed::Box<crate::model::ContainerImage>> {
1450        #[allow(unreachable_patterns)]
1451        self.image.as_ref().and_then(|v| match v {
1452            crate::model::gce_setup::Image::ContainerImage(v) => std::option::Option::Some(v),
1453            _ => std::option::Option::None,
1454        })
1455    }
1456
1457    /// Sets the value of [image][crate::model::GceSetup::image]
1458    /// to hold a `ContainerImage`.
1459    ///
1460    /// Note that all the setters affecting `image` are
1461    /// mutually exclusive.
1462    pub fn set_container_image<
1463        T: std::convert::Into<std::boxed::Box<crate::model::ContainerImage>>,
1464    >(
1465        mut self,
1466        v: T,
1467    ) -> Self {
1468        self.image =
1469            std::option::Option::Some(crate::model::gce_setup::Image::ContainerImage(v.into()));
1470        self
1471    }
1472}
1473
1474impl wkt::message::Message for GceSetup {
1475    fn typename() -> &'static str {
1476        "type.googleapis.com/google.cloud.notebooks.v2.GceSetup"
1477    }
1478}
1479
1480/// Defines additional types related to [GceSetup].
1481pub mod gce_setup {
1482    #[allow(unused_imports)]
1483    use super::*;
1484
1485    /// Type of the image; can be one of VM image, or container image.
1486    #[derive(Clone, Debug, PartialEq)]
1487    #[non_exhaustive]
1488    pub enum Image {
1489        /// Optional. Use a Compute Engine VM image to start the notebook instance.
1490        VmImage(std::boxed::Box<crate::model::VmImage>),
1491        /// Optional. Use a container image to start the notebook instance.
1492        ContainerImage(std::boxed::Box<crate::model::ContainerImage>),
1493    }
1494}
1495
1496/// The entry of VM image upgrade history.
1497#[derive(Clone, Default, PartialEq)]
1498#[non_exhaustive]
1499pub struct UpgradeHistoryEntry {
1500    /// Optional. The snapshot of the boot disk of this notebook instance before
1501    /// upgrade.
1502    pub snapshot: std::string::String,
1503
1504    /// Optional. The VM image before this instance upgrade.
1505    pub vm_image: std::string::String,
1506
1507    /// Optional. The container image before this instance upgrade.
1508    pub container_image: std::string::String,
1509
1510    /// Optional. The framework of this notebook instance.
1511    pub framework: std::string::String,
1512
1513    /// Optional. The version of the notebook instance before this upgrade.
1514    pub version: std::string::String,
1515
1516    /// Output only. The state of this instance upgrade history entry.
1517    pub state: crate::model::upgrade_history_entry::State,
1518
1519    /// Immutable. The time that this instance upgrade history entry is created.
1520    pub create_time: std::option::Option<wkt::Timestamp>,
1521
1522    /// Optional. Action. Rolloback or Upgrade.
1523    pub action: crate::model::upgrade_history_entry::Action,
1524
1525    /// Optional. Target VM Version, like m63.
1526    pub target_version: std::string::String,
1527
1528    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1529}
1530
1531impl UpgradeHistoryEntry {
1532    pub fn new() -> Self {
1533        std::default::Default::default()
1534    }
1535
1536    /// Sets the value of [snapshot][crate::model::UpgradeHistoryEntry::snapshot].
1537    pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1538        self.snapshot = v.into();
1539        self
1540    }
1541
1542    /// Sets the value of [vm_image][crate::model::UpgradeHistoryEntry::vm_image].
1543    pub fn set_vm_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1544        self.vm_image = v.into();
1545        self
1546    }
1547
1548    /// Sets the value of [container_image][crate::model::UpgradeHistoryEntry::container_image].
1549    pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1550        self.container_image = v.into();
1551        self
1552    }
1553
1554    /// Sets the value of [framework][crate::model::UpgradeHistoryEntry::framework].
1555    pub fn set_framework<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1556        self.framework = v.into();
1557        self
1558    }
1559
1560    /// Sets the value of [version][crate::model::UpgradeHistoryEntry::version].
1561    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1562        self.version = v.into();
1563        self
1564    }
1565
1566    /// Sets the value of [state][crate::model::UpgradeHistoryEntry::state].
1567    pub fn set_state<T: std::convert::Into<crate::model::upgrade_history_entry::State>>(
1568        mut self,
1569        v: T,
1570    ) -> Self {
1571        self.state = v.into();
1572        self
1573    }
1574
1575    /// Sets the value of [create_time][crate::model::UpgradeHistoryEntry::create_time].
1576    pub fn set_create_time<T>(mut self, v: T) -> Self
1577    where
1578        T: std::convert::Into<wkt::Timestamp>,
1579    {
1580        self.create_time = std::option::Option::Some(v.into());
1581        self
1582    }
1583
1584    /// Sets or clears the value of [create_time][crate::model::UpgradeHistoryEntry::create_time].
1585    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1586    where
1587        T: std::convert::Into<wkt::Timestamp>,
1588    {
1589        self.create_time = v.map(|x| x.into());
1590        self
1591    }
1592
1593    /// Sets the value of [action][crate::model::UpgradeHistoryEntry::action].
1594    pub fn set_action<T: std::convert::Into<crate::model::upgrade_history_entry::Action>>(
1595        mut self,
1596        v: T,
1597    ) -> Self {
1598        self.action = v.into();
1599        self
1600    }
1601
1602    /// Sets the value of [target_version][crate::model::UpgradeHistoryEntry::target_version].
1603    pub fn set_target_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1604        self.target_version = v.into();
1605        self
1606    }
1607}
1608
1609impl wkt::message::Message for UpgradeHistoryEntry {
1610    fn typename() -> &'static str {
1611        "type.googleapis.com/google.cloud.notebooks.v2.UpgradeHistoryEntry"
1612    }
1613}
1614
1615/// Defines additional types related to [UpgradeHistoryEntry].
1616pub mod upgrade_history_entry {
1617    #[allow(unused_imports)]
1618    use super::*;
1619
1620    /// The definition of the states of this upgrade history entry.
1621    ///
1622    /// # Working with unknown values
1623    ///
1624    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1625    /// additional enum variants at any time. Adding new variants is not considered
1626    /// a breaking change. Applications should write their code in anticipation of:
1627    ///
1628    /// - New values appearing in future releases of the client library, **and**
1629    /// - New values received dynamically, without application changes.
1630    ///
1631    /// Please consult the [Working with enums] section in the user guide for some
1632    /// guidelines.
1633    ///
1634    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1635    #[derive(Clone, Debug, PartialEq)]
1636    #[non_exhaustive]
1637    pub enum State {
1638        /// State is not specified.
1639        Unspecified,
1640        /// The instance upgrade is started.
1641        Started,
1642        /// The instance upgrade is succeeded.
1643        Succeeded,
1644        /// The instance upgrade is failed.
1645        Failed,
1646        /// If set, the enum was initialized with an unknown value.
1647        ///
1648        /// Applications can examine the value using [State::value] or
1649        /// [State::name].
1650        UnknownValue(state::UnknownValue),
1651    }
1652
1653    #[doc(hidden)]
1654    pub mod state {
1655        #[allow(unused_imports)]
1656        use super::*;
1657        #[derive(Clone, Debug, PartialEq)]
1658        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1659    }
1660
1661    impl State {
1662        /// Gets the enum value.
1663        ///
1664        /// Returns `None` if the enum contains an unknown value deserialized from
1665        /// the string representation of enums.
1666        pub fn value(&self) -> std::option::Option<i32> {
1667            match self {
1668                Self::Unspecified => std::option::Option::Some(0),
1669                Self::Started => std::option::Option::Some(1),
1670                Self::Succeeded => std::option::Option::Some(2),
1671                Self::Failed => std::option::Option::Some(3),
1672                Self::UnknownValue(u) => u.0.value(),
1673            }
1674        }
1675
1676        /// Gets the enum value as a string.
1677        ///
1678        /// Returns `None` if the enum contains an unknown value deserialized from
1679        /// the integer representation of enums.
1680        pub fn name(&self) -> std::option::Option<&str> {
1681            match self {
1682                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1683                Self::Started => std::option::Option::Some("STARTED"),
1684                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1685                Self::Failed => std::option::Option::Some("FAILED"),
1686                Self::UnknownValue(u) => u.0.name(),
1687            }
1688        }
1689    }
1690
1691    impl std::default::Default for State {
1692        fn default() -> Self {
1693            use std::convert::From;
1694            Self::from(0)
1695        }
1696    }
1697
1698    impl std::fmt::Display for State {
1699        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1700            wkt::internal::display_enum(f, self.name(), self.value())
1701        }
1702    }
1703
1704    impl std::convert::From<i32> for State {
1705        fn from(value: i32) -> Self {
1706            match value {
1707                0 => Self::Unspecified,
1708                1 => Self::Started,
1709                2 => Self::Succeeded,
1710                3 => Self::Failed,
1711                _ => Self::UnknownValue(state::UnknownValue(
1712                    wkt::internal::UnknownEnumValue::Integer(value),
1713                )),
1714            }
1715        }
1716    }
1717
1718    impl std::convert::From<&str> for State {
1719        fn from(value: &str) -> Self {
1720            use std::string::ToString;
1721            match value {
1722                "STATE_UNSPECIFIED" => Self::Unspecified,
1723                "STARTED" => Self::Started,
1724                "SUCCEEDED" => Self::Succeeded,
1725                "FAILED" => Self::Failed,
1726                _ => Self::UnknownValue(state::UnknownValue(
1727                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1728                )),
1729            }
1730        }
1731    }
1732
1733    impl serde::ser::Serialize for State {
1734        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1735        where
1736            S: serde::Serializer,
1737        {
1738            match self {
1739                Self::Unspecified => serializer.serialize_i32(0),
1740                Self::Started => serializer.serialize_i32(1),
1741                Self::Succeeded => serializer.serialize_i32(2),
1742                Self::Failed => serializer.serialize_i32(3),
1743                Self::UnknownValue(u) => u.0.serialize(serializer),
1744            }
1745        }
1746    }
1747
1748    impl<'de> serde::de::Deserialize<'de> for State {
1749        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1750        where
1751            D: serde::Deserializer<'de>,
1752        {
1753            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1754                ".google.cloud.notebooks.v2.UpgradeHistoryEntry.State",
1755            ))
1756        }
1757    }
1758
1759    /// The definition of operations of this upgrade history entry.
1760    ///
1761    /// # Working with unknown values
1762    ///
1763    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1764    /// additional enum variants at any time. Adding new variants is not considered
1765    /// a breaking change. Applications should write their code in anticipation of:
1766    ///
1767    /// - New values appearing in future releases of the client library, **and**
1768    /// - New values received dynamically, without application changes.
1769    ///
1770    /// Please consult the [Working with enums] section in the user guide for some
1771    /// guidelines.
1772    ///
1773    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1774    #[derive(Clone, Debug, PartialEq)]
1775    #[non_exhaustive]
1776    pub enum Action {
1777        /// Operation is not specified.
1778        Unspecified,
1779        /// Upgrade.
1780        Upgrade,
1781        /// Rollback.
1782        Rollback,
1783        /// If set, the enum was initialized with an unknown value.
1784        ///
1785        /// Applications can examine the value using [Action::value] or
1786        /// [Action::name].
1787        UnknownValue(action::UnknownValue),
1788    }
1789
1790    #[doc(hidden)]
1791    pub mod action {
1792        #[allow(unused_imports)]
1793        use super::*;
1794        #[derive(Clone, Debug, PartialEq)]
1795        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1796    }
1797
1798    impl Action {
1799        /// Gets the enum value.
1800        ///
1801        /// Returns `None` if the enum contains an unknown value deserialized from
1802        /// the string representation of enums.
1803        pub fn value(&self) -> std::option::Option<i32> {
1804            match self {
1805                Self::Unspecified => std::option::Option::Some(0),
1806                Self::Upgrade => std::option::Option::Some(1),
1807                Self::Rollback => std::option::Option::Some(2),
1808                Self::UnknownValue(u) => u.0.value(),
1809            }
1810        }
1811
1812        /// Gets the enum value as a string.
1813        ///
1814        /// Returns `None` if the enum contains an unknown value deserialized from
1815        /// the integer representation of enums.
1816        pub fn name(&self) -> std::option::Option<&str> {
1817            match self {
1818                Self::Unspecified => std::option::Option::Some("ACTION_UNSPECIFIED"),
1819                Self::Upgrade => std::option::Option::Some("UPGRADE"),
1820                Self::Rollback => std::option::Option::Some("ROLLBACK"),
1821                Self::UnknownValue(u) => u.0.name(),
1822            }
1823        }
1824    }
1825
1826    impl std::default::Default for Action {
1827        fn default() -> Self {
1828            use std::convert::From;
1829            Self::from(0)
1830        }
1831    }
1832
1833    impl std::fmt::Display for Action {
1834        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1835            wkt::internal::display_enum(f, self.name(), self.value())
1836        }
1837    }
1838
1839    impl std::convert::From<i32> for Action {
1840        fn from(value: i32) -> Self {
1841            match value {
1842                0 => Self::Unspecified,
1843                1 => Self::Upgrade,
1844                2 => Self::Rollback,
1845                _ => Self::UnknownValue(action::UnknownValue(
1846                    wkt::internal::UnknownEnumValue::Integer(value),
1847                )),
1848            }
1849        }
1850    }
1851
1852    impl std::convert::From<&str> for Action {
1853        fn from(value: &str) -> Self {
1854            use std::string::ToString;
1855            match value {
1856                "ACTION_UNSPECIFIED" => Self::Unspecified,
1857                "UPGRADE" => Self::Upgrade,
1858                "ROLLBACK" => Self::Rollback,
1859                _ => Self::UnknownValue(action::UnknownValue(
1860                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1861                )),
1862            }
1863        }
1864    }
1865
1866    impl serde::ser::Serialize for Action {
1867        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1868        where
1869            S: serde::Serializer,
1870        {
1871            match self {
1872                Self::Unspecified => serializer.serialize_i32(0),
1873                Self::Upgrade => serializer.serialize_i32(1),
1874                Self::Rollback => serializer.serialize_i32(2),
1875                Self::UnknownValue(u) => u.0.serialize(serializer),
1876            }
1877        }
1878    }
1879
1880    impl<'de> serde::de::Deserialize<'de> for Action {
1881        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1882        where
1883            D: serde::Deserializer<'de>,
1884        {
1885            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Action>::new(
1886                ".google.cloud.notebooks.v2.UpgradeHistoryEntry.Action",
1887            ))
1888        }
1889    }
1890}
1891
1892/// The definition of a notebook instance.
1893#[derive(Clone, Default, PartialEq)]
1894#[non_exhaustive]
1895pub struct Instance {
1896    /// Output only. The name of this notebook instance. Format:
1897    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
1898    pub name: std::string::String,
1899
1900    /// Output only. The proxy endpoint that is used to access the Jupyter
1901    /// notebook.
1902    pub proxy_uri: std::string::String,
1903
1904    /// Optional. Input only. The owner of this instance after creation. Format:
1905    /// `alias@example.com`
1906    ///
1907    /// Currently supports one owner only. If not specified, all of the service
1908    /// account users of your VM instance's service account can use
1909    /// the instance.
1910    pub instance_owners: std::vec::Vec<std::string::String>,
1911
1912    /// Output only. Email address of entity that sent original CreateInstance
1913    /// request.
1914    pub creator: std::string::String,
1915
1916    /// Output only. The state of this instance.
1917    pub state: crate::model::State,
1918
1919    /// Output only. The upgrade history of this instance.
1920    pub upgrade_history: std::vec::Vec<crate::model::UpgradeHistoryEntry>,
1921
1922    /// Output only. Unique ID of the resource.
1923    pub id: std::string::String,
1924
1925    /// Output only. Instance health_state.
1926    pub health_state: crate::model::HealthState,
1927
1928    /// Output only. Additional information about instance health.
1929    /// Example:
1930    ///
1931    /// ```norust
1932    /// healthInfo": {
1933    ///   "docker_proxy_agent_status": "1",
1934    ///   "docker_status": "1",
1935    ///   "jupyterlab_api_status": "-1",
1936    ///   "jupyterlab_status": "-1",
1937    ///   "updated": "2020-10-18 09:40:03.573409"
1938    /// }
1939    /// ```
1940    pub health_info: std::collections::HashMap<std::string::String, std::string::String>,
1941
1942    /// Output only. Instance creation time.
1943    pub create_time: std::option::Option<wkt::Timestamp>,
1944
1945    /// Output only. Instance update time.
1946    pub update_time: std::option::Option<wkt::Timestamp>,
1947
1948    /// Optional. If true, the notebook instance will not register with the proxy.
1949    pub disable_proxy_access: bool,
1950
1951    /// Optional. Labels to apply to this instance.
1952    /// These can be later modified by the UpdateInstance method.
1953    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1954
1955    /// Setup for the Notebook instance.
1956    pub infrastructure: std::option::Option<crate::model::instance::Infrastructure>,
1957
1958    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1959}
1960
1961impl Instance {
1962    pub fn new() -> Self {
1963        std::default::Default::default()
1964    }
1965
1966    /// Sets the value of [name][crate::model::Instance::name].
1967    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1968        self.name = v.into();
1969        self
1970    }
1971
1972    /// Sets the value of [proxy_uri][crate::model::Instance::proxy_uri].
1973    pub fn set_proxy_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1974        self.proxy_uri = v.into();
1975        self
1976    }
1977
1978    /// Sets the value of [instance_owners][crate::model::Instance::instance_owners].
1979    pub fn set_instance_owners<T, V>(mut self, v: T) -> Self
1980    where
1981        T: std::iter::IntoIterator<Item = V>,
1982        V: std::convert::Into<std::string::String>,
1983    {
1984        use std::iter::Iterator;
1985        self.instance_owners = v.into_iter().map(|i| i.into()).collect();
1986        self
1987    }
1988
1989    /// Sets the value of [creator][crate::model::Instance::creator].
1990    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1991        self.creator = v.into();
1992        self
1993    }
1994
1995    /// Sets the value of [state][crate::model::Instance::state].
1996    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
1997        self.state = v.into();
1998        self
1999    }
2000
2001    /// Sets the value of [upgrade_history][crate::model::Instance::upgrade_history].
2002    pub fn set_upgrade_history<T, V>(mut self, v: T) -> Self
2003    where
2004        T: std::iter::IntoIterator<Item = V>,
2005        V: std::convert::Into<crate::model::UpgradeHistoryEntry>,
2006    {
2007        use std::iter::Iterator;
2008        self.upgrade_history = v.into_iter().map(|i| i.into()).collect();
2009        self
2010    }
2011
2012    /// Sets the value of [id][crate::model::Instance::id].
2013    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2014        self.id = v.into();
2015        self
2016    }
2017
2018    /// Sets the value of [health_state][crate::model::Instance::health_state].
2019    pub fn set_health_state<T: std::convert::Into<crate::model::HealthState>>(
2020        mut self,
2021        v: T,
2022    ) -> Self {
2023        self.health_state = v.into();
2024        self
2025    }
2026
2027    /// Sets the value of [health_info][crate::model::Instance::health_info].
2028    pub fn set_health_info<T, K, V>(mut self, v: T) -> Self
2029    where
2030        T: std::iter::IntoIterator<Item = (K, V)>,
2031        K: std::convert::Into<std::string::String>,
2032        V: std::convert::Into<std::string::String>,
2033    {
2034        use std::iter::Iterator;
2035        self.health_info = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2036        self
2037    }
2038
2039    /// Sets the value of [create_time][crate::model::Instance::create_time].
2040    pub fn set_create_time<T>(mut self, v: T) -> Self
2041    where
2042        T: std::convert::Into<wkt::Timestamp>,
2043    {
2044        self.create_time = std::option::Option::Some(v.into());
2045        self
2046    }
2047
2048    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
2049    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2050    where
2051        T: std::convert::Into<wkt::Timestamp>,
2052    {
2053        self.create_time = v.map(|x| x.into());
2054        self
2055    }
2056
2057    /// Sets the value of [update_time][crate::model::Instance::update_time].
2058    pub fn set_update_time<T>(mut self, v: T) -> Self
2059    where
2060        T: std::convert::Into<wkt::Timestamp>,
2061    {
2062        self.update_time = std::option::Option::Some(v.into());
2063        self
2064    }
2065
2066    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
2067    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2068    where
2069        T: std::convert::Into<wkt::Timestamp>,
2070    {
2071        self.update_time = v.map(|x| x.into());
2072        self
2073    }
2074
2075    /// Sets the value of [disable_proxy_access][crate::model::Instance::disable_proxy_access].
2076    pub fn set_disable_proxy_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2077        self.disable_proxy_access = v.into();
2078        self
2079    }
2080
2081    /// Sets the value of [labels][crate::model::Instance::labels].
2082    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2083    where
2084        T: std::iter::IntoIterator<Item = (K, V)>,
2085        K: std::convert::Into<std::string::String>,
2086        V: std::convert::Into<std::string::String>,
2087    {
2088        use std::iter::Iterator;
2089        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2090        self
2091    }
2092
2093    /// Sets the value of [infrastructure][crate::model::Instance::infrastructure].
2094    ///
2095    /// Note that all the setters affecting `infrastructure` are mutually
2096    /// exclusive.
2097    pub fn set_infrastructure<
2098        T: std::convert::Into<std::option::Option<crate::model::instance::Infrastructure>>,
2099    >(
2100        mut self,
2101        v: T,
2102    ) -> Self {
2103        self.infrastructure = v.into();
2104        self
2105    }
2106
2107    /// The value of [infrastructure][crate::model::Instance::infrastructure]
2108    /// if it holds a `GceSetup`, `None` if the field is not set or
2109    /// holds a different branch.
2110    pub fn gce_setup(&self) -> std::option::Option<&std::boxed::Box<crate::model::GceSetup>> {
2111        #[allow(unreachable_patterns)]
2112        self.infrastructure.as_ref().and_then(|v| match v {
2113            crate::model::instance::Infrastructure::GceSetup(v) => std::option::Option::Some(v),
2114            _ => std::option::Option::None,
2115        })
2116    }
2117
2118    /// Sets the value of [infrastructure][crate::model::Instance::infrastructure]
2119    /// to hold a `GceSetup`.
2120    ///
2121    /// Note that all the setters affecting `infrastructure` are
2122    /// mutually exclusive.
2123    pub fn set_gce_setup<T: std::convert::Into<std::boxed::Box<crate::model::GceSetup>>>(
2124        mut self,
2125        v: T,
2126    ) -> Self {
2127        self.infrastructure =
2128            std::option::Option::Some(crate::model::instance::Infrastructure::GceSetup(v.into()));
2129        self
2130    }
2131}
2132
2133impl wkt::message::Message for Instance {
2134    fn typename() -> &'static str {
2135        "type.googleapis.com/google.cloud.notebooks.v2.Instance"
2136    }
2137}
2138
2139/// Defines additional types related to [Instance].
2140pub mod instance {
2141    #[allow(unused_imports)]
2142    use super::*;
2143
2144    /// Setup for the Notebook instance.
2145    #[derive(Clone, Debug, PartialEq)]
2146    #[non_exhaustive]
2147    pub enum Infrastructure {
2148        /// Optional. Compute Engine setup for the notebook. Uses notebook-defined
2149        /// fields.
2150        GceSetup(std::boxed::Box<crate::model::GceSetup>),
2151    }
2152}
2153
2154/// Represents the metadata of the long-running operation.
2155#[derive(Clone, Default, PartialEq)]
2156#[non_exhaustive]
2157pub struct OperationMetadata {
2158    /// The time the operation was created.
2159    pub create_time: std::option::Option<wkt::Timestamp>,
2160
2161    /// The time the operation finished running.
2162    pub end_time: std::option::Option<wkt::Timestamp>,
2163
2164    /// Server-defined resource path for the target of the operation.
2165    pub target: std::string::String,
2166
2167    /// Name of the verb executed by the operation.
2168    pub verb: std::string::String,
2169
2170    /// Human-readable status of the operation, if any.
2171    pub status_message: std::string::String,
2172
2173    /// Identifies whether the user has requested cancellation
2174    /// of the operation. Operations that have successfully been cancelled
2175    /// have [Operation.error][] value with a
2176    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
2177    /// `Code.CANCELLED`.
2178    ///
2179    /// [google.rpc.Status.code]: rpc::model::Status::code
2180    pub requested_cancellation: bool,
2181
2182    /// API version used to start the operation.
2183    pub api_version: std::string::String,
2184
2185    /// API endpoint name of this operation.
2186    pub endpoint: std::string::String,
2187
2188    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2189}
2190
2191impl OperationMetadata {
2192    pub fn new() -> Self {
2193        std::default::Default::default()
2194    }
2195
2196    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
2197    pub fn set_create_time<T>(mut self, v: T) -> Self
2198    where
2199        T: std::convert::Into<wkt::Timestamp>,
2200    {
2201        self.create_time = std::option::Option::Some(v.into());
2202        self
2203    }
2204
2205    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
2206    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2207    where
2208        T: std::convert::Into<wkt::Timestamp>,
2209    {
2210        self.create_time = v.map(|x| x.into());
2211        self
2212    }
2213
2214    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
2215    pub fn set_end_time<T>(mut self, v: T) -> Self
2216    where
2217        T: std::convert::Into<wkt::Timestamp>,
2218    {
2219        self.end_time = std::option::Option::Some(v.into());
2220        self
2221    }
2222
2223    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
2224    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2225    where
2226        T: std::convert::Into<wkt::Timestamp>,
2227    {
2228        self.end_time = v.map(|x| x.into());
2229        self
2230    }
2231
2232    /// Sets the value of [target][crate::model::OperationMetadata::target].
2233    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2234        self.target = v.into();
2235        self
2236    }
2237
2238    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
2239    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2240        self.verb = v.into();
2241        self
2242    }
2243
2244    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
2245    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2246        self.status_message = v.into();
2247        self
2248    }
2249
2250    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
2251    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2252        self.requested_cancellation = v.into();
2253        self
2254    }
2255
2256    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
2257    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2258        self.api_version = v.into();
2259        self
2260    }
2261
2262    /// Sets the value of [endpoint][crate::model::OperationMetadata::endpoint].
2263    pub fn set_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2264        self.endpoint = v.into();
2265        self
2266    }
2267}
2268
2269impl wkt::message::Message for OperationMetadata {
2270    fn typename() -> &'static str {
2271        "type.googleapis.com/google.cloud.notebooks.v2.OperationMetadata"
2272    }
2273}
2274
2275/// Request for listing notebook instances.
2276#[derive(Clone, Default, PartialEq)]
2277#[non_exhaustive]
2278pub struct ListInstancesRequest {
2279    /// Required. Format:
2280    /// `parent=projects/{project_id}/locations/{location}`
2281    pub parent: std::string::String,
2282
2283    /// Optional. Maximum return size of the list call.
2284    pub page_size: i32,
2285
2286    /// Optional. A previous returned page token that can be used to continue
2287    /// listing from the last result.
2288    pub page_token: std::string::String,
2289
2290    /// Optional. Sort results. Supported values are "name", "name desc" or ""
2291    /// (unsorted).
2292    pub order_by: std::string::String,
2293
2294    /// Optional. List filter.
2295    pub filter: std::string::String,
2296
2297    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2298}
2299
2300impl ListInstancesRequest {
2301    pub fn new() -> Self {
2302        std::default::Default::default()
2303    }
2304
2305    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
2306    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2307        self.parent = v.into();
2308        self
2309    }
2310
2311    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
2312    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2313        self.page_size = v.into();
2314        self
2315    }
2316
2317    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
2318    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2319        self.page_token = v.into();
2320        self
2321    }
2322
2323    /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
2324    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2325        self.order_by = v.into();
2326        self
2327    }
2328
2329    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
2330    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2331        self.filter = v.into();
2332        self
2333    }
2334}
2335
2336impl wkt::message::Message for ListInstancesRequest {
2337    fn typename() -> &'static str {
2338        "type.googleapis.com/google.cloud.notebooks.v2.ListInstancesRequest"
2339    }
2340}
2341
2342/// Response for listing notebook instances.
2343#[derive(Clone, Default, PartialEq)]
2344#[non_exhaustive]
2345pub struct ListInstancesResponse {
2346    /// A list of returned instances.
2347    pub instances: std::vec::Vec<crate::model::Instance>,
2348
2349    /// Page token that can be used to continue listing from the last result in the
2350    /// next list call.
2351    pub next_page_token: std::string::String,
2352
2353    /// Locations that could not be reached. For example,
2354    /// ['us-west1-a', 'us-central1-b'].
2355    /// A ListInstancesResponse will only contain either instances or unreachables,
2356    pub unreachable: std::vec::Vec<std::string::String>,
2357
2358    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2359}
2360
2361impl ListInstancesResponse {
2362    pub fn new() -> Self {
2363        std::default::Default::default()
2364    }
2365
2366    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
2367    pub fn set_instances<T, V>(mut self, v: T) -> Self
2368    where
2369        T: std::iter::IntoIterator<Item = V>,
2370        V: std::convert::Into<crate::model::Instance>,
2371    {
2372        use std::iter::Iterator;
2373        self.instances = v.into_iter().map(|i| i.into()).collect();
2374        self
2375    }
2376
2377    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
2378    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2379        self.next_page_token = v.into();
2380        self
2381    }
2382
2383    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
2384    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2385    where
2386        T: std::iter::IntoIterator<Item = V>,
2387        V: std::convert::Into<std::string::String>,
2388    {
2389        use std::iter::Iterator;
2390        self.unreachable = v.into_iter().map(|i| i.into()).collect();
2391        self
2392    }
2393}
2394
2395impl wkt::message::Message for ListInstancesResponse {
2396    fn typename() -> &'static str {
2397        "type.googleapis.com/google.cloud.notebooks.v2.ListInstancesResponse"
2398    }
2399}
2400
2401#[doc(hidden)]
2402impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
2403    type PageItem = crate::model::Instance;
2404
2405    fn items(self) -> std::vec::Vec<Self::PageItem> {
2406        self.instances
2407    }
2408
2409    fn next_page_token(&self) -> std::string::String {
2410        use std::clone::Clone;
2411        self.next_page_token.clone()
2412    }
2413}
2414
2415/// Request for getting a notebook instance.
2416#[derive(Clone, Default, PartialEq)]
2417#[non_exhaustive]
2418pub struct GetInstanceRequest {
2419    /// Required. Format:
2420    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
2421    pub name: std::string::String,
2422
2423    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2424}
2425
2426impl GetInstanceRequest {
2427    pub fn new() -> Self {
2428        std::default::Default::default()
2429    }
2430
2431    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
2432    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2433        self.name = v.into();
2434        self
2435    }
2436}
2437
2438impl wkt::message::Message for GetInstanceRequest {
2439    fn typename() -> &'static str {
2440        "type.googleapis.com/google.cloud.notebooks.v2.GetInstanceRequest"
2441    }
2442}
2443
2444/// Request for creating a notebook instance.
2445#[derive(Clone, Default, PartialEq)]
2446#[non_exhaustive]
2447pub struct CreateInstanceRequest {
2448    /// Required. Format:
2449    /// `parent=projects/{project_id}/locations/{location}`
2450    pub parent: std::string::String,
2451
2452    /// Required. User-defined unique ID of this instance.
2453    pub instance_id: std::string::String,
2454
2455    /// Required. The instance to be created.
2456    pub instance: std::option::Option<crate::model::Instance>,
2457
2458    /// Optional. Idempotent request UUID.
2459    pub request_id: std::string::String,
2460
2461    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2462}
2463
2464impl CreateInstanceRequest {
2465    pub fn new() -> Self {
2466        std::default::Default::default()
2467    }
2468
2469    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
2470    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2471        self.parent = v.into();
2472        self
2473    }
2474
2475    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
2476    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2477        self.instance_id = v.into();
2478        self
2479    }
2480
2481    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
2482    pub fn set_instance<T>(mut self, v: T) -> Self
2483    where
2484        T: std::convert::Into<crate::model::Instance>,
2485    {
2486        self.instance = std::option::Option::Some(v.into());
2487        self
2488    }
2489
2490    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
2491    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
2492    where
2493        T: std::convert::Into<crate::model::Instance>,
2494    {
2495        self.instance = v.map(|x| x.into());
2496        self
2497    }
2498
2499    /// Sets the value of [request_id][crate::model::CreateInstanceRequest::request_id].
2500    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2501        self.request_id = v.into();
2502        self
2503    }
2504}
2505
2506impl wkt::message::Message for CreateInstanceRequest {
2507    fn typename() -> &'static str {
2508        "type.googleapis.com/google.cloud.notebooks.v2.CreateInstanceRequest"
2509    }
2510}
2511
2512/// Request for updating a notebook instance.
2513#[derive(Clone, Default, PartialEq)]
2514#[non_exhaustive]
2515pub struct UpdateInstanceRequest {
2516    /// Required. A representation of an instance.
2517    pub instance: std::option::Option<crate::model::Instance>,
2518
2519    /// Required. Mask used to update an instance
2520    pub update_mask: std::option::Option<wkt::FieldMask>,
2521
2522    /// Optional. Idempotent request UUID.
2523    pub request_id: std::string::String,
2524
2525    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2526}
2527
2528impl UpdateInstanceRequest {
2529    pub fn new() -> Self {
2530        std::default::Default::default()
2531    }
2532
2533    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
2534    pub fn set_instance<T>(mut self, v: T) -> Self
2535    where
2536        T: std::convert::Into<crate::model::Instance>,
2537    {
2538        self.instance = std::option::Option::Some(v.into());
2539        self
2540    }
2541
2542    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
2543    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
2544    where
2545        T: std::convert::Into<crate::model::Instance>,
2546    {
2547        self.instance = v.map(|x| x.into());
2548        self
2549    }
2550
2551    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
2552    pub fn set_update_mask<T>(mut self, v: T) -> Self
2553    where
2554        T: std::convert::Into<wkt::FieldMask>,
2555    {
2556        self.update_mask = std::option::Option::Some(v.into());
2557        self
2558    }
2559
2560    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
2561    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2562    where
2563        T: std::convert::Into<wkt::FieldMask>,
2564    {
2565        self.update_mask = v.map(|x| x.into());
2566        self
2567    }
2568
2569    /// Sets the value of [request_id][crate::model::UpdateInstanceRequest::request_id].
2570    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2571        self.request_id = v.into();
2572        self
2573    }
2574}
2575
2576impl wkt::message::Message for UpdateInstanceRequest {
2577    fn typename() -> &'static str {
2578        "type.googleapis.com/google.cloud.notebooks.v2.UpdateInstanceRequest"
2579    }
2580}
2581
2582/// Request for deleting a notebook instance.
2583#[derive(Clone, Default, PartialEq)]
2584#[non_exhaustive]
2585pub struct DeleteInstanceRequest {
2586    /// Required. Format:
2587    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
2588    pub name: std::string::String,
2589
2590    /// Optional. Idempotent request UUID.
2591    pub request_id: std::string::String,
2592
2593    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2594}
2595
2596impl DeleteInstanceRequest {
2597    pub fn new() -> Self {
2598        std::default::Default::default()
2599    }
2600
2601    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
2602    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2603        self.name = v.into();
2604        self
2605    }
2606
2607    /// Sets the value of [request_id][crate::model::DeleteInstanceRequest::request_id].
2608    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2609        self.request_id = v.into();
2610        self
2611    }
2612}
2613
2614impl wkt::message::Message for DeleteInstanceRequest {
2615    fn typename() -> &'static str {
2616        "type.googleapis.com/google.cloud.notebooks.v2.DeleteInstanceRequest"
2617    }
2618}
2619
2620/// Request for starting a notebook instance
2621#[derive(Clone, Default, PartialEq)]
2622#[non_exhaustive]
2623pub struct StartInstanceRequest {
2624    /// Required. Format:
2625    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
2626    pub name: std::string::String,
2627
2628    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2629}
2630
2631impl StartInstanceRequest {
2632    pub fn new() -> Self {
2633        std::default::Default::default()
2634    }
2635
2636    /// Sets the value of [name][crate::model::StartInstanceRequest::name].
2637    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2638        self.name = v.into();
2639        self
2640    }
2641}
2642
2643impl wkt::message::Message for StartInstanceRequest {
2644    fn typename() -> &'static str {
2645        "type.googleapis.com/google.cloud.notebooks.v2.StartInstanceRequest"
2646    }
2647}
2648
2649/// Request for stopping a notebook instance
2650#[derive(Clone, Default, PartialEq)]
2651#[non_exhaustive]
2652pub struct StopInstanceRequest {
2653    /// Required. Format:
2654    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
2655    pub name: std::string::String,
2656
2657    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2658}
2659
2660impl StopInstanceRequest {
2661    pub fn new() -> Self {
2662        std::default::Default::default()
2663    }
2664
2665    /// Sets the value of [name][crate::model::StopInstanceRequest::name].
2666    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2667        self.name = v.into();
2668        self
2669    }
2670}
2671
2672impl wkt::message::Message for StopInstanceRequest {
2673    fn typename() -> &'static str {
2674        "type.googleapis.com/google.cloud.notebooks.v2.StopInstanceRequest"
2675    }
2676}
2677
2678/// Request for resetting a notebook instance
2679#[derive(Clone, Default, PartialEq)]
2680#[non_exhaustive]
2681pub struct ResetInstanceRequest {
2682    /// Required. Format:
2683    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
2684    pub name: std::string::String,
2685
2686    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2687}
2688
2689impl ResetInstanceRequest {
2690    pub fn new() -> Self {
2691        std::default::Default::default()
2692    }
2693
2694    /// Sets the value of [name][crate::model::ResetInstanceRequest::name].
2695    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2696        self.name = v.into();
2697        self
2698    }
2699}
2700
2701impl wkt::message::Message for ResetInstanceRequest {
2702    fn typename() -> &'static str {
2703        "type.googleapis.com/google.cloud.notebooks.v2.ResetInstanceRequest"
2704    }
2705}
2706
2707/// Request for checking if a notebook instance is upgradeable.
2708#[derive(Clone, Default, PartialEq)]
2709#[non_exhaustive]
2710pub struct CheckInstanceUpgradabilityRequest {
2711    /// Required. Format:
2712    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
2713    pub notebook_instance: std::string::String,
2714
2715    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2716}
2717
2718impl CheckInstanceUpgradabilityRequest {
2719    pub fn new() -> Self {
2720        std::default::Default::default()
2721    }
2722
2723    /// Sets the value of [notebook_instance][crate::model::CheckInstanceUpgradabilityRequest::notebook_instance].
2724    pub fn set_notebook_instance<T: std::convert::Into<std::string::String>>(
2725        mut self,
2726        v: T,
2727    ) -> Self {
2728        self.notebook_instance = v.into();
2729        self
2730    }
2731}
2732
2733impl wkt::message::Message for CheckInstanceUpgradabilityRequest {
2734    fn typename() -> &'static str {
2735        "type.googleapis.com/google.cloud.notebooks.v2.CheckInstanceUpgradabilityRequest"
2736    }
2737}
2738
2739/// Response for checking if a notebook instance is upgradeable.
2740#[derive(Clone, Default, PartialEq)]
2741#[non_exhaustive]
2742pub struct CheckInstanceUpgradabilityResponse {
2743    /// If an instance is upgradeable.
2744    pub upgradeable: bool,
2745
2746    /// The version this instance will be upgraded to if calling the upgrade
2747    /// endpoint. This field will only be populated if field upgradeable is true.
2748    pub upgrade_version: std::string::String,
2749
2750    /// Additional information about upgrade.
2751    pub upgrade_info: std::string::String,
2752
2753    /// The new image self link this instance will be upgraded to if calling the
2754    /// upgrade endpoint. This field will only be populated if field upgradeable
2755    /// is true.
2756    pub upgrade_image: std::string::String,
2757
2758    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2759}
2760
2761impl CheckInstanceUpgradabilityResponse {
2762    pub fn new() -> Self {
2763        std::default::Default::default()
2764    }
2765
2766    /// Sets the value of [upgradeable][crate::model::CheckInstanceUpgradabilityResponse::upgradeable].
2767    pub fn set_upgradeable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2768        self.upgradeable = v.into();
2769        self
2770    }
2771
2772    /// Sets the value of [upgrade_version][crate::model::CheckInstanceUpgradabilityResponse::upgrade_version].
2773    pub fn set_upgrade_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2774        self.upgrade_version = v.into();
2775        self
2776    }
2777
2778    /// Sets the value of [upgrade_info][crate::model::CheckInstanceUpgradabilityResponse::upgrade_info].
2779    pub fn set_upgrade_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2780        self.upgrade_info = v.into();
2781        self
2782    }
2783
2784    /// Sets the value of [upgrade_image][crate::model::CheckInstanceUpgradabilityResponse::upgrade_image].
2785    pub fn set_upgrade_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2786        self.upgrade_image = v.into();
2787        self
2788    }
2789}
2790
2791impl wkt::message::Message for CheckInstanceUpgradabilityResponse {
2792    fn typename() -> &'static str {
2793        "type.googleapis.com/google.cloud.notebooks.v2.CheckInstanceUpgradabilityResponse"
2794    }
2795}
2796
2797/// Request for upgrading a notebook instance
2798#[derive(Clone, Default, PartialEq)]
2799#[non_exhaustive]
2800pub struct UpgradeInstanceRequest {
2801    /// Required. Format:
2802    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
2803    pub name: std::string::String,
2804
2805    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2806}
2807
2808impl UpgradeInstanceRequest {
2809    pub fn new() -> Self {
2810        std::default::Default::default()
2811    }
2812
2813    /// Sets the value of [name][crate::model::UpgradeInstanceRequest::name].
2814    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2815        self.name = v.into();
2816        self
2817    }
2818}
2819
2820impl wkt::message::Message for UpgradeInstanceRequest {
2821    fn typename() -> &'static str {
2822        "type.googleapis.com/google.cloud.notebooks.v2.UpgradeInstanceRequest"
2823    }
2824}
2825
2826/// Request for rollbacking a notebook instance
2827#[derive(Clone, Default, PartialEq)]
2828#[non_exhaustive]
2829pub struct RollbackInstanceRequest {
2830    /// Required. Format:
2831    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
2832    pub name: std::string::String,
2833
2834    /// Required. The snapshot for rollback.
2835    /// Example: "projects/test-project/global/snapshots/krwlzipynril".
2836    pub target_snapshot: std::string::String,
2837
2838    /// Required. Output only. Revision Id
2839    pub revision_id: std::string::String,
2840
2841    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2842}
2843
2844impl RollbackInstanceRequest {
2845    pub fn new() -> Self {
2846        std::default::Default::default()
2847    }
2848
2849    /// Sets the value of [name][crate::model::RollbackInstanceRequest::name].
2850    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2851        self.name = v.into();
2852        self
2853    }
2854
2855    /// Sets the value of [target_snapshot][crate::model::RollbackInstanceRequest::target_snapshot].
2856    pub fn set_target_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2857        self.target_snapshot = v.into();
2858        self
2859    }
2860
2861    /// Sets the value of [revision_id][crate::model::RollbackInstanceRequest::revision_id].
2862    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2863        self.revision_id = v.into();
2864        self
2865    }
2866}
2867
2868impl wkt::message::Message for RollbackInstanceRequest {
2869    fn typename() -> &'static str {
2870        "type.googleapis.com/google.cloud.notebooks.v2.RollbackInstanceRequest"
2871    }
2872}
2873
2874/// Request for creating a notebook instance diagnostic file.
2875#[derive(Clone, Default, PartialEq)]
2876#[non_exhaustive]
2877pub struct DiagnoseInstanceRequest {
2878    /// Required. Format:
2879    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`
2880    pub name: std::string::String,
2881
2882    /// Required. Defines flags that are used to run the diagnostic tool
2883    pub diagnostic_config: std::option::Option<crate::model::DiagnosticConfig>,
2884
2885    /// Optional. Maxmium amount of time in minutes before the operation times out.
2886    pub timeout_minutes: i32,
2887
2888    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2889}
2890
2891impl DiagnoseInstanceRequest {
2892    pub fn new() -> Self {
2893        std::default::Default::default()
2894    }
2895
2896    /// Sets the value of [name][crate::model::DiagnoseInstanceRequest::name].
2897    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2898        self.name = v.into();
2899        self
2900    }
2901
2902    /// Sets the value of [diagnostic_config][crate::model::DiagnoseInstanceRequest::diagnostic_config].
2903    pub fn set_diagnostic_config<T>(mut self, v: T) -> Self
2904    where
2905        T: std::convert::Into<crate::model::DiagnosticConfig>,
2906    {
2907        self.diagnostic_config = std::option::Option::Some(v.into());
2908        self
2909    }
2910
2911    /// Sets or clears the value of [diagnostic_config][crate::model::DiagnoseInstanceRequest::diagnostic_config].
2912    pub fn set_or_clear_diagnostic_config<T>(mut self, v: std::option::Option<T>) -> Self
2913    where
2914        T: std::convert::Into<crate::model::DiagnosticConfig>,
2915    {
2916        self.diagnostic_config = v.map(|x| x.into());
2917        self
2918    }
2919
2920    /// Sets the value of [timeout_minutes][crate::model::DiagnoseInstanceRequest::timeout_minutes].
2921    pub fn set_timeout_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2922        self.timeout_minutes = v.into();
2923        self
2924    }
2925}
2926
2927impl wkt::message::Message for DiagnoseInstanceRequest {
2928    fn typename() -> &'static str {
2929        "type.googleapis.com/google.cloud.notebooks.v2.DiagnoseInstanceRequest"
2930    }
2931}
2932
2933/// Definition of the disk encryption options.
2934///
2935/// # Working with unknown values
2936///
2937/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2938/// additional enum variants at any time. Adding new variants is not considered
2939/// a breaking change. Applications should write their code in anticipation of:
2940///
2941/// - New values appearing in future releases of the client library, **and**
2942/// - New values received dynamically, without application changes.
2943///
2944/// Please consult the [Working with enums] section in the user guide for some
2945/// guidelines.
2946///
2947/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2948#[derive(Clone, Debug, PartialEq)]
2949#[non_exhaustive]
2950pub enum DiskEncryption {
2951    /// Disk encryption is not specified.
2952    Unspecified,
2953    /// Use Google managed encryption keys to encrypt the boot disk.
2954    Gmek,
2955    /// Use customer managed encryption keys to encrypt the boot disk.
2956    Cmek,
2957    /// If set, the enum was initialized with an unknown value.
2958    ///
2959    /// Applications can examine the value using [DiskEncryption::value] or
2960    /// [DiskEncryption::name].
2961    UnknownValue(disk_encryption::UnknownValue),
2962}
2963
2964#[doc(hidden)]
2965pub mod disk_encryption {
2966    #[allow(unused_imports)]
2967    use super::*;
2968    #[derive(Clone, Debug, PartialEq)]
2969    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2970}
2971
2972impl DiskEncryption {
2973    /// Gets the enum value.
2974    ///
2975    /// Returns `None` if the enum contains an unknown value deserialized from
2976    /// the string representation of enums.
2977    pub fn value(&self) -> std::option::Option<i32> {
2978        match self {
2979            Self::Unspecified => std::option::Option::Some(0),
2980            Self::Gmek => std::option::Option::Some(1),
2981            Self::Cmek => std::option::Option::Some(2),
2982            Self::UnknownValue(u) => u.0.value(),
2983        }
2984    }
2985
2986    /// Gets the enum value as a string.
2987    ///
2988    /// Returns `None` if the enum contains an unknown value deserialized from
2989    /// the integer representation of enums.
2990    pub fn name(&self) -> std::option::Option<&str> {
2991        match self {
2992            Self::Unspecified => std::option::Option::Some("DISK_ENCRYPTION_UNSPECIFIED"),
2993            Self::Gmek => std::option::Option::Some("GMEK"),
2994            Self::Cmek => std::option::Option::Some("CMEK"),
2995            Self::UnknownValue(u) => u.0.name(),
2996        }
2997    }
2998}
2999
3000impl std::default::Default for DiskEncryption {
3001    fn default() -> Self {
3002        use std::convert::From;
3003        Self::from(0)
3004    }
3005}
3006
3007impl std::fmt::Display for DiskEncryption {
3008    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3009        wkt::internal::display_enum(f, self.name(), self.value())
3010    }
3011}
3012
3013impl std::convert::From<i32> for DiskEncryption {
3014    fn from(value: i32) -> Self {
3015        match value {
3016            0 => Self::Unspecified,
3017            1 => Self::Gmek,
3018            2 => Self::Cmek,
3019            _ => Self::UnknownValue(disk_encryption::UnknownValue(
3020                wkt::internal::UnknownEnumValue::Integer(value),
3021            )),
3022        }
3023    }
3024}
3025
3026impl std::convert::From<&str> for DiskEncryption {
3027    fn from(value: &str) -> Self {
3028        use std::string::ToString;
3029        match value {
3030            "DISK_ENCRYPTION_UNSPECIFIED" => Self::Unspecified,
3031            "GMEK" => Self::Gmek,
3032            "CMEK" => Self::Cmek,
3033            _ => Self::UnknownValue(disk_encryption::UnknownValue(
3034                wkt::internal::UnknownEnumValue::String(value.to_string()),
3035            )),
3036        }
3037    }
3038}
3039
3040impl serde::ser::Serialize for DiskEncryption {
3041    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3042    where
3043        S: serde::Serializer,
3044    {
3045        match self {
3046            Self::Unspecified => serializer.serialize_i32(0),
3047            Self::Gmek => serializer.serialize_i32(1),
3048            Self::Cmek => serializer.serialize_i32(2),
3049            Self::UnknownValue(u) => u.0.serialize(serializer),
3050        }
3051    }
3052}
3053
3054impl<'de> serde::de::Deserialize<'de> for DiskEncryption {
3055    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3056    where
3057        D: serde::Deserializer<'de>,
3058    {
3059        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiskEncryption>::new(
3060            ".google.cloud.notebooks.v2.DiskEncryption",
3061        ))
3062    }
3063}
3064
3065/// Possible disk types.
3066///
3067/// # Working with unknown values
3068///
3069/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3070/// additional enum variants at any time. Adding new variants is not considered
3071/// a breaking change. Applications should write their code in anticipation of:
3072///
3073/// - New values appearing in future releases of the client library, **and**
3074/// - New values received dynamically, without application changes.
3075///
3076/// Please consult the [Working with enums] section in the user guide for some
3077/// guidelines.
3078///
3079/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3080#[derive(Clone, Debug, PartialEq)]
3081#[non_exhaustive]
3082pub enum DiskType {
3083    /// Disk type not set.
3084    Unspecified,
3085    /// Standard persistent disk type.
3086    PdStandard,
3087    /// SSD persistent disk type.
3088    PdSsd,
3089    /// Balanced persistent disk type.
3090    PdBalanced,
3091    /// Extreme persistent disk type.
3092    PdExtreme,
3093    /// If set, the enum was initialized with an unknown value.
3094    ///
3095    /// Applications can examine the value using [DiskType::value] or
3096    /// [DiskType::name].
3097    UnknownValue(disk_type::UnknownValue),
3098}
3099
3100#[doc(hidden)]
3101pub mod disk_type {
3102    #[allow(unused_imports)]
3103    use super::*;
3104    #[derive(Clone, Debug, PartialEq)]
3105    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3106}
3107
3108impl DiskType {
3109    /// Gets the enum value.
3110    ///
3111    /// Returns `None` if the enum contains an unknown value deserialized from
3112    /// the string representation of enums.
3113    pub fn value(&self) -> std::option::Option<i32> {
3114        match self {
3115            Self::Unspecified => std::option::Option::Some(0),
3116            Self::PdStandard => std::option::Option::Some(1),
3117            Self::PdSsd => std::option::Option::Some(2),
3118            Self::PdBalanced => std::option::Option::Some(3),
3119            Self::PdExtreme => std::option::Option::Some(4),
3120            Self::UnknownValue(u) => u.0.value(),
3121        }
3122    }
3123
3124    /// Gets the enum value as a string.
3125    ///
3126    /// Returns `None` if the enum contains an unknown value deserialized from
3127    /// the integer representation of enums.
3128    pub fn name(&self) -> std::option::Option<&str> {
3129        match self {
3130            Self::Unspecified => std::option::Option::Some("DISK_TYPE_UNSPECIFIED"),
3131            Self::PdStandard => std::option::Option::Some("PD_STANDARD"),
3132            Self::PdSsd => std::option::Option::Some("PD_SSD"),
3133            Self::PdBalanced => std::option::Option::Some("PD_BALANCED"),
3134            Self::PdExtreme => std::option::Option::Some("PD_EXTREME"),
3135            Self::UnknownValue(u) => u.0.name(),
3136        }
3137    }
3138}
3139
3140impl std::default::Default for DiskType {
3141    fn default() -> Self {
3142        use std::convert::From;
3143        Self::from(0)
3144    }
3145}
3146
3147impl std::fmt::Display for DiskType {
3148    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3149        wkt::internal::display_enum(f, self.name(), self.value())
3150    }
3151}
3152
3153impl std::convert::From<i32> for DiskType {
3154    fn from(value: i32) -> Self {
3155        match value {
3156            0 => Self::Unspecified,
3157            1 => Self::PdStandard,
3158            2 => Self::PdSsd,
3159            3 => Self::PdBalanced,
3160            4 => Self::PdExtreme,
3161            _ => Self::UnknownValue(disk_type::UnknownValue(
3162                wkt::internal::UnknownEnumValue::Integer(value),
3163            )),
3164        }
3165    }
3166}
3167
3168impl std::convert::From<&str> for DiskType {
3169    fn from(value: &str) -> Self {
3170        use std::string::ToString;
3171        match value {
3172            "DISK_TYPE_UNSPECIFIED" => Self::Unspecified,
3173            "PD_STANDARD" => Self::PdStandard,
3174            "PD_SSD" => Self::PdSsd,
3175            "PD_BALANCED" => Self::PdBalanced,
3176            "PD_EXTREME" => Self::PdExtreme,
3177            _ => Self::UnknownValue(disk_type::UnknownValue(
3178                wkt::internal::UnknownEnumValue::String(value.to_string()),
3179            )),
3180        }
3181    }
3182}
3183
3184impl serde::ser::Serialize for DiskType {
3185    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3186    where
3187        S: serde::Serializer,
3188    {
3189        match self {
3190            Self::Unspecified => serializer.serialize_i32(0),
3191            Self::PdStandard => serializer.serialize_i32(1),
3192            Self::PdSsd => serializer.serialize_i32(2),
3193            Self::PdBalanced => serializer.serialize_i32(3),
3194            Self::PdExtreme => serializer.serialize_i32(4),
3195            Self::UnknownValue(u) => u.0.serialize(serializer),
3196        }
3197    }
3198}
3199
3200impl<'de> serde::de::Deserialize<'de> for DiskType {
3201    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3202    where
3203        D: serde::Deserializer<'de>,
3204    {
3205        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiskType>::new(
3206            ".google.cloud.notebooks.v2.DiskType",
3207        ))
3208    }
3209}
3210
3211/// The definition of the states of this instance.
3212///
3213/// # Working with unknown values
3214///
3215/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3216/// additional enum variants at any time. Adding new variants is not considered
3217/// a breaking change. Applications should write their code in anticipation of:
3218///
3219/// - New values appearing in future releases of the client library, **and**
3220/// - New values received dynamically, without application changes.
3221///
3222/// Please consult the [Working with enums] section in the user guide for some
3223/// guidelines.
3224///
3225/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3226#[derive(Clone, Debug, PartialEq)]
3227#[non_exhaustive]
3228pub enum State {
3229    /// State is not specified.
3230    Unspecified,
3231    /// The control logic is starting the instance.
3232    Starting,
3233    /// The control logic is installing required frameworks and registering the
3234    /// instance with notebook proxy
3235    Provisioning,
3236    /// The instance is running.
3237    Active,
3238    /// The control logic is stopping the instance.
3239    Stopping,
3240    /// The instance is stopped.
3241    Stopped,
3242    /// The instance is deleted.
3243    Deleted,
3244    /// The instance is upgrading.
3245    Upgrading,
3246    /// The instance is being created.
3247    Initializing,
3248    /// The instance is suspending.
3249    Suspending,
3250    /// The instance is suspended.
3251    Suspended,
3252    /// If set, the enum was initialized with an unknown value.
3253    ///
3254    /// Applications can examine the value using [State::value] or
3255    /// [State::name].
3256    UnknownValue(state::UnknownValue),
3257}
3258
3259#[doc(hidden)]
3260pub mod state {
3261    #[allow(unused_imports)]
3262    use super::*;
3263    #[derive(Clone, Debug, PartialEq)]
3264    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3265}
3266
3267impl State {
3268    /// Gets the enum value.
3269    ///
3270    /// Returns `None` if the enum contains an unknown value deserialized from
3271    /// the string representation of enums.
3272    pub fn value(&self) -> std::option::Option<i32> {
3273        match self {
3274            Self::Unspecified => std::option::Option::Some(0),
3275            Self::Starting => std::option::Option::Some(1),
3276            Self::Provisioning => std::option::Option::Some(2),
3277            Self::Active => std::option::Option::Some(3),
3278            Self::Stopping => std::option::Option::Some(4),
3279            Self::Stopped => std::option::Option::Some(5),
3280            Self::Deleted => std::option::Option::Some(6),
3281            Self::Upgrading => std::option::Option::Some(7),
3282            Self::Initializing => std::option::Option::Some(8),
3283            Self::Suspending => std::option::Option::Some(9),
3284            Self::Suspended => std::option::Option::Some(10),
3285            Self::UnknownValue(u) => u.0.value(),
3286        }
3287    }
3288
3289    /// Gets the enum value as a string.
3290    ///
3291    /// Returns `None` if the enum contains an unknown value deserialized from
3292    /// the integer representation of enums.
3293    pub fn name(&self) -> std::option::Option<&str> {
3294        match self {
3295            Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3296            Self::Starting => std::option::Option::Some("STARTING"),
3297            Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3298            Self::Active => std::option::Option::Some("ACTIVE"),
3299            Self::Stopping => std::option::Option::Some("STOPPING"),
3300            Self::Stopped => std::option::Option::Some("STOPPED"),
3301            Self::Deleted => std::option::Option::Some("DELETED"),
3302            Self::Upgrading => std::option::Option::Some("UPGRADING"),
3303            Self::Initializing => std::option::Option::Some("INITIALIZING"),
3304            Self::Suspending => std::option::Option::Some("SUSPENDING"),
3305            Self::Suspended => std::option::Option::Some("SUSPENDED"),
3306            Self::UnknownValue(u) => u.0.name(),
3307        }
3308    }
3309}
3310
3311impl std::default::Default for State {
3312    fn default() -> Self {
3313        use std::convert::From;
3314        Self::from(0)
3315    }
3316}
3317
3318impl std::fmt::Display for State {
3319    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3320        wkt::internal::display_enum(f, self.name(), self.value())
3321    }
3322}
3323
3324impl std::convert::From<i32> for State {
3325    fn from(value: i32) -> Self {
3326        match value {
3327            0 => Self::Unspecified,
3328            1 => Self::Starting,
3329            2 => Self::Provisioning,
3330            3 => Self::Active,
3331            4 => Self::Stopping,
3332            5 => Self::Stopped,
3333            6 => Self::Deleted,
3334            7 => Self::Upgrading,
3335            8 => Self::Initializing,
3336            9 => Self::Suspending,
3337            10 => Self::Suspended,
3338            _ => Self::UnknownValue(state::UnknownValue(
3339                wkt::internal::UnknownEnumValue::Integer(value),
3340            )),
3341        }
3342    }
3343}
3344
3345impl std::convert::From<&str> for State {
3346    fn from(value: &str) -> Self {
3347        use std::string::ToString;
3348        match value {
3349            "STATE_UNSPECIFIED" => Self::Unspecified,
3350            "STARTING" => Self::Starting,
3351            "PROVISIONING" => Self::Provisioning,
3352            "ACTIVE" => Self::Active,
3353            "STOPPING" => Self::Stopping,
3354            "STOPPED" => Self::Stopped,
3355            "DELETED" => Self::Deleted,
3356            "UPGRADING" => Self::Upgrading,
3357            "INITIALIZING" => Self::Initializing,
3358            "SUSPENDING" => Self::Suspending,
3359            "SUSPENDED" => Self::Suspended,
3360            _ => Self::UnknownValue(state::UnknownValue(
3361                wkt::internal::UnknownEnumValue::String(value.to_string()),
3362            )),
3363        }
3364    }
3365}
3366
3367impl serde::ser::Serialize for State {
3368    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3369    where
3370        S: serde::Serializer,
3371    {
3372        match self {
3373            Self::Unspecified => serializer.serialize_i32(0),
3374            Self::Starting => serializer.serialize_i32(1),
3375            Self::Provisioning => serializer.serialize_i32(2),
3376            Self::Active => serializer.serialize_i32(3),
3377            Self::Stopping => serializer.serialize_i32(4),
3378            Self::Stopped => serializer.serialize_i32(5),
3379            Self::Deleted => serializer.serialize_i32(6),
3380            Self::Upgrading => serializer.serialize_i32(7),
3381            Self::Initializing => serializer.serialize_i32(8),
3382            Self::Suspending => serializer.serialize_i32(9),
3383            Self::Suspended => serializer.serialize_i32(10),
3384            Self::UnknownValue(u) => u.0.serialize(serializer),
3385        }
3386    }
3387}
3388
3389impl<'de> serde::de::Deserialize<'de> for State {
3390    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3391    where
3392        D: serde::Deserializer<'de>,
3393    {
3394        deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3395            ".google.cloud.notebooks.v2.State",
3396        ))
3397    }
3398}
3399
3400/// The instance health state.
3401///
3402/// # Working with unknown values
3403///
3404/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3405/// additional enum variants at any time. Adding new variants is not considered
3406/// a breaking change. Applications should write their code in anticipation of:
3407///
3408/// - New values appearing in future releases of the client library, **and**
3409/// - New values received dynamically, without application changes.
3410///
3411/// Please consult the [Working with enums] section in the user guide for some
3412/// guidelines.
3413///
3414/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3415#[derive(Clone, Debug, PartialEq)]
3416#[non_exhaustive]
3417pub enum HealthState {
3418    /// The instance substate is unknown.
3419    Unspecified,
3420    /// The instance is known to be in an healthy state
3421    /// (for example, critical daemons are running)
3422    /// Applies to ACTIVE state.
3423    Healthy,
3424    /// The instance is known to be in an unhealthy state
3425    /// (for example, critical daemons are not running)
3426    /// Applies to ACTIVE state.
3427    Unhealthy,
3428    /// The instance has not installed health monitoring agent.
3429    /// Applies to ACTIVE state.
3430    AgentNotInstalled,
3431    /// The instance health monitoring agent is not running.
3432    /// Applies to ACTIVE state.
3433    AgentNotRunning,
3434    /// If set, the enum was initialized with an unknown value.
3435    ///
3436    /// Applications can examine the value using [HealthState::value] or
3437    /// [HealthState::name].
3438    UnknownValue(health_state::UnknownValue),
3439}
3440
3441#[doc(hidden)]
3442pub mod health_state {
3443    #[allow(unused_imports)]
3444    use super::*;
3445    #[derive(Clone, Debug, PartialEq)]
3446    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3447}
3448
3449impl HealthState {
3450    /// Gets the enum value.
3451    ///
3452    /// Returns `None` if the enum contains an unknown value deserialized from
3453    /// the string representation of enums.
3454    pub fn value(&self) -> std::option::Option<i32> {
3455        match self {
3456            Self::Unspecified => std::option::Option::Some(0),
3457            Self::Healthy => std::option::Option::Some(1),
3458            Self::Unhealthy => std::option::Option::Some(2),
3459            Self::AgentNotInstalled => std::option::Option::Some(3),
3460            Self::AgentNotRunning => std::option::Option::Some(4),
3461            Self::UnknownValue(u) => u.0.value(),
3462        }
3463    }
3464
3465    /// Gets the enum value as a string.
3466    ///
3467    /// Returns `None` if the enum contains an unknown value deserialized from
3468    /// the integer representation of enums.
3469    pub fn name(&self) -> std::option::Option<&str> {
3470        match self {
3471            Self::Unspecified => std::option::Option::Some("HEALTH_STATE_UNSPECIFIED"),
3472            Self::Healthy => std::option::Option::Some("HEALTHY"),
3473            Self::Unhealthy => std::option::Option::Some("UNHEALTHY"),
3474            Self::AgentNotInstalled => std::option::Option::Some("AGENT_NOT_INSTALLED"),
3475            Self::AgentNotRunning => std::option::Option::Some("AGENT_NOT_RUNNING"),
3476            Self::UnknownValue(u) => u.0.name(),
3477        }
3478    }
3479}
3480
3481impl std::default::Default for HealthState {
3482    fn default() -> Self {
3483        use std::convert::From;
3484        Self::from(0)
3485    }
3486}
3487
3488impl std::fmt::Display for HealthState {
3489    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3490        wkt::internal::display_enum(f, self.name(), self.value())
3491    }
3492}
3493
3494impl std::convert::From<i32> for HealthState {
3495    fn from(value: i32) -> Self {
3496        match value {
3497            0 => Self::Unspecified,
3498            1 => Self::Healthy,
3499            2 => Self::Unhealthy,
3500            3 => Self::AgentNotInstalled,
3501            4 => Self::AgentNotRunning,
3502            _ => Self::UnknownValue(health_state::UnknownValue(
3503                wkt::internal::UnknownEnumValue::Integer(value),
3504            )),
3505        }
3506    }
3507}
3508
3509impl std::convert::From<&str> for HealthState {
3510    fn from(value: &str) -> Self {
3511        use std::string::ToString;
3512        match value {
3513            "HEALTH_STATE_UNSPECIFIED" => Self::Unspecified,
3514            "HEALTHY" => Self::Healthy,
3515            "UNHEALTHY" => Self::Unhealthy,
3516            "AGENT_NOT_INSTALLED" => Self::AgentNotInstalled,
3517            "AGENT_NOT_RUNNING" => Self::AgentNotRunning,
3518            _ => Self::UnknownValue(health_state::UnknownValue(
3519                wkt::internal::UnknownEnumValue::String(value.to_string()),
3520            )),
3521        }
3522    }
3523}
3524
3525impl serde::ser::Serialize for HealthState {
3526    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3527    where
3528        S: serde::Serializer,
3529    {
3530        match self {
3531            Self::Unspecified => serializer.serialize_i32(0),
3532            Self::Healthy => serializer.serialize_i32(1),
3533            Self::Unhealthy => serializer.serialize_i32(2),
3534            Self::AgentNotInstalled => serializer.serialize_i32(3),
3535            Self::AgentNotRunning => serializer.serialize_i32(4),
3536            Self::UnknownValue(u) => u.0.serialize(serializer),
3537        }
3538    }
3539}
3540
3541impl<'de> serde::de::Deserialize<'de> for HealthState {
3542    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3543    where
3544        D: serde::Deserializer<'de>,
3545    {
3546        deserializer.deserialize_any(wkt::internal::EnumVisitor::<HealthState>::new(
3547            ".google.cloud.notebooks.v2.HealthState",
3548        ))
3549    }
3550}