Skip to main content

google_cloud_notebooks_v2/
model.rs

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