Skip to main content

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