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