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