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