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