google_cloud_baremetalsolution_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 gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate location;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Represents the metadata from a long-running operation.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct OperationMetadata {
44 /// Output only. The time the operation was created.
45 pub create_time: std::option::Option<wkt::Timestamp>,
46
47 /// Output only. The time the operation finished running.
48 pub end_time: std::option::Option<wkt::Timestamp>,
49
50 /// Output only. Server-defined resource path for the target of the operation.
51 pub target: std::string::String,
52
53 /// Output only. Name of the action executed by the operation.
54 pub verb: std::string::String,
55
56 /// Output only. Human-readable status of the operation, if any.
57 pub status_message: std::string::String,
58
59 /// Output only. Identifies whether the user requested the cancellation
60 /// of the operation. Operations that have been successfully cancelled
61 /// have [Operation.error][] value with a
62 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
63 /// `Code.CANCELLED`.
64 ///
65 /// [google.rpc.Status.code]: rpc::model::Status::code
66 pub requested_cancellation: bool,
67
68 /// Output only. API version used with the operation.
69 pub api_version: std::string::String,
70
71 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
72}
73
74impl OperationMetadata {
75 pub fn new() -> Self {
76 std::default::Default::default()
77 }
78
79 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
80 ///
81 /// # Example
82 /// ```ignore,no_run
83 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
84 /// use wkt::Timestamp;
85 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
86 /// ```
87 pub fn set_create_time<T>(mut self, v: T) -> Self
88 where
89 T: std::convert::Into<wkt::Timestamp>,
90 {
91 self.create_time = std::option::Option::Some(v.into());
92 self
93 }
94
95 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
96 ///
97 /// # Example
98 /// ```ignore,no_run
99 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
100 /// use wkt::Timestamp;
101 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
102 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
103 /// ```
104 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
105 where
106 T: std::convert::Into<wkt::Timestamp>,
107 {
108 self.create_time = v.map(|x| x.into());
109 self
110 }
111
112 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
113 ///
114 /// # Example
115 /// ```ignore,no_run
116 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
117 /// use wkt::Timestamp;
118 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
119 /// ```
120 pub fn set_end_time<T>(mut self, v: T) -> Self
121 where
122 T: std::convert::Into<wkt::Timestamp>,
123 {
124 self.end_time = std::option::Option::Some(v.into());
125 self
126 }
127
128 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
129 ///
130 /// # Example
131 /// ```ignore,no_run
132 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
133 /// use wkt::Timestamp;
134 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
135 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
136 /// ```
137 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
138 where
139 T: std::convert::Into<wkt::Timestamp>,
140 {
141 self.end_time = v.map(|x| x.into());
142 self
143 }
144
145 /// Sets the value of [target][crate::model::OperationMetadata::target].
146 ///
147 /// # Example
148 /// ```ignore,no_run
149 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
150 /// let x = OperationMetadata::new().set_target("example");
151 /// ```
152 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
153 self.target = v.into();
154 self
155 }
156
157 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
158 ///
159 /// # Example
160 /// ```ignore,no_run
161 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
162 /// let x = OperationMetadata::new().set_verb("example");
163 /// ```
164 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
165 self.verb = v.into();
166 self
167 }
168
169 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
170 ///
171 /// # Example
172 /// ```ignore,no_run
173 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
174 /// let x = OperationMetadata::new().set_status_message("example");
175 /// ```
176 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
177 self.status_message = v.into();
178 self
179 }
180
181 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
182 ///
183 /// # Example
184 /// ```ignore,no_run
185 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
186 /// let x = OperationMetadata::new().set_requested_cancellation(true);
187 /// ```
188 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
189 self.requested_cancellation = v.into();
190 self
191 }
192
193 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
194 ///
195 /// # Example
196 /// ```ignore,no_run
197 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
198 /// let x = OperationMetadata::new().set_api_version("example");
199 /// ```
200 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
201 self.api_version = v.into();
202 self
203 }
204}
205
206impl wkt::message::Message for OperationMetadata {
207 fn typename() -> &'static str {
208 "type.googleapis.com/google.cloud.baremetalsolution.v2.OperationMetadata"
209 }
210}
211
212/// Response message from resetting a server.
213#[derive(Clone, Default, PartialEq)]
214#[non_exhaustive]
215pub struct ResetInstanceResponse {
216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
217}
218
219impl ResetInstanceResponse {
220 pub fn new() -> Self {
221 std::default::Default::default()
222 }
223}
224
225impl wkt::message::Message for ResetInstanceResponse {
226 fn typename() -> &'static str {
227 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceResponse"
228 }
229}
230
231/// A server.
232#[derive(Clone, Default, PartialEq)]
233#[non_exhaustive]
234pub struct Instance {
235 /// Immutable. The resource name of this `Instance`.
236 /// Resource names are schemeless URIs that follow the conventions in
237 /// <https://cloud.google.com/apis/design/resource_names>.
238 /// Format:
239 /// `projects/{project}/locations/{location}/instances/{instance}`
240 pub name: std::string::String,
241
242 /// Output only. An identifier for the `Instance`, generated by the backend.
243 pub id: std::string::String,
244
245 /// Output only. Create a time stamp.
246 pub create_time: std::option::Option<wkt::Timestamp>,
247
248 /// Output only. Update a time stamp.
249 pub update_time: std::option::Option<wkt::Timestamp>,
250
251 /// Immutable. The server type.
252 /// [Available server
253 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
254 pub machine_type: std::string::String,
255
256 /// Output only. The state of the server.
257 pub state: crate::model::instance::State,
258
259 /// True if you enable hyperthreading for the server, otherwise false.
260 /// The default value is false.
261 pub hyperthreading_enabled: bool,
262
263 /// Labels as key value pairs.
264 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
265
266 /// Immutable. List of LUNs associated with this server.
267 pub luns: std::vec::Vec<crate::model::Lun>,
268
269 /// Input only. List of Volumes to attach to this Instance on creation.
270 /// This field won't be populated in Get/List responses.
271 pub volumes: std::vec::Vec<crate::model::Volume>,
272
273 /// Output only. List of networks associated with this server.
274 pub networks: std::vec::Vec<crate::model::Network>,
275
276 /// Output only. True if the interactive serial console feature is enabled for
277 /// the instance, false otherwise. The default value is false.
278 pub interactive_serial_console_enabled: bool,
279
280 /// The OS image currently installed on the server.
281 pub os_image: std::string::String,
282
283 /// Immutable. Pod name.
284 /// Pod is an independent part of infrastructure.
285 /// Instance can be connected to the assets (networks, volumes) allocated
286 /// in the same pod only.
287 pub pod: std::string::String,
288
289 /// Instance network template name. For eg, bondaa-bondaa, bondab-nic, etc.
290 /// Generally, the template name follows the syntax of
291 /// "bond<bond_mode>" or "nic".
292 pub network_template: std::string::String,
293
294 /// List of logical interfaces for the instance. The number of logical
295 /// interfaces will be the same as number of hardware bond/nic on the chosen
296 /// network template. For the non-multivlan configurations (for eg, existing
297 /// servers) that use existing default network template (bondaa-bondaa), both
298 /// the Instance.networks field and the Instance.logical_interfaces fields will
299 /// be filled to ensure backward compatibility. For the others, only
300 /// Instance.logical_interfaces will be filled.
301 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
302
303 /// Output only. Text field about info for logging in.
304 pub login_info: std::string::String,
305
306 /// The workload profile for the instance.
307 pub workload_profile: crate::model::WorkloadProfile,
308
309 /// Output only. The firmware version for the instance.
310 pub firmware_version: std::string::String,
311
312 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
313}
314
315impl Instance {
316 pub fn new() -> Self {
317 std::default::Default::default()
318 }
319
320 /// Sets the value of [name][crate::model::Instance::name].
321 ///
322 /// # Example
323 /// ```ignore,no_run
324 /// # use google_cloud_baremetalsolution_v2::model::Instance;
325 /// let x = Instance::new().set_name("example");
326 /// ```
327 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
328 self.name = v.into();
329 self
330 }
331
332 /// Sets the value of [id][crate::model::Instance::id].
333 ///
334 /// # Example
335 /// ```ignore,no_run
336 /// # use google_cloud_baremetalsolution_v2::model::Instance;
337 /// let x = Instance::new().set_id("example");
338 /// ```
339 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
340 self.id = v.into();
341 self
342 }
343
344 /// Sets the value of [create_time][crate::model::Instance::create_time].
345 ///
346 /// # Example
347 /// ```ignore,no_run
348 /// # use google_cloud_baremetalsolution_v2::model::Instance;
349 /// use wkt::Timestamp;
350 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
351 /// ```
352 pub fn set_create_time<T>(mut self, v: T) -> Self
353 where
354 T: std::convert::Into<wkt::Timestamp>,
355 {
356 self.create_time = std::option::Option::Some(v.into());
357 self
358 }
359
360 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
361 ///
362 /// # Example
363 /// ```ignore,no_run
364 /// # use google_cloud_baremetalsolution_v2::model::Instance;
365 /// use wkt::Timestamp;
366 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
367 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
368 /// ```
369 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
370 where
371 T: std::convert::Into<wkt::Timestamp>,
372 {
373 self.create_time = v.map(|x| x.into());
374 self
375 }
376
377 /// Sets the value of [update_time][crate::model::Instance::update_time].
378 ///
379 /// # Example
380 /// ```ignore,no_run
381 /// # use google_cloud_baremetalsolution_v2::model::Instance;
382 /// use wkt::Timestamp;
383 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
384 /// ```
385 pub fn set_update_time<T>(mut self, v: T) -> Self
386 where
387 T: std::convert::Into<wkt::Timestamp>,
388 {
389 self.update_time = std::option::Option::Some(v.into());
390 self
391 }
392
393 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
394 ///
395 /// # Example
396 /// ```ignore,no_run
397 /// # use google_cloud_baremetalsolution_v2::model::Instance;
398 /// use wkt::Timestamp;
399 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
400 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
401 /// ```
402 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
403 where
404 T: std::convert::Into<wkt::Timestamp>,
405 {
406 self.update_time = v.map(|x| x.into());
407 self
408 }
409
410 /// Sets the value of [machine_type][crate::model::Instance::machine_type].
411 ///
412 /// # Example
413 /// ```ignore,no_run
414 /// # use google_cloud_baremetalsolution_v2::model::Instance;
415 /// let x = Instance::new().set_machine_type("example");
416 /// ```
417 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
418 self.machine_type = v.into();
419 self
420 }
421
422 /// Sets the value of [state][crate::model::Instance::state].
423 ///
424 /// # Example
425 /// ```ignore,no_run
426 /// # use google_cloud_baremetalsolution_v2::model::Instance;
427 /// use google_cloud_baremetalsolution_v2::model::instance::State;
428 /// let x0 = Instance::new().set_state(State::Provisioning);
429 /// let x1 = Instance::new().set_state(State::Running);
430 /// let x2 = Instance::new().set_state(State::Deleted);
431 /// ```
432 pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
433 self.state = v.into();
434 self
435 }
436
437 /// Sets the value of [hyperthreading_enabled][crate::model::Instance::hyperthreading_enabled].
438 ///
439 /// # Example
440 /// ```ignore,no_run
441 /// # use google_cloud_baremetalsolution_v2::model::Instance;
442 /// let x = Instance::new().set_hyperthreading_enabled(true);
443 /// ```
444 pub fn set_hyperthreading_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
445 self.hyperthreading_enabled = v.into();
446 self
447 }
448
449 /// Sets the value of [labels][crate::model::Instance::labels].
450 ///
451 /// # Example
452 /// ```ignore,no_run
453 /// # use google_cloud_baremetalsolution_v2::model::Instance;
454 /// let x = Instance::new().set_labels([
455 /// ("key0", "abc"),
456 /// ("key1", "xyz"),
457 /// ]);
458 /// ```
459 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
460 where
461 T: std::iter::IntoIterator<Item = (K, V)>,
462 K: std::convert::Into<std::string::String>,
463 V: std::convert::Into<std::string::String>,
464 {
465 use std::iter::Iterator;
466 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
467 self
468 }
469
470 /// Sets the value of [luns][crate::model::Instance::luns].
471 ///
472 /// # Example
473 /// ```ignore,no_run
474 /// # use google_cloud_baremetalsolution_v2::model::Instance;
475 /// use google_cloud_baremetalsolution_v2::model::Lun;
476 /// let x = Instance::new()
477 /// .set_luns([
478 /// Lun::default()/* use setters */,
479 /// Lun::default()/* use (different) setters */,
480 /// ]);
481 /// ```
482 pub fn set_luns<T, V>(mut self, v: T) -> Self
483 where
484 T: std::iter::IntoIterator<Item = V>,
485 V: std::convert::Into<crate::model::Lun>,
486 {
487 use std::iter::Iterator;
488 self.luns = v.into_iter().map(|i| i.into()).collect();
489 self
490 }
491
492 /// Sets the value of [volumes][crate::model::Instance::volumes].
493 ///
494 /// # Example
495 /// ```ignore,no_run
496 /// # use google_cloud_baremetalsolution_v2::model::Instance;
497 /// use google_cloud_baremetalsolution_v2::model::Volume;
498 /// let x = Instance::new()
499 /// .set_volumes([
500 /// Volume::default()/* use setters */,
501 /// Volume::default()/* use (different) setters */,
502 /// ]);
503 /// ```
504 pub fn set_volumes<T, V>(mut self, v: T) -> Self
505 where
506 T: std::iter::IntoIterator<Item = V>,
507 V: std::convert::Into<crate::model::Volume>,
508 {
509 use std::iter::Iterator;
510 self.volumes = v.into_iter().map(|i| i.into()).collect();
511 self
512 }
513
514 /// Sets the value of [networks][crate::model::Instance::networks].
515 ///
516 /// # Example
517 /// ```ignore,no_run
518 /// # use google_cloud_baremetalsolution_v2::model::Instance;
519 /// use google_cloud_baremetalsolution_v2::model::Network;
520 /// let x = Instance::new()
521 /// .set_networks([
522 /// Network::default()/* use setters */,
523 /// Network::default()/* use (different) setters */,
524 /// ]);
525 /// ```
526 pub fn set_networks<T, V>(mut self, v: T) -> Self
527 where
528 T: std::iter::IntoIterator<Item = V>,
529 V: std::convert::Into<crate::model::Network>,
530 {
531 use std::iter::Iterator;
532 self.networks = v.into_iter().map(|i| i.into()).collect();
533 self
534 }
535
536 /// Sets the value of [interactive_serial_console_enabled][crate::model::Instance::interactive_serial_console_enabled].
537 ///
538 /// # Example
539 /// ```ignore,no_run
540 /// # use google_cloud_baremetalsolution_v2::model::Instance;
541 /// let x = Instance::new().set_interactive_serial_console_enabled(true);
542 /// ```
543 pub fn set_interactive_serial_console_enabled<T: std::convert::Into<bool>>(
544 mut self,
545 v: T,
546 ) -> Self {
547 self.interactive_serial_console_enabled = v.into();
548 self
549 }
550
551 /// Sets the value of [os_image][crate::model::Instance::os_image].
552 ///
553 /// # Example
554 /// ```ignore,no_run
555 /// # use google_cloud_baremetalsolution_v2::model::Instance;
556 /// let x = Instance::new().set_os_image("example");
557 /// ```
558 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
559 self.os_image = v.into();
560 self
561 }
562
563 /// Sets the value of [pod][crate::model::Instance::pod].
564 ///
565 /// # Example
566 /// ```ignore,no_run
567 /// # use google_cloud_baremetalsolution_v2::model::Instance;
568 /// let x = Instance::new().set_pod("example");
569 /// ```
570 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
571 self.pod = v.into();
572 self
573 }
574
575 /// Sets the value of [network_template][crate::model::Instance::network_template].
576 ///
577 /// # Example
578 /// ```ignore,no_run
579 /// # use google_cloud_baremetalsolution_v2::model::Instance;
580 /// let x = Instance::new().set_network_template("example");
581 /// ```
582 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
583 mut self,
584 v: T,
585 ) -> Self {
586 self.network_template = v.into();
587 self
588 }
589
590 /// Sets the value of [logical_interfaces][crate::model::Instance::logical_interfaces].
591 ///
592 /// # Example
593 /// ```ignore,no_run
594 /// # use google_cloud_baremetalsolution_v2::model::Instance;
595 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
596 /// let x = Instance::new()
597 /// .set_logical_interfaces([
598 /// LogicalInterface::default()/* use setters */,
599 /// LogicalInterface::default()/* use (different) setters */,
600 /// ]);
601 /// ```
602 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
603 where
604 T: std::iter::IntoIterator<Item = V>,
605 V: std::convert::Into<crate::model::LogicalInterface>,
606 {
607 use std::iter::Iterator;
608 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
609 self
610 }
611
612 /// Sets the value of [login_info][crate::model::Instance::login_info].
613 ///
614 /// # Example
615 /// ```ignore,no_run
616 /// # use google_cloud_baremetalsolution_v2::model::Instance;
617 /// let x = Instance::new().set_login_info("example");
618 /// ```
619 pub fn set_login_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
620 self.login_info = v.into();
621 self
622 }
623
624 /// Sets the value of [workload_profile][crate::model::Instance::workload_profile].
625 ///
626 /// # Example
627 /// ```ignore,no_run
628 /// # use google_cloud_baremetalsolution_v2::model::Instance;
629 /// use google_cloud_baremetalsolution_v2::model::WorkloadProfile;
630 /// let x0 = Instance::new().set_workload_profile(WorkloadProfile::Generic);
631 /// let x1 = Instance::new().set_workload_profile(WorkloadProfile::Hana);
632 /// ```
633 pub fn set_workload_profile<T: std::convert::Into<crate::model::WorkloadProfile>>(
634 mut self,
635 v: T,
636 ) -> Self {
637 self.workload_profile = v.into();
638 self
639 }
640
641 /// Sets the value of [firmware_version][crate::model::Instance::firmware_version].
642 ///
643 /// # Example
644 /// ```ignore,no_run
645 /// # use google_cloud_baremetalsolution_v2::model::Instance;
646 /// let x = Instance::new().set_firmware_version("example");
647 /// ```
648 pub fn set_firmware_version<T: std::convert::Into<std::string::String>>(
649 mut self,
650 v: T,
651 ) -> Self {
652 self.firmware_version = v.into();
653 self
654 }
655}
656
657impl wkt::message::Message for Instance {
658 fn typename() -> &'static str {
659 "type.googleapis.com/google.cloud.baremetalsolution.v2.Instance"
660 }
661}
662
663/// Defines additional types related to [Instance].
664pub mod instance {
665 #[allow(unused_imports)]
666 use super::*;
667
668 /// The possible states for this server.
669 ///
670 /// # Working with unknown values
671 ///
672 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
673 /// additional enum variants at any time. Adding new variants is not considered
674 /// a breaking change. Applications should write their code in anticipation of:
675 ///
676 /// - New values appearing in future releases of the client library, **and**
677 /// - New values received dynamically, without application changes.
678 ///
679 /// Please consult the [Working with enums] section in the user guide for some
680 /// guidelines.
681 ///
682 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
683 #[derive(Clone, Debug, PartialEq)]
684 #[non_exhaustive]
685 pub enum State {
686 /// The server is in an unknown state.
687 Unspecified,
688 /// The server is being provisioned.
689 Provisioning,
690 /// The server is running.
691 Running,
692 /// The server has been deleted.
693 Deleted,
694 /// The server is being updated.
695 Updating,
696 /// The server is starting.
697 Starting,
698 /// The server is stopping.
699 Stopping,
700 /// The server is shutdown.
701 Shutdown,
702 /// If set, the enum was initialized with an unknown value.
703 ///
704 /// Applications can examine the value using [State::value] or
705 /// [State::name].
706 UnknownValue(state::UnknownValue),
707 }
708
709 #[doc(hidden)]
710 pub mod state {
711 #[allow(unused_imports)]
712 use super::*;
713 #[derive(Clone, Debug, PartialEq)]
714 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
715 }
716
717 impl State {
718 /// Gets the enum value.
719 ///
720 /// Returns `None` if the enum contains an unknown value deserialized from
721 /// the string representation of enums.
722 pub fn value(&self) -> std::option::Option<i32> {
723 match self {
724 Self::Unspecified => std::option::Option::Some(0),
725 Self::Provisioning => std::option::Option::Some(1),
726 Self::Running => std::option::Option::Some(2),
727 Self::Deleted => std::option::Option::Some(3),
728 Self::Updating => std::option::Option::Some(4),
729 Self::Starting => std::option::Option::Some(5),
730 Self::Stopping => std::option::Option::Some(6),
731 Self::Shutdown => std::option::Option::Some(7),
732 Self::UnknownValue(u) => u.0.value(),
733 }
734 }
735
736 /// Gets the enum value as a string.
737 ///
738 /// Returns `None` if the enum contains an unknown value deserialized from
739 /// the integer representation of enums.
740 pub fn name(&self) -> std::option::Option<&str> {
741 match self {
742 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
743 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
744 Self::Running => std::option::Option::Some("RUNNING"),
745 Self::Deleted => std::option::Option::Some("DELETED"),
746 Self::Updating => std::option::Option::Some("UPDATING"),
747 Self::Starting => std::option::Option::Some("STARTING"),
748 Self::Stopping => std::option::Option::Some("STOPPING"),
749 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
750 Self::UnknownValue(u) => u.0.name(),
751 }
752 }
753 }
754
755 impl std::default::Default for State {
756 fn default() -> Self {
757 use std::convert::From;
758 Self::from(0)
759 }
760 }
761
762 impl std::fmt::Display for State {
763 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
764 wkt::internal::display_enum(f, self.name(), self.value())
765 }
766 }
767
768 impl std::convert::From<i32> for State {
769 fn from(value: i32) -> Self {
770 match value {
771 0 => Self::Unspecified,
772 1 => Self::Provisioning,
773 2 => Self::Running,
774 3 => Self::Deleted,
775 4 => Self::Updating,
776 5 => Self::Starting,
777 6 => Self::Stopping,
778 7 => Self::Shutdown,
779 _ => Self::UnknownValue(state::UnknownValue(
780 wkt::internal::UnknownEnumValue::Integer(value),
781 )),
782 }
783 }
784 }
785
786 impl std::convert::From<&str> for State {
787 fn from(value: &str) -> Self {
788 use std::string::ToString;
789 match value {
790 "STATE_UNSPECIFIED" => Self::Unspecified,
791 "PROVISIONING" => Self::Provisioning,
792 "RUNNING" => Self::Running,
793 "DELETED" => Self::Deleted,
794 "UPDATING" => Self::Updating,
795 "STARTING" => Self::Starting,
796 "STOPPING" => Self::Stopping,
797 "SHUTDOWN" => Self::Shutdown,
798 _ => Self::UnknownValue(state::UnknownValue(
799 wkt::internal::UnknownEnumValue::String(value.to_string()),
800 )),
801 }
802 }
803 }
804
805 impl serde::ser::Serialize for State {
806 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
807 where
808 S: serde::Serializer,
809 {
810 match self {
811 Self::Unspecified => serializer.serialize_i32(0),
812 Self::Provisioning => serializer.serialize_i32(1),
813 Self::Running => serializer.serialize_i32(2),
814 Self::Deleted => serializer.serialize_i32(3),
815 Self::Updating => serializer.serialize_i32(4),
816 Self::Starting => serializer.serialize_i32(5),
817 Self::Stopping => serializer.serialize_i32(6),
818 Self::Shutdown => serializer.serialize_i32(7),
819 Self::UnknownValue(u) => u.0.serialize(serializer),
820 }
821 }
822 }
823
824 impl<'de> serde::de::Deserialize<'de> for State {
825 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
826 where
827 D: serde::Deserializer<'de>,
828 {
829 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
830 ".google.cloud.baremetalsolution.v2.Instance.State",
831 ))
832 }
833 }
834}
835
836/// Message for requesting server information.
837#[derive(Clone, Default, PartialEq)]
838#[non_exhaustive]
839pub struct GetInstanceRequest {
840 /// Required. Name of the resource.
841 pub name: std::string::String,
842
843 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
844}
845
846impl GetInstanceRequest {
847 pub fn new() -> Self {
848 std::default::Default::default()
849 }
850
851 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
852 ///
853 /// # Example
854 /// ```ignore,no_run
855 /// # use google_cloud_baremetalsolution_v2::model::GetInstanceRequest;
856 /// let x = GetInstanceRequest::new().set_name("example");
857 /// ```
858 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
859 self.name = v.into();
860 self
861 }
862}
863
864impl wkt::message::Message for GetInstanceRequest {
865 fn typename() -> &'static str {
866 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetInstanceRequest"
867 }
868}
869
870/// Message for requesting the list of servers.
871#[derive(Clone, Default, PartialEq)]
872#[non_exhaustive]
873pub struct ListInstancesRequest {
874 /// Required. Parent value for ListInstancesRequest.
875 pub parent: std::string::String,
876
877 /// Requested page size. Server may return fewer items than requested.
878 /// If unspecified, the server will pick an appropriate default.
879 pub page_size: i32,
880
881 /// A token identifying a page of results from the server.
882 pub page_token: std::string::String,
883
884 /// List filter.
885 pub filter: std::string::String,
886
887 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
888}
889
890impl ListInstancesRequest {
891 pub fn new() -> Self {
892 std::default::Default::default()
893 }
894
895 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
896 ///
897 /// # Example
898 /// ```ignore,no_run
899 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
900 /// let x = ListInstancesRequest::new().set_parent("example");
901 /// ```
902 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
903 self.parent = v.into();
904 self
905 }
906
907 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
908 ///
909 /// # Example
910 /// ```ignore,no_run
911 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
912 /// let x = ListInstancesRequest::new().set_page_size(42);
913 /// ```
914 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
915 self.page_size = v.into();
916 self
917 }
918
919 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
920 ///
921 /// # Example
922 /// ```ignore,no_run
923 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
924 /// let x = ListInstancesRequest::new().set_page_token("example");
925 /// ```
926 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
927 self.page_token = v.into();
928 self
929 }
930
931 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
932 ///
933 /// # Example
934 /// ```ignore,no_run
935 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
936 /// let x = ListInstancesRequest::new().set_filter("example");
937 /// ```
938 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
939 self.filter = v.into();
940 self
941 }
942}
943
944impl wkt::message::Message for ListInstancesRequest {
945 fn typename() -> &'static str {
946 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesRequest"
947 }
948}
949
950/// Response message for the list of servers.
951#[derive(Clone, Default, PartialEq)]
952#[non_exhaustive]
953pub struct ListInstancesResponse {
954 /// The list of servers.
955 pub instances: std::vec::Vec<crate::model::Instance>,
956
957 /// A token identifying a page of results from the server.
958 pub next_page_token: std::string::String,
959
960 /// Locations that could not be reached.
961 pub unreachable: std::vec::Vec<std::string::String>,
962
963 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
964}
965
966impl ListInstancesResponse {
967 pub fn new() -> Self {
968 std::default::Default::default()
969 }
970
971 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
972 ///
973 /// # Example
974 /// ```ignore,no_run
975 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
976 /// use google_cloud_baremetalsolution_v2::model::Instance;
977 /// let x = ListInstancesResponse::new()
978 /// .set_instances([
979 /// Instance::default()/* use setters */,
980 /// Instance::default()/* use (different) setters */,
981 /// ]);
982 /// ```
983 pub fn set_instances<T, V>(mut self, v: T) -> Self
984 where
985 T: std::iter::IntoIterator<Item = V>,
986 V: std::convert::Into<crate::model::Instance>,
987 {
988 use std::iter::Iterator;
989 self.instances = v.into_iter().map(|i| i.into()).collect();
990 self
991 }
992
993 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
994 ///
995 /// # Example
996 /// ```ignore,no_run
997 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
998 /// let x = ListInstancesResponse::new().set_next_page_token("example");
999 /// ```
1000 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1001 self.next_page_token = v.into();
1002 self
1003 }
1004
1005 /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
1006 ///
1007 /// # Example
1008 /// ```ignore,no_run
1009 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
1010 /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
1011 /// ```
1012 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1013 where
1014 T: std::iter::IntoIterator<Item = V>,
1015 V: std::convert::Into<std::string::String>,
1016 {
1017 use std::iter::Iterator;
1018 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1019 self
1020 }
1021}
1022
1023impl wkt::message::Message for ListInstancesResponse {
1024 fn typename() -> &'static str {
1025 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesResponse"
1026 }
1027}
1028
1029#[doc(hidden)]
1030impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
1031 type PageItem = crate::model::Instance;
1032
1033 fn items(self) -> std::vec::Vec<Self::PageItem> {
1034 self.instances
1035 }
1036
1037 fn next_page_token(&self) -> std::string::String {
1038 use std::clone::Clone;
1039 self.next_page_token.clone()
1040 }
1041}
1042
1043/// Message requesting to updating a server.
1044#[derive(Clone, Default, PartialEq)]
1045#[non_exhaustive]
1046pub struct UpdateInstanceRequest {
1047 /// Required. The server to update.
1048 ///
1049 /// The `name` field is used to identify the instance to update.
1050 /// Format: projects/{project}/locations/{location}/instances/{instance}
1051 pub instance: std::option::Option<crate::model::Instance>,
1052
1053 /// The list of fields to update.
1054 /// The currently supported fields are:
1055 /// `labels`
1056 /// `hyperthreading_enabled`
1057 /// `os_image`
1058 pub update_mask: std::option::Option<wkt::FieldMask>,
1059
1060 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1061}
1062
1063impl UpdateInstanceRequest {
1064 pub fn new() -> Self {
1065 std::default::Default::default()
1066 }
1067
1068 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
1069 ///
1070 /// # Example
1071 /// ```ignore,no_run
1072 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1073 /// use google_cloud_baremetalsolution_v2::model::Instance;
1074 /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
1075 /// ```
1076 pub fn set_instance<T>(mut self, v: T) -> Self
1077 where
1078 T: std::convert::Into<crate::model::Instance>,
1079 {
1080 self.instance = std::option::Option::Some(v.into());
1081 self
1082 }
1083
1084 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
1085 ///
1086 /// # Example
1087 /// ```ignore,no_run
1088 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1089 /// use google_cloud_baremetalsolution_v2::model::Instance;
1090 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
1091 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
1092 /// ```
1093 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1094 where
1095 T: std::convert::Into<crate::model::Instance>,
1096 {
1097 self.instance = v.map(|x| x.into());
1098 self
1099 }
1100
1101 /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1102 ///
1103 /// # Example
1104 /// ```ignore,no_run
1105 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1106 /// use wkt::FieldMask;
1107 /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1108 /// ```
1109 pub fn set_update_mask<T>(mut self, v: T) -> Self
1110 where
1111 T: std::convert::Into<wkt::FieldMask>,
1112 {
1113 self.update_mask = std::option::Option::Some(v.into());
1114 self
1115 }
1116
1117 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1118 ///
1119 /// # Example
1120 /// ```ignore,no_run
1121 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1122 /// use wkt::FieldMask;
1123 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1124 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1125 /// ```
1126 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1127 where
1128 T: std::convert::Into<wkt::FieldMask>,
1129 {
1130 self.update_mask = v.map(|x| x.into());
1131 self
1132 }
1133}
1134
1135impl wkt::message::Message for UpdateInstanceRequest {
1136 fn typename() -> &'static str {
1137 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateInstanceRequest"
1138 }
1139}
1140
1141/// Message requesting rename of a server.
1142#[derive(Clone, Default, PartialEq)]
1143#[non_exhaustive]
1144pub struct RenameInstanceRequest {
1145 /// Required. The `name` field is used to identify the instance.
1146 /// Format: projects/{project}/locations/{location}/instances/{instance}
1147 pub name: std::string::String,
1148
1149 /// Required. The new `id` of the instance.
1150 pub new_instance_id: std::string::String,
1151
1152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1153}
1154
1155impl RenameInstanceRequest {
1156 pub fn new() -> Self {
1157 std::default::Default::default()
1158 }
1159
1160 /// Sets the value of [name][crate::model::RenameInstanceRequest::name].
1161 ///
1162 /// # Example
1163 /// ```ignore,no_run
1164 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1165 /// let x = RenameInstanceRequest::new().set_name("example");
1166 /// ```
1167 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1168 self.name = v.into();
1169 self
1170 }
1171
1172 /// Sets the value of [new_instance_id][crate::model::RenameInstanceRequest::new_instance_id].
1173 ///
1174 /// # Example
1175 /// ```ignore,no_run
1176 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1177 /// let x = RenameInstanceRequest::new().set_new_instance_id("example");
1178 /// ```
1179 pub fn set_new_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1180 self.new_instance_id = v.into();
1181 self
1182 }
1183}
1184
1185impl wkt::message::Message for RenameInstanceRequest {
1186 fn typename() -> &'static str {
1187 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameInstanceRequest"
1188 }
1189}
1190
1191/// Message requesting to reset a server.
1192#[derive(Clone, Default, PartialEq)]
1193#[non_exhaustive]
1194pub struct ResetInstanceRequest {
1195 /// Required. Name of the resource.
1196 pub name: std::string::String,
1197
1198 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1199}
1200
1201impl ResetInstanceRequest {
1202 pub fn new() -> Self {
1203 std::default::Default::default()
1204 }
1205
1206 /// Sets the value of [name][crate::model::ResetInstanceRequest::name].
1207 ///
1208 /// # Example
1209 /// ```ignore,no_run
1210 /// # use google_cloud_baremetalsolution_v2::model::ResetInstanceRequest;
1211 /// let x = ResetInstanceRequest::new().set_name("example");
1212 /// ```
1213 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1214 self.name = v.into();
1215 self
1216 }
1217}
1218
1219impl wkt::message::Message for ResetInstanceRequest {
1220 fn typename() -> &'static str {
1221 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceRequest"
1222 }
1223}
1224
1225/// Message requesting to start a server.
1226#[derive(Clone, Default, PartialEq)]
1227#[non_exhaustive]
1228pub struct StartInstanceRequest {
1229 /// Required. Name of the resource.
1230 pub name: std::string::String,
1231
1232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1233}
1234
1235impl StartInstanceRequest {
1236 pub fn new() -> Self {
1237 std::default::Default::default()
1238 }
1239
1240 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
1241 ///
1242 /// # Example
1243 /// ```ignore,no_run
1244 /// # use google_cloud_baremetalsolution_v2::model::StartInstanceRequest;
1245 /// let x = StartInstanceRequest::new().set_name("example");
1246 /// ```
1247 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1248 self.name = v.into();
1249 self
1250 }
1251}
1252
1253impl wkt::message::Message for StartInstanceRequest {
1254 fn typename() -> &'static str {
1255 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceRequest"
1256 }
1257}
1258
1259/// Response message from starting a server.
1260#[derive(Clone, Default, PartialEq)]
1261#[non_exhaustive]
1262pub struct StartInstanceResponse {
1263 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1264}
1265
1266impl StartInstanceResponse {
1267 pub fn new() -> Self {
1268 std::default::Default::default()
1269 }
1270}
1271
1272impl wkt::message::Message for StartInstanceResponse {
1273 fn typename() -> &'static str {
1274 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceResponse"
1275 }
1276}
1277
1278/// Message requesting to stop a server.
1279#[derive(Clone, Default, PartialEq)]
1280#[non_exhaustive]
1281pub struct StopInstanceRequest {
1282 /// Required. Name of the resource.
1283 pub name: std::string::String,
1284
1285 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1286}
1287
1288impl StopInstanceRequest {
1289 pub fn new() -> Self {
1290 std::default::Default::default()
1291 }
1292
1293 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
1294 ///
1295 /// # Example
1296 /// ```ignore,no_run
1297 /// # use google_cloud_baremetalsolution_v2::model::StopInstanceRequest;
1298 /// let x = StopInstanceRequest::new().set_name("example");
1299 /// ```
1300 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1301 self.name = v.into();
1302 self
1303 }
1304}
1305
1306impl wkt::message::Message for StopInstanceRequest {
1307 fn typename() -> &'static str {
1308 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceRequest"
1309 }
1310}
1311
1312/// Response message from stopping a server.
1313#[derive(Clone, Default, PartialEq)]
1314#[non_exhaustive]
1315pub struct StopInstanceResponse {
1316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1317}
1318
1319impl StopInstanceResponse {
1320 pub fn new() -> Self {
1321 std::default::Default::default()
1322 }
1323}
1324
1325impl wkt::message::Message for StopInstanceResponse {
1326 fn typename() -> &'static str {
1327 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceResponse"
1328 }
1329}
1330
1331/// Message for enabling the interactive serial console on an instance.
1332#[derive(Clone, Default, PartialEq)]
1333#[non_exhaustive]
1334pub struct EnableInteractiveSerialConsoleRequest {
1335 /// Required. Name of the resource.
1336 pub name: std::string::String,
1337
1338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1339}
1340
1341impl EnableInteractiveSerialConsoleRequest {
1342 pub fn new() -> Self {
1343 std::default::Default::default()
1344 }
1345
1346 /// Sets the value of [name][crate::model::EnableInteractiveSerialConsoleRequest::name].
1347 ///
1348 /// # Example
1349 /// ```ignore,no_run
1350 /// # use google_cloud_baremetalsolution_v2::model::EnableInteractiveSerialConsoleRequest;
1351 /// let x = EnableInteractiveSerialConsoleRequest::new().set_name("example");
1352 /// ```
1353 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1354 self.name = v.into();
1355 self
1356 }
1357}
1358
1359impl wkt::message::Message for EnableInteractiveSerialConsoleRequest {
1360 fn typename() -> &'static str {
1361 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleRequest"
1362 }
1363}
1364
1365/// Message for response of EnableInteractiveSerialConsole.
1366#[derive(Clone, Default, PartialEq)]
1367#[non_exhaustive]
1368pub struct EnableInteractiveSerialConsoleResponse {
1369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1370}
1371
1372impl EnableInteractiveSerialConsoleResponse {
1373 pub fn new() -> Self {
1374 std::default::Default::default()
1375 }
1376}
1377
1378impl wkt::message::Message for EnableInteractiveSerialConsoleResponse {
1379 fn typename() -> &'static str {
1380 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleResponse"
1381 }
1382}
1383
1384/// Message for disabling the interactive serial console on an instance.
1385#[derive(Clone, Default, PartialEq)]
1386#[non_exhaustive]
1387pub struct DisableInteractiveSerialConsoleRequest {
1388 /// Required. Name of the resource.
1389 pub name: std::string::String,
1390
1391 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1392}
1393
1394impl DisableInteractiveSerialConsoleRequest {
1395 pub fn new() -> Self {
1396 std::default::Default::default()
1397 }
1398
1399 /// Sets the value of [name][crate::model::DisableInteractiveSerialConsoleRequest::name].
1400 ///
1401 /// # Example
1402 /// ```ignore,no_run
1403 /// # use google_cloud_baremetalsolution_v2::model::DisableInteractiveSerialConsoleRequest;
1404 /// let x = DisableInteractiveSerialConsoleRequest::new().set_name("example");
1405 /// ```
1406 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1407 self.name = v.into();
1408 self
1409 }
1410}
1411
1412impl wkt::message::Message for DisableInteractiveSerialConsoleRequest {
1413 fn typename() -> &'static str {
1414 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleRequest"
1415 }
1416}
1417
1418/// Message for response of DisableInteractiveSerialConsole.
1419#[derive(Clone, Default, PartialEq)]
1420#[non_exhaustive]
1421pub struct DisableInteractiveSerialConsoleResponse {
1422 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1423}
1424
1425impl DisableInteractiveSerialConsoleResponse {
1426 pub fn new() -> Self {
1427 std::default::Default::default()
1428 }
1429}
1430
1431impl wkt::message::Message for DisableInteractiveSerialConsoleResponse {
1432 fn typename() -> &'static str {
1433 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleResponse"
1434 }
1435}
1436
1437/// Message for detach specific LUN from an Instance.
1438#[derive(Clone, Default, PartialEq)]
1439#[non_exhaustive]
1440pub struct DetachLunRequest {
1441 /// Required. Name of the instance.
1442 pub instance: std::string::String,
1443
1444 /// Required. Name of the Lun to detach.
1445 pub lun: std::string::String,
1446
1447 /// If true, performs lun unmapping without instance reboot.
1448 pub skip_reboot: bool,
1449
1450 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1451}
1452
1453impl DetachLunRequest {
1454 pub fn new() -> Self {
1455 std::default::Default::default()
1456 }
1457
1458 /// Sets the value of [instance][crate::model::DetachLunRequest::instance].
1459 ///
1460 /// # Example
1461 /// ```ignore,no_run
1462 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1463 /// let x = DetachLunRequest::new().set_instance("example");
1464 /// ```
1465 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1466 self.instance = v.into();
1467 self
1468 }
1469
1470 /// Sets the value of [lun][crate::model::DetachLunRequest::lun].
1471 ///
1472 /// # Example
1473 /// ```ignore,no_run
1474 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1475 /// let x = DetachLunRequest::new().set_lun("example");
1476 /// ```
1477 pub fn set_lun<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1478 self.lun = v.into();
1479 self
1480 }
1481
1482 /// Sets the value of [skip_reboot][crate::model::DetachLunRequest::skip_reboot].
1483 ///
1484 /// # Example
1485 /// ```ignore,no_run
1486 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1487 /// let x = DetachLunRequest::new().set_skip_reboot(true);
1488 /// ```
1489 pub fn set_skip_reboot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1490 self.skip_reboot = v.into();
1491 self
1492 }
1493}
1494
1495impl wkt::message::Message for DetachLunRequest {
1496 fn typename() -> &'static str {
1497 "type.googleapis.com/google.cloud.baremetalsolution.v2.DetachLunRequest"
1498 }
1499}
1500
1501/// Network template.
1502#[derive(Clone, Default, PartialEq)]
1503#[non_exhaustive]
1504pub struct ServerNetworkTemplate {
1505 /// Output only. Template's unique name. The full resource name follows the
1506 /// pattern:
1507 /// `projects/{project}/locations/{location}/serverNetworkTemplate/{server_network_template}`
1508 /// Generally, the {server_network_template} follows the syntax of
1509 /// "bond<interface_type_index><bond_mode>" or "nic<interface_type_index>".
1510 pub name: std::string::String,
1511
1512 /// Instance types this template is applicable to.
1513 pub applicable_instance_types: std::vec::Vec<std::string::String>,
1514
1515 /// Logical interfaces.
1516 pub logical_interfaces: std::vec::Vec<crate::model::server_network_template::LogicalInterface>,
1517
1518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1519}
1520
1521impl ServerNetworkTemplate {
1522 pub fn new() -> Self {
1523 std::default::Default::default()
1524 }
1525
1526 /// Sets the value of [name][crate::model::ServerNetworkTemplate::name].
1527 ///
1528 /// # Example
1529 /// ```ignore,no_run
1530 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1531 /// let x = ServerNetworkTemplate::new().set_name("example");
1532 /// ```
1533 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1534 self.name = v.into();
1535 self
1536 }
1537
1538 /// Sets the value of [applicable_instance_types][crate::model::ServerNetworkTemplate::applicable_instance_types].
1539 ///
1540 /// # Example
1541 /// ```ignore,no_run
1542 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1543 /// let x = ServerNetworkTemplate::new().set_applicable_instance_types(["a", "b", "c"]);
1544 /// ```
1545 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
1546 where
1547 T: std::iter::IntoIterator<Item = V>,
1548 V: std::convert::Into<std::string::String>,
1549 {
1550 use std::iter::Iterator;
1551 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
1552 self
1553 }
1554
1555 /// Sets the value of [logical_interfaces][crate::model::ServerNetworkTemplate::logical_interfaces].
1556 ///
1557 /// # Example
1558 /// ```ignore,no_run
1559 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1560 /// use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1561 /// let x = ServerNetworkTemplate::new()
1562 /// .set_logical_interfaces([
1563 /// LogicalInterface::default()/* use setters */,
1564 /// LogicalInterface::default()/* use (different) setters */,
1565 /// ]);
1566 /// ```
1567 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
1568 where
1569 T: std::iter::IntoIterator<Item = V>,
1570 V: std::convert::Into<crate::model::server_network_template::LogicalInterface>,
1571 {
1572 use std::iter::Iterator;
1573 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
1574 self
1575 }
1576}
1577
1578impl wkt::message::Message for ServerNetworkTemplate {
1579 fn typename() -> &'static str {
1580 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate"
1581 }
1582}
1583
1584/// Defines additional types related to [ServerNetworkTemplate].
1585pub mod server_network_template {
1586 #[allow(unused_imports)]
1587 use super::*;
1588
1589 /// Logical interface.
1590 #[derive(Clone, Default, PartialEq)]
1591 #[non_exhaustive]
1592 pub struct LogicalInterface {
1593 /// Interface name.
1594 /// This is not a globally unique identifier.
1595 /// Name is unique only inside the ServerNetworkTemplate. This is of syntax
1596 /// \<bond\><interface_type_index><bond_mode> or \<nic\><interface_type_index>
1597 /// and forms part of the network template name.
1598 pub name: std::string::String,
1599
1600 /// Interface type.
1601 pub r#type: crate::model::server_network_template::logical_interface::InterfaceType,
1602
1603 /// If true, interface must have network connected.
1604 pub required: bool,
1605
1606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1607 }
1608
1609 impl LogicalInterface {
1610 pub fn new() -> Self {
1611 std::default::Default::default()
1612 }
1613
1614 /// Sets the value of [name][crate::model::server_network_template::LogicalInterface::name].
1615 ///
1616 /// # Example
1617 /// ```ignore,no_run
1618 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1619 /// let x = LogicalInterface::new().set_name("example");
1620 /// ```
1621 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1622 self.name = v.into();
1623 self
1624 }
1625
1626 /// Sets the value of [r#type][crate::model::server_network_template::LogicalInterface::type].
1627 ///
1628 /// # Example
1629 /// ```ignore,no_run
1630 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1631 /// use google_cloud_baremetalsolution_v2::model::server_network_template::logical_interface::InterfaceType;
1632 /// let x0 = LogicalInterface::new().set_type(InterfaceType::Bond);
1633 /// let x1 = LogicalInterface::new().set_type(InterfaceType::Nic);
1634 /// ```
1635 pub fn set_type<
1636 T: std::convert::Into<
1637 crate::model::server_network_template::logical_interface::InterfaceType,
1638 >,
1639 >(
1640 mut self,
1641 v: T,
1642 ) -> Self {
1643 self.r#type = v.into();
1644 self
1645 }
1646
1647 /// Sets the value of [required][crate::model::server_network_template::LogicalInterface::required].
1648 ///
1649 /// # Example
1650 /// ```ignore,no_run
1651 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1652 /// let x = LogicalInterface::new().set_required(true);
1653 /// ```
1654 pub fn set_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1655 self.required = v.into();
1656 self
1657 }
1658 }
1659
1660 impl wkt::message::Message for LogicalInterface {
1661 fn typename() -> &'static str {
1662 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface"
1663 }
1664 }
1665
1666 /// Defines additional types related to [LogicalInterface].
1667 pub mod logical_interface {
1668 #[allow(unused_imports)]
1669 use super::*;
1670
1671 /// Interface type.
1672 ///
1673 /// # Working with unknown values
1674 ///
1675 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1676 /// additional enum variants at any time. Adding new variants is not considered
1677 /// a breaking change. Applications should write their code in anticipation of:
1678 ///
1679 /// - New values appearing in future releases of the client library, **and**
1680 /// - New values received dynamically, without application changes.
1681 ///
1682 /// Please consult the [Working with enums] section in the user guide for some
1683 /// guidelines.
1684 ///
1685 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1686 #[derive(Clone, Debug, PartialEq)]
1687 #[non_exhaustive]
1688 pub enum InterfaceType {
1689 /// Unspecified value.
1690 Unspecified,
1691 /// Bond interface type.
1692 Bond,
1693 /// NIC interface type.
1694 Nic,
1695 /// If set, the enum was initialized with an unknown value.
1696 ///
1697 /// Applications can examine the value using [InterfaceType::value] or
1698 /// [InterfaceType::name].
1699 UnknownValue(interface_type::UnknownValue),
1700 }
1701
1702 #[doc(hidden)]
1703 pub mod interface_type {
1704 #[allow(unused_imports)]
1705 use super::*;
1706 #[derive(Clone, Debug, PartialEq)]
1707 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1708 }
1709
1710 impl InterfaceType {
1711 /// Gets the enum value.
1712 ///
1713 /// Returns `None` if the enum contains an unknown value deserialized from
1714 /// the string representation of enums.
1715 pub fn value(&self) -> std::option::Option<i32> {
1716 match self {
1717 Self::Unspecified => std::option::Option::Some(0),
1718 Self::Bond => std::option::Option::Some(1),
1719 Self::Nic => std::option::Option::Some(2),
1720 Self::UnknownValue(u) => u.0.value(),
1721 }
1722 }
1723
1724 /// Gets the enum value as a string.
1725 ///
1726 /// Returns `None` if the enum contains an unknown value deserialized from
1727 /// the integer representation of enums.
1728 pub fn name(&self) -> std::option::Option<&str> {
1729 match self {
1730 Self::Unspecified => std::option::Option::Some("INTERFACE_TYPE_UNSPECIFIED"),
1731 Self::Bond => std::option::Option::Some("BOND"),
1732 Self::Nic => std::option::Option::Some("NIC"),
1733 Self::UnknownValue(u) => u.0.name(),
1734 }
1735 }
1736 }
1737
1738 impl std::default::Default for InterfaceType {
1739 fn default() -> Self {
1740 use std::convert::From;
1741 Self::from(0)
1742 }
1743 }
1744
1745 impl std::fmt::Display for InterfaceType {
1746 fn fmt(
1747 &self,
1748 f: &mut std::fmt::Formatter<'_>,
1749 ) -> std::result::Result<(), std::fmt::Error> {
1750 wkt::internal::display_enum(f, self.name(), self.value())
1751 }
1752 }
1753
1754 impl std::convert::From<i32> for InterfaceType {
1755 fn from(value: i32) -> Self {
1756 match value {
1757 0 => Self::Unspecified,
1758 1 => Self::Bond,
1759 2 => Self::Nic,
1760 _ => Self::UnknownValue(interface_type::UnknownValue(
1761 wkt::internal::UnknownEnumValue::Integer(value),
1762 )),
1763 }
1764 }
1765 }
1766
1767 impl std::convert::From<&str> for InterfaceType {
1768 fn from(value: &str) -> Self {
1769 use std::string::ToString;
1770 match value {
1771 "INTERFACE_TYPE_UNSPECIFIED" => Self::Unspecified,
1772 "BOND" => Self::Bond,
1773 "NIC" => Self::Nic,
1774 _ => Self::UnknownValue(interface_type::UnknownValue(
1775 wkt::internal::UnknownEnumValue::String(value.to_string()),
1776 )),
1777 }
1778 }
1779 }
1780
1781 impl serde::ser::Serialize for InterfaceType {
1782 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1783 where
1784 S: serde::Serializer,
1785 {
1786 match self {
1787 Self::Unspecified => serializer.serialize_i32(0),
1788 Self::Bond => serializer.serialize_i32(1),
1789 Self::Nic => serializer.serialize_i32(2),
1790 Self::UnknownValue(u) => u.0.serialize(serializer),
1791 }
1792 }
1793 }
1794
1795 impl<'de> serde::de::Deserialize<'de> for InterfaceType {
1796 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1797 where
1798 D: serde::Deserializer<'de>,
1799 {
1800 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InterfaceType>::new(
1801 ".google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface.InterfaceType"))
1802 }
1803 }
1804 }
1805}
1806
1807/// A storage volume logical unit number (LUN).
1808#[derive(Clone, Default, PartialEq)]
1809#[non_exhaustive]
1810pub struct Lun {
1811 /// Output only. The name of the LUN.
1812 pub name: std::string::String,
1813
1814 /// An identifier for the LUN, generated by the backend.
1815 pub id: std::string::String,
1816
1817 /// The state of this storage volume.
1818 pub state: crate::model::lun::State,
1819
1820 /// The size of this LUN, in gigabytes.
1821 pub size_gb: i64,
1822
1823 /// The LUN multiprotocol type ensures the characteristics of the LUN are
1824 /// optimized for each operating system.
1825 pub multiprotocol_type: crate::model::lun::MultiprotocolType,
1826
1827 /// Display the storage volume for this LUN.
1828 pub storage_volume: std::string::String,
1829
1830 /// Display if this LUN can be shared between multiple physical servers.
1831 pub shareable: bool,
1832
1833 /// Display if this LUN is a boot LUN.
1834 pub boot_lun: bool,
1835
1836 /// The storage type for this LUN.
1837 pub storage_type: crate::model::lun::StorageType,
1838
1839 /// The WWID for this LUN.
1840 pub wwid: std::string::String,
1841
1842 /// Output only. Time after which LUN will be fully deleted.
1843 /// It is filled only for LUNs in COOL_OFF state.
1844 pub expire_time: std::option::Option<wkt::Timestamp>,
1845
1846 /// Output only. Instances this Lun is attached to.
1847 pub instances: std::vec::Vec<std::string::String>,
1848
1849 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1850}
1851
1852impl Lun {
1853 pub fn new() -> Self {
1854 std::default::Default::default()
1855 }
1856
1857 /// Sets the value of [name][crate::model::Lun::name].
1858 ///
1859 /// # Example
1860 /// ```ignore,no_run
1861 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1862 /// let x = Lun::new().set_name("example");
1863 /// ```
1864 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1865 self.name = v.into();
1866 self
1867 }
1868
1869 /// Sets the value of [id][crate::model::Lun::id].
1870 ///
1871 /// # Example
1872 /// ```ignore,no_run
1873 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1874 /// let x = Lun::new().set_id("example");
1875 /// ```
1876 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1877 self.id = v.into();
1878 self
1879 }
1880
1881 /// Sets the value of [state][crate::model::Lun::state].
1882 ///
1883 /// # Example
1884 /// ```ignore,no_run
1885 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1886 /// use google_cloud_baremetalsolution_v2::model::lun::State;
1887 /// let x0 = Lun::new().set_state(State::Creating);
1888 /// let x1 = Lun::new().set_state(State::Updating);
1889 /// let x2 = Lun::new().set_state(State::Ready);
1890 /// ```
1891 pub fn set_state<T: std::convert::Into<crate::model::lun::State>>(mut self, v: T) -> Self {
1892 self.state = v.into();
1893 self
1894 }
1895
1896 /// Sets the value of [size_gb][crate::model::Lun::size_gb].
1897 ///
1898 /// # Example
1899 /// ```ignore,no_run
1900 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1901 /// let x = Lun::new().set_size_gb(42);
1902 /// ```
1903 pub fn set_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1904 self.size_gb = v.into();
1905 self
1906 }
1907
1908 /// Sets the value of [multiprotocol_type][crate::model::Lun::multiprotocol_type].
1909 ///
1910 /// # Example
1911 /// ```ignore,no_run
1912 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1913 /// use google_cloud_baremetalsolution_v2::model::lun::MultiprotocolType;
1914 /// let x0 = Lun::new().set_multiprotocol_type(MultiprotocolType::Linux);
1915 /// ```
1916 pub fn set_multiprotocol_type<T: std::convert::Into<crate::model::lun::MultiprotocolType>>(
1917 mut self,
1918 v: T,
1919 ) -> Self {
1920 self.multiprotocol_type = v.into();
1921 self
1922 }
1923
1924 /// Sets the value of [storage_volume][crate::model::Lun::storage_volume].
1925 ///
1926 /// # Example
1927 /// ```ignore,no_run
1928 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1929 /// let x = Lun::new().set_storage_volume("example");
1930 /// ```
1931 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1932 self.storage_volume = v.into();
1933 self
1934 }
1935
1936 /// Sets the value of [shareable][crate::model::Lun::shareable].
1937 ///
1938 /// # Example
1939 /// ```ignore,no_run
1940 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1941 /// let x = Lun::new().set_shareable(true);
1942 /// ```
1943 pub fn set_shareable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1944 self.shareable = v.into();
1945 self
1946 }
1947
1948 /// Sets the value of [boot_lun][crate::model::Lun::boot_lun].
1949 ///
1950 /// # Example
1951 /// ```ignore,no_run
1952 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1953 /// let x = Lun::new().set_boot_lun(true);
1954 /// ```
1955 pub fn set_boot_lun<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1956 self.boot_lun = v.into();
1957 self
1958 }
1959
1960 /// Sets the value of [storage_type][crate::model::Lun::storage_type].
1961 ///
1962 /// # Example
1963 /// ```ignore,no_run
1964 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1965 /// use google_cloud_baremetalsolution_v2::model::lun::StorageType;
1966 /// let x0 = Lun::new().set_storage_type(StorageType::Ssd);
1967 /// let x1 = Lun::new().set_storage_type(StorageType::Hdd);
1968 /// ```
1969 pub fn set_storage_type<T: std::convert::Into<crate::model::lun::StorageType>>(
1970 mut self,
1971 v: T,
1972 ) -> Self {
1973 self.storage_type = v.into();
1974 self
1975 }
1976
1977 /// Sets the value of [wwid][crate::model::Lun::wwid].
1978 ///
1979 /// # Example
1980 /// ```ignore,no_run
1981 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1982 /// let x = Lun::new().set_wwid("example");
1983 /// ```
1984 pub fn set_wwid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1985 self.wwid = v.into();
1986 self
1987 }
1988
1989 /// Sets the value of [expire_time][crate::model::Lun::expire_time].
1990 ///
1991 /// # Example
1992 /// ```ignore,no_run
1993 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1994 /// use wkt::Timestamp;
1995 /// let x = Lun::new().set_expire_time(Timestamp::default()/* use setters */);
1996 /// ```
1997 pub fn set_expire_time<T>(mut self, v: T) -> Self
1998 where
1999 T: std::convert::Into<wkt::Timestamp>,
2000 {
2001 self.expire_time = std::option::Option::Some(v.into());
2002 self
2003 }
2004
2005 /// Sets or clears the value of [expire_time][crate::model::Lun::expire_time].
2006 ///
2007 /// # Example
2008 /// ```ignore,no_run
2009 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2010 /// use wkt::Timestamp;
2011 /// let x = Lun::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2012 /// let x = Lun::new().set_or_clear_expire_time(None::<Timestamp>);
2013 /// ```
2014 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2015 where
2016 T: std::convert::Into<wkt::Timestamp>,
2017 {
2018 self.expire_time = v.map(|x| x.into());
2019 self
2020 }
2021
2022 /// Sets the value of [instances][crate::model::Lun::instances].
2023 ///
2024 /// # Example
2025 /// ```ignore,no_run
2026 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2027 /// let x = Lun::new().set_instances(["a", "b", "c"]);
2028 /// ```
2029 pub fn set_instances<T, V>(mut self, v: T) -> Self
2030 where
2031 T: std::iter::IntoIterator<Item = V>,
2032 V: std::convert::Into<std::string::String>,
2033 {
2034 use std::iter::Iterator;
2035 self.instances = v.into_iter().map(|i| i.into()).collect();
2036 self
2037 }
2038}
2039
2040impl wkt::message::Message for Lun {
2041 fn typename() -> &'static str {
2042 "type.googleapis.com/google.cloud.baremetalsolution.v2.Lun"
2043 }
2044}
2045
2046/// Defines additional types related to [Lun].
2047pub mod lun {
2048 #[allow(unused_imports)]
2049 use super::*;
2050
2051 /// The possible states for the LUN.
2052 ///
2053 /// # Working with unknown values
2054 ///
2055 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2056 /// additional enum variants at any time. Adding new variants is not considered
2057 /// a breaking change. Applications should write their code in anticipation of:
2058 ///
2059 /// - New values appearing in future releases of the client library, **and**
2060 /// - New values received dynamically, without application changes.
2061 ///
2062 /// Please consult the [Working with enums] section in the user guide for some
2063 /// guidelines.
2064 ///
2065 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2066 #[derive(Clone, Debug, PartialEq)]
2067 #[non_exhaustive]
2068 pub enum State {
2069 /// The LUN is in an unknown state.
2070 Unspecified,
2071 /// The LUN is being created.
2072 Creating,
2073 /// The LUN is being updated.
2074 Updating,
2075 /// The LUN is ready for use.
2076 Ready,
2077 /// The LUN has been requested to be deleted.
2078 Deleting,
2079 /// The LUN is in cool off state. It will be deleted after `expire_time`.
2080 CoolOff,
2081 /// If set, the enum was initialized with an unknown value.
2082 ///
2083 /// Applications can examine the value using [State::value] or
2084 /// [State::name].
2085 UnknownValue(state::UnknownValue),
2086 }
2087
2088 #[doc(hidden)]
2089 pub mod state {
2090 #[allow(unused_imports)]
2091 use super::*;
2092 #[derive(Clone, Debug, PartialEq)]
2093 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2094 }
2095
2096 impl State {
2097 /// Gets the enum value.
2098 ///
2099 /// Returns `None` if the enum contains an unknown value deserialized from
2100 /// the string representation of enums.
2101 pub fn value(&self) -> std::option::Option<i32> {
2102 match self {
2103 Self::Unspecified => std::option::Option::Some(0),
2104 Self::Creating => std::option::Option::Some(1),
2105 Self::Updating => std::option::Option::Some(2),
2106 Self::Ready => std::option::Option::Some(3),
2107 Self::Deleting => std::option::Option::Some(4),
2108 Self::CoolOff => std::option::Option::Some(5),
2109 Self::UnknownValue(u) => u.0.value(),
2110 }
2111 }
2112
2113 /// Gets the enum value as a string.
2114 ///
2115 /// Returns `None` if the enum contains an unknown value deserialized from
2116 /// the integer representation of enums.
2117 pub fn name(&self) -> std::option::Option<&str> {
2118 match self {
2119 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2120 Self::Creating => std::option::Option::Some("CREATING"),
2121 Self::Updating => std::option::Option::Some("UPDATING"),
2122 Self::Ready => std::option::Option::Some("READY"),
2123 Self::Deleting => std::option::Option::Some("DELETING"),
2124 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
2125 Self::UnknownValue(u) => u.0.name(),
2126 }
2127 }
2128 }
2129
2130 impl std::default::Default for State {
2131 fn default() -> Self {
2132 use std::convert::From;
2133 Self::from(0)
2134 }
2135 }
2136
2137 impl std::fmt::Display for State {
2138 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2139 wkt::internal::display_enum(f, self.name(), self.value())
2140 }
2141 }
2142
2143 impl std::convert::From<i32> for State {
2144 fn from(value: i32) -> Self {
2145 match value {
2146 0 => Self::Unspecified,
2147 1 => Self::Creating,
2148 2 => Self::Updating,
2149 3 => Self::Ready,
2150 4 => Self::Deleting,
2151 5 => Self::CoolOff,
2152 _ => Self::UnknownValue(state::UnknownValue(
2153 wkt::internal::UnknownEnumValue::Integer(value),
2154 )),
2155 }
2156 }
2157 }
2158
2159 impl std::convert::From<&str> for State {
2160 fn from(value: &str) -> Self {
2161 use std::string::ToString;
2162 match value {
2163 "STATE_UNSPECIFIED" => Self::Unspecified,
2164 "CREATING" => Self::Creating,
2165 "UPDATING" => Self::Updating,
2166 "READY" => Self::Ready,
2167 "DELETING" => Self::Deleting,
2168 "COOL_OFF" => Self::CoolOff,
2169 _ => Self::UnknownValue(state::UnknownValue(
2170 wkt::internal::UnknownEnumValue::String(value.to_string()),
2171 )),
2172 }
2173 }
2174 }
2175
2176 impl serde::ser::Serialize for State {
2177 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2178 where
2179 S: serde::Serializer,
2180 {
2181 match self {
2182 Self::Unspecified => serializer.serialize_i32(0),
2183 Self::Creating => serializer.serialize_i32(1),
2184 Self::Updating => serializer.serialize_i32(2),
2185 Self::Ready => serializer.serialize_i32(3),
2186 Self::Deleting => serializer.serialize_i32(4),
2187 Self::CoolOff => serializer.serialize_i32(5),
2188 Self::UnknownValue(u) => u.0.serialize(serializer),
2189 }
2190 }
2191 }
2192
2193 impl<'de> serde::de::Deserialize<'de> for State {
2194 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2195 where
2196 D: serde::Deserializer<'de>,
2197 {
2198 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2199 ".google.cloud.baremetalsolution.v2.Lun.State",
2200 ))
2201 }
2202 }
2203
2204 /// Display the operating systems present for the LUN multiprotocol type.
2205 ///
2206 /// # Working with unknown values
2207 ///
2208 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2209 /// additional enum variants at any time. Adding new variants is not considered
2210 /// a breaking change. Applications should write their code in anticipation of:
2211 ///
2212 /// - New values appearing in future releases of the client library, **and**
2213 /// - New values received dynamically, without application changes.
2214 ///
2215 /// Please consult the [Working with enums] section in the user guide for some
2216 /// guidelines.
2217 ///
2218 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2219 #[derive(Clone, Debug, PartialEq)]
2220 #[non_exhaustive]
2221 pub enum MultiprotocolType {
2222 /// Server has no OS specified.
2223 Unspecified,
2224 /// Server with Linux OS.
2225 Linux,
2226 /// If set, the enum was initialized with an unknown value.
2227 ///
2228 /// Applications can examine the value using [MultiprotocolType::value] or
2229 /// [MultiprotocolType::name].
2230 UnknownValue(multiprotocol_type::UnknownValue),
2231 }
2232
2233 #[doc(hidden)]
2234 pub mod multiprotocol_type {
2235 #[allow(unused_imports)]
2236 use super::*;
2237 #[derive(Clone, Debug, PartialEq)]
2238 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2239 }
2240
2241 impl MultiprotocolType {
2242 /// Gets the enum value.
2243 ///
2244 /// Returns `None` if the enum contains an unknown value deserialized from
2245 /// the string representation of enums.
2246 pub fn value(&self) -> std::option::Option<i32> {
2247 match self {
2248 Self::Unspecified => std::option::Option::Some(0),
2249 Self::Linux => std::option::Option::Some(1),
2250 Self::UnknownValue(u) => u.0.value(),
2251 }
2252 }
2253
2254 /// Gets the enum value as a string.
2255 ///
2256 /// Returns `None` if the enum contains an unknown value deserialized from
2257 /// the integer representation of enums.
2258 pub fn name(&self) -> std::option::Option<&str> {
2259 match self {
2260 Self::Unspecified => std::option::Option::Some("MULTIPROTOCOL_TYPE_UNSPECIFIED"),
2261 Self::Linux => std::option::Option::Some("LINUX"),
2262 Self::UnknownValue(u) => u.0.name(),
2263 }
2264 }
2265 }
2266
2267 impl std::default::Default for MultiprotocolType {
2268 fn default() -> Self {
2269 use std::convert::From;
2270 Self::from(0)
2271 }
2272 }
2273
2274 impl std::fmt::Display for MultiprotocolType {
2275 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2276 wkt::internal::display_enum(f, self.name(), self.value())
2277 }
2278 }
2279
2280 impl std::convert::From<i32> for MultiprotocolType {
2281 fn from(value: i32) -> Self {
2282 match value {
2283 0 => Self::Unspecified,
2284 1 => Self::Linux,
2285 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2286 wkt::internal::UnknownEnumValue::Integer(value),
2287 )),
2288 }
2289 }
2290 }
2291
2292 impl std::convert::From<&str> for MultiprotocolType {
2293 fn from(value: &str) -> Self {
2294 use std::string::ToString;
2295 match value {
2296 "MULTIPROTOCOL_TYPE_UNSPECIFIED" => Self::Unspecified,
2297 "LINUX" => Self::Linux,
2298 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2299 wkt::internal::UnknownEnumValue::String(value.to_string()),
2300 )),
2301 }
2302 }
2303 }
2304
2305 impl serde::ser::Serialize for MultiprotocolType {
2306 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2307 where
2308 S: serde::Serializer,
2309 {
2310 match self {
2311 Self::Unspecified => serializer.serialize_i32(0),
2312 Self::Linux => serializer.serialize_i32(1),
2313 Self::UnknownValue(u) => u.0.serialize(serializer),
2314 }
2315 }
2316 }
2317
2318 impl<'de> serde::de::Deserialize<'de> for MultiprotocolType {
2319 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2320 where
2321 D: serde::Deserializer<'de>,
2322 {
2323 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MultiprotocolType>::new(
2324 ".google.cloud.baremetalsolution.v2.Lun.MultiprotocolType",
2325 ))
2326 }
2327 }
2328
2329 /// The storage types for a LUN.
2330 ///
2331 /// # Working with unknown values
2332 ///
2333 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2334 /// additional enum variants at any time. Adding new variants is not considered
2335 /// a breaking change. Applications should write their code in anticipation of:
2336 ///
2337 /// - New values appearing in future releases of the client library, **and**
2338 /// - New values received dynamically, without application changes.
2339 ///
2340 /// Please consult the [Working with enums] section in the user guide for some
2341 /// guidelines.
2342 ///
2343 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2344 #[derive(Clone, Debug, PartialEq)]
2345 #[non_exhaustive]
2346 pub enum StorageType {
2347 /// The storage type for this LUN is unknown.
2348 Unspecified,
2349 /// This storage type for this LUN is SSD.
2350 Ssd,
2351 /// This storage type for this LUN is HDD.
2352 Hdd,
2353 /// If set, the enum was initialized with an unknown value.
2354 ///
2355 /// Applications can examine the value using [StorageType::value] or
2356 /// [StorageType::name].
2357 UnknownValue(storage_type::UnknownValue),
2358 }
2359
2360 #[doc(hidden)]
2361 pub mod storage_type {
2362 #[allow(unused_imports)]
2363 use super::*;
2364 #[derive(Clone, Debug, PartialEq)]
2365 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2366 }
2367
2368 impl StorageType {
2369 /// Gets the enum value.
2370 ///
2371 /// Returns `None` if the enum contains an unknown value deserialized from
2372 /// the string representation of enums.
2373 pub fn value(&self) -> std::option::Option<i32> {
2374 match self {
2375 Self::Unspecified => std::option::Option::Some(0),
2376 Self::Ssd => std::option::Option::Some(1),
2377 Self::Hdd => std::option::Option::Some(2),
2378 Self::UnknownValue(u) => u.0.value(),
2379 }
2380 }
2381
2382 /// Gets the enum value as a string.
2383 ///
2384 /// Returns `None` if the enum contains an unknown value deserialized from
2385 /// the integer representation of enums.
2386 pub fn name(&self) -> std::option::Option<&str> {
2387 match self {
2388 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
2389 Self::Ssd => std::option::Option::Some("SSD"),
2390 Self::Hdd => std::option::Option::Some("HDD"),
2391 Self::UnknownValue(u) => u.0.name(),
2392 }
2393 }
2394 }
2395
2396 impl std::default::Default for StorageType {
2397 fn default() -> Self {
2398 use std::convert::From;
2399 Self::from(0)
2400 }
2401 }
2402
2403 impl std::fmt::Display for StorageType {
2404 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2405 wkt::internal::display_enum(f, self.name(), self.value())
2406 }
2407 }
2408
2409 impl std::convert::From<i32> for StorageType {
2410 fn from(value: i32) -> Self {
2411 match value {
2412 0 => Self::Unspecified,
2413 1 => Self::Ssd,
2414 2 => Self::Hdd,
2415 _ => Self::UnknownValue(storage_type::UnknownValue(
2416 wkt::internal::UnknownEnumValue::Integer(value),
2417 )),
2418 }
2419 }
2420 }
2421
2422 impl std::convert::From<&str> for StorageType {
2423 fn from(value: &str) -> Self {
2424 use std::string::ToString;
2425 match value {
2426 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
2427 "SSD" => Self::Ssd,
2428 "HDD" => Self::Hdd,
2429 _ => Self::UnknownValue(storage_type::UnknownValue(
2430 wkt::internal::UnknownEnumValue::String(value.to_string()),
2431 )),
2432 }
2433 }
2434 }
2435
2436 impl serde::ser::Serialize for StorageType {
2437 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2438 where
2439 S: serde::Serializer,
2440 {
2441 match self {
2442 Self::Unspecified => serializer.serialize_i32(0),
2443 Self::Ssd => serializer.serialize_i32(1),
2444 Self::Hdd => serializer.serialize_i32(2),
2445 Self::UnknownValue(u) => u.0.serialize(serializer),
2446 }
2447 }
2448 }
2449
2450 impl<'de> serde::de::Deserialize<'de> for StorageType {
2451 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2452 where
2453 D: serde::Deserializer<'de>,
2454 {
2455 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
2456 ".google.cloud.baremetalsolution.v2.Lun.StorageType",
2457 ))
2458 }
2459 }
2460}
2461
2462/// Message for requesting storage lun information.
2463#[derive(Clone, Default, PartialEq)]
2464#[non_exhaustive]
2465pub struct GetLunRequest {
2466 /// Required. Name of the resource.
2467 pub name: std::string::String,
2468
2469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2470}
2471
2472impl GetLunRequest {
2473 pub fn new() -> Self {
2474 std::default::Default::default()
2475 }
2476
2477 /// Sets the value of [name][crate::model::GetLunRequest::name].
2478 ///
2479 /// # Example
2480 /// ```ignore,no_run
2481 /// # use google_cloud_baremetalsolution_v2::model::GetLunRequest;
2482 /// let x = GetLunRequest::new().set_name("example");
2483 /// ```
2484 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2485 self.name = v.into();
2486 self
2487 }
2488}
2489
2490impl wkt::message::Message for GetLunRequest {
2491 fn typename() -> &'static str {
2492 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetLunRequest"
2493 }
2494}
2495
2496/// Message for requesting a list of storage volume luns.
2497#[derive(Clone, Default, PartialEq)]
2498#[non_exhaustive]
2499pub struct ListLunsRequest {
2500 /// Required. Parent value for ListLunsRequest.
2501 pub parent: std::string::String,
2502
2503 /// Requested page size. The server might return fewer items than requested.
2504 /// If unspecified, server will pick an appropriate default.
2505 pub page_size: i32,
2506
2507 /// A token identifying a page of results from the server.
2508 pub page_token: std::string::String,
2509
2510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2511}
2512
2513impl ListLunsRequest {
2514 pub fn new() -> Self {
2515 std::default::Default::default()
2516 }
2517
2518 /// Sets the value of [parent][crate::model::ListLunsRequest::parent].
2519 ///
2520 /// # Example
2521 /// ```ignore,no_run
2522 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2523 /// let x = ListLunsRequest::new().set_parent("example");
2524 /// ```
2525 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2526 self.parent = v.into();
2527 self
2528 }
2529
2530 /// Sets the value of [page_size][crate::model::ListLunsRequest::page_size].
2531 ///
2532 /// # Example
2533 /// ```ignore,no_run
2534 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2535 /// let x = ListLunsRequest::new().set_page_size(42);
2536 /// ```
2537 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2538 self.page_size = v.into();
2539 self
2540 }
2541
2542 /// Sets the value of [page_token][crate::model::ListLunsRequest::page_token].
2543 ///
2544 /// # Example
2545 /// ```ignore,no_run
2546 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2547 /// let x = ListLunsRequest::new().set_page_token("example");
2548 /// ```
2549 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2550 self.page_token = v.into();
2551 self
2552 }
2553}
2554
2555impl wkt::message::Message for ListLunsRequest {
2556 fn typename() -> &'static str {
2557 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsRequest"
2558 }
2559}
2560
2561/// Response message containing the list of storage volume luns.
2562#[derive(Clone, Default, PartialEq)]
2563#[non_exhaustive]
2564pub struct ListLunsResponse {
2565 /// The list of luns.
2566 pub luns: std::vec::Vec<crate::model::Lun>,
2567
2568 /// A token identifying a page of results from the server.
2569 pub next_page_token: std::string::String,
2570
2571 /// Locations that could not be reached.
2572 pub unreachable: std::vec::Vec<std::string::String>,
2573
2574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2575}
2576
2577impl ListLunsResponse {
2578 pub fn new() -> Self {
2579 std::default::Default::default()
2580 }
2581
2582 /// Sets the value of [luns][crate::model::ListLunsResponse::luns].
2583 ///
2584 /// # Example
2585 /// ```ignore,no_run
2586 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2587 /// use google_cloud_baremetalsolution_v2::model::Lun;
2588 /// let x = ListLunsResponse::new()
2589 /// .set_luns([
2590 /// Lun::default()/* use setters */,
2591 /// Lun::default()/* use (different) setters */,
2592 /// ]);
2593 /// ```
2594 pub fn set_luns<T, V>(mut self, v: T) -> Self
2595 where
2596 T: std::iter::IntoIterator<Item = V>,
2597 V: std::convert::Into<crate::model::Lun>,
2598 {
2599 use std::iter::Iterator;
2600 self.luns = v.into_iter().map(|i| i.into()).collect();
2601 self
2602 }
2603
2604 /// Sets the value of [next_page_token][crate::model::ListLunsResponse::next_page_token].
2605 ///
2606 /// # Example
2607 /// ```ignore,no_run
2608 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2609 /// let x = ListLunsResponse::new().set_next_page_token("example");
2610 /// ```
2611 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2612 self.next_page_token = v.into();
2613 self
2614 }
2615
2616 /// Sets the value of [unreachable][crate::model::ListLunsResponse::unreachable].
2617 ///
2618 /// # Example
2619 /// ```ignore,no_run
2620 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2621 /// let x = ListLunsResponse::new().set_unreachable(["a", "b", "c"]);
2622 /// ```
2623 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2624 where
2625 T: std::iter::IntoIterator<Item = V>,
2626 V: std::convert::Into<std::string::String>,
2627 {
2628 use std::iter::Iterator;
2629 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2630 self
2631 }
2632}
2633
2634impl wkt::message::Message for ListLunsResponse {
2635 fn typename() -> &'static str {
2636 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsResponse"
2637 }
2638}
2639
2640#[doc(hidden)]
2641impl gax::paginator::internal::PageableResponse for ListLunsResponse {
2642 type PageItem = crate::model::Lun;
2643
2644 fn items(self) -> std::vec::Vec<Self::PageItem> {
2645 self.luns
2646 }
2647
2648 fn next_page_token(&self) -> std::string::String {
2649 use std::clone::Clone;
2650 self.next_page_token.clone()
2651 }
2652}
2653
2654/// Request for skip lun cooloff and delete it.
2655#[derive(Clone, Default, PartialEq)]
2656#[non_exhaustive]
2657pub struct EvictLunRequest {
2658 /// Required. The name of the lun.
2659 pub name: std::string::String,
2660
2661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2662}
2663
2664impl EvictLunRequest {
2665 pub fn new() -> Self {
2666 std::default::Default::default()
2667 }
2668
2669 /// Sets the value of [name][crate::model::EvictLunRequest::name].
2670 ///
2671 /// # Example
2672 /// ```ignore,no_run
2673 /// # use google_cloud_baremetalsolution_v2::model::EvictLunRequest;
2674 /// let x = EvictLunRequest::new().set_name("example");
2675 /// ```
2676 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2677 self.name = v.into();
2678 self
2679 }
2680}
2681
2682impl wkt::message::Message for EvictLunRequest {
2683 fn typename() -> &'static str {
2684 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictLunRequest"
2685 }
2686}
2687
2688/// A Network.
2689#[derive(Clone, Default, PartialEq)]
2690#[non_exhaustive]
2691pub struct Network {
2692 /// Output only. The resource name of this `Network`.
2693 /// Resource names are schemeless URIs that follow the conventions in
2694 /// <https://cloud.google.com/apis/design/resource_names>.
2695 /// Format:
2696 /// `projects/{project}/locations/{location}/networks/{network}`
2697 pub name: std::string::String,
2698
2699 /// An identifier for the `Network`, generated by the backend.
2700 pub id: std::string::String,
2701
2702 /// The type of this network.
2703 pub r#type: crate::model::network::Type,
2704
2705 /// IP address configured.
2706 pub ip_address: std::string::String,
2707
2708 /// List of physical interfaces.
2709 pub mac_address: std::vec::Vec<std::string::String>,
2710
2711 /// The Network state.
2712 pub state: crate::model::network::State,
2713
2714 /// The vlan id of the Network.
2715 pub vlan_id: std::string::String,
2716
2717 /// The cidr of the Network.
2718 pub cidr: std::string::String,
2719
2720 /// The vrf for the Network.
2721 pub vrf: std::option::Option<crate::model::Vrf>,
2722
2723 /// Labels as key value pairs.
2724 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2725
2726 /// IP range for reserved for services (e.g. NFS).
2727 pub services_cidr: std::string::String,
2728
2729 /// List of IP address reservations in this network.
2730 /// When updating this field, an error will be generated if a reservation
2731 /// conflicts with an IP address already allocated to a physical server.
2732 pub reservations: std::vec::Vec<crate::model::NetworkAddressReservation>,
2733
2734 /// Output only. Pod name.
2735 pub pod: std::string::String,
2736
2737 /// Input only. List of mount points to attach the network to.
2738 pub mount_points: std::vec::Vec<crate::model::NetworkMountPoint>,
2739
2740 /// Whether network uses standard frames or jumbo ones.
2741 pub jumbo_frames_enabled: bool,
2742
2743 /// Output only. Gateway ip address.
2744 pub gateway_ip: std::string::String,
2745
2746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2747}
2748
2749impl Network {
2750 pub fn new() -> Self {
2751 std::default::Default::default()
2752 }
2753
2754 /// Sets the value of [name][crate::model::Network::name].
2755 ///
2756 /// # Example
2757 /// ```ignore,no_run
2758 /// # use google_cloud_baremetalsolution_v2::model::Network;
2759 /// let x = Network::new().set_name("example");
2760 /// ```
2761 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2762 self.name = v.into();
2763 self
2764 }
2765
2766 /// Sets the value of [id][crate::model::Network::id].
2767 ///
2768 /// # Example
2769 /// ```ignore,no_run
2770 /// # use google_cloud_baremetalsolution_v2::model::Network;
2771 /// let x = Network::new().set_id("example");
2772 /// ```
2773 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2774 self.id = v.into();
2775 self
2776 }
2777
2778 /// Sets the value of [r#type][crate::model::Network::type].
2779 ///
2780 /// # Example
2781 /// ```ignore,no_run
2782 /// # use google_cloud_baremetalsolution_v2::model::Network;
2783 /// use google_cloud_baremetalsolution_v2::model::network::Type;
2784 /// let x0 = Network::new().set_type(Type::Client);
2785 /// let x1 = Network::new().set_type(Type::Private);
2786 /// ```
2787 pub fn set_type<T: std::convert::Into<crate::model::network::Type>>(mut self, v: T) -> Self {
2788 self.r#type = v.into();
2789 self
2790 }
2791
2792 /// Sets the value of [ip_address][crate::model::Network::ip_address].
2793 ///
2794 /// # Example
2795 /// ```ignore,no_run
2796 /// # use google_cloud_baremetalsolution_v2::model::Network;
2797 /// let x = Network::new().set_ip_address("example");
2798 /// ```
2799 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2800 self.ip_address = v.into();
2801 self
2802 }
2803
2804 /// Sets the value of [mac_address][crate::model::Network::mac_address].
2805 ///
2806 /// # Example
2807 /// ```ignore,no_run
2808 /// # use google_cloud_baremetalsolution_v2::model::Network;
2809 /// let x = Network::new().set_mac_address(["a", "b", "c"]);
2810 /// ```
2811 pub fn set_mac_address<T, V>(mut self, v: T) -> Self
2812 where
2813 T: std::iter::IntoIterator<Item = V>,
2814 V: std::convert::Into<std::string::String>,
2815 {
2816 use std::iter::Iterator;
2817 self.mac_address = v.into_iter().map(|i| i.into()).collect();
2818 self
2819 }
2820
2821 /// Sets the value of [state][crate::model::Network::state].
2822 ///
2823 /// # Example
2824 /// ```ignore,no_run
2825 /// # use google_cloud_baremetalsolution_v2::model::Network;
2826 /// use google_cloud_baremetalsolution_v2::model::network::State;
2827 /// let x0 = Network::new().set_state(State::Provisioning);
2828 /// let x1 = Network::new().set_state(State::Provisioned);
2829 /// let x2 = Network::new().set_state(State::Deprovisioning);
2830 /// ```
2831 pub fn set_state<T: std::convert::Into<crate::model::network::State>>(mut self, v: T) -> Self {
2832 self.state = v.into();
2833 self
2834 }
2835
2836 /// Sets the value of [vlan_id][crate::model::Network::vlan_id].
2837 ///
2838 /// # Example
2839 /// ```ignore,no_run
2840 /// # use google_cloud_baremetalsolution_v2::model::Network;
2841 /// let x = Network::new().set_vlan_id("example");
2842 /// ```
2843 pub fn set_vlan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2844 self.vlan_id = v.into();
2845 self
2846 }
2847
2848 /// Sets the value of [cidr][crate::model::Network::cidr].
2849 ///
2850 /// # Example
2851 /// ```ignore,no_run
2852 /// # use google_cloud_baremetalsolution_v2::model::Network;
2853 /// let x = Network::new().set_cidr("example");
2854 /// ```
2855 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2856 self.cidr = v.into();
2857 self
2858 }
2859
2860 /// Sets the value of [vrf][crate::model::Network::vrf].
2861 ///
2862 /// # Example
2863 /// ```ignore,no_run
2864 /// # use google_cloud_baremetalsolution_v2::model::Network;
2865 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2866 /// let x = Network::new().set_vrf(Vrf::default()/* use setters */);
2867 /// ```
2868 pub fn set_vrf<T>(mut self, v: T) -> Self
2869 where
2870 T: std::convert::Into<crate::model::Vrf>,
2871 {
2872 self.vrf = std::option::Option::Some(v.into());
2873 self
2874 }
2875
2876 /// Sets or clears the value of [vrf][crate::model::Network::vrf].
2877 ///
2878 /// # Example
2879 /// ```ignore,no_run
2880 /// # use google_cloud_baremetalsolution_v2::model::Network;
2881 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2882 /// let x = Network::new().set_or_clear_vrf(Some(Vrf::default()/* use setters */));
2883 /// let x = Network::new().set_or_clear_vrf(None::<Vrf>);
2884 /// ```
2885 pub fn set_or_clear_vrf<T>(mut self, v: std::option::Option<T>) -> Self
2886 where
2887 T: std::convert::Into<crate::model::Vrf>,
2888 {
2889 self.vrf = v.map(|x| x.into());
2890 self
2891 }
2892
2893 /// Sets the value of [labels][crate::model::Network::labels].
2894 ///
2895 /// # Example
2896 /// ```ignore,no_run
2897 /// # use google_cloud_baremetalsolution_v2::model::Network;
2898 /// let x = Network::new().set_labels([
2899 /// ("key0", "abc"),
2900 /// ("key1", "xyz"),
2901 /// ]);
2902 /// ```
2903 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2904 where
2905 T: std::iter::IntoIterator<Item = (K, V)>,
2906 K: std::convert::Into<std::string::String>,
2907 V: std::convert::Into<std::string::String>,
2908 {
2909 use std::iter::Iterator;
2910 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2911 self
2912 }
2913
2914 /// Sets the value of [services_cidr][crate::model::Network::services_cidr].
2915 ///
2916 /// # Example
2917 /// ```ignore,no_run
2918 /// # use google_cloud_baremetalsolution_v2::model::Network;
2919 /// let x = Network::new().set_services_cidr("example");
2920 /// ```
2921 pub fn set_services_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2922 self.services_cidr = v.into();
2923 self
2924 }
2925
2926 /// Sets the value of [reservations][crate::model::Network::reservations].
2927 ///
2928 /// # Example
2929 /// ```ignore,no_run
2930 /// # use google_cloud_baremetalsolution_v2::model::Network;
2931 /// use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
2932 /// let x = Network::new()
2933 /// .set_reservations([
2934 /// NetworkAddressReservation::default()/* use setters */,
2935 /// NetworkAddressReservation::default()/* use (different) setters */,
2936 /// ]);
2937 /// ```
2938 pub fn set_reservations<T, V>(mut self, v: T) -> Self
2939 where
2940 T: std::iter::IntoIterator<Item = V>,
2941 V: std::convert::Into<crate::model::NetworkAddressReservation>,
2942 {
2943 use std::iter::Iterator;
2944 self.reservations = v.into_iter().map(|i| i.into()).collect();
2945 self
2946 }
2947
2948 /// Sets the value of [pod][crate::model::Network::pod].
2949 ///
2950 /// # Example
2951 /// ```ignore,no_run
2952 /// # use google_cloud_baremetalsolution_v2::model::Network;
2953 /// let x = Network::new().set_pod("example");
2954 /// ```
2955 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2956 self.pod = v.into();
2957 self
2958 }
2959
2960 /// Sets the value of [mount_points][crate::model::Network::mount_points].
2961 ///
2962 /// # Example
2963 /// ```ignore,no_run
2964 /// # use google_cloud_baremetalsolution_v2::model::Network;
2965 /// use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
2966 /// let x = Network::new()
2967 /// .set_mount_points([
2968 /// NetworkMountPoint::default()/* use setters */,
2969 /// NetworkMountPoint::default()/* use (different) setters */,
2970 /// ]);
2971 /// ```
2972 pub fn set_mount_points<T, V>(mut self, v: T) -> Self
2973 where
2974 T: std::iter::IntoIterator<Item = V>,
2975 V: std::convert::Into<crate::model::NetworkMountPoint>,
2976 {
2977 use std::iter::Iterator;
2978 self.mount_points = v.into_iter().map(|i| i.into()).collect();
2979 self
2980 }
2981
2982 /// Sets the value of [jumbo_frames_enabled][crate::model::Network::jumbo_frames_enabled].
2983 ///
2984 /// # Example
2985 /// ```ignore,no_run
2986 /// # use google_cloud_baremetalsolution_v2::model::Network;
2987 /// let x = Network::new().set_jumbo_frames_enabled(true);
2988 /// ```
2989 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2990 self.jumbo_frames_enabled = v.into();
2991 self
2992 }
2993
2994 /// Sets the value of [gateway_ip][crate::model::Network::gateway_ip].
2995 ///
2996 /// # Example
2997 /// ```ignore,no_run
2998 /// # use google_cloud_baremetalsolution_v2::model::Network;
2999 /// let x = Network::new().set_gateway_ip("example");
3000 /// ```
3001 pub fn set_gateway_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3002 self.gateway_ip = v.into();
3003 self
3004 }
3005}
3006
3007impl wkt::message::Message for Network {
3008 fn typename() -> &'static str {
3009 "type.googleapis.com/google.cloud.baremetalsolution.v2.Network"
3010 }
3011}
3012
3013/// Defines additional types related to [Network].
3014pub mod network {
3015 #[allow(unused_imports)]
3016 use super::*;
3017
3018 /// Network type.
3019 ///
3020 /// # Working with unknown values
3021 ///
3022 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3023 /// additional enum variants at any time. Adding new variants is not considered
3024 /// a breaking change. Applications should write their code in anticipation of:
3025 ///
3026 /// - New values appearing in future releases of the client library, **and**
3027 /// - New values received dynamically, without application changes.
3028 ///
3029 /// Please consult the [Working with enums] section in the user guide for some
3030 /// guidelines.
3031 ///
3032 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3033 #[derive(Clone, Debug, PartialEq)]
3034 #[non_exhaustive]
3035 pub enum Type {
3036 /// Unspecified value.
3037 Unspecified,
3038 /// Client network, a network peered to a Google Cloud VPC.
3039 Client,
3040 /// Private network, a network local to the Bare Metal Solution environment.
3041 Private,
3042 /// If set, the enum was initialized with an unknown value.
3043 ///
3044 /// Applications can examine the value using [Type::value] or
3045 /// [Type::name].
3046 UnknownValue(r#type::UnknownValue),
3047 }
3048
3049 #[doc(hidden)]
3050 pub mod r#type {
3051 #[allow(unused_imports)]
3052 use super::*;
3053 #[derive(Clone, Debug, PartialEq)]
3054 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3055 }
3056
3057 impl Type {
3058 /// Gets the enum value.
3059 ///
3060 /// Returns `None` if the enum contains an unknown value deserialized from
3061 /// the string representation of enums.
3062 pub fn value(&self) -> std::option::Option<i32> {
3063 match self {
3064 Self::Unspecified => std::option::Option::Some(0),
3065 Self::Client => std::option::Option::Some(1),
3066 Self::Private => std::option::Option::Some(2),
3067 Self::UnknownValue(u) => u.0.value(),
3068 }
3069 }
3070
3071 /// Gets the enum value as a string.
3072 ///
3073 /// Returns `None` if the enum contains an unknown value deserialized from
3074 /// the integer representation of enums.
3075 pub fn name(&self) -> std::option::Option<&str> {
3076 match self {
3077 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
3078 Self::Client => std::option::Option::Some("CLIENT"),
3079 Self::Private => std::option::Option::Some("PRIVATE"),
3080 Self::UnknownValue(u) => u.0.name(),
3081 }
3082 }
3083 }
3084
3085 impl std::default::Default for Type {
3086 fn default() -> Self {
3087 use std::convert::From;
3088 Self::from(0)
3089 }
3090 }
3091
3092 impl std::fmt::Display for Type {
3093 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3094 wkt::internal::display_enum(f, self.name(), self.value())
3095 }
3096 }
3097
3098 impl std::convert::From<i32> for Type {
3099 fn from(value: i32) -> Self {
3100 match value {
3101 0 => Self::Unspecified,
3102 1 => Self::Client,
3103 2 => Self::Private,
3104 _ => Self::UnknownValue(r#type::UnknownValue(
3105 wkt::internal::UnknownEnumValue::Integer(value),
3106 )),
3107 }
3108 }
3109 }
3110
3111 impl std::convert::From<&str> for Type {
3112 fn from(value: &str) -> Self {
3113 use std::string::ToString;
3114 match value {
3115 "TYPE_UNSPECIFIED" => Self::Unspecified,
3116 "CLIENT" => Self::Client,
3117 "PRIVATE" => Self::Private,
3118 _ => Self::UnknownValue(r#type::UnknownValue(
3119 wkt::internal::UnknownEnumValue::String(value.to_string()),
3120 )),
3121 }
3122 }
3123 }
3124
3125 impl serde::ser::Serialize for Type {
3126 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3127 where
3128 S: serde::Serializer,
3129 {
3130 match self {
3131 Self::Unspecified => serializer.serialize_i32(0),
3132 Self::Client => serializer.serialize_i32(1),
3133 Self::Private => serializer.serialize_i32(2),
3134 Self::UnknownValue(u) => u.0.serialize(serializer),
3135 }
3136 }
3137 }
3138
3139 impl<'de> serde::de::Deserialize<'de> for Type {
3140 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3141 where
3142 D: serde::Deserializer<'de>,
3143 {
3144 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
3145 ".google.cloud.baremetalsolution.v2.Network.Type",
3146 ))
3147 }
3148 }
3149
3150 /// The possible states for this Network.
3151 ///
3152 /// # Working with unknown values
3153 ///
3154 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3155 /// additional enum variants at any time. Adding new variants is not considered
3156 /// a breaking change. Applications should write their code in anticipation of:
3157 ///
3158 /// - New values appearing in future releases of the client library, **and**
3159 /// - New values received dynamically, without application changes.
3160 ///
3161 /// Please consult the [Working with enums] section in the user guide for some
3162 /// guidelines.
3163 ///
3164 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3165 #[derive(Clone, Debug, PartialEq)]
3166 #[non_exhaustive]
3167 pub enum State {
3168 /// The Network is in an unknown state.
3169 Unspecified,
3170 /// The Network is provisioning.
3171 Provisioning,
3172 /// The Network has been provisioned.
3173 Provisioned,
3174 /// The Network is being deprovisioned.
3175 Deprovisioning,
3176 /// The Network is being updated.
3177 Updating,
3178 /// If set, the enum was initialized with an unknown value.
3179 ///
3180 /// Applications can examine the value using [State::value] or
3181 /// [State::name].
3182 UnknownValue(state::UnknownValue),
3183 }
3184
3185 #[doc(hidden)]
3186 pub mod state {
3187 #[allow(unused_imports)]
3188 use super::*;
3189 #[derive(Clone, Debug, PartialEq)]
3190 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3191 }
3192
3193 impl State {
3194 /// Gets the enum value.
3195 ///
3196 /// Returns `None` if the enum contains an unknown value deserialized from
3197 /// the string representation of enums.
3198 pub fn value(&self) -> std::option::Option<i32> {
3199 match self {
3200 Self::Unspecified => std::option::Option::Some(0),
3201 Self::Provisioning => std::option::Option::Some(1),
3202 Self::Provisioned => std::option::Option::Some(2),
3203 Self::Deprovisioning => std::option::Option::Some(3),
3204 Self::Updating => std::option::Option::Some(4),
3205 Self::UnknownValue(u) => u.0.value(),
3206 }
3207 }
3208
3209 /// Gets the enum value as a string.
3210 ///
3211 /// Returns `None` if the enum contains an unknown value deserialized from
3212 /// the integer representation of enums.
3213 pub fn name(&self) -> std::option::Option<&str> {
3214 match self {
3215 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3216 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3217 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3218 Self::Deprovisioning => std::option::Option::Some("DEPROVISIONING"),
3219 Self::Updating => std::option::Option::Some("UPDATING"),
3220 Self::UnknownValue(u) => u.0.name(),
3221 }
3222 }
3223 }
3224
3225 impl std::default::Default for State {
3226 fn default() -> Self {
3227 use std::convert::From;
3228 Self::from(0)
3229 }
3230 }
3231
3232 impl std::fmt::Display for State {
3233 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3234 wkt::internal::display_enum(f, self.name(), self.value())
3235 }
3236 }
3237
3238 impl std::convert::From<i32> for State {
3239 fn from(value: i32) -> Self {
3240 match value {
3241 0 => Self::Unspecified,
3242 1 => Self::Provisioning,
3243 2 => Self::Provisioned,
3244 3 => Self::Deprovisioning,
3245 4 => Self::Updating,
3246 _ => Self::UnknownValue(state::UnknownValue(
3247 wkt::internal::UnknownEnumValue::Integer(value),
3248 )),
3249 }
3250 }
3251 }
3252
3253 impl std::convert::From<&str> for State {
3254 fn from(value: &str) -> Self {
3255 use std::string::ToString;
3256 match value {
3257 "STATE_UNSPECIFIED" => Self::Unspecified,
3258 "PROVISIONING" => Self::Provisioning,
3259 "PROVISIONED" => Self::Provisioned,
3260 "DEPROVISIONING" => Self::Deprovisioning,
3261 "UPDATING" => Self::Updating,
3262 _ => Self::UnknownValue(state::UnknownValue(
3263 wkt::internal::UnknownEnumValue::String(value.to_string()),
3264 )),
3265 }
3266 }
3267 }
3268
3269 impl serde::ser::Serialize for State {
3270 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3271 where
3272 S: serde::Serializer,
3273 {
3274 match self {
3275 Self::Unspecified => serializer.serialize_i32(0),
3276 Self::Provisioning => serializer.serialize_i32(1),
3277 Self::Provisioned => serializer.serialize_i32(2),
3278 Self::Deprovisioning => serializer.serialize_i32(3),
3279 Self::Updating => serializer.serialize_i32(4),
3280 Self::UnknownValue(u) => u.0.serialize(serializer),
3281 }
3282 }
3283 }
3284
3285 impl<'de> serde::de::Deserialize<'de> for State {
3286 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3287 where
3288 D: serde::Deserializer<'de>,
3289 {
3290 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3291 ".google.cloud.baremetalsolution.v2.Network.State",
3292 ))
3293 }
3294 }
3295}
3296
3297/// A reservation of one or more addresses in a network.
3298#[derive(Clone, Default, PartialEq)]
3299#[non_exhaustive]
3300pub struct NetworkAddressReservation {
3301 /// The first address of this reservation block.
3302 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3303 pub start_address: std::string::String,
3304
3305 /// The last address of this reservation block, inclusive. I.e., for cases when
3306 /// reservations are only single addresses, end_address and start_address will
3307 /// be the same.
3308 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3309 pub end_address: std::string::String,
3310
3311 /// A note about this reservation, intended for human consumption.
3312 pub note: std::string::String,
3313
3314 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3315}
3316
3317impl NetworkAddressReservation {
3318 pub fn new() -> Self {
3319 std::default::Default::default()
3320 }
3321
3322 /// Sets the value of [start_address][crate::model::NetworkAddressReservation::start_address].
3323 ///
3324 /// # Example
3325 /// ```ignore,no_run
3326 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3327 /// let x = NetworkAddressReservation::new().set_start_address("example");
3328 /// ```
3329 pub fn set_start_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3330 self.start_address = v.into();
3331 self
3332 }
3333
3334 /// Sets the value of [end_address][crate::model::NetworkAddressReservation::end_address].
3335 ///
3336 /// # Example
3337 /// ```ignore,no_run
3338 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3339 /// let x = NetworkAddressReservation::new().set_end_address("example");
3340 /// ```
3341 pub fn set_end_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3342 self.end_address = v.into();
3343 self
3344 }
3345
3346 /// Sets the value of [note][crate::model::NetworkAddressReservation::note].
3347 ///
3348 /// # Example
3349 /// ```ignore,no_run
3350 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3351 /// let x = NetworkAddressReservation::new().set_note("example");
3352 /// ```
3353 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3354 self.note = v.into();
3355 self
3356 }
3357}
3358
3359impl wkt::message::Message for NetworkAddressReservation {
3360 fn typename() -> &'static str {
3361 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkAddressReservation"
3362 }
3363}
3364
3365/// A network VRF.
3366#[derive(Clone, Default, PartialEq)]
3367#[non_exhaustive]
3368pub struct Vrf {
3369 /// The name of the VRF.
3370 pub name: std::string::String,
3371
3372 /// The possible state of VRF.
3373 pub state: crate::model::vrf::State,
3374
3375 /// The QOS policy applied to this VRF.
3376 /// The value is only meaningful when all the vlan attachments have the same
3377 /// QoS. This field should not be used for new integrations, use vlan
3378 /// attachment level qos instead. The field is left for backward-compatibility.
3379 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3380
3381 /// The list of VLAN attachments for the VRF.
3382 pub vlan_attachments: std::vec::Vec<crate::model::vrf::VlanAttachment>,
3383
3384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3385}
3386
3387impl Vrf {
3388 pub fn new() -> Self {
3389 std::default::Default::default()
3390 }
3391
3392 /// Sets the value of [name][crate::model::Vrf::name].
3393 ///
3394 /// # Example
3395 /// ```ignore,no_run
3396 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3397 /// let x = Vrf::new().set_name("example");
3398 /// ```
3399 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3400 self.name = v.into();
3401 self
3402 }
3403
3404 /// Sets the value of [state][crate::model::Vrf::state].
3405 ///
3406 /// # Example
3407 /// ```ignore,no_run
3408 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3409 /// use google_cloud_baremetalsolution_v2::model::vrf::State;
3410 /// let x0 = Vrf::new().set_state(State::Provisioning);
3411 /// let x1 = Vrf::new().set_state(State::Provisioned);
3412 /// ```
3413 pub fn set_state<T: std::convert::Into<crate::model::vrf::State>>(mut self, v: T) -> Self {
3414 self.state = v.into();
3415 self
3416 }
3417
3418 /// Sets the value of [qos_policy][crate::model::Vrf::qos_policy].
3419 ///
3420 /// # Example
3421 /// ```ignore,no_run
3422 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3423 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3424 /// let x = Vrf::new().set_qos_policy(QosPolicy::default()/* use setters */);
3425 /// ```
3426 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3427 where
3428 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3429 {
3430 self.qos_policy = std::option::Option::Some(v.into());
3431 self
3432 }
3433
3434 /// Sets or clears the value of [qos_policy][crate::model::Vrf::qos_policy].
3435 ///
3436 /// # Example
3437 /// ```ignore,no_run
3438 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3439 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3440 /// let x = Vrf::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3441 /// let x = Vrf::new().set_or_clear_qos_policy(None::<QosPolicy>);
3442 /// ```
3443 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3444 where
3445 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3446 {
3447 self.qos_policy = v.map(|x| x.into());
3448 self
3449 }
3450
3451 /// Sets the value of [vlan_attachments][crate::model::Vrf::vlan_attachments].
3452 ///
3453 /// # Example
3454 /// ```ignore,no_run
3455 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3456 /// use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3457 /// let x = Vrf::new()
3458 /// .set_vlan_attachments([
3459 /// VlanAttachment::default()/* use setters */,
3460 /// VlanAttachment::default()/* use (different) setters */,
3461 /// ]);
3462 /// ```
3463 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
3464 where
3465 T: std::iter::IntoIterator<Item = V>,
3466 V: std::convert::Into<crate::model::vrf::VlanAttachment>,
3467 {
3468 use std::iter::Iterator;
3469 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
3470 self
3471 }
3472}
3473
3474impl wkt::message::Message for Vrf {
3475 fn typename() -> &'static str {
3476 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF"
3477 }
3478}
3479
3480/// Defines additional types related to [Vrf].
3481pub mod vrf {
3482 #[allow(unused_imports)]
3483 use super::*;
3484
3485 /// QOS policy parameters.
3486 #[derive(Clone, Default, PartialEq)]
3487 #[non_exhaustive]
3488 pub struct QosPolicy {
3489 /// The bandwidth permitted by the QOS policy, in gbps.
3490 pub bandwidth_gbps: f64,
3491
3492 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3493 }
3494
3495 impl QosPolicy {
3496 pub fn new() -> Self {
3497 std::default::Default::default()
3498 }
3499
3500 /// Sets the value of [bandwidth_gbps][crate::model::vrf::QosPolicy::bandwidth_gbps].
3501 ///
3502 /// # Example
3503 /// ```ignore,no_run
3504 /// # use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3505 /// let x = QosPolicy::new().set_bandwidth_gbps(42.0);
3506 /// ```
3507 pub fn set_bandwidth_gbps<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3508 self.bandwidth_gbps = v.into();
3509 self
3510 }
3511 }
3512
3513 impl wkt::message::Message for QosPolicy {
3514 fn typename() -> &'static str {
3515 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.QosPolicy"
3516 }
3517 }
3518
3519 /// VLAN attachment details.
3520 #[derive(Clone, Default, PartialEq)]
3521 #[non_exhaustive]
3522 pub struct VlanAttachment {
3523 /// The peer vlan ID of the attachment.
3524 pub peer_vlan_id: i64,
3525
3526 /// The peer IP of the attachment.
3527 pub peer_ip: std::string::String,
3528
3529 /// The router IP of the attachment.
3530 pub router_ip: std::string::String,
3531
3532 /// Input only. Pairing key.
3533 pub pairing_key: std::string::String,
3534
3535 /// The QOS policy applied to this VLAN attachment.
3536 /// This value should be preferred to using qos at vrf level.
3537 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3538
3539 /// Immutable. The identifier of the attachment within vrf.
3540 pub id: std::string::String,
3541
3542 /// Optional. The name of the vlan attachment within vrf. This is of the form
3543 /// projects/{project_number}/regions/{region}/interconnectAttachments/{interconnect_attachment}
3544 pub interconnect_attachment: std::string::String,
3545
3546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3547 }
3548
3549 impl VlanAttachment {
3550 pub fn new() -> Self {
3551 std::default::Default::default()
3552 }
3553
3554 /// Sets the value of [peer_vlan_id][crate::model::vrf::VlanAttachment::peer_vlan_id].
3555 ///
3556 /// # Example
3557 /// ```ignore,no_run
3558 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3559 /// let x = VlanAttachment::new().set_peer_vlan_id(42);
3560 /// ```
3561 pub fn set_peer_vlan_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3562 self.peer_vlan_id = v.into();
3563 self
3564 }
3565
3566 /// Sets the value of [peer_ip][crate::model::vrf::VlanAttachment::peer_ip].
3567 ///
3568 /// # Example
3569 /// ```ignore,no_run
3570 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3571 /// let x = VlanAttachment::new().set_peer_ip("example");
3572 /// ```
3573 pub fn set_peer_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3574 self.peer_ip = v.into();
3575 self
3576 }
3577
3578 /// Sets the value of [router_ip][crate::model::vrf::VlanAttachment::router_ip].
3579 ///
3580 /// # Example
3581 /// ```ignore,no_run
3582 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3583 /// let x = VlanAttachment::new().set_router_ip("example");
3584 /// ```
3585 pub fn set_router_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3586 self.router_ip = v.into();
3587 self
3588 }
3589
3590 /// Sets the value of [pairing_key][crate::model::vrf::VlanAttachment::pairing_key].
3591 ///
3592 /// # Example
3593 /// ```ignore,no_run
3594 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3595 /// let x = VlanAttachment::new().set_pairing_key("example");
3596 /// ```
3597 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3598 self.pairing_key = v.into();
3599 self
3600 }
3601
3602 /// Sets the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3603 ///
3604 /// # Example
3605 /// ```ignore,no_run
3606 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3607 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3608 /// let x = VlanAttachment::new().set_qos_policy(QosPolicy::default()/* use setters */);
3609 /// ```
3610 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3611 where
3612 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3613 {
3614 self.qos_policy = std::option::Option::Some(v.into());
3615 self
3616 }
3617
3618 /// Sets or clears the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3619 ///
3620 /// # Example
3621 /// ```ignore,no_run
3622 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3623 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3624 /// let x = VlanAttachment::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3625 /// let x = VlanAttachment::new().set_or_clear_qos_policy(None::<QosPolicy>);
3626 /// ```
3627 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3628 where
3629 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3630 {
3631 self.qos_policy = v.map(|x| x.into());
3632 self
3633 }
3634
3635 /// Sets the value of [id][crate::model::vrf::VlanAttachment::id].
3636 ///
3637 /// # Example
3638 /// ```ignore,no_run
3639 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3640 /// let x = VlanAttachment::new().set_id("example");
3641 /// ```
3642 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3643 self.id = v.into();
3644 self
3645 }
3646
3647 /// Sets the value of [interconnect_attachment][crate::model::vrf::VlanAttachment::interconnect_attachment].
3648 ///
3649 /// # Example
3650 /// ```ignore,no_run
3651 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3652 /// let x = VlanAttachment::new().set_interconnect_attachment("example");
3653 /// ```
3654 pub fn set_interconnect_attachment<T: std::convert::Into<std::string::String>>(
3655 mut self,
3656 v: T,
3657 ) -> Self {
3658 self.interconnect_attachment = v.into();
3659 self
3660 }
3661 }
3662
3663 impl wkt::message::Message for VlanAttachment {
3664 fn typename() -> &'static str {
3665 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.VlanAttachment"
3666 }
3667 }
3668
3669 /// The possible states for this VRF.
3670 ///
3671 /// # Working with unknown values
3672 ///
3673 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3674 /// additional enum variants at any time. Adding new variants is not considered
3675 /// a breaking change. Applications should write their code in anticipation of:
3676 ///
3677 /// - New values appearing in future releases of the client library, **and**
3678 /// - New values received dynamically, without application changes.
3679 ///
3680 /// Please consult the [Working with enums] section in the user guide for some
3681 /// guidelines.
3682 ///
3683 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3684 #[derive(Clone, Debug, PartialEq)]
3685 #[non_exhaustive]
3686 pub enum State {
3687 /// The unspecified state.
3688 Unspecified,
3689 /// The vrf is provisioning.
3690 Provisioning,
3691 /// The vrf is provisioned.
3692 Provisioned,
3693 /// If set, the enum was initialized with an unknown value.
3694 ///
3695 /// Applications can examine the value using [State::value] or
3696 /// [State::name].
3697 UnknownValue(state::UnknownValue),
3698 }
3699
3700 #[doc(hidden)]
3701 pub mod state {
3702 #[allow(unused_imports)]
3703 use super::*;
3704 #[derive(Clone, Debug, PartialEq)]
3705 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3706 }
3707
3708 impl State {
3709 /// Gets the enum value.
3710 ///
3711 /// Returns `None` if the enum contains an unknown value deserialized from
3712 /// the string representation of enums.
3713 pub fn value(&self) -> std::option::Option<i32> {
3714 match self {
3715 Self::Unspecified => std::option::Option::Some(0),
3716 Self::Provisioning => std::option::Option::Some(1),
3717 Self::Provisioned => std::option::Option::Some(2),
3718 Self::UnknownValue(u) => u.0.value(),
3719 }
3720 }
3721
3722 /// Gets the enum value as a string.
3723 ///
3724 /// Returns `None` if the enum contains an unknown value deserialized from
3725 /// the integer representation of enums.
3726 pub fn name(&self) -> std::option::Option<&str> {
3727 match self {
3728 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3729 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3730 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3731 Self::UnknownValue(u) => u.0.name(),
3732 }
3733 }
3734 }
3735
3736 impl std::default::Default for State {
3737 fn default() -> Self {
3738 use std::convert::From;
3739 Self::from(0)
3740 }
3741 }
3742
3743 impl std::fmt::Display for State {
3744 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3745 wkt::internal::display_enum(f, self.name(), self.value())
3746 }
3747 }
3748
3749 impl std::convert::From<i32> for State {
3750 fn from(value: i32) -> Self {
3751 match value {
3752 0 => Self::Unspecified,
3753 1 => Self::Provisioning,
3754 2 => Self::Provisioned,
3755 _ => Self::UnknownValue(state::UnknownValue(
3756 wkt::internal::UnknownEnumValue::Integer(value),
3757 )),
3758 }
3759 }
3760 }
3761
3762 impl std::convert::From<&str> for State {
3763 fn from(value: &str) -> Self {
3764 use std::string::ToString;
3765 match value {
3766 "STATE_UNSPECIFIED" => Self::Unspecified,
3767 "PROVISIONING" => Self::Provisioning,
3768 "PROVISIONED" => Self::Provisioned,
3769 _ => Self::UnknownValue(state::UnknownValue(
3770 wkt::internal::UnknownEnumValue::String(value.to_string()),
3771 )),
3772 }
3773 }
3774 }
3775
3776 impl serde::ser::Serialize for State {
3777 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3778 where
3779 S: serde::Serializer,
3780 {
3781 match self {
3782 Self::Unspecified => serializer.serialize_i32(0),
3783 Self::Provisioning => serializer.serialize_i32(1),
3784 Self::Provisioned => serializer.serialize_i32(2),
3785 Self::UnknownValue(u) => u.0.serialize(serializer),
3786 }
3787 }
3788 }
3789
3790 impl<'de> serde::de::Deserialize<'de> for State {
3791 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3792 where
3793 D: serde::Deserializer<'de>,
3794 {
3795 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3796 ".google.cloud.baremetalsolution.v2.VRF.State",
3797 ))
3798 }
3799 }
3800}
3801
3802/// Each logical interface represents a logical abstraction of the underlying
3803/// physical interface (for eg. bond, nic) of the instance. Each logical
3804/// interface can effectively map to multiple network-IP pairs and still be
3805/// mapped to one underlying physical interface.
3806#[derive(Clone, Default, PartialEq)]
3807#[non_exhaustive]
3808pub struct LogicalInterface {
3809 /// List of logical network interfaces within a logical interface.
3810 pub logical_network_interfaces:
3811 std::vec::Vec<crate::model::logical_interface::LogicalNetworkInterface>,
3812
3813 /// Interface name. This is of syntax \<bond\><bond_mode> or \<nic\> and
3814 /// forms part of the network template name.
3815 pub name: std::string::String,
3816
3817 /// The index of the logical interface mapping to the index of the hardware
3818 /// bond or nic on the chosen network template. This field is deprecated.
3819 #[deprecated]
3820 pub interface_index: i32,
3821
3822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3823}
3824
3825impl LogicalInterface {
3826 pub fn new() -> Self {
3827 std::default::Default::default()
3828 }
3829
3830 /// Sets the value of [logical_network_interfaces][crate::model::LogicalInterface::logical_network_interfaces].
3831 ///
3832 /// # Example
3833 /// ```ignore,no_run
3834 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3835 /// use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3836 /// let x = LogicalInterface::new()
3837 /// .set_logical_network_interfaces([
3838 /// LogicalNetworkInterface::default()/* use setters */,
3839 /// LogicalNetworkInterface::default()/* use (different) setters */,
3840 /// ]);
3841 /// ```
3842 pub fn set_logical_network_interfaces<T, V>(mut self, v: T) -> Self
3843 where
3844 T: std::iter::IntoIterator<Item = V>,
3845 V: std::convert::Into<crate::model::logical_interface::LogicalNetworkInterface>,
3846 {
3847 use std::iter::Iterator;
3848 self.logical_network_interfaces = v.into_iter().map(|i| i.into()).collect();
3849 self
3850 }
3851
3852 /// Sets the value of [name][crate::model::LogicalInterface::name].
3853 ///
3854 /// # Example
3855 /// ```ignore,no_run
3856 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3857 /// let x = LogicalInterface::new().set_name("example");
3858 /// ```
3859 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3860 self.name = v.into();
3861 self
3862 }
3863
3864 /// Sets the value of [interface_index][crate::model::LogicalInterface::interface_index].
3865 ///
3866 /// # Example
3867 /// ```ignore,no_run
3868 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3869 /// let x = LogicalInterface::new().set_interface_index(42);
3870 /// ```
3871 #[deprecated]
3872 pub fn set_interface_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3873 self.interface_index = v.into();
3874 self
3875 }
3876}
3877
3878impl wkt::message::Message for LogicalInterface {
3879 fn typename() -> &'static str {
3880 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface"
3881 }
3882}
3883
3884/// Defines additional types related to [LogicalInterface].
3885pub mod logical_interface {
3886 #[allow(unused_imports)]
3887 use super::*;
3888
3889 /// Each logical network interface is effectively a network and IP pair.
3890 #[derive(Clone, Default, PartialEq)]
3891 #[non_exhaustive]
3892 pub struct LogicalNetworkInterface {
3893 /// Name of the network
3894 pub network: std::string::String,
3895
3896 /// IP address in the network
3897 pub ip_address: std::string::String,
3898
3899 /// Whether this interface is the default gateway for the instance. Only
3900 /// one interface can be the default gateway for the instance.
3901 pub default_gateway: bool,
3902
3903 /// Type of network.
3904 pub network_type: crate::model::network::Type,
3905
3906 /// An identifier for the `Network`, generated by the backend.
3907 pub id: std::string::String,
3908
3909 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3910 }
3911
3912 impl LogicalNetworkInterface {
3913 pub fn new() -> Self {
3914 std::default::Default::default()
3915 }
3916
3917 /// Sets the value of [network][crate::model::logical_interface::LogicalNetworkInterface::network].
3918 ///
3919 /// # Example
3920 /// ```ignore,no_run
3921 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3922 /// let x = LogicalNetworkInterface::new().set_network("example");
3923 /// ```
3924 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3925 self.network = v.into();
3926 self
3927 }
3928
3929 /// Sets the value of [ip_address][crate::model::logical_interface::LogicalNetworkInterface::ip_address].
3930 ///
3931 /// # Example
3932 /// ```ignore,no_run
3933 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3934 /// let x = LogicalNetworkInterface::new().set_ip_address("example");
3935 /// ```
3936 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3937 self.ip_address = v.into();
3938 self
3939 }
3940
3941 /// Sets the value of [default_gateway][crate::model::logical_interface::LogicalNetworkInterface::default_gateway].
3942 ///
3943 /// # Example
3944 /// ```ignore,no_run
3945 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3946 /// let x = LogicalNetworkInterface::new().set_default_gateway(true);
3947 /// ```
3948 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3949 self.default_gateway = v.into();
3950 self
3951 }
3952
3953 /// Sets the value of [network_type][crate::model::logical_interface::LogicalNetworkInterface::network_type].
3954 ///
3955 /// # Example
3956 /// ```ignore,no_run
3957 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3958 /// use google_cloud_baremetalsolution_v2::model::network::Type;
3959 /// let x0 = LogicalNetworkInterface::new().set_network_type(Type::Client);
3960 /// let x1 = LogicalNetworkInterface::new().set_network_type(Type::Private);
3961 /// ```
3962 pub fn set_network_type<T: std::convert::Into<crate::model::network::Type>>(
3963 mut self,
3964 v: T,
3965 ) -> Self {
3966 self.network_type = v.into();
3967 self
3968 }
3969
3970 /// Sets the value of [id][crate::model::logical_interface::LogicalNetworkInterface::id].
3971 ///
3972 /// # Example
3973 /// ```ignore,no_run
3974 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3975 /// let x = LogicalNetworkInterface::new().set_id("example");
3976 /// ```
3977 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3978 self.id = v.into();
3979 self
3980 }
3981 }
3982
3983 impl wkt::message::Message for LogicalNetworkInterface {
3984 fn typename() -> &'static str {
3985 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface.LogicalNetworkInterface"
3986 }
3987 }
3988}
3989
3990/// Message for requesting network information.
3991#[derive(Clone, Default, PartialEq)]
3992#[non_exhaustive]
3993pub struct GetNetworkRequest {
3994 /// Required. Name of the resource.
3995 pub name: std::string::String,
3996
3997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3998}
3999
4000impl GetNetworkRequest {
4001 pub fn new() -> Self {
4002 std::default::Default::default()
4003 }
4004
4005 /// Sets the value of [name][crate::model::GetNetworkRequest::name].
4006 ///
4007 /// # Example
4008 /// ```ignore,no_run
4009 /// # use google_cloud_baremetalsolution_v2::model::GetNetworkRequest;
4010 /// let x = GetNetworkRequest::new().set_name("example");
4011 /// ```
4012 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4013 self.name = v.into();
4014 self
4015 }
4016}
4017
4018impl wkt::message::Message for GetNetworkRequest {
4019 fn typename() -> &'static str {
4020 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNetworkRequest"
4021 }
4022}
4023
4024/// Message for requesting a list of networks.
4025#[derive(Clone, Default, PartialEq)]
4026#[non_exhaustive]
4027pub struct ListNetworksRequest {
4028 /// Required. Parent value for ListNetworksRequest.
4029 pub parent: std::string::String,
4030
4031 /// Requested page size. The server might return fewer items than requested.
4032 /// If unspecified, server will pick an appropriate default.
4033 pub page_size: i32,
4034
4035 /// A token identifying a page of results from the server.
4036 pub page_token: std::string::String,
4037
4038 /// List filter.
4039 pub filter: std::string::String,
4040
4041 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4042}
4043
4044impl ListNetworksRequest {
4045 pub fn new() -> Self {
4046 std::default::Default::default()
4047 }
4048
4049 /// Sets the value of [parent][crate::model::ListNetworksRequest::parent].
4050 ///
4051 /// # Example
4052 /// ```ignore,no_run
4053 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4054 /// let x = ListNetworksRequest::new().set_parent("example");
4055 /// ```
4056 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4057 self.parent = v.into();
4058 self
4059 }
4060
4061 /// Sets the value of [page_size][crate::model::ListNetworksRequest::page_size].
4062 ///
4063 /// # Example
4064 /// ```ignore,no_run
4065 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4066 /// let x = ListNetworksRequest::new().set_page_size(42);
4067 /// ```
4068 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4069 self.page_size = v.into();
4070 self
4071 }
4072
4073 /// Sets the value of [page_token][crate::model::ListNetworksRequest::page_token].
4074 ///
4075 /// # Example
4076 /// ```ignore,no_run
4077 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4078 /// let x = ListNetworksRequest::new().set_page_token("example");
4079 /// ```
4080 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4081 self.page_token = v.into();
4082 self
4083 }
4084
4085 /// Sets the value of [filter][crate::model::ListNetworksRequest::filter].
4086 ///
4087 /// # Example
4088 /// ```ignore,no_run
4089 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4090 /// let x = ListNetworksRequest::new().set_filter("example");
4091 /// ```
4092 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4093 self.filter = v.into();
4094 self
4095 }
4096}
4097
4098impl wkt::message::Message for ListNetworksRequest {
4099 fn typename() -> &'static str {
4100 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksRequest"
4101 }
4102}
4103
4104/// Response message containing the list of networks.
4105#[derive(Clone, Default, PartialEq)]
4106#[non_exhaustive]
4107pub struct ListNetworksResponse {
4108 /// The list of networks.
4109 pub networks: std::vec::Vec<crate::model::Network>,
4110
4111 /// A token identifying a page of results from the server.
4112 pub next_page_token: std::string::String,
4113
4114 /// Locations that could not be reached.
4115 pub unreachable: std::vec::Vec<std::string::String>,
4116
4117 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4118}
4119
4120impl ListNetworksResponse {
4121 pub fn new() -> Self {
4122 std::default::Default::default()
4123 }
4124
4125 /// Sets the value of [networks][crate::model::ListNetworksResponse::networks].
4126 ///
4127 /// # Example
4128 /// ```ignore,no_run
4129 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4130 /// use google_cloud_baremetalsolution_v2::model::Network;
4131 /// let x = ListNetworksResponse::new()
4132 /// .set_networks([
4133 /// Network::default()/* use setters */,
4134 /// Network::default()/* use (different) setters */,
4135 /// ]);
4136 /// ```
4137 pub fn set_networks<T, V>(mut self, v: T) -> Self
4138 where
4139 T: std::iter::IntoIterator<Item = V>,
4140 V: std::convert::Into<crate::model::Network>,
4141 {
4142 use std::iter::Iterator;
4143 self.networks = v.into_iter().map(|i| i.into()).collect();
4144 self
4145 }
4146
4147 /// Sets the value of [next_page_token][crate::model::ListNetworksResponse::next_page_token].
4148 ///
4149 /// # Example
4150 /// ```ignore,no_run
4151 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4152 /// let x = ListNetworksResponse::new().set_next_page_token("example");
4153 /// ```
4154 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4155 self.next_page_token = v.into();
4156 self
4157 }
4158
4159 /// Sets the value of [unreachable][crate::model::ListNetworksResponse::unreachable].
4160 ///
4161 /// # Example
4162 /// ```ignore,no_run
4163 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4164 /// let x = ListNetworksResponse::new().set_unreachable(["a", "b", "c"]);
4165 /// ```
4166 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4167 where
4168 T: std::iter::IntoIterator<Item = V>,
4169 V: std::convert::Into<std::string::String>,
4170 {
4171 use std::iter::Iterator;
4172 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4173 self
4174 }
4175}
4176
4177impl wkt::message::Message for ListNetworksResponse {
4178 fn typename() -> &'static str {
4179 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksResponse"
4180 }
4181}
4182
4183#[doc(hidden)]
4184impl gax::paginator::internal::PageableResponse for ListNetworksResponse {
4185 type PageItem = crate::model::Network;
4186
4187 fn items(self) -> std::vec::Vec<Self::PageItem> {
4188 self.networks
4189 }
4190
4191 fn next_page_token(&self) -> std::string::String {
4192 use std::clone::Clone;
4193 self.next_page_token.clone()
4194 }
4195}
4196
4197/// Message requesting to updating a network.
4198#[derive(Clone, Default, PartialEq)]
4199#[non_exhaustive]
4200pub struct UpdateNetworkRequest {
4201 /// Required. The network to update.
4202 ///
4203 /// The `name` field is used to identify the instance to update.
4204 /// Format: projects/{project}/locations/{location}/networks/{network}
4205 pub network: std::option::Option<crate::model::Network>,
4206
4207 /// The list of fields to update.
4208 /// The only currently supported fields are:
4209 /// `labels`, `reservations`, `vrf.vlan_attachments`
4210 pub update_mask: std::option::Option<wkt::FieldMask>,
4211
4212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4213}
4214
4215impl UpdateNetworkRequest {
4216 pub fn new() -> Self {
4217 std::default::Default::default()
4218 }
4219
4220 /// Sets the value of [network][crate::model::UpdateNetworkRequest::network].
4221 ///
4222 /// # Example
4223 /// ```ignore,no_run
4224 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4225 /// use google_cloud_baremetalsolution_v2::model::Network;
4226 /// let x = UpdateNetworkRequest::new().set_network(Network::default()/* use setters */);
4227 /// ```
4228 pub fn set_network<T>(mut self, v: T) -> Self
4229 where
4230 T: std::convert::Into<crate::model::Network>,
4231 {
4232 self.network = std::option::Option::Some(v.into());
4233 self
4234 }
4235
4236 /// Sets or clears the value of [network][crate::model::UpdateNetworkRequest::network].
4237 ///
4238 /// # Example
4239 /// ```ignore,no_run
4240 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4241 /// use google_cloud_baremetalsolution_v2::model::Network;
4242 /// let x = UpdateNetworkRequest::new().set_or_clear_network(Some(Network::default()/* use setters */));
4243 /// let x = UpdateNetworkRequest::new().set_or_clear_network(None::<Network>);
4244 /// ```
4245 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4246 where
4247 T: std::convert::Into<crate::model::Network>,
4248 {
4249 self.network = v.map(|x| x.into());
4250 self
4251 }
4252
4253 /// Sets the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4254 ///
4255 /// # Example
4256 /// ```ignore,no_run
4257 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4258 /// use wkt::FieldMask;
4259 /// let x = UpdateNetworkRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4260 /// ```
4261 pub fn set_update_mask<T>(mut self, v: T) -> Self
4262 where
4263 T: std::convert::Into<wkt::FieldMask>,
4264 {
4265 self.update_mask = std::option::Option::Some(v.into());
4266 self
4267 }
4268
4269 /// Sets or clears the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4270 ///
4271 /// # Example
4272 /// ```ignore,no_run
4273 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4274 /// use wkt::FieldMask;
4275 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4276 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4277 /// ```
4278 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4279 where
4280 T: std::convert::Into<wkt::FieldMask>,
4281 {
4282 self.update_mask = v.map(|x| x.into());
4283 self
4284 }
4285}
4286
4287impl wkt::message::Message for UpdateNetworkRequest {
4288 fn typename() -> &'static str {
4289 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNetworkRequest"
4290 }
4291}
4292
4293/// Network with all used IP addresses.
4294#[derive(Clone, Default, PartialEq)]
4295#[non_exhaustive]
4296pub struct NetworkUsage {
4297 /// Network.
4298 pub network: std::option::Option<crate::model::Network>,
4299
4300 /// All used IP addresses in this network.
4301 pub used_ips: std::vec::Vec<std::string::String>,
4302
4303 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4304}
4305
4306impl NetworkUsage {
4307 pub fn new() -> Self {
4308 std::default::Default::default()
4309 }
4310
4311 /// Sets the value of [network][crate::model::NetworkUsage::network].
4312 ///
4313 /// # Example
4314 /// ```ignore,no_run
4315 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4316 /// use google_cloud_baremetalsolution_v2::model::Network;
4317 /// let x = NetworkUsage::new().set_network(Network::default()/* use setters */);
4318 /// ```
4319 pub fn set_network<T>(mut self, v: T) -> Self
4320 where
4321 T: std::convert::Into<crate::model::Network>,
4322 {
4323 self.network = std::option::Option::Some(v.into());
4324 self
4325 }
4326
4327 /// Sets or clears the value of [network][crate::model::NetworkUsage::network].
4328 ///
4329 /// # Example
4330 /// ```ignore,no_run
4331 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4332 /// use google_cloud_baremetalsolution_v2::model::Network;
4333 /// let x = NetworkUsage::new().set_or_clear_network(Some(Network::default()/* use setters */));
4334 /// let x = NetworkUsage::new().set_or_clear_network(None::<Network>);
4335 /// ```
4336 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4337 where
4338 T: std::convert::Into<crate::model::Network>,
4339 {
4340 self.network = v.map(|x| x.into());
4341 self
4342 }
4343
4344 /// Sets the value of [used_ips][crate::model::NetworkUsage::used_ips].
4345 ///
4346 /// # Example
4347 /// ```ignore,no_run
4348 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4349 /// let x = NetworkUsage::new().set_used_ips(["a", "b", "c"]);
4350 /// ```
4351 pub fn set_used_ips<T, V>(mut self, v: T) -> Self
4352 where
4353 T: std::iter::IntoIterator<Item = V>,
4354 V: std::convert::Into<std::string::String>,
4355 {
4356 use std::iter::Iterator;
4357 self.used_ips = v.into_iter().map(|i| i.into()).collect();
4358 self
4359 }
4360}
4361
4362impl wkt::message::Message for NetworkUsage {
4363 fn typename() -> &'static str {
4364 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkUsage"
4365 }
4366}
4367
4368/// Request to get networks with IPs.
4369#[derive(Clone, Default, PartialEq)]
4370#[non_exhaustive]
4371pub struct ListNetworkUsageRequest {
4372 /// Required. Parent value (project and location).
4373 pub location: std::string::String,
4374
4375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4376}
4377
4378impl ListNetworkUsageRequest {
4379 pub fn new() -> Self {
4380 std::default::Default::default()
4381 }
4382
4383 /// Sets the value of [location][crate::model::ListNetworkUsageRequest::location].
4384 ///
4385 /// # Example
4386 /// ```ignore,no_run
4387 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageRequest;
4388 /// let x = ListNetworkUsageRequest::new().set_location("example");
4389 /// ```
4390 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4391 self.location = v.into();
4392 self
4393 }
4394}
4395
4396impl wkt::message::Message for ListNetworkUsageRequest {
4397 fn typename() -> &'static str {
4398 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageRequest"
4399 }
4400}
4401
4402/// Response with Networks with IPs
4403#[derive(Clone, Default, PartialEq)]
4404#[non_exhaustive]
4405pub struct ListNetworkUsageResponse {
4406 /// Networks with IPs.
4407 pub networks: std::vec::Vec<crate::model::NetworkUsage>,
4408
4409 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4410}
4411
4412impl ListNetworkUsageResponse {
4413 pub fn new() -> Self {
4414 std::default::Default::default()
4415 }
4416
4417 /// Sets the value of [networks][crate::model::ListNetworkUsageResponse::networks].
4418 ///
4419 /// # Example
4420 /// ```ignore,no_run
4421 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageResponse;
4422 /// use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4423 /// let x = ListNetworkUsageResponse::new()
4424 /// .set_networks([
4425 /// NetworkUsage::default()/* use setters */,
4426 /// NetworkUsage::default()/* use (different) setters */,
4427 /// ]);
4428 /// ```
4429 pub fn set_networks<T, V>(mut self, v: T) -> Self
4430 where
4431 T: std::iter::IntoIterator<Item = V>,
4432 V: std::convert::Into<crate::model::NetworkUsage>,
4433 {
4434 use std::iter::Iterator;
4435 self.networks = v.into_iter().map(|i| i.into()).collect();
4436 self
4437 }
4438}
4439
4440impl wkt::message::Message for ListNetworkUsageResponse {
4441 fn typename() -> &'static str {
4442 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageResponse"
4443 }
4444}
4445
4446/// Mount point for a network.
4447#[derive(Clone, Default, PartialEq)]
4448#[non_exhaustive]
4449pub struct NetworkMountPoint {
4450 /// Instance to attach network to.
4451 pub instance: std::string::String,
4452
4453 /// Logical interface to detach from.
4454 pub logical_interface: std::string::String,
4455
4456 /// Network should be a default gateway.
4457 pub default_gateway: bool,
4458
4459 /// Ip address of the server.
4460 pub ip_address: std::string::String,
4461
4462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4463}
4464
4465impl NetworkMountPoint {
4466 pub fn new() -> Self {
4467 std::default::Default::default()
4468 }
4469
4470 /// Sets the value of [instance][crate::model::NetworkMountPoint::instance].
4471 ///
4472 /// # Example
4473 /// ```ignore,no_run
4474 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4475 /// let x = NetworkMountPoint::new().set_instance("example");
4476 /// ```
4477 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4478 self.instance = v.into();
4479 self
4480 }
4481
4482 /// Sets the value of [logical_interface][crate::model::NetworkMountPoint::logical_interface].
4483 ///
4484 /// # Example
4485 /// ```ignore,no_run
4486 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4487 /// let x = NetworkMountPoint::new().set_logical_interface("example");
4488 /// ```
4489 pub fn set_logical_interface<T: std::convert::Into<std::string::String>>(
4490 mut self,
4491 v: T,
4492 ) -> Self {
4493 self.logical_interface = v.into();
4494 self
4495 }
4496
4497 /// Sets the value of [default_gateway][crate::model::NetworkMountPoint::default_gateway].
4498 ///
4499 /// # Example
4500 /// ```ignore,no_run
4501 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4502 /// let x = NetworkMountPoint::new().set_default_gateway(true);
4503 /// ```
4504 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4505 self.default_gateway = v.into();
4506 self
4507 }
4508
4509 /// Sets the value of [ip_address][crate::model::NetworkMountPoint::ip_address].
4510 ///
4511 /// # Example
4512 /// ```ignore,no_run
4513 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4514 /// let x = NetworkMountPoint::new().set_ip_address("example");
4515 /// ```
4516 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4517 self.ip_address = v.into();
4518 self
4519 }
4520}
4521
4522impl wkt::message::Message for NetworkMountPoint {
4523 fn typename() -> &'static str {
4524 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkMountPoint"
4525 }
4526}
4527
4528/// Message requesting rename of a server.
4529#[derive(Clone, Default, PartialEq)]
4530#[non_exhaustive]
4531pub struct RenameNetworkRequest {
4532 /// Required. The `name` field is used to identify the network.
4533 /// Format: projects/{project}/locations/{location}/networks/{network}
4534 pub name: std::string::String,
4535
4536 /// Required. The new `id` of the network.
4537 pub new_network_id: std::string::String,
4538
4539 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4540}
4541
4542impl RenameNetworkRequest {
4543 pub fn new() -> Self {
4544 std::default::Default::default()
4545 }
4546
4547 /// Sets the value of [name][crate::model::RenameNetworkRequest::name].
4548 ///
4549 /// # Example
4550 /// ```ignore,no_run
4551 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4552 /// let x = RenameNetworkRequest::new().set_name("example");
4553 /// ```
4554 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4555 self.name = v.into();
4556 self
4557 }
4558
4559 /// Sets the value of [new_network_id][crate::model::RenameNetworkRequest::new_network_id].
4560 ///
4561 /// # Example
4562 /// ```ignore,no_run
4563 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4564 /// let x = RenameNetworkRequest::new().set_new_network_id("example");
4565 /// ```
4566 pub fn set_new_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4567 self.new_network_id = v.into();
4568 self
4569 }
4570}
4571
4572impl wkt::message::Message for RenameNetworkRequest {
4573 fn typename() -> &'static str {
4574 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNetworkRequest"
4575 }
4576}
4577
4578/// An NFS share.
4579#[derive(Clone, Default, PartialEq)]
4580#[non_exhaustive]
4581pub struct NfsShare {
4582 /// Immutable. The name of the NFS share.
4583 pub name: std::string::String,
4584
4585 /// Output only. An identifier for the NFS share, generated by the backend.
4586 /// This field will be deprecated in the future, use `id` instead.
4587 pub nfs_share_id: std::string::String,
4588
4589 /// Output only. An identifier for the NFS share, generated by the backend.
4590 /// This is the same value as nfs_share_id and will replace it in the future.
4591 pub id: std::string::String,
4592
4593 /// Output only. The state of the NFS share.
4594 pub state: crate::model::nfs_share::State,
4595
4596 /// Output only. The underlying volume of the share. Created automatically
4597 /// during provisioning.
4598 pub volume: std::string::String,
4599
4600 /// List of allowed access points.
4601 pub allowed_clients: std::vec::Vec<crate::model::nfs_share::AllowedClient>,
4602
4603 /// Labels as key value pairs.
4604 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4605
4606 /// The requested size, in GiB.
4607 pub requested_size_gib: i64,
4608
4609 /// Immutable. The storage type of the underlying volume.
4610 pub storage_type: crate::model::nfs_share::StorageType,
4611
4612 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4613}
4614
4615impl NfsShare {
4616 pub fn new() -> Self {
4617 std::default::Default::default()
4618 }
4619
4620 /// Sets the value of [name][crate::model::NfsShare::name].
4621 ///
4622 /// # Example
4623 /// ```ignore,no_run
4624 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4625 /// let x = NfsShare::new().set_name("example");
4626 /// ```
4627 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4628 self.name = v.into();
4629 self
4630 }
4631
4632 /// Sets the value of [nfs_share_id][crate::model::NfsShare::nfs_share_id].
4633 ///
4634 /// # Example
4635 /// ```ignore,no_run
4636 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4637 /// let x = NfsShare::new().set_nfs_share_id("example");
4638 /// ```
4639 pub fn set_nfs_share_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4640 self.nfs_share_id = v.into();
4641 self
4642 }
4643
4644 /// Sets the value of [id][crate::model::NfsShare::id].
4645 ///
4646 /// # Example
4647 /// ```ignore,no_run
4648 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4649 /// let x = NfsShare::new().set_id("example");
4650 /// ```
4651 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4652 self.id = v.into();
4653 self
4654 }
4655
4656 /// Sets the value of [state][crate::model::NfsShare::state].
4657 ///
4658 /// # Example
4659 /// ```ignore,no_run
4660 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4661 /// use google_cloud_baremetalsolution_v2::model::nfs_share::State;
4662 /// let x0 = NfsShare::new().set_state(State::Provisioned);
4663 /// let x1 = NfsShare::new().set_state(State::Creating);
4664 /// let x2 = NfsShare::new().set_state(State::Updating);
4665 /// ```
4666 pub fn set_state<T: std::convert::Into<crate::model::nfs_share::State>>(
4667 mut self,
4668 v: T,
4669 ) -> Self {
4670 self.state = v.into();
4671 self
4672 }
4673
4674 /// Sets the value of [volume][crate::model::NfsShare::volume].
4675 ///
4676 /// # Example
4677 /// ```ignore,no_run
4678 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4679 /// let x = NfsShare::new().set_volume("example");
4680 /// ```
4681 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4682 self.volume = v.into();
4683 self
4684 }
4685
4686 /// Sets the value of [allowed_clients][crate::model::NfsShare::allowed_clients].
4687 ///
4688 /// # Example
4689 /// ```ignore,no_run
4690 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4691 /// use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4692 /// let x = NfsShare::new()
4693 /// .set_allowed_clients([
4694 /// AllowedClient::default()/* use setters */,
4695 /// AllowedClient::default()/* use (different) setters */,
4696 /// ]);
4697 /// ```
4698 pub fn set_allowed_clients<T, V>(mut self, v: T) -> Self
4699 where
4700 T: std::iter::IntoIterator<Item = V>,
4701 V: std::convert::Into<crate::model::nfs_share::AllowedClient>,
4702 {
4703 use std::iter::Iterator;
4704 self.allowed_clients = v.into_iter().map(|i| i.into()).collect();
4705 self
4706 }
4707
4708 /// Sets the value of [labels][crate::model::NfsShare::labels].
4709 ///
4710 /// # Example
4711 /// ```ignore,no_run
4712 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4713 /// let x = NfsShare::new().set_labels([
4714 /// ("key0", "abc"),
4715 /// ("key1", "xyz"),
4716 /// ]);
4717 /// ```
4718 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4719 where
4720 T: std::iter::IntoIterator<Item = (K, V)>,
4721 K: std::convert::Into<std::string::String>,
4722 V: std::convert::Into<std::string::String>,
4723 {
4724 use std::iter::Iterator;
4725 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4726 self
4727 }
4728
4729 /// Sets the value of [requested_size_gib][crate::model::NfsShare::requested_size_gib].
4730 ///
4731 /// # Example
4732 /// ```ignore,no_run
4733 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4734 /// let x = NfsShare::new().set_requested_size_gib(42);
4735 /// ```
4736 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4737 self.requested_size_gib = v.into();
4738 self
4739 }
4740
4741 /// Sets the value of [storage_type][crate::model::NfsShare::storage_type].
4742 ///
4743 /// # Example
4744 /// ```ignore,no_run
4745 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4746 /// use google_cloud_baremetalsolution_v2::model::nfs_share::StorageType;
4747 /// let x0 = NfsShare::new().set_storage_type(StorageType::Ssd);
4748 /// let x1 = NfsShare::new().set_storage_type(StorageType::Hdd);
4749 /// ```
4750 pub fn set_storage_type<T: std::convert::Into<crate::model::nfs_share::StorageType>>(
4751 mut self,
4752 v: T,
4753 ) -> Self {
4754 self.storage_type = v.into();
4755 self
4756 }
4757}
4758
4759impl wkt::message::Message for NfsShare {
4760 fn typename() -> &'static str {
4761 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare"
4762 }
4763}
4764
4765/// Defines additional types related to [NfsShare].
4766pub mod nfs_share {
4767 #[allow(unused_imports)]
4768 use super::*;
4769
4770 /// Represents an 'access point' for the share.
4771 #[derive(Clone, Default, PartialEq)]
4772 #[non_exhaustive]
4773 pub struct AllowedClient {
4774 /// The network the access point sits on.
4775 pub network: std::string::String,
4776
4777 /// Output only. The IP address of the share on this network. Assigned
4778 /// automatically during provisioning based on the network's services_cidr.
4779 pub share_ip: std::string::String,
4780
4781 /// The subnet of IP addresses permitted to access the share.
4782 pub allowed_clients_cidr: std::string::String,
4783
4784 /// Mount permissions.
4785 pub mount_permissions: crate::model::nfs_share::MountPermissions,
4786
4787 /// Allow dev flag. Which controls whether to allow creation of devices.
4788 pub allow_dev: bool,
4789
4790 /// Allow the setuid flag.
4791 pub allow_suid: bool,
4792
4793 /// Disable root squashing, which is a feature of NFS.
4794 /// Root squash is a special mapping of the remote superuser (root) identity
4795 /// when using identity authentication.
4796 pub no_root_squash: bool,
4797
4798 /// Output only. The path to access NFS, in format shareIP:/InstanceID
4799 /// InstanceID is the generated ID instead of customer provided name.
4800 /// example like "10.0.0.0:/g123456789-nfs001"
4801 pub nfs_path: std::string::String,
4802
4803 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4804 }
4805
4806 impl AllowedClient {
4807 pub fn new() -> Self {
4808 std::default::Default::default()
4809 }
4810
4811 /// Sets the value of [network][crate::model::nfs_share::AllowedClient::network].
4812 ///
4813 /// # Example
4814 /// ```ignore,no_run
4815 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4816 /// let x = AllowedClient::new().set_network("example");
4817 /// ```
4818 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4819 self.network = v.into();
4820 self
4821 }
4822
4823 /// Sets the value of [share_ip][crate::model::nfs_share::AllowedClient::share_ip].
4824 ///
4825 /// # Example
4826 /// ```ignore,no_run
4827 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4828 /// let x = AllowedClient::new().set_share_ip("example");
4829 /// ```
4830 pub fn set_share_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4831 self.share_ip = v.into();
4832 self
4833 }
4834
4835 /// Sets the value of [allowed_clients_cidr][crate::model::nfs_share::AllowedClient::allowed_clients_cidr].
4836 ///
4837 /// # Example
4838 /// ```ignore,no_run
4839 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4840 /// let x = AllowedClient::new().set_allowed_clients_cidr("example");
4841 /// ```
4842 pub fn set_allowed_clients_cidr<T: std::convert::Into<std::string::String>>(
4843 mut self,
4844 v: T,
4845 ) -> Self {
4846 self.allowed_clients_cidr = v.into();
4847 self
4848 }
4849
4850 /// Sets the value of [mount_permissions][crate::model::nfs_share::AllowedClient::mount_permissions].
4851 ///
4852 /// # Example
4853 /// ```ignore,no_run
4854 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4855 /// use google_cloud_baremetalsolution_v2::model::nfs_share::MountPermissions;
4856 /// let x0 = AllowedClient::new().set_mount_permissions(MountPermissions::Read);
4857 /// let x1 = AllowedClient::new().set_mount_permissions(MountPermissions::ReadWrite);
4858 /// ```
4859 pub fn set_mount_permissions<
4860 T: std::convert::Into<crate::model::nfs_share::MountPermissions>,
4861 >(
4862 mut self,
4863 v: T,
4864 ) -> Self {
4865 self.mount_permissions = v.into();
4866 self
4867 }
4868
4869 /// Sets the value of [allow_dev][crate::model::nfs_share::AllowedClient::allow_dev].
4870 ///
4871 /// # Example
4872 /// ```ignore,no_run
4873 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4874 /// let x = AllowedClient::new().set_allow_dev(true);
4875 /// ```
4876 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4877 self.allow_dev = v.into();
4878 self
4879 }
4880
4881 /// Sets the value of [allow_suid][crate::model::nfs_share::AllowedClient::allow_suid].
4882 ///
4883 /// # Example
4884 /// ```ignore,no_run
4885 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4886 /// let x = AllowedClient::new().set_allow_suid(true);
4887 /// ```
4888 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4889 self.allow_suid = v.into();
4890 self
4891 }
4892
4893 /// Sets the value of [no_root_squash][crate::model::nfs_share::AllowedClient::no_root_squash].
4894 ///
4895 /// # Example
4896 /// ```ignore,no_run
4897 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4898 /// let x = AllowedClient::new().set_no_root_squash(true);
4899 /// ```
4900 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4901 self.no_root_squash = v.into();
4902 self
4903 }
4904
4905 /// Sets the value of [nfs_path][crate::model::nfs_share::AllowedClient::nfs_path].
4906 ///
4907 /// # Example
4908 /// ```ignore,no_run
4909 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4910 /// let x = AllowedClient::new().set_nfs_path("example");
4911 /// ```
4912 pub fn set_nfs_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4913 self.nfs_path = v.into();
4914 self
4915 }
4916 }
4917
4918 impl wkt::message::Message for AllowedClient {
4919 fn typename() -> &'static str {
4920 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare.AllowedClient"
4921 }
4922 }
4923
4924 /// The possible states for this NFS share.
4925 ///
4926 /// # Working with unknown values
4927 ///
4928 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4929 /// additional enum variants at any time. Adding new variants is not considered
4930 /// a breaking change. Applications should write their code in anticipation of:
4931 ///
4932 /// - New values appearing in future releases of the client library, **and**
4933 /// - New values received dynamically, without application changes.
4934 ///
4935 /// Please consult the [Working with enums] section in the user guide for some
4936 /// guidelines.
4937 ///
4938 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4939 #[derive(Clone, Debug, PartialEq)]
4940 #[non_exhaustive]
4941 pub enum State {
4942 /// The share is in an unknown state.
4943 Unspecified,
4944 /// The share has been provisioned.
4945 Provisioned,
4946 /// The NFS Share is being created.
4947 Creating,
4948 /// The NFS Share is being updated.
4949 Updating,
4950 /// The NFS Share has been requested to be deleted.
4951 Deleting,
4952 /// If set, the enum was initialized with an unknown value.
4953 ///
4954 /// Applications can examine the value using [State::value] or
4955 /// [State::name].
4956 UnknownValue(state::UnknownValue),
4957 }
4958
4959 #[doc(hidden)]
4960 pub mod state {
4961 #[allow(unused_imports)]
4962 use super::*;
4963 #[derive(Clone, Debug, PartialEq)]
4964 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4965 }
4966
4967 impl State {
4968 /// Gets the enum value.
4969 ///
4970 /// Returns `None` if the enum contains an unknown value deserialized from
4971 /// the string representation of enums.
4972 pub fn value(&self) -> std::option::Option<i32> {
4973 match self {
4974 Self::Unspecified => std::option::Option::Some(0),
4975 Self::Provisioned => std::option::Option::Some(1),
4976 Self::Creating => std::option::Option::Some(2),
4977 Self::Updating => std::option::Option::Some(3),
4978 Self::Deleting => std::option::Option::Some(4),
4979 Self::UnknownValue(u) => u.0.value(),
4980 }
4981 }
4982
4983 /// Gets the enum value as a string.
4984 ///
4985 /// Returns `None` if the enum contains an unknown value deserialized from
4986 /// the integer representation of enums.
4987 pub fn name(&self) -> std::option::Option<&str> {
4988 match self {
4989 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4990 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
4991 Self::Creating => std::option::Option::Some("CREATING"),
4992 Self::Updating => std::option::Option::Some("UPDATING"),
4993 Self::Deleting => std::option::Option::Some("DELETING"),
4994 Self::UnknownValue(u) => u.0.name(),
4995 }
4996 }
4997 }
4998
4999 impl std::default::Default for State {
5000 fn default() -> Self {
5001 use std::convert::From;
5002 Self::from(0)
5003 }
5004 }
5005
5006 impl std::fmt::Display for State {
5007 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5008 wkt::internal::display_enum(f, self.name(), self.value())
5009 }
5010 }
5011
5012 impl std::convert::From<i32> for State {
5013 fn from(value: i32) -> Self {
5014 match value {
5015 0 => Self::Unspecified,
5016 1 => Self::Provisioned,
5017 2 => Self::Creating,
5018 3 => Self::Updating,
5019 4 => Self::Deleting,
5020 _ => Self::UnknownValue(state::UnknownValue(
5021 wkt::internal::UnknownEnumValue::Integer(value),
5022 )),
5023 }
5024 }
5025 }
5026
5027 impl std::convert::From<&str> for State {
5028 fn from(value: &str) -> Self {
5029 use std::string::ToString;
5030 match value {
5031 "STATE_UNSPECIFIED" => Self::Unspecified,
5032 "PROVISIONED" => Self::Provisioned,
5033 "CREATING" => Self::Creating,
5034 "UPDATING" => Self::Updating,
5035 "DELETING" => Self::Deleting,
5036 _ => Self::UnknownValue(state::UnknownValue(
5037 wkt::internal::UnknownEnumValue::String(value.to_string()),
5038 )),
5039 }
5040 }
5041 }
5042
5043 impl serde::ser::Serialize for State {
5044 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5045 where
5046 S: serde::Serializer,
5047 {
5048 match self {
5049 Self::Unspecified => serializer.serialize_i32(0),
5050 Self::Provisioned => serializer.serialize_i32(1),
5051 Self::Creating => serializer.serialize_i32(2),
5052 Self::Updating => serializer.serialize_i32(3),
5053 Self::Deleting => serializer.serialize_i32(4),
5054 Self::UnknownValue(u) => u.0.serialize(serializer),
5055 }
5056 }
5057 }
5058
5059 impl<'de> serde::de::Deserialize<'de> for State {
5060 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5061 where
5062 D: serde::Deserializer<'de>,
5063 {
5064 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5065 ".google.cloud.baremetalsolution.v2.NfsShare.State",
5066 ))
5067 }
5068 }
5069
5070 /// The possible mount permissions.
5071 ///
5072 /// # Working with unknown values
5073 ///
5074 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5075 /// additional enum variants at any time. Adding new variants is not considered
5076 /// a breaking change. Applications should write their code in anticipation of:
5077 ///
5078 /// - New values appearing in future releases of the client library, **and**
5079 /// - New values received dynamically, without application changes.
5080 ///
5081 /// Please consult the [Working with enums] section in the user guide for some
5082 /// guidelines.
5083 ///
5084 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5085 #[derive(Clone, Debug, PartialEq)]
5086 #[non_exhaustive]
5087 pub enum MountPermissions {
5088 /// Permissions were not specified.
5089 Unspecified,
5090 /// NFS share can be mount with read-only permissions.
5091 Read,
5092 /// NFS share can be mount with read-write permissions.
5093 ReadWrite,
5094 /// If set, the enum was initialized with an unknown value.
5095 ///
5096 /// Applications can examine the value using [MountPermissions::value] or
5097 /// [MountPermissions::name].
5098 UnknownValue(mount_permissions::UnknownValue),
5099 }
5100
5101 #[doc(hidden)]
5102 pub mod mount_permissions {
5103 #[allow(unused_imports)]
5104 use super::*;
5105 #[derive(Clone, Debug, PartialEq)]
5106 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5107 }
5108
5109 impl MountPermissions {
5110 /// Gets the enum value.
5111 ///
5112 /// Returns `None` if the enum contains an unknown value deserialized from
5113 /// the string representation of enums.
5114 pub fn value(&self) -> std::option::Option<i32> {
5115 match self {
5116 Self::Unspecified => std::option::Option::Some(0),
5117 Self::Read => std::option::Option::Some(1),
5118 Self::ReadWrite => std::option::Option::Some(2),
5119 Self::UnknownValue(u) => u.0.value(),
5120 }
5121 }
5122
5123 /// Gets the enum value as a string.
5124 ///
5125 /// Returns `None` if the enum contains an unknown value deserialized from
5126 /// the integer representation of enums.
5127 pub fn name(&self) -> std::option::Option<&str> {
5128 match self {
5129 Self::Unspecified => std::option::Option::Some("MOUNT_PERMISSIONS_UNSPECIFIED"),
5130 Self::Read => std::option::Option::Some("READ"),
5131 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
5132 Self::UnknownValue(u) => u.0.name(),
5133 }
5134 }
5135 }
5136
5137 impl std::default::Default for MountPermissions {
5138 fn default() -> Self {
5139 use std::convert::From;
5140 Self::from(0)
5141 }
5142 }
5143
5144 impl std::fmt::Display for MountPermissions {
5145 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5146 wkt::internal::display_enum(f, self.name(), self.value())
5147 }
5148 }
5149
5150 impl std::convert::From<i32> for MountPermissions {
5151 fn from(value: i32) -> Self {
5152 match value {
5153 0 => Self::Unspecified,
5154 1 => Self::Read,
5155 2 => Self::ReadWrite,
5156 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5157 wkt::internal::UnknownEnumValue::Integer(value),
5158 )),
5159 }
5160 }
5161 }
5162
5163 impl std::convert::From<&str> for MountPermissions {
5164 fn from(value: &str) -> Self {
5165 use std::string::ToString;
5166 match value {
5167 "MOUNT_PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
5168 "READ" => Self::Read,
5169 "READ_WRITE" => Self::ReadWrite,
5170 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5171 wkt::internal::UnknownEnumValue::String(value.to_string()),
5172 )),
5173 }
5174 }
5175 }
5176
5177 impl serde::ser::Serialize for MountPermissions {
5178 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5179 where
5180 S: serde::Serializer,
5181 {
5182 match self {
5183 Self::Unspecified => serializer.serialize_i32(0),
5184 Self::Read => serializer.serialize_i32(1),
5185 Self::ReadWrite => serializer.serialize_i32(2),
5186 Self::UnknownValue(u) => u.0.serialize(serializer),
5187 }
5188 }
5189 }
5190
5191 impl<'de> serde::de::Deserialize<'de> for MountPermissions {
5192 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5193 where
5194 D: serde::Deserializer<'de>,
5195 {
5196 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MountPermissions>::new(
5197 ".google.cloud.baremetalsolution.v2.NfsShare.MountPermissions",
5198 ))
5199 }
5200 }
5201
5202 /// The storage type for a volume.
5203 ///
5204 /// # Working with unknown values
5205 ///
5206 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5207 /// additional enum variants at any time. Adding new variants is not considered
5208 /// a breaking change. Applications should write their code in anticipation of:
5209 ///
5210 /// - New values appearing in future releases of the client library, **and**
5211 /// - New values received dynamically, without application changes.
5212 ///
5213 /// Please consult the [Working with enums] section in the user guide for some
5214 /// guidelines.
5215 ///
5216 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5217 #[derive(Clone, Debug, PartialEq)]
5218 #[non_exhaustive]
5219 pub enum StorageType {
5220 /// The storage type for this volume is unknown.
5221 Unspecified,
5222 /// The storage type for this volume is SSD.
5223 Ssd,
5224 /// This storage type for this volume is HDD.
5225 Hdd,
5226 /// If set, the enum was initialized with an unknown value.
5227 ///
5228 /// Applications can examine the value using [StorageType::value] or
5229 /// [StorageType::name].
5230 UnknownValue(storage_type::UnknownValue),
5231 }
5232
5233 #[doc(hidden)]
5234 pub mod storage_type {
5235 #[allow(unused_imports)]
5236 use super::*;
5237 #[derive(Clone, Debug, PartialEq)]
5238 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5239 }
5240
5241 impl StorageType {
5242 /// Gets the enum value.
5243 ///
5244 /// Returns `None` if the enum contains an unknown value deserialized from
5245 /// the string representation of enums.
5246 pub fn value(&self) -> std::option::Option<i32> {
5247 match self {
5248 Self::Unspecified => std::option::Option::Some(0),
5249 Self::Ssd => std::option::Option::Some(1),
5250 Self::Hdd => std::option::Option::Some(2),
5251 Self::UnknownValue(u) => u.0.value(),
5252 }
5253 }
5254
5255 /// Gets the enum value as a string.
5256 ///
5257 /// Returns `None` if the enum contains an unknown value deserialized from
5258 /// the integer representation of enums.
5259 pub fn name(&self) -> std::option::Option<&str> {
5260 match self {
5261 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
5262 Self::Ssd => std::option::Option::Some("SSD"),
5263 Self::Hdd => std::option::Option::Some("HDD"),
5264 Self::UnknownValue(u) => u.0.name(),
5265 }
5266 }
5267 }
5268
5269 impl std::default::Default for StorageType {
5270 fn default() -> Self {
5271 use std::convert::From;
5272 Self::from(0)
5273 }
5274 }
5275
5276 impl std::fmt::Display for StorageType {
5277 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5278 wkt::internal::display_enum(f, self.name(), self.value())
5279 }
5280 }
5281
5282 impl std::convert::From<i32> for StorageType {
5283 fn from(value: i32) -> Self {
5284 match value {
5285 0 => Self::Unspecified,
5286 1 => Self::Ssd,
5287 2 => Self::Hdd,
5288 _ => Self::UnknownValue(storage_type::UnknownValue(
5289 wkt::internal::UnknownEnumValue::Integer(value),
5290 )),
5291 }
5292 }
5293 }
5294
5295 impl std::convert::From<&str> for StorageType {
5296 fn from(value: &str) -> Self {
5297 use std::string::ToString;
5298 match value {
5299 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
5300 "SSD" => Self::Ssd,
5301 "HDD" => Self::Hdd,
5302 _ => Self::UnknownValue(storage_type::UnknownValue(
5303 wkt::internal::UnknownEnumValue::String(value.to_string()),
5304 )),
5305 }
5306 }
5307 }
5308
5309 impl serde::ser::Serialize for StorageType {
5310 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5311 where
5312 S: serde::Serializer,
5313 {
5314 match self {
5315 Self::Unspecified => serializer.serialize_i32(0),
5316 Self::Ssd => serializer.serialize_i32(1),
5317 Self::Hdd => serializer.serialize_i32(2),
5318 Self::UnknownValue(u) => u.0.serialize(serializer),
5319 }
5320 }
5321 }
5322
5323 impl<'de> serde::de::Deserialize<'de> for StorageType {
5324 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5325 where
5326 D: serde::Deserializer<'de>,
5327 {
5328 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
5329 ".google.cloud.baremetalsolution.v2.NfsShare.StorageType",
5330 ))
5331 }
5332 }
5333}
5334
5335/// Message for requesting NFS share information.
5336#[derive(Clone, Default, PartialEq)]
5337#[non_exhaustive]
5338pub struct GetNfsShareRequest {
5339 /// Required. Name of the resource.
5340 pub name: std::string::String,
5341
5342 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5343}
5344
5345impl GetNfsShareRequest {
5346 pub fn new() -> Self {
5347 std::default::Default::default()
5348 }
5349
5350 /// Sets the value of [name][crate::model::GetNfsShareRequest::name].
5351 ///
5352 /// # Example
5353 /// ```ignore,no_run
5354 /// # use google_cloud_baremetalsolution_v2::model::GetNfsShareRequest;
5355 /// let x = GetNfsShareRequest::new().set_name("example");
5356 /// ```
5357 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5358 self.name = v.into();
5359 self
5360 }
5361}
5362
5363impl wkt::message::Message for GetNfsShareRequest {
5364 fn typename() -> &'static str {
5365 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNfsShareRequest"
5366 }
5367}
5368
5369/// Message for requesting a list of NFS shares.
5370#[derive(Clone, Default, PartialEq)]
5371#[non_exhaustive]
5372pub struct ListNfsSharesRequest {
5373 /// Required. Parent value for ListNfsSharesRequest.
5374 pub parent: std::string::String,
5375
5376 /// Requested page size. The server might return fewer items than requested.
5377 /// If unspecified, server will pick an appropriate default.
5378 pub page_size: i32,
5379
5380 /// A token identifying a page of results from the server.
5381 pub page_token: std::string::String,
5382
5383 /// List filter.
5384 pub filter: std::string::String,
5385
5386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5387}
5388
5389impl ListNfsSharesRequest {
5390 pub fn new() -> Self {
5391 std::default::Default::default()
5392 }
5393
5394 /// Sets the value of [parent][crate::model::ListNfsSharesRequest::parent].
5395 ///
5396 /// # Example
5397 /// ```ignore,no_run
5398 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5399 /// let x = ListNfsSharesRequest::new().set_parent("example");
5400 /// ```
5401 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5402 self.parent = v.into();
5403 self
5404 }
5405
5406 /// Sets the value of [page_size][crate::model::ListNfsSharesRequest::page_size].
5407 ///
5408 /// # Example
5409 /// ```ignore,no_run
5410 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5411 /// let x = ListNfsSharesRequest::new().set_page_size(42);
5412 /// ```
5413 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5414 self.page_size = v.into();
5415 self
5416 }
5417
5418 /// Sets the value of [page_token][crate::model::ListNfsSharesRequest::page_token].
5419 ///
5420 /// # Example
5421 /// ```ignore,no_run
5422 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5423 /// let x = ListNfsSharesRequest::new().set_page_token("example");
5424 /// ```
5425 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5426 self.page_token = v.into();
5427 self
5428 }
5429
5430 /// Sets the value of [filter][crate::model::ListNfsSharesRequest::filter].
5431 ///
5432 /// # Example
5433 /// ```ignore,no_run
5434 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5435 /// let x = ListNfsSharesRequest::new().set_filter("example");
5436 /// ```
5437 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5438 self.filter = v.into();
5439 self
5440 }
5441}
5442
5443impl wkt::message::Message for ListNfsSharesRequest {
5444 fn typename() -> &'static str {
5445 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesRequest"
5446 }
5447}
5448
5449/// Response message containing the list of NFS shares.
5450#[derive(Clone, Default, PartialEq)]
5451#[non_exhaustive]
5452pub struct ListNfsSharesResponse {
5453 /// The list of NFS shares.
5454 pub nfs_shares: std::vec::Vec<crate::model::NfsShare>,
5455
5456 /// A token identifying a page of results from the server.
5457 pub next_page_token: std::string::String,
5458
5459 /// Locations that could not be reached.
5460 pub unreachable: std::vec::Vec<std::string::String>,
5461
5462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5463}
5464
5465impl ListNfsSharesResponse {
5466 pub fn new() -> Self {
5467 std::default::Default::default()
5468 }
5469
5470 /// Sets the value of [nfs_shares][crate::model::ListNfsSharesResponse::nfs_shares].
5471 ///
5472 /// # Example
5473 /// ```ignore,no_run
5474 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5475 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5476 /// let x = ListNfsSharesResponse::new()
5477 /// .set_nfs_shares([
5478 /// NfsShare::default()/* use setters */,
5479 /// NfsShare::default()/* use (different) setters */,
5480 /// ]);
5481 /// ```
5482 pub fn set_nfs_shares<T, V>(mut self, v: T) -> Self
5483 where
5484 T: std::iter::IntoIterator<Item = V>,
5485 V: std::convert::Into<crate::model::NfsShare>,
5486 {
5487 use std::iter::Iterator;
5488 self.nfs_shares = v.into_iter().map(|i| i.into()).collect();
5489 self
5490 }
5491
5492 /// Sets the value of [next_page_token][crate::model::ListNfsSharesResponse::next_page_token].
5493 ///
5494 /// # Example
5495 /// ```ignore,no_run
5496 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5497 /// let x = ListNfsSharesResponse::new().set_next_page_token("example");
5498 /// ```
5499 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5500 self.next_page_token = v.into();
5501 self
5502 }
5503
5504 /// Sets the value of [unreachable][crate::model::ListNfsSharesResponse::unreachable].
5505 ///
5506 /// # Example
5507 /// ```ignore,no_run
5508 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5509 /// let x = ListNfsSharesResponse::new().set_unreachable(["a", "b", "c"]);
5510 /// ```
5511 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5512 where
5513 T: std::iter::IntoIterator<Item = V>,
5514 V: std::convert::Into<std::string::String>,
5515 {
5516 use std::iter::Iterator;
5517 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5518 self
5519 }
5520}
5521
5522impl wkt::message::Message for ListNfsSharesResponse {
5523 fn typename() -> &'static str {
5524 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesResponse"
5525 }
5526}
5527
5528#[doc(hidden)]
5529impl gax::paginator::internal::PageableResponse for ListNfsSharesResponse {
5530 type PageItem = crate::model::NfsShare;
5531
5532 fn items(self) -> std::vec::Vec<Self::PageItem> {
5533 self.nfs_shares
5534 }
5535
5536 fn next_page_token(&self) -> std::string::String {
5537 use std::clone::Clone;
5538 self.next_page_token.clone()
5539 }
5540}
5541
5542/// Message requesting to updating an NFS share.
5543#[derive(Clone, Default, PartialEq)]
5544#[non_exhaustive]
5545pub struct UpdateNfsShareRequest {
5546 /// Required. The NFS share to update.
5547 ///
5548 /// The `name` field is used to identify the NFS share to update.
5549 /// Format: projects/{project}/locations/{location}/nfsShares/{nfs_share}
5550 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5551
5552 /// The list of fields to update.
5553 /// The only currently supported fields are:
5554 /// `labels`
5555 /// `allowed_clients`
5556 pub update_mask: std::option::Option<wkt::FieldMask>,
5557
5558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5559}
5560
5561impl UpdateNfsShareRequest {
5562 pub fn new() -> Self {
5563 std::default::Default::default()
5564 }
5565
5566 /// Sets the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5567 ///
5568 /// # Example
5569 /// ```ignore,no_run
5570 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5571 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5572 /// let x = UpdateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5573 /// ```
5574 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5575 where
5576 T: std::convert::Into<crate::model::NfsShare>,
5577 {
5578 self.nfs_share = std::option::Option::Some(v.into());
5579 self
5580 }
5581
5582 /// Sets or clears the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5583 ///
5584 /// # Example
5585 /// ```ignore,no_run
5586 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5587 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5588 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5589 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5590 /// ```
5591 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5592 where
5593 T: std::convert::Into<crate::model::NfsShare>,
5594 {
5595 self.nfs_share = v.map(|x| x.into());
5596 self
5597 }
5598
5599 /// Sets the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5600 ///
5601 /// # Example
5602 /// ```ignore,no_run
5603 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5604 /// use wkt::FieldMask;
5605 /// let x = UpdateNfsShareRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5606 /// ```
5607 pub fn set_update_mask<T>(mut self, v: T) -> Self
5608 where
5609 T: std::convert::Into<wkt::FieldMask>,
5610 {
5611 self.update_mask = std::option::Option::Some(v.into());
5612 self
5613 }
5614
5615 /// Sets or clears the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5616 ///
5617 /// # Example
5618 /// ```ignore,no_run
5619 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5620 /// use wkt::FieldMask;
5621 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5622 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5623 /// ```
5624 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5625 where
5626 T: std::convert::Into<wkt::FieldMask>,
5627 {
5628 self.update_mask = v.map(|x| x.into());
5629 self
5630 }
5631}
5632
5633impl wkt::message::Message for UpdateNfsShareRequest {
5634 fn typename() -> &'static str {
5635 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNfsShareRequest"
5636 }
5637}
5638
5639/// Message requesting rename of a server.
5640#[derive(Clone, Default, PartialEq)]
5641#[non_exhaustive]
5642pub struct RenameNfsShareRequest {
5643 /// Required. The `name` field is used to identify the nfsshare.
5644 /// Format: projects/{project}/locations/{location}/nfsshares/{nfsshare}
5645 pub name: std::string::String,
5646
5647 /// Required. The new `id` of the nfsshare.
5648 pub new_nfsshare_id: std::string::String,
5649
5650 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5651}
5652
5653impl RenameNfsShareRequest {
5654 pub fn new() -> Self {
5655 std::default::Default::default()
5656 }
5657
5658 /// Sets the value of [name][crate::model::RenameNfsShareRequest::name].
5659 ///
5660 /// # Example
5661 /// ```ignore,no_run
5662 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5663 /// let x = RenameNfsShareRequest::new().set_name("example");
5664 /// ```
5665 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5666 self.name = v.into();
5667 self
5668 }
5669
5670 /// Sets the value of [new_nfsshare_id][crate::model::RenameNfsShareRequest::new_nfsshare_id].
5671 ///
5672 /// # Example
5673 /// ```ignore,no_run
5674 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5675 /// let x = RenameNfsShareRequest::new().set_new_nfsshare_id("example");
5676 /// ```
5677 pub fn set_new_nfsshare_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5678 self.new_nfsshare_id = v.into();
5679 self
5680 }
5681}
5682
5683impl wkt::message::Message for RenameNfsShareRequest {
5684 fn typename() -> &'static str {
5685 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNfsShareRequest"
5686 }
5687}
5688
5689/// Message for creating an NFS share.
5690#[derive(Clone, Default, PartialEq)]
5691#[non_exhaustive]
5692pub struct CreateNfsShareRequest {
5693 /// Required. The parent project and location.
5694 pub parent: std::string::String,
5695
5696 /// Required. The NfsShare to create.
5697 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5698
5699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5700}
5701
5702impl CreateNfsShareRequest {
5703 pub fn new() -> Self {
5704 std::default::Default::default()
5705 }
5706
5707 /// Sets the value of [parent][crate::model::CreateNfsShareRequest::parent].
5708 ///
5709 /// # Example
5710 /// ```ignore,no_run
5711 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5712 /// let x = CreateNfsShareRequest::new().set_parent("example");
5713 /// ```
5714 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5715 self.parent = v.into();
5716 self
5717 }
5718
5719 /// Sets the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5720 ///
5721 /// # Example
5722 /// ```ignore,no_run
5723 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5724 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5725 /// let x = CreateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5726 /// ```
5727 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5728 where
5729 T: std::convert::Into<crate::model::NfsShare>,
5730 {
5731 self.nfs_share = std::option::Option::Some(v.into());
5732 self
5733 }
5734
5735 /// Sets or clears the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5736 ///
5737 /// # Example
5738 /// ```ignore,no_run
5739 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5740 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5741 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5742 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5743 /// ```
5744 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5745 where
5746 T: std::convert::Into<crate::model::NfsShare>,
5747 {
5748 self.nfs_share = v.map(|x| x.into());
5749 self
5750 }
5751}
5752
5753impl wkt::message::Message for CreateNfsShareRequest {
5754 fn typename() -> &'static str {
5755 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateNfsShareRequest"
5756 }
5757}
5758
5759/// Message for deleting an NFS share.
5760#[derive(Clone, Default, PartialEq)]
5761#[non_exhaustive]
5762pub struct DeleteNfsShareRequest {
5763 /// Required. The name of the NFS share to delete.
5764 pub name: std::string::String,
5765
5766 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5767}
5768
5769impl DeleteNfsShareRequest {
5770 pub fn new() -> Self {
5771 std::default::Default::default()
5772 }
5773
5774 /// Sets the value of [name][crate::model::DeleteNfsShareRequest::name].
5775 ///
5776 /// # Example
5777 /// ```ignore,no_run
5778 /// # use google_cloud_baremetalsolution_v2::model::DeleteNfsShareRequest;
5779 /// let x = DeleteNfsShareRequest::new().set_name("example");
5780 /// ```
5781 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5782 self.name = v.into();
5783 self
5784 }
5785}
5786
5787impl wkt::message::Message for DeleteNfsShareRequest {
5788 fn typename() -> &'static str {
5789 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteNfsShareRequest"
5790 }
5791}
5792
5793/// Operation System image.
5794#[derive(Clone, Default, PartialEq)]
5795#[non_exhaustive]
5796pub struct OSImage {
5797 /// Output only. OS Image's unique name.
5798 pub name: std::string::String,
5799
5800 /// OS Image code.
5801 pub code: std::string::String,
5802
5803 /// OS Image description.
5804 pub description: std::string::String,
5805
5806 /// Instance types this image is applicable to.
5807 /// [Available
5808 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
5809 pub applicable_instance_types: std::vec::Vec<std::string::String>,
5810
5811 /// Network templates that can be used with this OS Image.
5812 pub supported_network_templates: std::vec::Vec<std::string::String>,
5813
5814 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5815}
5816
5817impl OSImage {
5818 pub fn new() -> Self {
5819 std::default::Default::default()
5820 }
5821
5822 /// Sets the value of [name][crate::model::OSImage::name].
5823 ///
5824 /// # Example
5825 /// ```ignore,no_run
5826 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5827 /// let x = OSImage::new().set_name("example");
5828 /// ```
5829 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5830 self.name = v.into();
5831 self
5832 }
5833
5834 /// Sets the value of [code][crate::model::OSImage::code].
5835 ///
5836 /// # Example
5837 /// ```ignore,no_run
5838 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5839 /// let x = OSImage::new().set_code("example");
5840 /// ```
5841 pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5842 self.code = v.into();
5843 self
5844 }
5845
5846 /// Sets the value of [description][crate::model::OSImage::description].
5847 ///
5848 /// # Example
5849 /// ```ignore,no_run
5850 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5851 /// let x = OSImage::new().set_description("example");
5852 /// ```
5853 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5854 self.description = v.into();
5855 self
5856 }
5857
5858 /// Sets the value of [applicable_instance_types][crate::model::OSImage::applicable_instance_types].
5859 ///
5860 /// # Example
5861 /// ```ignore,no_run
5862 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5863 /// let x = OSImage::new().set_applicable_instance_types(["a", "b", "c"]);
5864 /// ```
5865 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
5866 where
5867 T: std::iter::IntoIterator<Item = V>,
5868 V: std::convert::Into<std::string::String>,
5869 {
5870 use std::iter::Iterator;
5871 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
5872 self
5873 }
5874
5875 /// Sets the value of [supported_network_templates][crate::model::OSImage::supported_network_templates].
5876 ///
5877 /// # Example
5878 /// ```ignore,no_run
5879 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5880 /// let x = OSImage::new().set_supported_network_templates(["a", "b", "c"]);
5881 /// ```
5882 pub fn set_supported_network_templates<T, V>(mut self, v: T) -> Self
5883 where
5884 T: std::iter::IntoIterator<Item = V>,
5885 V: std::convert::Into<std::string::String>,
5886 {
5887 use std::iter::Iterator;
5888 self.supported_network_templates = v.into_iter().map(|i| i.into()).collect();
5889 self
5890 }
5891}
5892
5893impl wkt::message::Message for OSImage {
5894 fn typename() -> &'static str {
5895 "type.googleapis.com/google.cloud.baremetalsolution.v2.OSImage"
5896 }
5897}
5898
5899/// Request for getting all available OS images.
5900#[derive(Clone, Default, PartialEq)]
5901#[non_exhaustive]
5902pub struct ListOSImagesRequest {
5903 /// Required. Parent value for ListProvisioningQuotasRequest.
5904 pub parent: std::string::String,
5905
5906 /// Requested page size. The server might return fewer items than requested.
5907 /// If unspecified, server will pick an appropriate default.
5908 /// Notice that page_size field is not supported and won't be respected in
5909 /// the API request for now, will be updated when pagination is supported.
5910 pub page_size: i32,
5911
5912 /// A token identifying a page of results from the server.
5913 pub page_token: std::string::String,
5914
5915 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5916}
5917
5918impl ListOSImagesRequest {
5919 pub fn new() -> Self {
5920 std::default::Default::default()
5921 }
5922
5923 /// Sets the value of [parent][crate::model::ListOSImagesRequest::parent].
5924 ///
5925 /// # Example
5926 /// ```ignore,no_run
5927 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5928 /// let x = ListOSImagesRequest::new().set_parent("example");
5929 /// ```
5930 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5931 self.parent = v.into();
5932 self
5933 }
5934
5935 /// Sets the value of [page_size][crate::model::ListOSImagesRequest::page_size].
5936 ///
5937 /// # Example
5938 /// ```ignore,no_run
5939 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5940 /// let x = ListOSImagesRequest::new().set_page_size(42);
5941 /// ```
5942 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5943 self.page_size = v.into();
5944 self
5945 }
5946
5947 /// Sets the value of [page_token][crate::model::ListOSImagesRequest::page_token].
5948 ///
5949 /// # Example
5950 /// ```ignore,no_run
5951 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5952 /// let x = ListOSImagesRequest::new().set_page_token("example");
5953 /// ```
5954 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5955 self.page_token = v.into();
5956 self
5957 }
5958}
5959
5960impl wkt::message::Message for ListOSImagesRequest {
5961 fn typename() -> &'static str {
5962 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesRequest"
5963 }
5964}
5965
5966/// Request for getting all available OS images.
5967#[derive(Clone, Default, PartialEq)]
5968#[non_exhaustive]
5969pub struct ListOSImagesResponse {
5970 /// The OS images available.
5971 pub os_images: std::vec::Vec<crate::model::OSImage>,
5972
5973 /// Token to retrieve the next page of results, or empty if there are no more
5974 /// results in the list.
5975 pub next_page_token: std::string::String,
5976
5977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5978}
5979
5980impl ListOSImagesResponse {
5981 pub fn new() -> Self {
5982 std::default::Default::default()
5983 }
5984
5985 /// Sets the value of [os_images][crate::model::ListOSImagesResponse::os_images].
5986 ///
5987 /// # Example
5988 /// ```ignore,no_run
5989 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
5990 /// use google_cloud_baremetalsolution_v2::model::OSImage;
5991 /// let x = ListOSImagesResponse::new()
5992 /// .set_os_images([
5993 /// OSImage::default()/* use setters */,
5994 /// OSImage::default()/* use (different) setters */,
5995 /// ]);
5996 /// ```
5997 pub fn set_os_images<T, V>(mut self, v: T) -> Self
5998 where
5999 T: std::iter::IntoIterator<Item = V>,
6000 V: std::convert::Into<crate::model::OSImage>,
6001 {
6002 use std::iter::Iterator;
6003 self.os_images = v.into_iter().map(|i| i.into()).collect();
6004 self
6005 }
6006
6007 /// Sets the value of [next_page_token][crate::model::ListOSImagesResponse::next_page_token].
6008 ///
6009 /// # Example
6010 /// ```ignore,no_run
6011 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
6012 /// let x = ListOSImagesResponse::new().set_next_page_token("example");
6013 /// ```
6014 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6015 self.next_page_token = v.into();
6016 self
6017 }
6018}
6019
6020impl wkt::message::Message for ListOSImagesResponse {
6021 fn typename() -> &'static str {
6022 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesResponse"
6023 }
6024}
6025
6026#[doc(hidden)]
6027impl gax::paginator::internal::PageableResponse for ListOSImagesResponse {
6028 type PageItem = crate::model::OSImage;
6029
6030 fn items(self) -> std::vec::Vec<Self::PageItem> {
6031 self.os_images
6032 }
6033
6034 fn next_page_token(&self) -> std::string::String {
6035 use std::clone::Clone;
6036 self.next_page_token.clone()
6037 }
6038}
6039
6040/// A provisioning configuration.
6041#[derive(Clone, Default, PartialEq)]
6042#[non_exhaustive]
6043pub struct ProvisioningConfig {
6044 /// Output only. The system-generated name of the provisioning config. This
6045 /// follows the UUID format.
6046 pub name: std::string::String,
6047
6048 /// Instances to be created.
6049 pub instances: std::vec::Vec<crate::model::InstanceConfig>,
6050
6051 /// Networks to be created.
6052 pub networks: std::vec::Vec<crate::model::NetworkConfig>,
6053
6054 /// Volumes to be created.
6055 pub volumes: std::vec::Vec<crate::model::VolumeConfig>,
6056
6057 /// A generated ticket id to track provisioning request.
6058 pub ticket_id: std::string::String,
6059
6060 /// A service account to enable customers to access instance credentials upon
6061 /// handover.
6062 pub handover_service_account: std::string::String,
6063
6064 /// Email provided to send a confirmation with provisioning config to.
6065 /// Deprecated in favour of email field in request messages.
6066 #[deprecated]
6067 pub email: std::string::String,
6068
6069 /// Output only. State of ProvisioningConfig.
6070 pub state: crate::model::provisioning_config::State,
6071
6072 /// Optional. Location name of this ProvisioningConfig.
6073 /// It is optional only for Intake UI transition period.
6074 pub location: std::string::String,
6075
6076 /// Output only. Last update timestamp.
6077 pub update_time: std::option::Option<wkt::Timestamp>,
6078
6079 /// Output only. URI to Cloud Console UI view of this provisioning config.
6080 pub cloud_console_uri: std::string::String,
6081
6082 /// If true, VPC SC is enabled for the cluster.
6083 pub vpc_sc_enabled: bool,
6084
6085 /// Optional status messages associated with the FAILED state.
6086 pub status_message: std::string::String,
6087
6088 /// Optional. The user-defined identifier of the provisioning config.
6089 pub custom_id: std::string::String,
6090
6091 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6092}
6093
6094impl ProvisioningConfig {
6095 pub fn new() -> Self {
6096 std::default::Default::default()
6097 }
6098
6099 /// Sets the value of [name][crate::model::ProvisioningConfig::name].
6100 ///
6101 /// # Example
6102 /// ```ignore,no_run
6103 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6104 /// let x = ProvisioningConfig::new().set_name("example");
6105 /// ```
6106 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6107 self.name = v.into();
6108 self
6109 }
6110
6111 /// Sets the value of [instances][crate::model::ProvisioningConfig::instances].
6112 ///
6113 /// # Example
6114 /// ```ignore,no_run
6115 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6116 /// use google_cloud_baremetalsolution_v2::model::InstanceConfig;
6117 /// let x = ProvisioningConfig::new()
6118 /// .set_instances([
6119 /// InstanceConfig::default()/* use setters */,
6120 /// InstanceConfig::default()/* use (different) setters */,
6121 /// ]);
6122 /// ```
6123 pub fn set_instances<T, V>(mut self, v: T) -> Self
6124 where
6125 T: std::iter::IntoIterator<Item = V>,
6126 V: std::convert::Into<crate::model::InstanceConfig>,
6127 {
6128 use std::iter::Iterator;
6129 self.instances = v.into_iter().map(|i| i.into()).collect();
6130 self
6131 }
6132
6133 /// Sets the value of [networks][crate::model::ProvisioningConfig::networks].
6134 ///
6135 /// # Example
6136 /// ```ignore,no_run
6137 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6138 /// use google_cloud_baremetalsolution_v2::model::NetworkConfig;
6139 /// let x = ProvisioningConfig::new()
6140 /// .set_networks([
6141 /// NetworkConfig::default()/* use setters */,
6142 /// NetworkConfig::default()/* use (different) setters */,
6143 /// ]);
6144 /// ```
6145 pub fn set_networks<T, V>(mut self, v: T) -> Self
6146 where
6147 T: std::iter::IntoIterator<Item = V>,
6148 V: std::convert::Into<crate::model::NetworkConfig>,
6149 {
6150 use std::iter::Iterator;
6151 self.networks = v.into_iter().map(|i| i.into()).collect();
6152 self
6153 }
6154
6155 /// Sets the value of [volumes][crate::model::ProvisioningConfig::volumes].
6156 ///
6157 /// # Example
6158 /// ```ignore,no_run
6159 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6160 /// use google_cloud_baremetalsolution_v2::model::VolumeConfig;
6161 /// let x = ProvisioningConfig::new()
6162 /// .set_volumes([
6163 /// VolumeConfig::default()/* use setters */,
6164 /// VolumeConfig::default()/* use (different) setters */,
6165 /// ]);
6166 /// ```
6167 pub fn set_volumes<T, V>(mut self, v: T) -> Self
6168 where
6169 T: std::iter::IntoIterator<Item = V>,
6170 V: std::convert::Into<crate::model::VolumeConfig>,
6171 {
6172 use std::iter::Iterator;
6173 self.volumes = v.into_iter().map(|i| i.into()).collect();
6174 self
6175 }
6176
6177 /// Sets the value of [ticket_id][crate::model::ProvisioningConfig::ticket_id].
6178 ///
6179 /// # Example
6180 /// ```ignore,no_run
6181 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6182 /// let x = ProvisioningConfig::new().set_ticket_id("example");
6183 /// ```
6184 pub fn set_ticket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6185 self.ticket_id = v.into();
6186 self
6187 }
6188
6189 /// Sets the value of [handover_service_account][crate::model::ProvisioningConfig::handover_service_account].
6190 ///
6191 /// # Example
6192 /// ```ignore,no_run
6193 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6194 /// let x = ProvisioningConfig::new().set_handover_service_account("example");
6195 /// ```
6196 pub fn set_handover_service_account<T: std::convert::Into<std::string::String>>(
6197 mut self,
6198 v: T,
6199 ) -> Self {
6200 self.handover_service_account = v.into();
6201 self
6202 }
6203
6204 /// Sets the value of [email][crate::model::ProvisioningConfig::email].
6205 ///
6206 /// # Example
6207 /// ```ignore,no_run
6208 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6209 /// let x = ProvisioningConfig::new().set_email("example");
6210 /// ```
6211 #[deprecated]
6212 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6213 self.email = v.into();
6214 self
6215 }
6216
6217 /// Sets the value of [state][crate::model::ProvisioningConfig::state].
6218 ///
6219 /// # Example
6220 /// ```ignore,no_run
6221 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6222 /// use google_cloud_baremetalsolution_v2::model::provisioning_config::State;
6223 /// let x0 = ProvisioningConfig::new().set_state(State::Draft);
6224 /// let x1 = ProvisioningConfig::new().set_state(State::Submitted);
6225 /// let x2 = ProvisioningConfig::new().set_state(State::Provisioning);
6226 /// ```
6227 pub fn set_state<T: std::convert::Into<crate::model::provisioning_config::State>>(
6228 mut self,
6229 v: T,
6230 ) -> Self {
6231 self.state = v.into();
6232 self
6233 }
6234
6235 /// Sets the value of [location][crate::model::ProvisioningConfig::location].
6236 ///
6237 /// # Example
6238 /// ```ignore,no_run
6239 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6240 /// let x = ProvisioningConfig::new().set_location("example");
6241 /// ```
6242 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6243 self.location = v.into();
6244 self
6245 }
6246
6247 /// Sets the value of [update_time][crate::model::ProvisioningConfig::update_time].
6248 ///
6249 /// # Example
6250 /// ```ignore,no_run
6251 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6252 /// use wkt::Timestamp;
6253 /// let x = ProvisioningConfig::new().set_update_time(Timestamp::default()/* use setters */);
6254 /// ```
6255 pub fn set_update_time<T>(mut self, v: T) -> Self
6256 where
6257 T: std::convert::Into<wkt::Timestamp>,
6258 {
6259 self.update_time = std::option::Option::Some(v.into());
6260 self
6261 }
6262
6263 /// Sets or clears the value of [update_time][crate::model::ProvisioningConfig::update_time].
6264 ///
6265 /// # Example
6266 /// ```ignore,no_run
6267 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6268 /// use wkt::Timestamp;
6269 /// let x = ProvisioningConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6270 /// let x = ProvisioningConfig::new().set_or_clear_update_time(None::<Timestamp>);
6271 /// ```
6272 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6273 where
6274 T: std::convert::Into<wkt::Timestamp>,
6275 {
6276 self.update_time = v.map(|x| x.into());
6277 self
6278 }
6279
6280 /// Sets the value of [cloud_console_uri][crate::model::ProvisioningConfig::cloud_console_uri].
6281 ///
6282 /// # Example
6283 /// ```ignore,no_run
6284 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6285 /// let x = ProvisioningConfig::new().set_cloud_console_uri("example");
6286 /// ```
6287 pub fn set_cloud_console_uri<T: std::convert::Into<std::string::String>>(
6288 mut self,
6289 v: T,
6290 ) -> Self {
6291 self.cloud_console_uri = v.into();
6292 self
6293 }
6294
6295 /// Sets the value of [vpc_sc_enabled][crate::model::ProvisioningConfig::vpc_sc_enabled].
6296 ///
6297 /// # Example
6298 /// ```ignore,no_run
6299 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6300 /// let x = ProvisioningConfig::new().set_vpc_sc_enabled(true);
6301 /// ```
6302 pub fn set_vpc_sc_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6303 self.vpc_sc_enabled = v.into();
6304 self
6305 }
6306
6307 /// Sets the value of [status_message][crate::model::ProvisioningConfig::status_message].
6308 ///
6309 /// # Example
6310 /// ```ignore,no_run
6311 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6312 /// let x = ProvisioningConfig::new().set_status_message("example");
6313 /// ```
6314 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6315 self.status_message = v.into();
6316 self
6317 }
6318
6319 /// Sets the value of [custom_id][crate::model::ProvisioningConfig::custom_id].
6320 ///
6321 /// # Example
6322 /// ```ignore,no_run
6323 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6324 /// let x = ProvisioningConfig::new().set_custom_id("example");
6325 /// ```
6326 pub fn set_custom_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6327 self.custom_id = v.into();
6328 self
6329 }
6330}
6331
6332impl wkt::message::Message for ProvisioningConfig {
6333 fn typename() -> &'static str {
6334 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningConfig"
6335 }
6336}
6337
6338/// Defines additional types related to [ProvisioningConfig].
6339pub mod provisioning_config {
6340 #[allow(unused_imports)]
6341 use super::*;
6342
6343 /// The possible states for this ProvisioningConfig.
6344 ///
6345 /// # Working with unknown values
6346 ///
6347 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6348 /// additional enum variants at any time. Adding new variants is not considered
6349 /// a breaking change. Applications should write their code in anticipation of:
6350 ///
6351 /// - New values appearing in future releases of the client library, **and**
6352 /// - New values received dynamically, without application changes.
6353 ///
6354 /// Please consult the [Working with enums] section in the user guide for some
6355 /// guidelines.
6356 ///
6357 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6358 #[derive(Clone, Debug, PartialEq)]
6359 #[non_exhaustive]
6360 pub enum State {
6361 /// State wasn't specified.
6362 Unspecified,
6363 /// ProvisioningConfig is a draft and can be freely modified.
6364 Draft,
6365 /// ProvisioningConfig was already submitted and cannot be modified.
6366 Submitted,
6367 /// ProvisioningConfig was in the provisioning state. Initially this state
6368 /// comes from the work order table in big query when SNOW is used. Later
6369 /// this field can be set by the work order API.
6370 Provisioning,
6371 /// ProvisioningConfig was provisioned, meaning the resources exist.
6372 Provisioned,
6373 /// ProvisioningConfig was validated. A validation tool will be run to
6374 /// set this state.
6375 Validated,
6376 /// ProvisioningConfig was canceled.
6377 Cancelled,
6378 /// The request is submitted for provisioning, with error return.
6379 Failed,
6380 /// If set, the enum was initialized with an unknown value.
6381 ///
6382 /// Applications can examine the value using [State::value] or
6383 /// [State::name].
6384 UnknownValue(state::UnknownValue),
6385 }
6386
6387 #[doc(hidden)]
6388 pub mod state {
6389 #[allow(unused_imports)]
6390 use super::*;
6391 #[derive(Clone, Debug, PartialEq)]
6392 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6393 }
6394
6395 impl State {
6396 /// Gets the enum value.
6397 ///
6398 /// Returns `None` if the enum contains an unknown value deserialized from
6399 /// the string representation of enums.
6400 pub fn value(&self) -> std::option::Option<i32> {
6401 match self {
6402 Self::Unspecified => std::option::Option::Some(0),
6403 Self::Draft => std::option::Option::Some(1),
6404 Self::Submitted => std::option::Option::Some(2),
6405 Self::Provisioning => std::option::Option::Some(3),
6406 Self::Provisioned => std::option::Option::Some(4),
6407 Self::Validated => std::option::Option::Some(5),
6408 Self::Cancelled => std::option::Option::Some(6),
6409 Self::Failed => std::option::Option::Some(7),
6410 Self::UnknownValue(u) => u.0.value(),
6411 }
6412 }
6413
6414 /// Gets the enum value as a string.
6415 ///
6416 /// Returns `None` if the enum contains an unknown value deserialized from
6417 /// the integer representation of enums.
6418 pub fn name(&self) -> std::option::Option<&str> {
6419 match self {
6420 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6421 Self::Draft => std::option::Option::Some("DRAFT"),
6422 Self::Submitted => std::option::Option::Some("SUBMITTED"),
6423 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
6424 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
6425 Self::Validated => std::option::Option::Some("VALIDATED"),
6426 Self::Cancelled => std::option::Option::Some("CANCELLED"),
6427 Self::Failed => std::option::Option::Some("FAILED"),
6428 Self::UnknownValue(u) => u.0.name(),
6429 }
6430 }
6431 }
6432
6433 impl std::default::Default for State {
6434 fn default() -> Self {
6435 use std::convert::From;
6436 Self::from(0)
6437 }
6438 }
6439
6440 impl std::fmt::Display for State {
6441 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6442 wkt::internal::display_enum(f, self.name(), self.value())
6443 }
6444 }
6445
6446 impl std::convert::From<i32> for State {
6447 fn from(value: i32) -> Self {
6448 match value {
6449 0 => Self::Unspecified,
6450 1 => Self::Draft,
6451 2 => Self::Submitted,
6452 3 => Self::Provisioning,
6453 4 => Self::Provisioned,
6454 5 => Self::Validated,
6455 6 => Self::Cancelled,
6456 7 => Self::Failed,
6457 _ => Self::UnknownValue(state::UnknownValue(
6458 wkt::internal::UnknownEnumValue::Integer(value),
6459 )),
6460 }
6461 }
6462 }
6463
6464 impl std::convert::From<&str> for State {
6465 fn from(value: &str) -> Self {
6466 use std::string::ToString;
6467 match value {
6468 "STATE_UNSPECIFIED" => Self::Unspecified,
6469 "DRAFT" => Self::Draft,
6470 "SUBMITTED" => Self::Submitted,
6471 "PROVISIONING" => Self::Provisioning,
6472 "PROVISIONED" => Self::Provisioned,
6473 "VALIDATED" => Self::Validated,
6474 "CANCELLED" => Self::Cancelled,
6475 "FAILED" => Self::Failed,
6476 _ => Self::UnknownValue(state::UnknownValue(
6477 wkt::internal::UnknownEnumValue::String(value.to_string()),
6478 )),
6479 }
6480 }
6481 }
6482
6483 impl serde::ser::Serialize for State {
6484 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6485 where
6486 S: serde::Serializer,
6487 {
6488 match self {
6489 Self::Unspecified => serializer.serialize_i32(0),
6490 Self::Draft => serializer.serialize_i32(1),
6491 Self::Submitted => serializer.serialize_i32(2),
6492 Self::Provisioning => serializer.serialize_i32(3),
6493 Self::Provisioned => serializer.serialize_i32(4),
6494 Self::Validated => serializer.serialize_i32(5),
6495 Self::Cancelled => serializer.serialize_i32(6),
6496 Self::Failed => serializer.serialize_i32(7),
6497 Self::UnknownValue(u) => u.0.serialize(serializer),
6498 }
6499 }
6500 }
6501
6502 impl<'de> serde::de::Deserialize<'de> for State {
6503 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6504 where
6505 D: serde::Deserializer<'de>,
6506 {
6507 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6508 ".google.cloud.baremetalsolution.v2.ProvisioningConfig.State",
6509 ))
6510 }
6511 }
6512}
6513
6514/// Request for SubmitProvisioningConfig.
6515#[derive(Clone, Default, PartialEq)]
6516#[non_exhaustive]
6517pub struct SubmitProvisioningConfigRequest {
6518 /// Required. The parent project and location containing the
6519 /// ProvisioningConfig.
6520 pub parent: std::string::String,
6521
6522 /// Required. The ProvisioningConfig to create.
6523 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6524
6525 /// Optional. Email provided to send a confirmation with provisioning config
6526 /// to.
6527 pub email: std::string::String,
6528
6529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6530}
6531
6532impl SubmitProvisioningConfigRequest {
6533 pub fn new() -> Self {
6534 std::default::Default::default()
6535 }
6536
6537 /// Sets the value of [parent][crate::model::SubmitProvisioningConfigRequest::parent].
6538 ///
6539 /// # Example
6540 /// ```ignore,no_run
6541 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6542 /// let x = SubmitProvisioningConfigRequest::new().set_parent("example");
6543 /// ```
6544 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6545 self.parent = v.into();
6546 self
6547 }
6548
6549 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6550 ///
6551 /// # Example
6552 /// ```ignore,no_run
6553 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6554 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6555 /// let x = SubmitProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6556 /// ```
6557 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6558 where
6559 T: std::convert::Into<crate::model::ProvisioningConfig>,
6560 {
6561 self.provisioning_config = std::option::Option::Some(v.into());
6562 self
6563 }
6564
6565 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6566 ///
6567 /// # Example
6568 /// ```ignore,no_run
6569 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6570 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6571 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6572 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6573 /// ```
6574 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6575 where
6576 T: std::convert::Into<crate::model::ProvisioningConfig>,
6577 {
6578 self.provisioning_config = v.map(|x| x.into());
6579 self
6580 }
6581
6582 /// Sets the value of [email][crate::model::SubmitProvisioningConfigRequest::email].
6583 ///
6584 /// # Example
6585 /// ```ignore,no_run
6586 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6587 /// let x = SubmitProvisioningConfigRequest::new().set_email("example");
6588 /// ```
6589 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6590 self.email = v.into();
6591 self
6592 }
6593}
6594
6595impl wkt::message::Message for SubmitProvisioningConfigRequest {
6596 fn typename() -> &'static str {
6597 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigRequest"
6598 }
6599}
6600
6601/// Response for SubmitProvisioningConfig.
6602#[derive(Clone, Default, PartialEq)]
6603#[non_exhaustive]
6604pub struct SubmitProvisioningConfigResponse {
6605 /// The submitted provisioning config.
6606 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6607
6608 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6609}
6610
6611impl SubmitProvisioningConfigResponse {
6612 pub fn new() -> Self {
6613 std::default::Default::default()
6614 }
6615
6616 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6617 ///
6618 /// # Example
6619 /// ```ignore,no_run
6620 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6621 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6622 /// let x = SubmitProvisioningConfigResponse::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6623 /// ```
6624 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6625 where
6626 T: std::convert::Into<crate::model::ProvisioningConfig>,
6627 {
6628 self.provisioning_config = std::option::Option::Some(v.into());
6629 self
6630 }
6631
6632 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6633 ///
6634 /// # Example
6635 /// ```ignore,no_run
6636 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6637 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6638 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6639 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6640 /// ```
6641 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6642 where
6643 T: std::convert::Into<crate::model::ProvisioningConfig>,
6644 {
6645 self.provisioning_config = v.map(|x| x.into());
6646 self
6647 }
6648}
6649
6650impl wkt::message::Message for SubmitProvisioningConfigResponse {
6651 fn typename() -> &'static str {
6652 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigResponse"
6653 }
6654}
6655
6656/// A provisioning quota for a given project.
6657#[derive(Clone, Default, PartialEq)]
6658#[non_exhaustive]
6659pub struct ProvisioningQuota {
6660 /// Output only. The name of the provisioning quota.
6661 pub name: std::string::String,
6662
6663 /// The asset type of this provisioning quota.
6664 pub asset_type: crate::model::provisioning_quota::AssetType,
6665
6666 /// The gcp service of the provisioning quota.
6667 pub gcp_service: std::string::String,
6668
6669 /// The specific location of the provisioining quota.
6670 pub location: std::string::String,
6671
6672 /// The available count of the provisioning quota.
6673 pub available_count: i32,
6674
6675 /// The quota of one asset type.
6676 pub quota: std::option::Option<crate::model::provisioning_quota::Quota>,
6677
6678 /// Available quantity based on asset type.
6679 pub availability: std::option::Option<crate::model::provisioning_quota::Availability>,
6680
6681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6682}
6683
6684impl ProvisioningQuota {
6685 pub fn new() -> Self {
6686 std::default::Default::default()
6687 }
6688
6689 /// Sets the value of [name][crate::model::ProvisioningQuota::name].
6690 ///
6691 /// # Example
6692 /// ```ignore,no_run
6693 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6694 /// let x = ProvisioningQuota::new().set_name("example");
6695 /// ```
6696 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6697 self.name = v.into();
6698 self
6699 }
6700
6701 /// Sets the value of [asset_type][crate::model::ProvisioningQuota::asset_type].
6702 ///
6703 /// # Example
6704 /// ```ignore,no_run
6705 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6706 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::AssetType;
6707 /// let x0 = ProvisioningQuota::new().set_asset_type(AssetType::Server);
6708 /// let x1 = ProvisioningQuota::new().set_asset_type(AssetType::Storage);
6709 /// let x2 = ProvisioningQuota::new().set_asset_type(AssetType::Network);
6710 /// ```
6711 pub fn set_asset_type<T: std::convert::Into<crate::model::provisioning_quota::AssetType>>(
6712 mut self,
6713 v: T,
6714 ) -> Self {
6715 self.asset_type = v.into();
6716 self
6717 }
6718
6719 /// Sets the value of [gcp_service][crate::model::ProvisioningQuota::gcp_service].
6720 ///
6721 /// # Example
6722 /// ```ignore,no_run
6723 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6724 /// let x = ProvisioningQuota::new().set_gcp_service("example");
6725 /// ```
6726 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6727 self.gcp_service = v.into();
6728 self
6729 }
6730
6731 /// Sets the value of [location][crate::model::ProvisioningQuota::location].
6732 ///
6733 /// # Example
6734 /// ```ignore,no_run
6735 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6736 /// let x = ProvisioningQuota::new().set_location("example");
6737 /// ```
6738 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6739 self.location = v.into();
6740 self
6741 }
6742
6743 /// Sets the value of [available_count][crate::model::ProvisioningQuota::available_count].
6744 ///
6745 /// # Example
6746 /// ```ignore,no_run
6747 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6748 /// let x = ProvisioningQuota::new().set_available_count(42);
6749 /// ```
6750 pub fn set_available_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6751 self.available_count = v.into();
6752 self
6753 }
6754
6755 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota].
6756 ///
6757 /// Note that all the setters affecting `quota` are mutually
6758 /// exclusive.
6759 ///
6760 /// # Example
6761 /// ```ignore,no_run
6762 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6763 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6764 /// let x = ProvisioningQuota::new().set_quota(Some(
6765 /// google_cloud_baremetalsolution_v2::model::provisioning_quota::Quota::InstanceQuota(InstanceQuota::default().into())));
6766 /// ```
6767 pub fn set_quota<
6768 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Quota>>,
6769 >(
6770 mut self,
6771 v: T,
6772 ) -> Self {
6773 self.quota = v.into();
6774 self
6775 }
6776
6777 /// The value of [quota][crate::model::ProvisioningQuota::quota]
6778 /// if it holds a `InstanceQuota`, `None` if the field is not set or
6779 /// holds a different branch.
6780 pub fn instance_quota(
6781 &self,
6782 ) -> std::option::Option<&std::boxed::Box<crate::model::InstanceQuota>> {
6783 #[allow(unreachable_patterns)]
6784 self.quota.as_ref().and_then(|v| match v {
6785 crate::model::provisioning_quota::Quota::InstanceQuota(v) => {
6786 std::option::Option::Some(v)
6787 }
6788 _ => std::option::Option::None,
6789 })
6790 }
6791
6792 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota]
6793 /// to hold a `InstanceQuota`.
6794 ///
6795 /// Note that all the setters affecting `quota` are
6796 /// mutually exclusive.
6797 ///
6798 /// # Example
6799 /// ```ignore,no_run
6800 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6801 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6802 /// let x = ProvisioningQuota::new().set_instance_quota(InstanceQuota::default()/* use setters */);
6803 /// assert!(x.instance_quota().is_some());
6804 /// ```
6805 pub fn set_instance_quota<
6806 T: std::convert::Into<std::boxed::Box<crate::model::InstanceQuota>>,
6807 >(
6808 mut self,
6809 v: T,
6810 ) -> Self {
6811 self.quota = std::option::Option::Some(
6812 crate::model::provisioning_quota::Quota::InstanceQuota(v.into()),
6813 );
6814 self
6815 }
6816
6817 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability].
6818 ///
6819 /// Note that all the setters affecting `availability` are mutually
6820 /// exclusive.
6821 ///
6822 /// # Example
6823 /// ```ignore,no_run
6824 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6825 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::Availability;
6826 /// let x = ProvisioningQuota::new().set_availability(Some(Availability::ServerCount(42)));
6827 /// ```
6828 pub fn set_availability<
6829 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Availability>>,
6830 >(
6831 mut self,
6832 v: T,
6833 ) -> Self {
6834 self.availability = v.into();
6835 self
6836 }
6837
6838 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6839 /// if it holds a `ServerCount`, `None` if the field is not set or
6840 /// holds a different branch.
6841 pub fn server_count(&self) -> std::option::Option<&i64> {
6842 #[allow(unreachable_patterns)]
6843 self.availability.as_ref().and_then(|v| match v {
6844 crate::model::provisioning_quota::Availability::ServerCount(v) => {
6845 std::option::Option::Some(v)
6846 }
6847 _ => std::option::Option::None,
6848 })
6849 }
6850
6851 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6852 /// to hold a `ServerCount`.
6853 ///
6854 /// Note that all the setters affecting `availability` are
6855 /// mutually exclusive.
6856 ///
6857 /// # Example
6858 /// ```ignore,no_run
6859 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6860 /// let x = ProvisioningQuota::new().set_server_count(42);
6861 /// assert!(x.server_count().is_some());
6862 /// assert!(x.network_bandwidth().is_none());
6863 /// assert!(x.storage_gib().is_none());
6864 /// ```
6865 pub fn set_server_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6866 self.availability = std::option::Option::Some(
6867 crate::model::provisioning_quota::Availability::ServerCount(v.into()),
6868 );
6869 self
6870 }
6871
6872 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6873 /// if it holds a `NetworkBandwidth`, `None` if the field is not set or
6874 /// holds a different branch.
6875 pub fn network_bandwidth(&self) -> std::option::Option<&i64> {
6876 #[allow(unreachable_patterns)]
6877 self.availability.as_ref().and_then(|v| match v {
6878 crate::model::provisioning_quota::Availability::NetworkBandwidth(v) => {
6879 std::option::Option::Some(v)
6880 }
6881 _ => std::option::Option::None,
6882 })
6883 }
6884
6885 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6886 /// to hold a `NetworkBandwidth`.
6887 ///
6888 /// Note that all the setters affecting `availability` are
6889 /// mutually exclusive.
6890 ///
6891 /// # Example
6892 /// ```ignore,no_run
6893 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6894 /// let x = ProvisioningQuota::new().set_network_bandwidth(42);
6895 /// assert!(x.network_bandwidth().is_some());
6896 /// assert!(x.server_count().is_none());
6897 /// assert!(x.storage_gib().is_none());
6898 /// ```
6899 pub fn set_network_bandwidth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6900 self.availability = std::option::Option::Some(
6901 crate::model::provisioning_quota::Availability::NetworkBandwidth(v.into()),
6902 );
6903 self
6904 }
6905
6906 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6907 /// if it holds a `StorageGib`, `None` if the field is not set or
6908 /// holds a different branch.
6909 pub fn storage_gib(&self) -> std::option::Option<&i64> {
6910 #[allow(unreachable_patterns)]
6911 self.availability.as_ref().and_then(|v| match v {
6912 crate::model::provisioning_quota::Availability::StorageGib(v) => {
6913 std::option::Option::Some(v)
6914 }
6915 _ => std::option::Option::None,
6916 })
6917 }
6918
6919 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6920 /// to hold a `StorageGib`.
6921 ///
6922 /// Note that all the setters affecting `availability` are
6923 /// mutually exclusive.
6924 ///
6925 /// # Example
6926 /// ```ignore,no_run
6927 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6928 /// let x = ProvisioningQuota::new().set_storage_gib(42);
6929 /// assert!(x.storage_gib().is_some());
6930 /// assert!(x.server_count().is_none());
6931 /// assert!(x.network_bandwidth().is_none());
6932 /// ```
6933 pub fn set_storage_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6934 self.availability = std::option::Option::Some(
6935 crate::model::provisioning_quota::Availability::StorageGib(v.into()),
6936 );
6937 self
6938 }
6939}
6940
6941impl wkt::message::Message for ProvisioningQuota {
6942 fn typename() -> &'static str {
6943 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningQuota"
6944 }
6945}
6946
6947/// Defines additional types related to [ProvisioningQuota].
6948pub mod provisioning_quota {
6949 #[allow(unused_imports)]
6950 use super::*;
6951
6952 /// The available asset types for intake.
6953 ///
6954 /// # Working with unknown values
6955 ///
6956 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6957 /// additional enum variants at any time. Adding new variants is not considered
6958 /// a breaking change. Applications should write their code in anticipation of:
6959 ///
6960 /// - New values appearing in future releases of the client library, **and**
6961 /// - New values received dynamically, without application changes.
6962 ///
6963 /// Please consult the [Working with enums] section in the user guide for some
6964 /// guidelines.
6965 ///
6966 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6967 #[derive(Clone, Debug, PartialEq)]
6968 #[non_exhaustive]
6969 pub enum AssetType {
6970 /// The unspecified type.
6971 Unspecified,
6972 /// The server asset type.
6973 Server,
6974 /// The storage asset type.
6975 Storage,
6976 /// The network asset type.
6977 Network,
6978 /// If set, the enum was initialized with an unknown value.
6979 ///
6980 /// Applications can examine the value using [AssetType::value] or
6981 /// [AssetType::name].
6982 UnknownValue(asset_type::UnknownValue),
6983 }
6984
6985 #[doc(hidden)]
6986 pub mod asset_type {
6987 #[allow(unused_imports)]
6988 use super::*;
6989 #[derive(Clone, Debug, PartialEq)]
6990 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6991 }
6992
6993 impl AssetType {
6994 /// Gets the enum value.
6995 ///
6996 /// Returns `None` if the enum contains an unknown value deserialized from
6997 /// the string representation of enums.
6998 pub fn value(&self) -> std::option::Option<i32> {
6999 match self {
7000 Self::Unspecified => std::option::Option::Some(0),
7001 Self::Server => std::option::Option::Some(1),
7002 Self::Storage => std::option::Option::Some(2),
7003 Self::Network => std::option::Option::Some(3),
7004 Self::UnknownValue(u) => u.0.value(),
7005 }
7006 }
7007
7008 /// Gets the enum value as a string.
7009 ///
7010 /// Returns `None` if the enum contains an unknown value deserialized from
7011 /// the integer representation of enums.
7012 pub fn name(&self) -> std::option::Option<&str> {
7013 match self {
7014 Self::Unspecified => std::option::Option::Some("ASSET_TYPE_UNSPECIFIED"),
7015 Self::Server => std::option::Option::Some("ASSET_TYPE_SERVER"),
7016 Self::Storage => std::option::Option::Some("ASSET_TYPE_STORAGE"),
7017 Self::Network => std::option::Option::Some("ASSET_TYPE_NETWORK"),
7018 Self::UnknownValue(u) => u.0.name(),
7019 }
7020 }
7021 }
7022
7023 impl std::default::Default for AssetType {
7024 fn default() -> Self {
7025 use std::convert::From;
7026 Self::from(0)
7027 }
7028 }
7029
7030 impl std::fmt::Display for AssetType {
7031 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7032 wkt::internal::display_enum(f, self.name(), self.value())
7033 }
7034 }
7035
7036 impl std::convert::From<i32> for AssetType {
7037 fn from(value: i32) -> Self {
7038 match value {
7039 0 => Self::Unspecified,
7040 1 => Self::Server,
7041 2 => Self::Storage,
7042 3 => Self::Network,
7043 _ => Self::UnknownValue(asset_type::UnknownValue(
7044 wkt::internal::UnknownEnumValue::Integer(value),
7045 )),
7046 }
7047 }
7048 }
7049
7050 impl std::convert::From<&str> for AssetType {
7051 fn from(value: &str) -> Self {
7052 use std::string::ToString;
7053 match value {
7054 "ASSET_TYPE_UNSPECIFIED" => Self::Unspecified,
7055 "ASSET_TYPE_SERVER" => Self::Server,
7056 "ASSET_TYPE_STORAGE" => Self::Storage,
7057 "ASSET_TYPE_NETWORK" => Self::Network,
7058 _ => Self::UnknownValue(asset_type::UnknownValue(
7059 wkt::internal::UnknownEnumValue::String(value.to_string()),
7060 )),
7061 }
7062 }
7063 }
7064
7065 impl serde::ser::Serialize for AssetType {
7066 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7067 where
7068 S: serde::Serializer,
7069 {
7070 match self {
7071 Self::Unspecified => serializer.serialize_i32(0),
7072 Self::Server => serializer.serialize_i32(1),
7073 Self::Storage => serializer.serialize_i32(2),
7074 Self::Network => serializer.serialize_i32(3),
7075 Self::UnknownValue(u) => u.0.serialize(serializer),
7076 }
7077 }
7078 }
7079
7080 impl<'de> serde::de::Deserialize<'de> for AssetType {
7081 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7082 where
7083 D: serde::Deserializer<'de>,
7084 {
7085 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AssetType>::new(
7086 ".google.cloud.baremetalsolution.v2.ProvisioningQuota.AssetType",
7087 ))
7088 }
7089 }
7090
7091 /// The quota of one asset type.
7092 #[derive(Clone, Debug, PartialEq)]
7093 #[non_exhaustive]
7094 pub enum Quota {
7095 /// Instance quota.
7096 InstanceQuota(std::boxed::Box<crate::model::InstanceQuota>),
7097 }
7098
7099 /// Available quantity based on asset type.
7100 #[derive(Clone, Debug, PartialEq)]
7101 #[non_exhaustive]
7102 pub enum Availability {
7103 /// Server count.
7104 ServerCount(i64),
7105 /// Network bandwidth, Gbps
7106 NetworkBandwidth(i64),
7107 /// Storage size (GB).
7108 StorageGib(i64),
7109 }
7110}
7111
7112/// Message for requesting the list of provisioning quotas.
7113#[derive(Clone, Default, PartialEq)]
7114#[non_exhaustive]
7115pub struct ListProvisioningQuotasRequest {
7116 /// Required. Parent value for ListProvisioningQuotasRequest.
7117 pub parent: std::string::String,
7118
7119 /// Requested page size. The server might return fewer items than requested.
7120 /// If unspecified, server will pick an appropriate default.
7121 /// Notice that page_size field is not supported and won't be respected in
7122 /// the API request for now, will be updated when pagination is supported.
7123 pub page_size: i32,
7124
7125 /// A token identifying a page of results from the server.
7126 pub page_token: std::string::String,
7127
7128 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7129}
7130
7131impl ListProvisioningQuotasRequest {
7132 pub fn new() -> Self {
7133 std::default::Default::default()
7134 }
7135
7136 /// Sets the value of [parent][crate::model::ListProvisioningQuotasRequest::parent].
7137 ///
7138 /// # Example
7139 /// ```ignore,no_run
7140 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7141 /// let x = ListProvisioningQuotasRequest::new().set_parent("example");
7142 /// ```
7143 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7144 self.parent = v.into();
7145 self
7146 }
7147
7148 /// Sets the value of [page_size][crate::model::ListProvisioningQuotasRequest::page_size].
7149 ///
7150 /// # Example
7151 /// ```ignore,no_run
7152 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7153 /// let x = ListProvisioningQuotasRequest::new().set_page_size(42);
7154 /// ```
7155 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7156 self.page_size = v.into();
7157 self
7158 }
7159
7160 /// Sets the value of [page_token][crate::model::ListProvisioningQuotasRequest::page_token].
7161 ///
7162 /// # Example
7163 /// ```ignore,no_run
7164 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7165 /// let x = ListProvisioningQuotasRequest::new().set_page_token("example");
7166 /// ```
7167 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7168 self.page_token = v.into();
7169 self
7170 }
7171}
7172
7173impl wkt::message::Message for ListProvisioningQuotasRequest {
7174 fn typename() -> &'static str {
7175 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasRequest"
7176 }
7177}
7178
7179/// Response message for the list of provisioning quotas.
7180#[derive(Clone, Default, PartialEq)]
7181#[non_exhaustive]
7182pub struct ListProvisioningQuotasResponse {
7183 /// The provisioning quotas registered in this project.
7184 pub provisioning_quotas: std::vec::Vec<crate::model::ProvisioningQuota>,
7185
7186 /// Token to retrieve the next page of results, or empty if there are no more
7187 /// results in the list.
7188 pub next_page_token: std::string::String,
7189
7190 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7191}
7192
7193impl ListProvisioningQuotasResponse {
7194 pub fn new() -> Self {
7195 std::default::Default::default()
7196 }
7197
7198 /// Sets the value of [provisioning_quotas][crate::model::ListProvisioningQuotasResponse::provisioning_quotas].
7199 ///
7200 /// # Example
7201 /// ```ignore,no_run
7202 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7203 /// use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7204 /// let x = ListProvisioningQuotasResponse::new()
7205 /// .set_provisioning_quotas([
7206 /// ProvisioningQuota::default()/* use setters */,
7207 /// ProvisioningQuota::default()/* use (different) setters */,
7208 /// ]);
7209 /// ```
7210 pub fn set_provisioning_quotas<T, V>(mut self, v: T) -> Self
7211 where
7212 T: std::iter::IntoIterator<Item = V>,
7213 V: std::convert::Into<crate::model::ProvisioningQuota>,
7214 {
7215 use std::iter::Iterator;
7216 self.provisioning_quotas = v.into_iter().map(|i| i.into()).collect();
7217 self
7218 }
7219
7220 /// Sets the value of [next_page_token][crate::model::ListProvisioningQuotasResponse::next_page_token].
7221 ///
7222 /// # Example
7223 /// ```ignore,no_run
7224 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7225 /// let x = ListProvisioningQuotasResponse::new().set_next_page_token("example");
7226 /// ```
7227 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7228 self.next_page_token = v.into();
7229 self
7230 }
7231}
7232
7233impl wkt::message::Message for ListProvisioningQuotasResponse {
7234 fn typename() -> &'static str {
7235 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasResponse"
7236 }
7237}
7238
7239#[doc(hidden)]
7240impl gax::paginator::internal::PageableResponse for ListProvisioningQuotasResponse {
7241 type PageItem = crate::model::ProvisioningQuota;
7242
7243 fn items(self) -> std::vec::Vec<Self::PageItem> {
7244 self.provisioning_quotas
7245 }
7246
7247 fn next_page_token(&self) -> std::string::String {
7248 use std::clone::Clone;
7249 self.next_page_token.clone()
7250 }
7251}
7252
7253/// Configuration parameters for a new instance.
7254#[derive(Clone, Default, PartialEq)]
7255#[non_exhaustive]
7256pub struct InstanceConfig {
7257 /// Output only. The name of the instance config.
7258 pub name: std::string::String,
7259
7260 /// A transient unique identifier to idenfity an instance within an
7261 /// ProvisioningConfig request.
7262 pub id: std::string::String,
7263
7264 /// Instance type.
7265 /// [Available
7266 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7267 pub instance_type: std::string::String,
7268
7269 /// Whether the instance should be provisioned with Hyperthreading enabled.
7270 pub hyperthreading: bool,
7271
7272 /// OS image to initialize the instance.
7273 /// [Available
7274 /// images](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7275 pub os_image: std::string::String,
7276
7277 /// Client network address. Filled if InstanceConfig.multivlan_config is false.
7278 #[deprecated]
7279 pub client_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7280
7281 /// Private network address, if any. Filled if InstanceConfig.multivlan_config
7282 /// is false.
7283 #[deprecated]
7284 pub private_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7285
7286 /// User note field, it can be used by customers to add additional information
7287 /// for the BMS Ops team .
7288 pub user_note: std::string::String,
7289
7290 /// If true networks can be from different projects of the same vendor account.
7291 pub account_networks_enabled: bool,
7292
7293 /// The type of network configuration on the instance.
7294 pub network_config: crate::model::instance_config::NetworkConfig,
7295
7296 /// Server network template name. Filled if InstanceConfig.multivlan_config is
7297 /// true.
7298 pub network_template: std::string::String,
7299
7300 /// List of logical interfaces for the instance. The number of logical
7301 /// interfaces will be the same as number of hardware bond/nic on the chosen
7302 /// network template. Filled if InstanceConfig.multivlan_config is true.
7303 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
7304
7305 /// List of names of ssh keys used to provision the instance.
7306 pub ssh_key_names: std::vec::Vec<std::string::String>,
7307
7308 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7309}
7310
7311impl InstanceConfig {
7312 pub fn new() -> Self {
7313 std::default::Default::default()
7314 }
7315
7316 /// Sets the value of [name][crate::model::InstanceConfig::name].
7317 ///
7318 /// # Example
7319 /// ```ignore,no_run
7320 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7321 /// let x = InstanceConfig::new().set_name("example");
7322 /// ```
7323 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7324 self.name = v.into();
7325 self
7326 }
7327
7328 /// Sets the value of [id][crate::model::InstanceConfig::id].
7329 ///
7330 /// # Example
7331 /// ```ignore,no_run
7332 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7333 /// let x = InstanceConfig::new().set_id("example");
7334 /// ```
7335 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7336 self.id = v.into();
7337 self
7338 }
7339
7340 /// Sets the value of [instance_type][crate::model::InstanceConfig::instance_type].
7341 ///
7342 /// # Example
7343 /// ```ignore,no_run
7344 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7345 /// let x = InstanceConfig::new().set_instance_type("example");
7346 /// ```
7347 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7348 self.instance_type = v.into();
7349 self
7350 }
7351
7352 /// Sets the value of [hyperthreading][crate::model::InstanceConfig::hyperthreading].
7353 ///
7354 /// # Example
7355 /// ```ignore,no_run
7356 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7357 /// let x = InstanceConfig::new().set_hyperthreading(true);
7358 /// ```
7359 pub fn set_hyperthreading<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7360 self.hyperthreading = v.into();
7361 self
7362 }
7363
7364 /// Sets the value of [os_image][crate::model::InstanceConfig::os_image].
7365 ///
7366 /// # Example
7367 /// ```ignore,no_run
7368 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7369 /// let x = InstanceConfig::new().set_os_image("example");
7370 /// ```
7371 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7372 self.os_image = v.into();
7373 self
7374 }
7375
7376 /// Sets the value of [client_network][crate::model::InstanceConfig::client_network].
7377 ///
7378 /// # Example
7379 /// ```ignore,no_run
7380 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7381 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7382 /// let x = InstanceConfig::new().set_client_network(NetworkAddress::default()/* use setters */);
7383 /// ```
7384 #[deprecated]
7385 pub fn set_client_network<T>(mut self, v: T) -> Self
7386 where
7387 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7388 {
7389 self.client_network = std::option::Option::Some(v.into());
7390 self
7391 }
7392
7393 /// Sets or clears the value of [client_network][crate::model::InstanceConfig::client_network].
7394 ///
7395 /// # Example
7396 /// ```ignore,no_run
7397 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7398 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7399 /// let x = InstanceConfig::new().set_or_clear_client_network(Some(NetworkAddress::default()/* use setters */));
7400 /// let x = InstanceConfig::new().set_or_clear_client_network(None::<NetworkAddress>);
7401 /// ```
7402 #[deprecated]
7403 pub fn set_or_clear_client_network<T>(mut self, v: std::option::Option<T>) -> Self
7404 where
7405 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7406 {
7407 self.client_network = v.map(|x| x.into());
7408 self
7409 }
7410
7411 /// Sets the value of [private_network][crate::model::InstanceConfig::private_network].
7412 ///
7413 /// # Example
7414 /// ```ignore,no_run
7415 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7416 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7417 /// let x = InstanceConfig::new().set_private_network(NetworkAddress::default()/* use setters */);
7418 /// ```
7419 #[deprecated]
7420 pub fn set_private_network<T>(mut self, v: T) -> Self
7421 where
7422 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7423 {
7424 self.private_network = std::option::Option::Some(v.into());
7425 self
7426 }
7427
7428 /// Sets or clears the value of [private_network][crate::model::InstanceConfig::private_network].
7429 ///
7430 /// # Example
7431 /// ```ignore,no_run
7432 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7433 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7434 /// let x = InstanceConfig::new().set_or_clear_private_network(Some(NetworkAddress::default()/* use setters */));
7435 /// let x = InstanceConfig::new().set_or_clear_private_network(None::<NetworkAddress>);
7436 /// ```
7437 #[deprecated]
7438 pub fn set_or_clear_private_network<T>(mut self, v: std::option::Option<T>) -> Self
7439 where
7440 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7441 {
7442 self.private_network = v.map(|x| x.into());
7443 self
7444 }
7445
7446 /// Sets the value of [user_note][crate::model::InstanceConfig::user_note].
7447 ///
7448 /// # Example
7449 /// ```ignore,no_run
7450 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7451 /// let x = InstanceConfig::new().set_user_note("example");
7452 /// ```
7453 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7454 self.user_note = v.into();
7455 self
7456 }
7457
7458 /// Sets the value of [account_networks_enabled][crate::model::InstanceConfig::account_networks_enabled].
7459 ///
7460 /// # Example
7461 /// ```ignore,no_run
7462 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7463 /// let x = InstanceConfig::new().set_account_networks_enabled(true);
7464 /// ```
7465 pub fn set_account_networks_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7466 self.account_networks_enabled = v.into();
7467 self
7468 }
7469
7470 /// Sets the value of [network_config][crate::model::InstanceConfig::network_config].
7471 ///
7472 /// # Example
7473 /// ```ignore,no_run
7474 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7475 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkConfig;
7476 /// let x0 = InstanceConfig::new().set_network_config(NetworkConfig::SingleVlan);
7477 /// let x1 = InstanceConfig::new().set_network_config(NetworkConfig::MultiVlan);
7478 /// ```
7479 pub fn set_network_config<
7480 T: std::convert::Into<crate::model::instance_config::NetworkConfig>,
7481 >(
7482 mut self,
7483 v: T,
7484 ) -> Self {
7485 self.network_config = v.into();
7486 self
7487 }
7488
7489 /// Sets the value of [network_template][crate::model::InstanceConfig::network_template].
7490 ///
7491 /// # Example
7492 /// ```ignore,no_run
7493 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7494 /// let x = InstanceConfig::new().set_network_template("example");
7495 /// ```
7496 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
7497 mut self,
7498 v: T,
7499 ) -> Self {
7500 self.network_template = v.into();
7501 self
7502 }
7503
7504 /// Sets the value of [logical_interfaces][crate::model::InstanceConfig::logical_interfaces].
7505 ///
7506 /// # Example
7507 /// ```ignore,no_run
7508 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7509 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
7510 /// let x = InstanceConfig::new()
7511 /// .set_logical_interfaces([
7512 /// LogicalInterface::default()/* use setters */,
7513 /// LogicalInterface::default()/* use (different) setters */,
7514 /// ]);
7515 /// ```
7516 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
7517 where
7518 T: std::iter::IntoIterator<Item = V>,
7519 V: std::convert::Into<crate::model::LogicalInterface>,
7520 {
7521 use std::iter::Iterator;
7522 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
7523 self
7524 }
7525
7526 /// Sets the value of [ssh_key_names][crate::model::InstanceConfig::ssh_key_names].
7527 ///
7528 /// # Example
7529 /// ```ignore,no_run
7530 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7531 /// let x = InstanceConfig::new().set_ssh_key_names(["a", "b", "c"]);
7532 /// ```
7533 pub fn set_ssh_key_names<T, V>(mut self, v: T) -> Self
7534 where
7535 T: std::iter::IntoIterator<Item = V>,
7536 V: std::convert::Into<std::string::String>,
7537 {
7538 use std::iter::Iterator;
7539 self.ssh_key_names = v.into_iter().map(|i| i.into()).collect();
7540 self
7541 }
7542}
7543
7544impl wkt::message::Message for InstanceConfig {
7545 fn typename() -> &'static str {
7546 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig"
7547 }
7548}
7549
7550/// Defines additional types related to [InstanceConfig].
7551pub mod instance_config {
7552 #[allow(unused_imports)]
7553 use super::*;
7554
7555 /// A network.
7556 #[derive(Clone, Default, PartialEq)]
7557 #[non_exhaustive]
7558 pub struct NetworkAddress {
7559 /// Id of the network to use, within the same ProvisioningConfig request.
7560 pub network_id: std::string::String,
7561
7562 /// IPv4 address to be assigned to the server.
7563 pub address: std::string::String,
7564
7565 /// Name of the existing network to use.
7566 pub existing_network_id: std::string::String,
7567
7568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7569 }
7570
7571 impl NetworkAddress {
7572 pub fn new() -> Self {
7573 std::default::Default::default()
7574 }
7575
7576 /// Sets the value of [network_id][crate::model::instance_config::NetworkAddress::network_id].
7577 ///
7578 /// # Example
7579 /// ```ignore,no_run
7580 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7581 /// let x = NetworkAddress::new().set_network_id("example");
7582 /// ```
7583 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7584 self.network_id = v.into();
7585 self
7586 }
7587
7588 /// Sets the value of [address][crate::model::instance_config::NetworkAddress::address].
7589 ///
7590 /// # Example
7591 /// ```ignore,no_run
7592 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7593 /// let x = NetworkAddress::new().set_address("example");
7594 /// ```
7595 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7596 self.address = v.into();
7597 self
7598 }
7599
7600 /// Sets the value of [existing_network_id][crate::model::instance_config::NetworkAddress::existing_network_id].
7601 ///
7602 /// # Example
7603 /// ```ignore,no_run
7604 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7605 /// let x = NetworkAddress::new().set_existing_network_id("example");
7606 /// ```
7607 pub fn set_existing_network_id<T: std::convert::Into<std::string::String>>(
7608 mut self,
7609 v: T,
7610 ) -> Self {
7611 self.existing_network_id = v.into();
7612 self
7613 }
7614 }
7615
7616 impl wkt::message::Message for NetworkAddress {
7617 fn typename() -> &'static str {
7618 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig.NetworkAddress"
7619 }
7620 }
7621
7622 /// The network configuration of the instance.
7623 ///
7624 /// # Working with unknown values
7625 ///
7626 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7627 /// additional enum variants at any time. Adding new variants is not considered
7628 /// a breaking change. Applications should write their code in anticipation of:
7629 ///
7630 /// - New values appearing in future releases of the client library, **and**
7631 /// - New values received dynamically, without application changes.
7632 ///
7633 /// Please consult the [Working with enums] section in the user guide for some
7634 /// guidelines.
7635 ///
7636 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7637 #[derive(Clone, Debug, PartialEq)]
7638 #[non_exhaustive]
7639 pub enum NetworkConfig {
7640 /// The unspecified network configuration.
7641 NetworkconfigUnspecified,
7642 /// Instance part of single client network and single private network.
7643 SingleVlan,
7644 /// Instance part of multiple (or single) client networks and private
7645 /// networks.
7646 MultiVlan,
7647 /// If set, the enum was initialized with an unknown value.
7648 ///
7649 /// Applications can examine the value using [NetworkConfig::value] or
7650 /// [NetworkConfig::name].
7651 UnknownValue(network_config::UnknownValue),
7652 }
7653
7654 #[doc(hidden)]
7655 pub mod network_config {
7656 #[allow(unused_imports)]
7657 use super::*;
7658 #[derive(Clone, Debug, PartialEq)]
7659 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7660 }
7661
7662 impl NetworkConfig {
7663 /// Gets the enum value.
7664 ///
7665 /// Returns `None` if the enum contains an unknown value deserialized from
7666 /// the string representation of enums.
7667 pub fn value(&self) -> std::option::Option<i32> {
7668 match self {
7669 Self::NetworkconfigUnspecified => std::option::Option::Some(0),
7670 Self::SingleVlan => std::option::Option::Some(1),
7671 Self::MultiVlan => std::option::Option::Some(2),
7672 Self::UnknownValue(u) => u.0.value(),
7673 }
7674 }
7675
7676 /// Gets the enum value as a string.
7677 ///
7678 /// Returns `None` if the enum contains an unknown value deserialized from
7679 /// the integer representation of enums.
7680 pub fn name(&self) -> std::option::Option<&str> {
7681 match self {
7682 Self::NetworkconfigUnspecified => {
7683 std::option::Option::Some("NETWORKCONFIG_UNSPECIFIED")
7684 }
7685 Self::SingleVlan => std::option::Option::Some("SINGLE_VLAN"),
7686 Self::MultiVlan => std::option::Option::Some("MULTI_VLAN"),
7687 Self::UnknownValue(u) => u.0.name(),
7688 }
7689 }
7690 }
7691
7692 impl std::default::Default for NetworkConfig {
7693 fn default() -> Self {
7694 use std::convert::From;
7695 Self::from(0)
7696 }
7697 }
7698
7699 impl std::fmt::Display for NetworkConfig {
7700 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7701 wkt::internal::display_enum(f, self.name(), self.value())
7702 }
7703 }
7704
7705 impl std::convert::From<i32> for NetworkConfig {
7706 fn from(value: i32) -> Self {
7707 match value {
7708 0 => Self::NetworkconfigUnspecified,
7709 1 => Self::SingleVlan,
7710 2 => Self::MultiVlan,
7711 _ => Self::UnknownValue(network_config::UnknownValue(
7712 wkt::internal::UnknownEnumValue::Integer(value),
7713 )),
7714 }
7715 }
7716 }
7717
7718 impl std::convert::From<&str> for NetworkConfig {
7719 fn from(value: &str) -> Self {
7720 use std::string::ToString;
7721 match value {
7722 "NETWORKCONFIG_UNSPECIFIED" => Self::NetworkconfigUnspecified,
7723 "SINGLE_VLAN" => Self::SingleVlan,
7724 "MULTI_VLAN" => Self::MultiVlan,
7725 _ => Self::UnknownValue(network_config::UnknownValue(
7726 wkt::internal::UnknownEnumValue::String(value.to_string()),
7727 )),
7728 }
7729 }
7730 }
7731
7732 impl serde::ser::Serialize for NetworkConfig {
7733 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7734 where
7735 S: serde::Serializer,
7736 {
7737 match self {
7738 Self::NetworkconfigUnspecified => serializer.serialize_i32(0),
7739 Self::SingleVlan => serializer.serialize_i32(1),
7740 Self::MultiVlan => serializer.serialize_i32(2),
7741 Self::UnknownValue(u) => u.0.serialize(serializer),
7742 }
7743 }
7744 }
7745
7746 impl<'de> serde::de::Deserialize<'de> for NetworkConfig {
7747 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7748 where
7749 D: serde::Deserializer<'de>,
7750 {
7751 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NetworkConfig>::new(
7752 ".google.cloud.baremetalsolution.v2.InstanceConfig.NetworkConfig",
7753 ))
7754 }
7755 }
7756}
7757
7758/// Configuration parameters for a new volume.
7759#[derive(Clone, Default, PartialEq)]
7760#[non_exhaustive]
7761pub struct VolumeConfig {
7762 /// Output only. The name of the volume config.
7763 pub name: std::string::String,
7764
7765 /// A transient unique identifier to identify a volume within an
7766 /// ProvisioningConfig request.
7767 pub id: std::string::String,
7768
7769 /// Whether snapshots should be enabled.
7770 pub snapshots_enabled: bool,
7771
7772 /// The type of this Volume.
7773 pub r#type: crate::model::volume_config::Type,
7774
7775 /// Volume protocol.
7776 pub protocol: crate::model::volume_config::Protocol,
7777
7778 /// The requested size of this volume, in GB.
7779 pub size_gb: i32,
7780
7781 /// LUN ranges to be configured. Set only when protocol is PROTOCOL_FC.
7782 pub lun_ranges: std::vec::Vec<crate::model::volume_config::LunRange>,
7783
7784 /// Machine ids connected to this volume. Set only when protocol is
7785 /// PROTOCOL_FC.
7786 pub machine_ids: std::vec::Vec<std::string::String>,
7787
7788 /// NFS exports. Set only when protocol is PROTOCOL_NFS.
7789 pub nfs_exports: std::vec::Vec<crate::model::volume_config::NfsExport>,
7790
7791 /// User note field, it can be used by customers to add additional information
7792 /// for the BMS Ops team .
7793 pub user_note: std::string::String,
7794
7795 /// The GCP service of the storage volume. Available gcp_service are in
7796 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
7797 pub gcp_service: std::string::String,
7798
7799 /// Performance tier of the Volume.
7800 /// Default is SHARED.
7801 pub performance_tier: crate::model::VolumePerformanceTier,
7802
7803 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7804}
7805
7806impl VolumeConfig {
7807 pub fn new() -> Self {
7808 std::default::Default::default()
7809 }
7810
7811 /// Sets the value of [name][crate::model::VolumeConfig::name].
7812 ///
7813 /// # Example
7814 /// ```ignore,no_run
7815 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7816 /// let x = VolumeConfig::new().set_name("example");
7817 /// ```
7818 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7819 self.name = v.into();
7820 self
7821 }
7822
7823 /// Sets the value of [id][crate::model::VolumeConfig::id].
7824 ///
7825 /// # Example
7826 /// ```ignore,no_run
7827 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7828 /// let x = VolumeConfig::new().set_id("example");
7829 /// ```
7830 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7831 self.id = v.into();
7832 self
7833 }
7834
7835 /// Sets the value of [snapshots_enabled][crate::model::VolumeConfig::snapshots_enabled].
7836 ///
7837 /// # Example
7838 /// ```ignore,no_run
7839 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7840 /// let x = VolumeConfig::new().set_snapshots_enabled(true);
7841 /// ```
7842 pub fn set_snapshots_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7843 self.snapshots_enabled = v.into();
7844 self
7845 }
7846
7847 /// Sets the value of [r#type][crate::model::VolumeConfig::type].
7848 ///
7849 /// # Example
7850 /// ```ignore,no_run
7851 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7852 /// use google_cloud_baremetalsolution_v2::model::volume_config::Type;
7853 /// let x0 = VolumeConfig::new().set_type(Type::Flash);
7854 /// let x1 = VolumeConfig::new().set_type(Type::Disk);
7855 /// ```
7856 pub fn set_type<T: std::convert::Into<crate::model::volume_config::Type>>(
7857 mut self,
7858 v: T,
7859 ) -> Self {
7860 self.r#type = v.into();
7861 self
7862 }
7863
7864 /// Sets the value of [protocol][crate::model::VolumeConfig::protocol].
7865 ///
7866 /// # Example
7867 /// ```ignore,no_run
7868 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7869 /// use google_cloud_baremetalsolution_v2::model::volume_config::Protocol;
7870 /// let x0 = VolumeConfig::new().set_protocol(Protocol::Fc);
7871 /// let x1 = VolumeConfig::new().set_protocol(Protocol::Nfs);
7872 /// ```
7873 pub fn set_protocol<T: std::convert::Into<crate::model::volume_config::Protocol>>(
7874 mut self,
7875 v: T,
7876 ) -> Self {
7877 self.protocol = v.into();
7878 self
7879 }
7880
7881 /// Sets the value of [size_gb][crate::model::VolumeConfig::size_gb].
7882 ///
7883 /// # Example
7884 /// ```ignore,no_run
7885 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7886 /// let x = VolumeConfig::new().set_size_gb(42);
7887 /// ```
7888 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7889 self.size_gb = v.into();
7890 self
7891 }
7892
7893 /// Sets the value of [lun_ranges][crate::model::VolumeConfig::lun_ranges].
7894 ///
7895 /// # Example
7896 /// ```ignore,no_run
7897 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7898 /// use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
7899 /// let x = VolumeConfig::new()
7900 /// .set_lun_ranges([
7901 /// LunRange::default()/* use setters */,
7902 /// LunRange::default()/* use (different) setters */,
7903 /// ]);
7904 /// ```
7905 pub fn set_lun_ranges<T, V>(mut self, v: T) -> Self
7906 where
7907 T: std::iter::IntoIterator<Item = V>,
7908 V: std::convert::Into<crate::model::volume_config::LunRange>,
7909 {
7910 use std::iter::Iterator;
7911 self.lun_ranges = v.into_iter().map(|i| i.into()).collect();
7912 self
7913 }
7914
7915 /// Sets the value of [machine_ids][crate::model::VolumeConfig::machine_ids].
7916 ///
7917 /// # Example
7918 /// ```ignore,no_run
7919 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7920 /// let x = VolumeConfig::new().set_machine_ids(["a", "b", "c"]);
7921 /// ```
7922 pub fn set_machine_ids<T, V>(mut self, v: T) -> Self
7923 where
7924 T: std::iter::IntoIterator<Item = V>,
7925 V: std::convert::Into<std::string::String>,
7926 {
7927 use std::iter::Iterator;
7928 self.machine_ids = v.into_iter().map(|i| i.into()).collect();
7929 self
7930 }
7931
7932 /// Sets the value of [nfs_exports][crate::model::VolumeConfig::nfs_exports].
7933 ///
7934 /// # Example
7935 /// ```ignore,no_run
7936 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7937 /// use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
7938 /// let x = VolumeConfig::new()
7939 /// .set_nfs_exports([
7940 /// NfsExport::default()/* use setters */,
7941 /// NfsExport::default()/* use (different) setters */,
7942 /// ]);
7943 /// ```
7944 pub fn set_nfs_exports<T, V>(mut self, v: T) -> Self
7945 where
7946 T: std::iter::IntoIterator<Item = V>,
7947 V: std::convert::Into<crate::model::volume_config::NfsExport>,
7948 {
7949 use std::iter::Iterator;
7950 self.nfs_exports = v.into_iter().map(|i| i.into()).collect();
7951 self
7952 }
7953
7954 /// Sets the value of [user_note][crate::model::VolumeConfig::user_note].
7955 ///
7956 /// # Example
7957 /// ```ignore,no_run
7958 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7959 /// let x = VolumeConfig::new().set_user_note("example");
7960 /// ```
7961 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7962 self.user_note = v.into();
7963 self
7964 }
7965
7966 /// Sets the value of [gcp_service][crate::model::VolumeConfig::gcp_service].
7967 ///
7968 /// # Example
7969 /// ```ignore,no_run
7970 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7971 /// let x = VolumeConfig::new().set_gcp_service("example");
7972 /// ```
7973 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7974 self.gcp_service = v.into();
7975 self
7976 }
7977
7978 /// Sets the value of [performance_tier][crate::model::VolumeConfig::performance_tier].
7979 ///
7980 /// # Example
7981 /// ```ignore,no_run
7982 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7983 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
7984 /// let x0 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Shared);
7985 /// let x1 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Assigned);
7986 /// let x2 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Ht);
7987 /// ```
7988 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
7989 mut self,
7990 v: T,
7991 ) -> Self {
7992 self.performance_tier = v.into();
7993 self
7994 }
7995}
7996
7997impl wkt::message::Message for VolumeConfig {
7998 fn typename() -> &'static str {
7999 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig"
8000 }
8001}
8002
8003/// Defines additional types related to [VolumeConfig].
8004pub mod volume_config {
8005 #[allow(unused_imports)]
8006 use super::*;
8007
8008 /// A LUN(Logical Unit Number) range.
8009 #[derive(Clone, Default, PartialEq)]
8010 #[non_exhaustive]
8011 pub struct LunRange {
8012 /// Number of LUNs to create.
8013 pub quantity: i32,
8014
8015 /// The requested size of each LUN, in GB.
8016 pub size_gb: i32,
8017
8018 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8019 }
8020
8021 impl LunRange {
8022 pub fn new() -> Self {
8023 std::default::Default::default()
8024 }
8025
8026 /// Sets the value of [quantity][crate::model::volume_config::LunRange::quantity].
8027 ///
8028 /// # Example
8029 /// ```ignore,no_run
8030 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8031 /// let x = LunRange::new().set_quantity(42);
8032 /// ```
8033 pub fn set_quantity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8034 self.quantity = v.into();
8035 self
8036 }
8037
8038 /// Sets the value of [size_gb][crate::model::volume_config::LunRange::size_gb].
8039 ///
8040 /// # Example
8041 /// ```ignore,no_run
8042 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8043 /// let x = LunRange::new().set_size_gb(42);
8044 /// ```
8045 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8046 self.size_gb = v.into();
8047 self
8048 }
8049 }
8050
8051 impl wkt::message::Message for LunRange {
8052 fn typename() -> &'static str {
8053 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.LunRange"
8054 }
8055 }
8056
8057 /// A NFS export entry.
8058 #[derive(Clone, Default, PartialEq)]
8059 #[non_exhaustive]
8060 pub struct NfsExport {
8061 /// Network to use to publish the export.
8062 pub network_id: std::string::String,
8063
8064 /// Export permissions.
8065 pub permissions: crate::model::volume_config::nfs_export::Permissions,
8066
8067 /// Disable root squashing, which is a feature of NFS.
8068 /// Root squash is a special mapping of the remote superuser (root) identity
8069 /// when using identity authentication.
8070 pub no_root_squash: bool,
8071
8072 /// Allow the setuid flag.
8073 pub allow_suid: bool,
8074
8075 /// Allow dev flag in NfsShare AllowedClientsRequest.
8076 pub allow_dev: bool,
8077
8078 /// A client object.
8079 pub client: std::option::Option<crate::model::volume_config::nfs_export::Client>,
8080
8081 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8082 }
8083
8084 impl NfsExport {
8085 pub fn new() -> Self {
8086 std::default::Default::default()
8087 }
8088
8089 /// Sets the value of [network_id][crate::model::volume_config::NfsExport::network_id].
8090 ///
8091 /// # Example
8092 /// ```ignore,no_run
8093 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8094 /// let x = NfsExport::new().set_network_id("example");
8095 /// ```
8096 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8097 self.network_id = v.into();
8098 self
8099 }
8100
8101 /// Sets the value of [permissions][crate::model::volume_config::NfsExport::permissions].
8102 ///
8103 /// # Example
8104 /// ```ignore,no_run
8105 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8106 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Permissions;
8107 /// let x0 = NfsExport::new().set_permissions(Permissions::ReadOnly);
8108 /// let x1 = NfsExport::new().set_permissions(Permissions::ReadWrite);
8109 /// ```
8110 pub fn set_permissions<
8111 T: std::convert::Into<crate::model::volume_config::nfs_export::Permissions>,
8112 >(
8113 mut self,
8114 v: T,
8115 ) -> Self {
8116 self.permissions = v.into();
8117 self
8118 }
8119
8120 /// Sets the value of [no_root_squash][crate::model::volume_config::NfsExport::no_root_squash].
8121 ///
8122 /// # Example
8123 /// ```ignore,no_run
8124 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8125 /// let x = NfsExport::new().set_no_root_squash(true);
8126 /// ```
8127 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8128 self.no_root_squash = v.into();
8129 self
8130 }
8131
8132 /// Sets the value of [allow_suid][crate::model::volume_config::NfsExport::allow_suid].
8133 ///
8134 /// # Example
8135 /// ```ignore,no_run
8136 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8137 /// let x = NfsExport::new().set_allow_suid(true);
8138 /// ```
8139 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8140 self.allow_suid = v.into();
8141 self
8142 }
8143
8144 /// Sets the value of [allow_dev][crate::model::volume_config::NfsExport::allow_dev].
8145 ///
8146 /// # Example
8147 /// ```ignore,no_run
8148 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8149 /// let x = NfsExport::new().set_allow_dev(true);
8150 /// ```
8151 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8152 self.allow_dev = v.into();
8153 self
8154 }
8155
8156 /// Sets the value of [client][crate::model::volume_config::NfsExport::client].
8157 ///
8158 /// Note that all the setters affecting `client` are mutually
8159 /// exclusive.
8160 ///
8161 /// # Example
8162 /// ```ignore,no_run
8163 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8164 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Client;
8165 /// let x = NfsExport::new().set_client(Some(Client::MachineId("example".to_string())));
8166 /// ```
8167 pub fn set_client<
8168 T: std::convert::Into<
8169 std::option::Option<crate::model::volume_config::nfs_export::Client>,
8170 >,
8171 >(
8172 mut self,
8173 v: T,
8174 ) -> Self {
8175 self.client = v.into();
8176 self
8177 }
8178
8179 /// The value of [client][crate::model::volume_config::NfsExport::client]
8180 /// if it holds a `MachineId`, `None` if the field is not set or
8181 /// holds a different branch.
8182 pub fn machine_id(&self) -> std::option::Option<&std::string::String> {
8183 #[allow(unreachable_patterns)]
8184 self.client.as_ref().and_then(|v| match v {
8185 crate::model::volume_config::nfs_export::Client::MachineId(v) => {
8186 std::option::Option::Some(v)
8187 }
8188 _ => std::option::Option::None,
8189 })
8190 }
8191
8192 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8193 /// to hold a `MachineId`.
8194 ///
8195 /// Note that all the setters affecting `client` are
8196 /// mutually exclusive.
8197 ///
8198 /// # Example
8199 /// ```ignore,no_run
8200 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8201 /// let x = NfsExport::new().set_machine_id("example");
8202 /// assert!(x.machine_id().is_some());
8203 /// assert!(x.cidr().is_none());
8204 /// ```
8205 pub fn set_machine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8206 self.client = std::option::Option::Some(
8207 crate::model::volume_config::nfs_export::Client::MachineId(v.into()),
8208 );
8209 self
8210 }
8211
8212 /// The value of [client][crate::model::volume_config::NfsExport::client]
8213 /// if it holds a `Cidr`, `None` if the field is not set or
8214 /// holds a different branch.
8215 pub fn cidr(&self) -> std::option::Option<&std::string::String> {
8216 #[allow(unreachable_patterns)]
8217 self.client.as_ref().and_then(|v| match v {
8218 crate::model::volume_config::nfs_export::Client::Cidr(v) => {
8219 std::option::Option::Some(v)
8220 }
8221 _ => std::option::Option::None,
8222 })
8223 }
8224
8225 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8226 /// to hold a `Cidr`.
8227 ///
8228 /// Note that all the setters affecting `client` are
8229 /// mutually exclusive.
8230 ///
8231 /// # Example
8232 /// ```ignore,no_run
8233 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8234 /// let x = NfsExport::new().set_cidr("example");
8235 /// assert!(x.cidr().is_some());
8236 /// assert!(x.machine_id().is_none());
8237 /// ```
8238 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8239 self.client = std::option::Option::Some(
8240 crate::model::volume_config::nfs_export::Client::Cidr(v.into()),
8241 );
8242 self
8243 }
8244 }
8245
8246 impl wkt::message::Message for NfsExport {
8247 fn typename() -> &'static str {
8248 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport"
8249 }
8250 }
8251
8252 /// Defines additional types related to [NfsExport].
8253 pub mod nfs_export {
8254 #[allow(unused_imports)]
8255 use super::*;
8256
8257 /// Permissions that can granted for an export.
8258 ///
8259 /// # Working with unknown values
8260 ///
8261 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8262 /// additional enum variants at any time. Adding new variants is not considered
8263 /// a breaking change. Applications should write their code in anticipation of:
8264 ///
8265 /// - New values appearing in future releases of the client library, **and**
8266 /// - New values received dynamically, without application changes.
8267 ///
8268 /// Please consult the [Working with enums] section in the user guide for some
8269 /// guidelines.
8270 ///
8271 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8272 #[derive(Clone, Debug, PartialEq)]
8273 #[non_exhaustive]
8274 pub enum Permissions {
8275 /// Unspecified value.
8276 Unspecified,
8277 /// Read-only permission.
8278 ReadOnly,
8279 /// Read-write permission.
8280 ReadWrite,
8281 /// If set, the enum was initialized with an unknown value.
8282 ///
8283 /// Applications can examine the value using [Permissions::value] or
8284 /// [Permissions::name].
8285 UnknownValue(permissions::UnknownValue),
8286 }
8287
8288 #[doc(hidden)]
8289 pub mod permissions {
8290 #[allow(unused_imports)]
8291 use super::*;
8292 #[derive(Clone, Debug, PartialEq)]
8293 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8294 }
8295
8296 impl Permissions {
8297 /// Gets the enum value.
8298 ///
8299 /// Returns `None` if the enum contains an unknown value deserialized from
8300 /// the string representation of enums.
8301 pub fn value(&self) -> std::option::Option<i32> {
8302 match self {
8303 Self::Unspecified => std::option::Option::Some(0),
8304 Self::ReadOnly => std::option::Option::Some(1),
8305 Self::ReadWrite => std::option::Option::Some(2),
8306 Self::UnknownValue(u) => u.0.value(),
8307 }
8308 }
8309
8310 /// Gets the enum value as a string.
8311 ///
8312 /// Returns `None` if the enum contains an unknown value deserialized from
8313 /// the integer representation of enums.
8314 pub fn name(&self) -> std::option::Option<&str> {
8315 match self {
8316 Self::Unspecified => std::option::Option::Some("PERMISSIONS_UNSPECIFIED"),
8317 Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
8318 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
8319 Self::UnknownValue(u) => u.0.name(),
8320 }
8321 }
8322 }
8323
8324 impl std::default::Default for Permissions {
8325 fn default() -> Self {
8326 use std::convert::From;
8327 Self::from(0)
8328 }
8329 }
8330
8331 impl std::fmt::Display for Permissions {
8332 fn fmt(
8333 &self,
8334 f: &mut std::fmt::Formatter<'_>,
8335 ) -> std::result::Result<(), std::fmt::Error> {
8336 wkt::internal::display_enum(f, self.name(), self.value())
8337 }
8338 }
8339
8340 impl std::convert::From<i32> for Permissions {
8341 fn from(value: i32) -> Self {
8342 match value {
8343 0 => Self::Unspecified,
8344 1 => Self::ReadOnly,
8345 2 => Self::ReadWrite,
8346 _ => Self::UnknownValue(permissions::UnknownValue(
8347 wkt::internal::UnknownEnumValue::Integer(value),
8348 )),
8349 }
8350 }
8351 }
8352
8353 impl std::convert::From<&str> for Permissions {
8354 fn from(value: &str) -> Self {
8355 use std::string::ToString;
8356 match value {
8357 "PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
8358 "READ_ONLY" => Self::ReadOnly,
8359 "READ_WRITE" => Self::ReadWrite,
8360 _ => Self::UnknownValue(permissions::UnknownValue(
8361 wkt::internal::UnknownEnumValue::String(value.to_string()),
8362 )),
8363 }
8364 }
8365 }
8366
8367 impl serde::ser::Serialize for Permissions {
8368 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8369 where
8370 S: serde::Serializer,
8371 {
8372 match self {
8373 Self::Unspecified => serializer.serialize_i32(0),
8374 Self::ReadOnly => serializer.serialize_i32(1),
8375 Self::ReadWrite => serializer.serialize_i32(2),
8376 Self::UnknownValue(u) => u.0.serialize(serializer),
8377 }
8378 }
8379 }
8380
8381 impl<'de> serde::de::Deserialize<'de> for Permissions {
8382 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8383 where
8384 D: serde::Deserializer<'de>,
8385 {
8386 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Permissions>::new(
8387 ".google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport.Permissions",
8388 ))
8389 }
8390 }
8391
8392 /// A client object.
8393 #[derive(Clone, Debug, PartialEq)]
8394 #[non_exhaustive]
8395 pub enum Client {
8396 /// Either a single machine, identified by an ID, or a comma-separated
8397 /// list of machine IDs.
8398 MachineId(std::string::String),
8399 /// A CIDR range.
8400 Cidr(std::string::String),
8401 }
8402 }
8403
8404 /// The types of Volumes.
8405 ///
8406 /// # Working with unknown values
8407 ///
8408 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8409 /// additional enum variants at any time. Adding new variants is not considered
8410 /// a breaking change. Applications should write their code in anticipation of:
8411 ///
8412 /// - New values appearing in future releases of the client library, **and**
8413 /// - New values received dynamically, without application changes.
8414 ///
8415 /// Please consult the [Working with enums] section in the user guide for some
8416 /// guidelines.
8417 ///
8418 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8419 #[derive(Clone, Debug, PartialEq)]
8420 #[non_exhaustive]
8421 pub enum Type {
8422 /// The unspecified type.
8423 Unspecified,
8424 /// This Volume is on flash.
8425 Flash,
8426 /// This Volume is on disk.
8427 Disk,
8428 /// If set, the enum was initialized with an unknown value.
8429 ///
8430 /// Applications can examine the value using [Type::value] or
8431 /// [Type::name].
8432 UnknownValue(r#type::UnknownValue),
8433 }
8434
8435 #[doc(hidden)]
8436 pub mod r#type {
8437 #[allow(unused_imports)]
8438 use super::*;
8439 #[derive(Clone, Debug, PartialEq)]
8440 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8441 }
8442
8443 impl Type {
8444 /// Gets the enum value.
8445 ///
8446 /// Returns `None` if the enum contains an unknown value deserialized from
8447 /// the string representation of enums.
8448 pub fn value(&self) -> std::option::Option<i32> {
8449 match self {
8450 Self::Unspecified => std::option::Option::Some(0),
8451 Self::Flash => std::option::Option::Some(1),
8452 Self::Disk => std::option::Option::Some(2),
8453 Self::UnknownValue(u) => u.0.value(),
8454 }
8455 }
8456
8457 /// Gets the enum value as a string.
8458 ///
8459 /// Returns `None` if the enum contains an unknown value deserialized from
8460 /// the integer representation of enums.
8461 pub fn name(&self) -> std::option::Option<&str> {
8462 match self {
8463 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8464 Self::Flash => std::option::Option::Some("FLASH"),
8465 Self::Disk => std::option::Option::Some("DISK"),
8466 Self::UnknownValue(u) => u.0.name(),
8467 }
8468 }
8469 }
8470
8471 impl std::default::Default for Type {
8472 fn default() -> Self {
8473 use std::convert::From;
8474 Self::from(0)
8475 }
8476 }
8477
8478 impl std::fmt::Display for Type {
8479 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8480 wkt::internal::display_enum(f, self.name(), self.value())
8481 }
8482 }
8483
8484 impl std::convert::From<i32> for Type {
8485 fn from(value: i32) -> Self {
8486 match value {
8487 0 => Self::Unspecified,
8488 1 => Self::Flash,
8489 2 => Self::Disk,
8490 _ => Self::UnknownValue(r#type::UnknownValue(
8491 wkt::internal::UnknownEnumValue::Integer(value),
8492 )),
8493 }
8494 }
8495 }
8496
8497 impl std::convert::From<&str> for Type {
8498 fn from(value: &str) -> Self {
8499 use std::string::ToString;
8500 match value {
8501 "TYPE_UNSPECIFIED" => Self::Unspecified,
8502 "FLASH" => Self::Flash,
8503 "DISK" => Self::Disk,
8504 _ => Self::UnknownValue(r#type::UnknownValue(
8505 wkt::internal::UnknownEnumValue::String(value.to_string()),
8506 )),
8507 }
8508 }
8509 }
8510
8511 impl serde::ser::Serialize for Type {
8512 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8513 where
8514 S: serde::Serializer,
8515 {
8516 match self {
8517 Self::Unspecified => serializer.serialize_i32(0),
8518 Self::Flash => serializer.serialize_i32(1),
8519 Self::Disk => serializer.serialize_i32(2),
8520 Self::UnknownValue(u) => u.0.serialize(serializer),
8521 }
8522 }
8523 }
8524
8525 impl<'de> serde::de::Deserialize<'de> for Type {
8526 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8527 where
8528 D: serde::Deserializer<'de>,
8529 {
8530 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
8531 ".google.cloud.baremetalsolution.v2.VolumeConfig.Type",
8532 ))
8533 }
8534 }
8535
8536 /// The protocol used to access the volume.
8537 ///
8538 /// # Working with unknown values
8539 ///
8540 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8541 /// additional enum variants at any time. Adding new variants is not considered
8542 /// a breaking change. Applications should write their code in anticipation of:
8543 ///
8544 /// - New values appearing in future releases of the client library, **and**
8545 /// - New values received dynamically, without application changes.
8546 ///
8547 /// Please consult the [Working with enums] section in the user guide for some
8548 /// guidelines.
8549 ///
8550 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8551 #[derive(Clone, Debug, PartialEq)]
8552 #[non_exhaustive]
8553 pub enum Protocol {
8554 /// Unspecified value.
8555 Unspecified,
8556 /// Fibre channel.
8557 Fc,
8558 /// Network file system.
8559 Nfs,
8560 /// If set, the enum was initialized with an unknown value.
8561 ///
8562 /// Applications can examine the value using [Protocol::value] or
8563 /// [Protocol::name].
8564 UnknownValue(protocol::UnknownValue),
8565 }
8566
8567 #[doc(hidden)]
8568 pub mod protocol {
8569 #[allow(unused_imports)]
8570 use super::*;
8571 #[derive(Clone, Debug, PartialEq)]
8572 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8573 }
8574
8575 impl Protocol {
8576 /// Gets the enum value.
8577 ///
8578 /// Returns `None` if the enum contains an unknown value deserialized from
8579 /// the string representation of enums.
8580 pub fn value(&self) -> std::option::Option<i32> {
8581 match self {
8582 Self::Unspecified => std::option::Option::Some(0),
8583 Self::Fc => std::option::Option::Some(1),
8584 Self::Nfs => std::option::Option::Some(2),
8585 Self::UnknownValue(u) => u.0.value(),
8586 }
8587 }
8588
8589 /// Gets the enum value as a string.
8590 ///
8591 /// Returns `None` if the enum contains an unknown value deserialized from
8592 /// the integer representation of enums.
8593 pub fn name(&self) -> std::option::Option<&str> {
8594 match self {
8595 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
8596 Self::Fc => std::option::Option::Some("PROTOCOL_FC"),
8597 Self::Nfs => std::option::Option::Some("PROTOCOL_NFS"),
8598 Self::UnknownValue(u) => u.0.name(),
8599 }
8600 }
8601 }
8602
8603 impl std::default::Default for Protocol {
8604 fn default() -> Self {
8605 use std::convert::From;
8606 Self::from(0)
8607 }
8608 }
8609
8610 impl std::fmt::Display for Protocol {
8611 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8612 wkt::internal::display_enum(f, self.name(), self.value())
8613 }
8614 }
8615
8616 impl std::convert::From<i32> for Protocol {
8617 fn from(value: i32) -> Self {
8618 match value {
8619 0 => Self::Unspecified,
8620 1 => Self::Fc,
8621 2 => Self::Nfs,
8622 _ => Self::UnknownValue(protocol::UnknownValue(
8623 wkt::internal::UnknownEnumValue::Integer(value),
8624 )),
8625 }
8626 }
8627 }
8628
8629 impl std::convert::From<&str> for Protocol {
8630 fn from(value: &str) -> Self {
8631 use std::string::ToString;
8632 match value {
8633 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
8634 "PROTOCOL_FC" => Self::Fc,
8635 "PROTOCOL_NFS" => Self::Nfs,
8636 _ => Self::UnknownValue(protocol::UnknownValue(
8637 wkt::internal::UnknownEnumValue::String(value.to_string()),
8638 )),
8639 }
8640 }
8641 }
8642
8643 impl serde::ser::Serialize for Protocol {
8644 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8645 where
8646 S: serde::Serializer,
8647 {
8648 match self {
8649 Self::Unspecified => serializer.serialize_i32(0),
8650 Self::Fc => serializer.serialize_i32(1),
8651 Self::Nfs => serializer.serialize_i32(2),
8652 Self::UnknownValue(u) => u.0.serialize(serializer),
8653 }
8654 }
8655 }
8656
8657 impl<'de> serde::de::Deserialize<'de> for Protocol {
8658 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8659 where
8660 D: serde::Deserializer<'de>,
8661 {
8662 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
8663 ".google.cloud.baremetalsolution.v2.VolumeConfig.Protocol",
8664 ))
8665 }
8666 }
8667}
8668
8669/// Configuration parameters for a new network.
8670#[derive(Clone, Default, PartialEq)]
8671#[non_exhaustive]
8672pub struct NetworkConfig {
8673 /// Output only. The name of the network config.
8674 pub name: std::string::String,
8675
8676 /// A transient unique identifier to identify a volume within an
8677 /// ProvisioningConfig request.
8678 pub id: std::string::String,
8679
8680 /// The type of this network, either Client or Private.
8681 pub r#type: crate::model::network_config::Type,
8682
8683 /// Interconnect bandwidth. Set only when type is CLIENT.
8684 pub bandwidth: crate::model::network_config::Bandwidth,
8685
8686 /// List of VLAN attachments. As of now there are always 2 attachments, but it
8687 /// is going to change in the future (multi vlan).
8688 pub vlan_attachments: std::vec::Vec<crate::model::network_config::IntakeVlanAttachment>,
8689
8690 /// CIDR range of the network.
8691 pub cidr: std::string::String,
8692
8693 /// Service CIDR, if any.
8694 pub service_cidr: crate::model::network_config::ServiceCidr,
8695
8696 /// User note field, it can be used by customers to add additional information
8697 /// for the BMS Ops team .
8698 pub user_note: std::string::String,
8699
8700 /// The GCP service of the network. Available gcp_service are in
8701 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
8702 pub gcp_service: std::string::String,
8703
8704 /// Whether the VLAN attachment pair is located in the same project.
8705 pub vlan_same_project: bool,
8706
8707 /// The JumboFramesEnabled option for customer to set.
8708 pub jumbo_frames_enabled: bool,
8709
8710 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8711}
8712
8713impl NetworkConfig {
8714 pub fn new() -> Self {
8715 std::default::Default::default()
8716 }
8717
8718 /// Sets the value of [name][crate::model::NetworkConfig::name].
8719 ///
8720 /// # Example
8721 /// ```ignore,no_run
8722 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8723 /// let x = NetworkConfig::new().set_name("example");
8724 /// ```
8725 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8726 self.name = v.into();
8727 self
8728 }
8729
8730 /// Sets the value of [id][crate::model::NetworkConfig::id].
8731 ///
8732 /// # Example
8733 /// ```ignore,no_run
8734 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8735 /// let x = NetworkConfig::new().set_id("example");
8736 /// ```
8737 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8738 self.id = v.into();
8739 self
8740 }
8741
8742 /// Sets the value of [r#type][crate::model::NetworkConfig::type].
8743 ///
8744 /// # Example
8745 /// ```ignore,no_run
8746 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8747 /// use google_cloud_baremetalsolution_v2::model::network_config::Type;
8748 /// let x0 = NetworkConfig::new().set_type(Type::Client);
8749 /// let x1 = NetworkConfig::new().set_type(Type::Private);
8750 /// ```
8751 pub fn set_type<T: std::convert::Into<crate::model::network_config::Type>>(
8752 mut self,
8753 v: T,
8754 ) -> Self {
8755 self.r#type = v.into();
8756 self
8757 }
8758
8759 /// Sets the value of [bandwidth][crate::model::NetworkConfig::bandwidth].
8760 ///
8761 /// # Example
8762 /// ```ignore,no_run
8763 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8764 /// use google_cloud_baremetalsolution_v2::model::network_config::Bandwidth;
8765 /// let x0 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw1Gbps);
8766 /// let x1 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw2Gbps);
8767 /// let x2 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw5Gbps);
8768 /// ```
8769 pub fn set_bandwidth<T: std::convert::Into<crate::model::network_config::Bandwidth>>(
8770 mut self,
8771 v: T,
8772 ) -> Self {
8773 self.bandwidth = v.into();
8774 self
8775 }
8776
8777 /// Sets the value of [vlan_attachments][crate::model::NetworkConfig::vlan_attachments].
8778 ///
8779 /// # Example
8780 /// ```ignore,no_run
8781 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8782 /// use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8783 /// let x = NetworkConfig::new()
8784 /// .set_vlan_attachments([
8785 /// IntakeVlanAttachment::default()/* use setters */,
8786 /// IntakeVlanAttachment::default()/* use (different) setters */,
8787 /// ]);
8788 /// ```
8789 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
8790 where
8791 T: std::iter::IntoIterator<Item = V>,
8792 V: std::convert::Into<crate::model::network_config::IntakeVlanAttachment>,
8793 {
8794 use std::iter::Iterator;
8795 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
8796 self
8797 }
8798
8799 /// Sets the value of [cidr][crate::model::NetworkConfig::cidr].
8800 ///
8801 /// # Example
8802 /// ```ignore,no_run
8803 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8804 /// let x = NetworkConfig::new().set_cidr("example");
8805 /// ```
8806 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8807 self.cidr = v.into();
8808 self
8809 }
8810
8811 /// Sets the value of [service_cidr][crate::model::NetworkConfig::service_cidr].
8812 ///
8813 /// # Example
8814 /// ```ignore,no_run
8815 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8816 /// use google_cloud_baremetalsolution_v2::model::network_config::ServiceCidr;
8817 /// let x0 = NetworkConfig::new().set_service_cidr(ServiceCidr::Disabled);
8818 /// let x1 = NetworkConfig::new().set_service_cidr(ServiceCidr::High26);
8819 /// let x2 = NetworkConfig::new().set_service_cidr(ServiceCidr::High27);
8820 /// ```
8821 pub fn set_service_cidr<T: std::convert::Into<crate::model::network_config::ServiceCidr>>(
8822 mut self,
8823 v: T,
8824 ) -> Self {
8825 self.service_cidr = v.into();
8826 self
8827 }
8828
8829 /// Sets the value of [user_note][crate::model::NetworkConfig::user_note].
8830 ///
8831 /// # Example
8832 /// ```ignore,no_run
8833 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8834 /// let x = NetworkConfig::new().set_user_note("example");
8835 /// ```
8836 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8837 self.user_note = v.into();
8838 self
8839 }
8840
8841 /// Sets the value of [gcp_service][crate::model::NetworkConfig::gcp_service].
8842 ///
8843 /// # Example
8844 /// ```ignore,no_run
8845 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8846 /// let x = NetworkConfig::new().set_gcp_service("example");
8847 /// ```
8848 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8849 self.gcp_service = v.into();
8850 self
8851 }
8852
8853 /// Sets the value of [vlan_same_project][crate::model::NetworkConfig::vlan_same_project].
8854 ///
8855 /// # Example
8856 /// ```ignore,no_run
8857 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8858 /// let x = NetworkConfig::new().set_vlan_same_project(true);
8859 /// ```
8860 pub fn set_vlan_same_project<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8861 self.vlan_same_project = v.into();
8862 self
8863 }
8864
8865 /// Sets the value of [jumbo_frames_enabled][crate::model::NetworkConfig::jumbo_frames_enabled].
8866 ///
8867 /// # Example
8868 /// ```ignore,no_run
8869 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8870 /// let x = NetworkConfig::new().set_jumbo_frames_enabled(true);
8871 /// ```
8872 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8873 self.jumbo_frames_enabled = v.into();
8874 self
8875 }
8876}
8877
8878impl wkt::message::Message for NetworkConfig {
8879 fn typename() -> &'static str {
8880 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig"
8881 }
8882}
8883
8884/// Defines additional types related to [NetworkConfig].
8885pub mod network_config {
8886 #[allow(unused_imports)]
8887 use super::*;
8888
8889 /// A GCP vlan attachment.
8890 #[derive(Clone, Default, PartialEq)]
8891 #[non_exhaustive]
8892 pub struct IntakeVlanAttachment {
8893 /// Identifier of the VLAN attachment.
8894 pub id: std::string::String,
8895
8896 /// Attachment pairing key.
8897 pub pairing_key: std::string::String,
8898
8899 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8900 }
8901
8902 impl IntakeVlanAttachment {
8903 pub fn new() -> Self {
8904 std::default::Default::default()
8905 }
8906
8907 /// Sets the value of [id][crate::model::network_config::IntakeVlanAttachment::id].
8908 ///
8909 /// # Example
8910 /// ```ignore,no_run
8911 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8912 /// let x = IntakeVlanAttachment::new().set_id("example");
8913 /// ```
8914 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8915 self.id = v.into();
8916 self
8917 }
8918
8919 /// Sets the value of [pairing_key][crate::model::network_config::IntakeVlanAttachment::pairing_key].
8920 ///
8921 /// # Example
8922 /// ```ignore,no_run
8923 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8924 /// let x = IntakeVlanAttachment::new().set_pairing_key("example");
8925 /// ```
8926 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8927 self.pairing_key = v.into();
8928 self
8929 }
8930 }
8931
8932 impl wkt::message::Message for IntakeVlanAttachment {
8933 fn typename() -> &'static str {
8934 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig.IntakeVlanAttachment"
8935 }
8936 }
8937
8938 /// Network type.
8939 ///
8940 /// # Working with unknown values
8941 ///
8942 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8943 /// additional enum variants at any time. Adding new variants is not considered
8944 /// a breaking change. Applications should write their code in anticipation of:
8945 ///
8946 /// - New values appearing in future releases of the client library, **and**
8947 /// - New values received dynamically, without application changes.
8948 ///
8949 /// Please consult the [Working with enums] section in the user guide for some
8950 /// guidelines.
8951 ///
8952 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8953 #[derive(Clone, Debug, PartialEq)]
8954 #[non_exhaustive]
8955 pub enum Type {
8956 /// Unspecified value.
8957 Unspecified,
8958 /// Client network, that is a network peered to a GCP VPC.
8959 Client,
8960 /// Private network, that is a network local to the BMS POD.
8961 Private,
8962 /// If set, the enum was initialized with an unknown value.
8963 ///
8964 /// Applications can examine the value using [Type::value] or
8965 /// [Type::name].
8966 UnknownValue(r#type::UnknownValue),
8967 }
8968
8969 #[doc(hidden)]
8970 pub mod r#type {
8971 #[allow(unused_imports)]
8972 use super::*;
8973 #[derive(Clone, Debug, PartialEq)]
8974 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8975 }
8976
8977 impl Type {
8978 /// Gets the enum value.
8979 ///
8980 /// Returns `None` if the enum contains an unknown value deserialized from
8981 /// the string representation of enums.
8982 pub fn value(&self) -> std::option::Option<i32> {
8983 match self {
8984 Self::Unspecified => std::option::Option::Some(0),
8985 Self::Client => std::option::Option::Some(1),
8986 Self::Private => std::option::Option::Some(2),
8987 Self::UnknownValue(u) => u.0.value(),
8988 }
8989 }
8990
8991 /// Gets the enum value as a string.
8992 ///
8993 /// Returns `None` if the enum contains an unknown value deserialized from
8994 /// the integer representation of enums.
8995 pub fn name(&self) -> std::option::Option<&str> {
8996 match self {
8997 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8998 Self::Client => std::option::Option::Some("CLIENT"),
8999 Self::Private => std::option::Option::Some("PRIVATE"),
9000 Self::UnknownValue(u) => u.0.name(),
9001 }
9002 }
9003 }
9004
9005 impl std::default::Default for Type {
9006 fn default() -> Self {
9007 use std::convert::From;
9008 Self::from(0)
9009 }
9010 }
9011
9012 impl std::fmt::Display for Type {
9013 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9014 wkt::internal::display_enum(f, self.name(), self.value())
9015 }
9016 }
9017
9018 impl std::convert::From<i32> for Type {
9019 fn from(value: i32) -> Self {
9020 match value {
9021 0 => Self::Unspecified,
9022 1 => Self::Client,
9023 2 => Self::Private,
9024 _ => Self::UnknownValue(r#type::UnknownValue(
9025 wkt::internal::UnknownEnumValue::Integer(value),
9026 )),
9027 }
9028 }
9029 }
9030
9031 impl std::convert::From<&str> for Type {
9032 fn from(value: &str) -> Self {
9033 use std::string::ToString;
9034 match value {
9035 "TYPE_UNSPECIFIED" => Self::Unspecified,
9036 "CLIENT" => Self::Client,
9037 "PRIVATE" => Self::Private,
9038 _ => Self::UnknownValue(r#type::UnknownValue(
9039 wkt::internal::UnknownEnumValue::String(value.to_string()),
9040 )),
9041 }
9042 }
9043 }
9044
9045 impl serde::ser::Serialize for Type {
9046 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9047 where
9048 S: serde::Serializer,
9049 {
9050 match self {
9051 Self::Unspecified => serializer.serialize_i32(0),
9052 Self::Client => serializer.serialize_i32(1),
9053 Self::Private => serializer.serialize_i32(2),
9054 Self::UnknownValue(u) => u.0.serialize(serializer),
9055 }
9056 }
9057 }
9058
9059 impl<'de> serde::de::Deserialize<'de> for Type {
9060 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9061 where
9062 D: serde::Deserializer<'de>,
9063 {
9064 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
9065 ".google.cloud.baremetalsolution.v2.NetworkConfig.Type",
9066 ))
9067 }
9068 }
9069
9070 /// Interconnect bandwidth.
9071 ///
9072 /// # Working with unknown values
9073 ///
9074 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9075 /// additional enum variants at any time. Adding new variants is not considered
9076 /// a breaking change. Applications should write their code in anticipation of:
9077 ///
9078 /// - New values appearing in future releases of the client library, **and**
9079 /// - New values received dynamically, without application changes.
9080 ///
9081 /// Please consult the [Working with enums] section in the user guide for some
9082 /// guidelines.
9083 ///
9084 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9085 #[derive(Clone, Debug, PartialEq)]
9086 #[non_exhaustive]
9087 pub enum Bandwidth {
9088 /// Unspecified value.
9089 Unspecified,
9090 /// 1 Gbps.
9091 Bw1Gbps,
9092 /// 2 Gbps.
9093 Bw2Gbps,
9094 /// 5 Gbps.
9095 Bw5Gbps,
9096 /// 10 Gbps.
9097 Bw10Gbps,
9098 /// If set, the enum was initialized with an unknown value.
9099 ///
9100 /// Applications can examine the value using [Bandwidth::value] or
9101 /// [Bandwidth::name].
9102 UnknownValue(bandwidth::UnknownValue),
9103 }
9104
9105 #[doc(hidden)]
9106 pub mod bandwidth {
9107 #[allow(unused_imports)]
9108 use super::*;
9109 #[derive(Clone, Debug, PartialEq)]
9110 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9111 }
9112
9113 impl Bandwidth {
9114 /// Gets the enum value.
9115 ///
9116 /// Returns `None` if the enum contains an unknown value deserialized from
9117 /// the string representation of enums.
9118 pub fn value(&self) -> std::option::Option<i32> {
9119 match self {
9120 Self::Unspecified => std::option::Option::Some(0),
9121 Self::Bw1Gbps => std::option::Option::Some(1),
9122 Self::Bw2Gbps => std::option::Option::Some(2),
9123 Self::Bw5Gbps => std::option::Option::Some(3),
9124 Self::Bw10Gbps => std::option::Option::Some(4),
9125 Self::UnknownValue(u) => u.0.value(),
9126 }
9127 }
9128
9129 /// Gets the enum value as a string.
9130 ///
9131 /// Returns `None` if the enum contains an unknown value deserialized from
9132 /// the integer representation of enums.
9133 pub fn name(&self) -> std::option::Option<&str> {
9134 match self {
9135 Self::Unspecified => std::option::Option::Some("BANDWIDTH_UNSPECIFIED"),
9136 Self::Bw1Gbps => std::option::Option::Some("BW_1_GBPS"),
9137 Self::Bw2Gbps => std::option::Option::Some("BW_2_GBPS"),
9138 Self::Bw5Gbps => std::option::Option::Some("BW_5_GBPS"),
9139 Self::Bw10Gbps => std::option::Option::Some("BW_10_GBPS"),
9140 Self::UnknownValue(u) => u.0.name(),
9141 }
9142 }
9143 }
9144
9145 impl std::default::Default for Bandwidth {
9146 fn default() -> Self {
9147 use std::convert::From;
9148 Self::from(0)
9149 }
9150 }
9151
9152 impl std::fmt::Display for Bandwidth {
9153 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9154 wkt::internal::display_enum(f, self.name(), self.value())
9155 }
9156 }
9157
9158 impl std::convert::From<i32> for Bandwidth {
9159 fn from(value: i32) -> Self {
9160 match value {
9161 0 => Self::Unspecified,
9162 1 => Self::Bw1Gbps,
9163 2 => Self::Bw2Gbps,
9164 3 => Self::Bw5Gbps,
9165 4 => Self::Bw10Gbps,
9166 _ => Self::UnknownValue(bandwidth::UnknownValue(
9167 wkt::internal::UnknownEnumValue::Integer(value),
9168 )),
9169 }
9170 }
9171 }
9172
9173 impl std::convert::From<&str> for Bandwidth {
9174 fn from(value: &str) -> Self {
9175 use std::string::ToString;
9176 match value {
9177 "BANDWIDTH_UNSPECIFIED" => Self::Unspecified,
9178 "BW_1_GBPS" => Self::Bw1Gbps,
9179 "BW_2_GBPS" => Self::Bw2Gbps,
9180 "BW_5_GBPS" => Self::Bw5Gbps,
9181 "BW_10_GBPS" => Self::Bw10Gbps,
9182 _ => Self::UnknownValue(bandwidth::UnknownValue(
9183 wkt::internal::UnknownEnumValue::String(value.to_string()),
9184 )),
9185 }
9186 }
9187 }
9188
9189 impl serde::ser::Serialize for Bandwidth {
9190 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9191 where
9192 S: serde::Serializer,
9193 {
9194 match self {
9195 Self::Unspecified => serializer.serialize_i32(0),
9196 Self::Bw1Gbps => serializer.serialize_i32(1),
9197 Self::Bw2Gbps => serializer.serialize_i32(2),
9198 Self::Bw5Gbps => serializer.serialize_i32(3),
9199 Self::Bw10Gbps => serializer.serialize_i32(4),
9200 Self::UnknownValue(u) => u.0.serialize(serializer),
9201 }
9202 }
9203 }
9204
9205 impl<'de> serde::de::Deserialize<'de> for Bandwidth {
9206 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9207 where
9208 D: serde::Deserializer<'de>,
9209 {
9210 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Bandwidth>::new(
9211 ".google.cloud.baremetalsolution.v2.NetworkConfig.Bandwidth",
9212 ))
9213 }
9214 }
9215
9216 /// Service network block.
9217 ///
9218 /// # Working with unknown values
9219 ///
9220 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9221 /// additional enum variants at any time. Adding new variants is not considered
9222 /// a breaking change. Applications should write their code in anticipation of:
9223 ///
9224 /// - New values appearing in future releases of the client library, **and**
9225 /// - New values received dynamically, without application changes.
9226 ///
9227 /// Please consult the [Working with enums] section in the user guide for some
9228 /// guidelines.
9229 ///
9230 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9231 #[derive(Clone, Debug, PartialEq)]
9232 #[non_exhaustive]
9233 pub enum ServiceCidr {
9234 /// Unspecified value.
9235 Unspecified,
9236 /// Services are disabled for the given network.
9237 Disabled,
9238 /// Use the highest /26 block of the network to host services.
9239 High26,
9240 /// Use the highest /27 block of the network to host services.
9241 High27,
9242 /// Use the highest /28 block of the network to host services.
9243 High28,
9244 /// If set, the enum was initialized with an unknown value.
9245 ///
9246 /// Applications can examine the value using [ServiceCidr::value] or
9247 /// [ServiceCidr::name].
9248 UnknownValue(service_cidr::UnknownValue),
9249 }
9250
9251 #[doc(hidden)]
9252 pub mod service_cidr {
9253 #[allow(unused_imports)]
9254 use super::*;
9255 #[derive(Clone, Debug, PartialEq)]
9256 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9257 }
9258
9259 impl ServiceCidr {
9260 /// Gets the enum value.
9261 ///
9262 /// Returns `None` if the enum contains an unknown value deserialized from
9263 /// the string representation of enums.
9264 pub fn value(&self) -> std::option::Option<i32> {
9265 match self {
9266 Self::Unspecified => std::option::Option::Some(0),
9267 Self::Disabled => std::option::Option::Some(1),
9268 Self::High26 => std::option::Option::Some(2),
9269 Self::High27 => std::option::Option::Some(3),
9270 Self::High28 => std::option::Option::Some(4),
9271 Self::UnknownValue(u) => u.0.value(),
9272 }
9273 }
9274
9275 /// Gets the enum value as a string.
9276 ///
9277 /// Returns `None` if the enum contains an unknown value deserialized from
9278 /// the integer representation of enums.
9279 pub fn name(&self) -> std::option::Option<&str> {
9280 match self {
9281 Self::Unspecified => std::option::Option::Some("SERVICE_CIDR_UNSPECIFIED"),
9282 Self::Disabled => std::option::Option::Some("DISABLED"),
9283 Self::High26 => std::option::Option::Some("HIGH_26"),
9284 Self::High27 => std::option::Option::Some("HIGH_27"),
9285 Self::High28 => std::option::Option::Some("HIGH_28"),
9286 Self::UnknownValue(u) => u.0.name(),
9287 }
9288 }
9289 }
9290
9291 impl std::default::Default for ServiceCidr {
9292 fn default() -> Self {
9293 use std::convert::From;
9294 Self::from(0)
9295 }
9296 }
9297
9298 impl std::fmt::Display for ServiceCidr {
9299 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9300 wkt::internal::display_enum(f, self.name(), self.value())
9301 }
9302 }
9303
9304 impl std::convert::From<i32> for ServiceCidr {
9305 fn from(value: i32) -> Self {
9306 match value {
9307 0 => Self::Unspecified,
9308 1 => Self::Disabled,
9309 2 => Self::High26,
9310 3 => Self::High27,
9311 4 => Self::High28,
9312 _ => Self::UnknownValue(service_cidr::UnknownValue(
9313 wkt::internal::UnknownEnumValue::Integer(value),
9314 )),
9315 }
9316 }
9317 }
9318
9319 impl std::convert::From<&str> for ServiceCidr {
9320 fn from(value: &str) -> Self {
9321 use std::string::ToString;
9322 match value {
9323 "SERVICE_CIDR_UNSPECIFIED" => Self::Unspecified,
9324 "DISABLED" => Self::Disabled,
9325 "HIGH_26" => Self::High26,
9326 "HIGH_27" => Self::High27,
9327 "HIGH_28" => Self::High28,
9328 _ => Self::UnknownValue(service_cidr::UnknownValue(
9329 wkt::internal::UnknownEnumValue::String(value.to_string()),
9330 )),
9331 }
9332 }
9333 }
9334
9335 impl serde::ser::Serialize for ServiceCidr {
9336 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9337 where
9338 S: serde::Serializer,
9339 {
9340 match self {
9341 Self::Unspecified => serializer.serialize_i32(0),
9342 Self::Disabled => serializer.serialize_i32(1),
9343 Self::High26 => serializer.serialize_i32(2),
9344 Self::High27 => serializer.serialize_i32(3),
9345 Self::High28 => serializer.serialize_i32(4),
9346 Self::UnknownValue(u) => u.0.serialize(serializer),
9347 }
9348 }
9349 }
9350
9351 impl<'de> serde::de::Deserialize<'de> for ServiceCidr {
9352 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9353 where
9354 D: serde::Deserializer<'de>,
9355 {
9356 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceCidr>::new(
9357 ".google.cloud.baremetalsolution.v2.NetworkConfig.ServiceCidr",
9358 ))
9359 }
9360 }
9361}
9362
9363/// A resource budget.
9364#[derive(Clone, Default, PartialEq)]
9365#[non_exhaustive]
9366pub struct InstanceQuota {
9367 /// Output only. The name of the instance quota.
9368 pub name: std::string::String,
9369
9370 /// Instance type.
9371 /// Deprecated: use gcp_service.
9372 #[deprecated]
9373 pub instance_type: std::string::String,
9374
9375 /// The gcp service of the provisioning quota.
9376 pub gcp_service: std::string::String,
9377
9378 /// Location where the quota applies.
9379 pub location: std::string::String,
9380
9381 /// Number of machines than can be created for the given location and
9382 /// instance_type.
9383 pub available_machine_count: i32,
9384
9385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9386}
9387
9388impl InstanceQuota {
9389 pub fn new() -> Self {
9390 std::default::Default::default()
9391 }
9392
9393 /// Sets the value of [name][crate::model::InstanceQuota::name].
9394 ///
9395 /// # Example
9396 /// ```ignore,no_run
9397 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9398 /// let x = InstanceQuota::new().set_name("example");
9399 /// ```
9400 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9401 self.name = v.into();
9402 self
9403 }
9404
9405 /// Sets the value of [instance_type][crate::model::InstanceQuota::instance_type].
9406 ///
9407 /// # Example
9408 /// ```ignore,no_run
9409 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9410 /// let x = InstanceQuota::new().set_instance_type("example");
9411 /// ```
9412 #[deprecated]
9413 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9414 self.instance_type = v.into();
9415 self
9416 }
9417
9418 /// Sets the value of [gcp_service][crate::model::InstanceQuota::gcp_service].
9419 ///
9420 /// # Example
9421 /// ```ignore,no_run
9422 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9423 /// let x = InstanceQuota::new().set_gcp_service("example");
9424 /// ```
9425 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9426 self.gcp_service = v.into();
9427 self
9428 }
9429
9430 /// Sets the value of [location][crate::model::InstanceQuota::location].
9431 ///
9432 /// # Example
9433 /// ```ignore,no_run
9434 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9435 /// let x = InstanceQuota::new().set_location("example");
9436 /// ```
9437 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9438 self.location = v.into();
9439 self
9440 }
9441
9442 /// Sets the value of [available_machine_count][crate::model::InstanceQuota::available_machine_count].
9443 ///
9444 /// # Example
9445 /// ```ignore,no_run
9446 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9447 /// let x = InstanceQuota::new().set_available_machine_count(42);
9448 /// ```
9449 pub fn set_available_machine_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9450 self.available_machine_count = v.into();
9451 self
9452 }
9453}
9454
9455impl wkt::message::Message for InstanceQuota {
9456 fn typename() -> &'static str {
9457 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceQuota"
9458 }
9459}
9460
9461/// Request for GetProvisioningConfig.
9462#[derive(Clone, Default, PartialEq)]
9463#[non_exhaustive]
9464pub struct GetProvisioningConfigRequest {
9465 /// Required. Name of the ProvisioningConfig.
9466 pub name: std::string::String,
9467
9468 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9469}
9470
9471impl GetProvisioningConfigRequest {
9472 pub fn new() -> Self {
9473 std::default::Default::default()
9474 }
9475
9476 /// Sets the value of [name][crate::model::GetProvisioningConfigRequest::name].
9477 ///
9478 /// # Example
9479 /// ```ignore,no_run
9480 /// # use google_cloud_baremetalsolution_v2::model::GetProvisioningConfigRequest;
9481 /// let x = GetProvisioningConfigRequest::new().set_name("example");
9482 /// ```
9483 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9484 self.name = v.into();
9485 self
9486 }
9487}
9488
9489impl wkt::message::Message for GetProvisioningConfigRequest {
9490 fn typename() -> &'static str {
9491 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetProvisioningConfigRequest"
9492 }
9493}
9494
9495/// Request for CreateProvisioningConfig.
9496#[derive(Clone, Default, PartialEq)]
9497#[non_exhaustive]
9498pub struct CreateProvisioningConfigRequest {
9499 /// Required. The parent project and location containing the
9500 /// ProvisioningConfig.
9501 pub parent: std::string::String,
9502
9503 /// Required. The ProvisioningConfig to create.
9504 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9505
9506 /// Optional. Email provided to send a confirmation with provisioning config
9507 /// to.
9508 pub email: std::string::String,
9509
9510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9511}
9512
9513impl CreateProvisioningConfigRequest {
9514 pub fn new() -> Self {
9515 std::default::Default::default()
9516 }
9517
9518 /// Sets the value of [parent][crate::model::CreateProvisioningConfigRequest::parent].
9519 ///
9520 /// # Example
9521 /// ```ignore,no_run
9522 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9523 /// let x = CreateProvisioningConfigRequest::new().set_parent("example");
9524 /// ```
9525 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9526 self.parent = v.into();
9527 self
9528 }
9529
9530 /// Sets the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9531 ///
9532 /// # Example
9533 /// ```ignore,no_run
9534 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9535 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9536 /// let x = CreateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9537 /// ```
9538 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9539 where
9540 T: std::convert::Into<crate::model::ProvisioningConfig>,
9541 {
9542 self.provisioning_config = std::option::Option::Some(v.into());
9543 self
9544 }
9545
9546 /// Sets or clears the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9547 ///
9548 /// # Example
9549 /// ```ignore,no_run
9550 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9551 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9552 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9553 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9554 /// ```
9555 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9556 where
9557 T: std::convert::Into<crate::model::ProvisioningConfig>,
9558 {
9559 self.provisioning_config = v.map(|x| x.into());
9560 self
9561 }
9562
9563 /// Sets the value of [email][crate::model::CreateProvisioningConfigRequest::email].
9564 ///
9565 /// # Example
9566 /// ```ignore,no_run
9567 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9568 /// let x = CreateProvisioningConfigRequest::new().set_email("example");
9569 /// ```
9570 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9571 self.email = v.into();
9572 self
9573 }
9574}
9575
9576impl wkt::message::Message for CreateProvisioningConfigRequest {
9577 fn typename() -> &'static str {
9578 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateProvisioningConfigRequest"
9579 }
9580}
9581
9582/// Message for updating a ProvisioningConfig.
9583#[derive(Clone, Default, PartialEq)]
9584#[non_exhaustive]
9585pub struct UpdateProvisioningConfigRequest {
9586 /// Required. The ProvisioningConfig to update.
9587 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9588
9589 /// Required. The list of fields to update.
9590 pub update_mask: std::option::Option<wkt::FieldMask>,
9591
9592 /// Optional. Email provided to send a confirmation with provisioning config
9593 /// to.
9594 pub email: std::string::String,
9595
9596 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9597}
9598
9599impl UpdateProvisioningConfigRequest {
9600 pub fn new() -> Self {
9601 std::default::Default::default()
9602 }
9603
9604 /// Sets the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9605 ///
9606 /// # Example
9607 /// ```ignore,no_run
9608 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9609 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9610 /// let x = UpdateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9611 /// ```
9612 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9613 where
9614 T: std::convert::Into<crate::model::ProvisioningConfig>,
9615 {
9616 self.provisioning_config = std::option::Option::Some(v.into());
9617 self
9618 }
9619
9620 /// Sets or clears the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9621 ///
9622 /// # Example
9623 /// ```ignore,no_run
9624 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9625 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9626 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9627 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9628 /// ```
9629 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9630 where
9631 T: std::convert::Into<crate::model::ProvisioningConfig>,
9632 {
9633 self.provisioning_config = v.map(|x| x.into());
9634 self
9635 }
9636
9637 /// Sets the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9638 ///
9639 /// # Example
9640 /// ```ignore,no_run
9641 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9642 /// use wkt::FieldMask;
9643 /// let x = UpdateProvisioningConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9644 /// ```
9645 pub fn set_update_mask<T>(mut self, v: T) -> Self
9646 where
9647 T: std::convert::Into<wkt::FieldMask>,
9648 {
9649 self.update_mask = std::option::Option::Some(v.into());
9650 self
9651 }
9652
9653 /// Sets or clears the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9654 ///
9655 /// # Example
9656 /// ```ignore,no_run
9657 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9658 /// use wkt::FieldMask;
9659 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9660 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9661 /// ```
9662 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9663 where
9664 T: std::convert::Into<wkt::FieldMask>,
9665 {
9666 self.update_mask = v.map(|x| x.into());
9667 self
9668 }
9669
9670 /// Sets the value of [email][crate::model::UpdateProvisioningConfigRequest::email].
9671 ///
9672 /// # Example
9673 /// ```ignore,no_run
9674 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9675 /// let x = UpdateProvisioningConfigRequest::new().set_email("example");
9676 /// ```
9677 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9678 self.email = v.into();
9679 self
9680 }
9681}
9682
9683impl wkt::message::Message for UpdateProvisioningConfigRequest {
9684 fn typename() -> &'static str {
9685 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateProvisioningConfigRequest"
9686 }
9687}
9688
9689/// An SSH key, used for authorizing with the interactive serial console feature.
9690#[derive(Clone, Default, PartialEq)]
9691#[non_exhaustive]
9692pub struct SSHKey {
9693 /// Output only. The name of this SSH key.
9694 /// Currently, the only valid value for the location is "global".
9695 pub name: std::string::String,
9696
9697 /// The public SSH key. This must be in OpenSSH .authorized_keys format.
9698 pub public_key: std::string::String,
9699
9700 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9701}
9702
9703impl SSHKey {
9704 pub fn new() -> Self {
9705 std::default::Default::default()
9706 }
9707
9708 /// Sets the value of [name][crate::model::SSHKey::name].
9709 ///
9710 /// # Example
9711 /// ```ignore,no_run
9712 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9713 /// let x = SSHKey::new().set_name("example");
9714 /// ```
9715 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9716 self.name = v.into();
9717 self
9718 }
9719
9720 /// Sets the value of [public_key][crate::model::SSHKey::public_key].
9721 ///
9722 /// # Example
9723 /// ```ignore,no_run
9724 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9725 /// let x = SSHKey::new().set_public_key("example");
9726 /// ```
9727 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9728 self.public_key = v.into();
9729 self
9730 }
9731}
9732
9733impl wkt::message::Message for SSHKey {
9734 fn typename() -> &'static str {
9735 "type.googleapis.com/google.cloud.baremetalsolution.v2.SSHKey"
9736 }
9737}
9738
9739/// Message for listing the public SSH keys in a project.
9740#[derive(Clone, Default, PartialEq)]
9741#[non_exhaustive]
9742pub struct ListSSHKeysRequest {
9743 /// Required. The parent containing the SSH keys.
9744 /// Currently, the only valid value for the location is "global".
9745 pub parent: std::string::String,
9746
9747 /// The maximum number of items to return.
9748 pub page_size: i32,
9749
9750 /// The next_page_token value returned from a previous List request, if any.
9751 pub page_token: std::string::String,
9752
9753 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9754}
9755
9756impl ListSSHKeysRequest {
9757 pub fn new() -> Self {
9758 std::default::Default::default()
9759 }
9760
9761 /// Sets the value of [parent][crate::model::ListSSHKeysRequest::parent].
9762 ///
9763 /// # Example
9764 /// ```ignore,no_run
9765 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9766 /// let x = ListSSHKeysRequest::new().set_parent("example");
9767 /// ```
9768 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9769 self.parent = v.into();
9770 self
9771 }
9772
9773 /// Sets the value of [page_size][crate::model::ListSSHKeysRequest::page_size].
9774 ///
9775 /// # Example
9776 /// ```ignore,no_run
9777 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9778 /// let x = ListSSHKeysRequest::new().set_page_size(42);
9779 /// ```
9780 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9781 self.page_size = v.into();
9782 self
9783 }
9784
9785 /// Sets the value of [page_token][crate::model::ListSSHKeysRequest::page_token].
9786 ///
9787 /// # Example
9788 /// ```ignore,no_run
9789 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9790 /// let x = ListSSHKeysRequest::new().set_page_token("example");
9791 /// ```
9792 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9793 self.page_token = v.into();
9794 self
9795 }
9796}
9797
9798impl wkt::message::Message for ListSSHKeysRequest {
9799 fn typename() -> &'static str {
9800 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysRequest"
9801 }
9802}
9803
9804/// Message for response of ListSSHKeys.
9805#[derive(Clone, Default, PartialEq)]
9806#[non_exhaustive]
9807pub struct ListSSHKeysResponse {
9808 /// The SSH keys registered in the project.
9809 pub ssh_keys: std::vec::Vec<crate::model::SSHKey>,
9810
9811 /// Token to retrieve the next page of results, or empty if there are no more
9812 /// results in the list.
9813 pub next_page_token: std::string::String,
9814
9815 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9816}
9817
9818impl ListSSHKeysResponse {
9819 pub fn new() -> Self {
9820 std::default::Default::default()
9821 }
9822
9823 /// Sets the value of [ssh_keys][crate::model::ListSSHKeysResponse::ssh_keys].
9824 ///
9825 /// # Example
9826 /// ```ignore,no_run
9827 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
9828 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9829 /// let x = ListSSHKeysResponse::new()
9830 /// .set_ssh_keys([
9831 /// SSHKey::default()/* use setters */,
9832 /// SSHKey::default()/* use (different) setters */,
9833 /// ]);
9834 /// ```
9835 pub fn set_ssh_keys<T, V>(mut self, v: T) -> Self
9836 where
9837 T: std::iter::IntoIterator<Item = V>,
9838 V: std::convert::Into<crate::model::SSHKey>,
9839 {
9840 use std::iter::Iterator;
9841 self.ssh_keys = v.into_iter().map(|i| i.into()).collect();
9842 self
9843 }
9844
9845 /// Sets the value of [next_page_token][crate::model::ListSSHKeysResponse::next_page_token].
9846 ///
9847 /// # Example
9848 /// ```ignore,no_run
9849 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
9850 /// let x = ListSSHKeysResponse::new().set_next_page_token("example");
9851 /// ```
9852 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9853 self.next_page_token = v.into();
9854 self
9855 }
9856}
9857
9858impl wkt::message::Message for ListSSHKeysResponse {
9859 fn typename() -> &'static str {
9860 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysResponse"
9861 }
9862}
9863
9864#[doc(hidden)]
9865impl gax::paginator::internal::PageableResponse for ListSSHKeysResponse {
9866 type PageItem = crate::model::SSHKey;
9867
9868 fn items(self) -> std::vec::Vec<Self::PageItem> {
9869 self.ssh_keys
9870 }
9871
9872 fn next_page_token(&self) -> std::string::String {
9873 use std::clone::Clone;
9874 self.next_page_token.clone()
9875 }
9876}
9877
9878/// Message for registering a public SSH key in a project.
9879#[derive(Clone, Default, PartialEq)]
9880#[non_exhaustive]
9881pub struct CreateSSHKeyRequest {
9882 /// Required. The parent containing the SSH keys.
9883 pub parent: std::string::String,
9884
9885 /// Required. The SSH key to register.
9886 pub ssh_key: std::option::Option<crate::model::SSHKey>,
9887
9888 /// Required. The ID to use for the key, which will become the final component
9889 /// of the key's resource name.
9890 ///
9891 /// This value must match the regex:
9892 /// [a-zA-Z0-9@.\-_]{1,64}
9893 pub ssh_key_id: std::string::String,
9894
9895 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9896}
9897
9898impl CreateSSHKeyRequest {
9899 pub fn new() -> Self {
9900 std::default::Default::default()
9901 }
9902
9903 /// Sets the value of [parent][crate::model::CreateSSHKeyRequest::parent].
9904 ///
9905 /// # Example
9906 /// ```ignore,no_run
9907 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9908 /// let x = CreateSSHKeyRequest::new().set_parent("example");
9909 /// ```
9910 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9911 self.parent = v.into();
9912 self
9913 }
9914
9915 /// Sets the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
9916 ///
9917 /// # Example
9918 /// ```ignore,no_run
9919 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9920 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9921 /// let x = CreateSSHKeyRequest::new().set_ssh_key(SSHKey::default()/* use setters */);
9922 /// ```
9923 pub fn set_ssh_key<T>(mut self, v: T) -> Self
9924 where
9925 T: std::convert::Into<crate::model::SSHKey>,
9926 {
9927 self.ssh_key = std::option::Option::Some(v.into());
9928 self
9929 }
9930
9931 /// Sets or clears the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
9932 ///
9933 /// # Example
9934 /// ```ignore,no_run
9935 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9936 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9937 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(Some(SSHKey::default()/* use setters */));
9938 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(None::<SSHKey>);
9939 /// ```
9940 pub fn set_or_clear_ssh_key<T>(mut self, v: std::option::Option<T>) -> Self
9941 where
9942 T: std::convert::Into<crate::model::SSHKey>,
9943 {
9944 self.ssh_key = v.map(|x| x.into());
9945 self
9946 }
9947
9948 /// Sets the value of [ssh_key_id][crate::model::CreateSSHKeyRequest::ssh_key_id].
9949 ///
9950 /// # Example
9951 /// ```ignore,no_run
9952 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9953 /// let x = CreateSSHKeyRequest::new().set_ssh_key_id("example");
9954 /// ```
9955 pub fn set_ssh_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9956 self.ssh_key_id = v.into();
9957 self
9958 }
9959}
9960
9961impl wkt::message::Message for CreateSSHKeyRequest {
9962 fn typename() -> &'static str {
9963 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateSSHKeyRequest"
9964 }
9965}
9966
9967/// Message for deleting an SSH key from a project.
9968#[derive(Clone, Default, PartialEq)]
9969#[non_exhaustive]
9970pub struct DeleteSSHKeyRequest {
9971 /// Required. The name of the SSH key to delete.
9972 /// Currently, the only valid value for the location is "global".
9973 pub name: std::string::String,
9974
9975 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9976}
9977
9978impl DeleteSSHKeyRequest {
9979 pub fn new() -> Self {
9980 std::default::Default::default()
9981 }
9982
9983 /// Sets the value of [name][crate::model::DeleteSSHKeyRequest::name].
9984 ///
9985 /// # Example
9986 /// ```ignore,no_run
9987 /// # use google_cloud_baremetalsolution_v2::model::DeleteSSHKeyRequest;
9988 /// let x = DeleteSSHKeyRequest::new().set_name("example");
9989 /// ```
9990 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9991 self.name = v.into();
9992 self
9993 }
9994}
9995
9996impl wkt::message::Message for DeleteSSHKeyRequest {
9997 fn typename() -> &'static str {
9998 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteSSHKeyRequest"
9999 }
10000}
10001
10002/// A storage volume.
10003#[derive(Clone, Default, PartialEq)]
10004#[non_exhaustive]
10005pub struct Volume {
10006 /// Output only. The resource name of this `Volume`.
10007 /// Resource names are schemeless URIs that follow the conventions in
10008 /// <https://cloud.google.com/apis/design/resource_names>.
10009 /// Format:
10010 /// `projects/{project}/locations/{location}/volumes/{volume}`
10011 pub name: std::string::String,
10012
10013 /// An identifier for the `Volume`, generated by the backend.
10014 pub id: std::string::String,
10015
10016 /// The storage type for this volume.
10017 pub storage_type: crate::model::volume::StorageType,
10018
10019 /// The state of this storage volume.
10020 pub state: crate::model::volume::State,
10021
10022 /// The requested size of this storage volume, in GiB.
10023 pub requested_size_gib: i64,
10024
10025 /// Originally requested size, in GiB.
10026 pub originally_requested_size_gib: i64,
10027
10028 /// The current size of this storage volume, in GiB, including space reserved
10029 /// for snapshots. This size might be different than the requested size if the
10030 /// storage volume has been configured with auto grow or auto shrink.
10031 pub current_size_gib: i64,
10032
10033 /// Additional emergency size that was requested for this Volume, in GiB.
10034 /// current_size_gib includes this value.
10035 pub emergency_size_gib: i64,
10036
10037 /// Maximum size volume can be expanded to in case of evergency, in GiB.
10038 pub max_size_gib: i64,
10039
10040 /// The size, in GiB, that this storage volume has expanded as a result of an
10041 /// auto grow policy. In the absence of auto-grow, the value is 0.
10042 pub auto_grown_size_gib: i64,
10043
10044 /// The space remaining in the storage volume for new LUNs, in GiB, excluding
10045 /// space reserved for snapshots.
10046 pub remaining_space_gib: i64,
10047
10048 /// Details about snapshot space reservation and usage on the storage volume.
10049 pub snapshot_reservation_detail:
10050 std::option::Option<crate::model::volume::SnapshotReservationDetail>,
10051
10052 /// The behavior to use when snapshot reserved space is full.
10053 pub snapshot_auto_delete_behavior: crate::model::volume::SnapshotAutoDeleteBehavior,
10054
10055 /// Labels as key value pairs.
10056 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10057
10058 /// Whether snapshots are enabled.
10059 pub snapshot_enabled: bool,
10060
10061 /// Immutable. Pod name.
10062 pub pod: std::string::String,
10063
10064 /// Output only. Storage protocol for the Volume.
10065 pub protocol: crate::model::volume::Protocol,
10066
10067 /// Output only. Whether this volume is a boot volume. A boot volume is one
10068 /// which contains a boot LUN.
10069 pub boot_volume: bool,
10070
10071 /// Immutable. Performance tier of the Volume.
10072 /// Default is SHARED.
10073 pub performance_tier: crate::model::VolumePerformanceTier,
10074
10075 /// Input only. User-specified notes for new Volume.
10076 /// Used to provision Volumes that require manual intervention.
10077 pub notes: std::string::String,
10078
10079 /// The workload profile for the volume.
10080 pub workload_profile: crate::model::volume::WorkloadProfile,
10081
10082 /// Output only. Time after which volume will be fully deleted.
10083 /// It is filled only for volumes in COOLOFF state.
10084 pub expire_time: std::option::Option<wkt::Timestamp>,
10085
10086 /// Output only. Instances this Volume is attached to.
10087 /// This field is set only in Get requests.
10088 pub instances: std::vec::Vec<std::string::String>,
10089
10090 /// Output only. Is the Volume attached at at least one instance.
10091 /// This field is a lightweight counterpart of `instances` field.
10092 /// It is filled in List responses as well.
10093 pub attached: bool,
10094
10095 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10096}
10097
10098impl Volume {
10099 pub fn new() -> Self {
10100 std::default::Default::default()
10101 }
10102
10103 /// Sets the value of [name][crate::model::Volume::name].
10104 ///
10105 /// # Example
10106 /// ```ignore,no_run
10107 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10108 /// let x = Volume::new().set_name("example");
10109 /// ```
10110 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10111 self.name = v.into();
10112 self
10113 }
10114
10115 /// Sets the value of [id][crate::model::Volume::id].
10116 ///
10117 /// # Example
10118 /// ```ignore,no_run
10119 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10120 /// let x = Volume::new().set_id("example");
10121 /// ```
10122 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10123 self.id = v.into();
10124 self
10125 }
10126
10127 /// Sets the value of [storage_type][crate::model::Volume::storage_type].
10128 ///
10129 /// # Example
10130 /// ```ignore,no_run
10131 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10132 /// use google_cloud_baremetalsolution_v2::model::volume::StorageType;
10133 /// let x0 = Volume::new().set_storage_type(StorageType::Ssd);
10134 /// let x1 = Volume::new().set_storage_type(StorageType::Hdd);
10135 /// ```
10136 pub fn set_storage_type<T: std::convert::Into<crate::model::volume::StorageType>>(
10137 mut self,
10138 v: T,
10139 ) -> Self {
10140 self.storage_type = v.into();
10141 self
10142 }
10143
10144 /// Sets the value of [state][crate::model::Volume::state].
10145 ///
10146 /// # Example
10147 /// ```ignore,no_run
10148 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10149 /// use google_cloud_baremetalsolution_v2::model::volume::State;
10150 /// let x0 = Volume::new().set_state(State::Creating);
10151 /// let x1 = Volume::new().set_state(State::Ready);
10152 /// let x2 = Volume::new().set_state(State::Deleting);
10153 /// ```
10154 pub fn set_state<T: std::convert::Into<crate::model::volume::State>>(mut self, v: T) -> Self {
10155 self.state = v.into();
10156 self
10157 }
10158
10159 /// Sets the value of [requested_size_gib][crate::model::Volume::requested_size_gib].
10160 ///
10161 /// # Example
10162 /// ```ignore,no_run
10163 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10164 /// let x = Volume::new().set_requested_size_gib(42);
10165 /// ```
10166 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10167 self.requested_size_gib = v.into();
10168 self
10169 }
10170
10171 /// Sets the value of [originally_requested_size_gib][crate::model::Volume::originally_requested_size_gib].
10172 ///
10173 /// # Example
10174 /// ```ignore,no_run
10175 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10176 /// let x = Volume::new().set_originally_requested_size_gib(42);
10177 /// ```
10178 pub fn set_originally_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10179 self.originally_requested_size_gib = v.into();
10180 self
10181 }
10182
10183 /// Sets the value of [current_size_gib][crate::model::Volume::current_size_gib].
10184 ///
10185 /// # Example
10186 /// ```ignore,no_run
10187 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10188 /// let x = Volume::new().set_current_size_gib(42);
10189 /// ```
10190 pub fn set_current_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10191 self.current_size_gib = v.into();
10192 self
10193 }
10194
10195 /// Sets the value of [emergency_size_gib][crate::model::Volume::emergency_size_gib].
10196 ///
10197 /// # Example
10198 /// ```ignore,no_run
10199 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10200 /// let x = Volume::new().set_emergency_size_gib(42);
10201 /// ```
10202 pub fn set_emergency_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10203 self.emergency_size_gib = v.into();
10204 self
10205 }
10206
10207 /// Sets the value of [max_size_gib][crate::model::Volume::max_size_gib].
10208 ///
10209 /// # Example
10210 /// ```ignore,no_run
10211 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10212 /// let x = Volume::new().set_max_size_gib(42);
10213 /// ```
10214 pub fn set_max_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10215 self.max_size_gib = v.into();
10216 self
10217 }
10218
10219 /// Sets the value of [auto_grown_size_gib][crate::model::Volume::auto_grown_size_gib].
10220 ///
10221 /// # Example
10222 /// ```ignore,no_run
10223 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10224 /// let x = Volume::new().set_auto_grown_size_gib(42);
10225 /// ```
10226 pub fn set_auto_grown_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10227 self.auto_grown_size_gib = v.into();
10228 self
10229 }
10230
10231 /// Sets the value of [remaining_space_gib][crate::model::Volume::remaining_space_gib].
10232 ///
10233 /// # Example
10234 /// ```ignore,no_run
10235 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10236 /// let x = Volume::new().set_remaining_space_gib(42);
10237 /// ```
10238 pub fn set_remaining_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10239 self.remaining_space_gib = v.into();
10240 self
10241 }
10242
10243 /// Sets the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10244 ///
10245 /// # Example
10246 /// ```ignore,no_run
10247 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10248 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10249 /// let x = Volume::new().set_snapshot_reservation_detail(SnapshotReservationDetail::default()/* use setters */);
10250 /// ```
10251 pub fn set_snapshot_reservation_detail<T>(mut self, v: T) -> Self
10252 where
10253 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10254 {
10255 self.snapshot_reservation_detail = std::option::Option::Some(v.into());
10256 self
10257 }
10258
10259 /// Sets or clears the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10260 ///
10261 /// # Example
10262 /// ```ignore,no_run
10263 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10264 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10265 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(Some(SnapshotReservationDetail::default()/* use setters */));
10266 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(None::<SnapshotReservationDetail>);
10267 /// ```
10268 pub fn set_or_clear_snapshot_reservation_detail<T>(mut self, v: std::option::Option<T>) -> Self
10269 where
10270 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10271 {
10272 self.snapshot_reservation_detail = v.map(|x| x.into());
10273 self
10274 }
10275
10276 /// Sets the value of [snapshot_auto_delete_behavior][crate::model::Volume::snapshot_auto_delete_behavior].
10277 ///
10278 /// # Example
10279 /// ```ignore,no_run
10280 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10281 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotAutoDeleteBehavior;
10282 /// let x0 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::Disabled);
10283 /// let x1 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::OldestFirst);
10284 /// let x2 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::NewestFirst);
10285 /// ```
10286 pub fn set_snapshot_auto_delete_behavior<
10287 T: std::convert::Into<crate::model::volume::SnapshotAutoDeleteBehavior>,
10288 >(
10289 mut self,
10290 v: T,
10291 ) -> Self {
10292 self.snapshot_auto_delete_behavior = v.into();
10293 self
10294 }
10295
10296 /// Sets the value of [labels][crate::model::Volume::labels].
10297 ///
10298 /// # Example
10299 /// ```ignore,no_run
10300 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10301 /// let x = Volume::new().set_labels([
10302 /// ("key0", "abc"),
10303 /// ("key1", "xyz"),
10304 /// ]);
10305 /// ```
10306 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10307 where
10308 T: std::iter::IntoIterator<Item = (K, V)>,
10309 K: std::convert::Into<std::string::String>,
10310 V: std::convert::Into<std::string::String>,
10311 {
10312 use std::iter::Iterator;
10313 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10314 self
10315 }
10316
10317 /// Sets the value of [snapshot_enabled][crate::model::Volume::snapshot_enabled].
10318 ///
10319 /// # Example
10320 /// ```ignore,no_run
10321 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10322 /// let x = Volume::new().set_snapshot_enabled(true);
10323 /// ```
10324 pub fn set_snapshot_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10325 self.snapshot_enabled = v.into();
10326 self
10327 }
10328
10329 /// Sets the value of [pod][crate::model::Volume::pod].
10330 ///
10331 /// # Example
10332 /// ```ignore,no_run
10333 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10334 /// let x = Volume::new().set_pod("example");
10335 /// ```
10336 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10337 self.pod = v.into();
10338 self
10339 }
10340
10341 /// Sets the value of [protocol][crate::model::Volume::protocol].
10342 ///
10343 /// # Example
10344 /// ```ignore,no_run
10345 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10346 /// use google_cloud_baremetalsolution_v2::model::volume::Protocol;
10347 /// let x0 = Volume::new().set_protocol(Protocol::FibreChannel);
10348 /// let x1 = Volume::new().set_protocol(Protocol::Nfs);
10349 /// ```
10350 pub fn set_protocol<T: std::convert::Into<crate::model::volume::Protocol>>(
10351 mut self,
10352 v: T,
10353 ) -> Self {
10354 self.protocol = v.into();
10355 self
10356 }
10357
10358 /// Sets the value of [boot_volume][crate::model::Volume::boot_volume].
10359 ///
10360 /// # Example
10361 /// ```ignore,no_run
10362 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10363 /// let x = Volume::new().set_boot_volume(true);
10364 /// ```
10365 pub fn set_boot_volume<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10366 self.boot_volume = v.into();
10367 self
10368 }
10369
10370 /// Sets the value of [performance_tier][crate::model::Volume::performance_tier].
10371 ///
10372 /// # Example
10373 /// ```ignore,no_run
10374 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10375 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
10376 /// let x0 = Volume::new().set_performance_tier(VolumePerformanceTier::Shared);
10377 /// let x1 = Volume::new().set_performance_tier(VolumePerformanceTier::Assigned);
10378 /// let x2 = Volume::new().set_performance_tier(VolumePerformanceTier::Ht);
10379 /// ```
10380 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
10381 mut self,
10382 v: T,
10383 ) -> Self {
10384 self.performance_tier = v.into();
10385 self
10386 }
10387
10388 /// Sets the value of [notes][crate::model::Volume::notes].
10389 ///
10390 /// # Example
10391 /// ```ignore,no_run
10392 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10393 /// let x = Volume::new().set_notes("example");
10394 /// ```
10395 pub fn set_notes<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10396 self.notes = v.into();
10397 self
10398 }
10399
10400 /// Sets the value of [workload_profile][crate::model::Volume::workload_profile].
10401 ///
10402 /// # Example
10403 /// ```ignore,no_run
10404 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10405 /// use google_cloud_baremetalsolution_v2::model::volume::WorkloadProfile;
10406 /// let x0 = Volume::new().set_workload_profile(WorkloadProfile::Generic);
10407 /// let x1 = Volume::new().set_workload_profile(WorkloadProfile::Hana);
10408 /// ```
10409 pub fn set_workload_profile<T: std::convert::Into<crate::model::volume::WorkloadProfile>>(
10410 mut self,
10411 v: T,
10412 ) -> Self {
10413 self.workload_profile = v.into();
10414 self
10415 }
10416
10417 /// Sets the value of [expire_time][crate::model::Volume::expire_time].
10418 ///
10419 /// # Example
10420 /// ```ignore,no_run
10421 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10422 /// use wkt::Timestamp;
10423 /// let x = Volume::new().set_expire_time(Timestamp::default()/* use setters */);
10424 /// ```
10425 pub fn set_expire_time<T>(mut self, v: T) -> Self
10426 where
10427 T: std::convert::Into<wkt::Timestamp>,
10428 {
10429 self.expire_time = std::option::Option::Some(v.into());
10430 self
10431 }
10432
10433 /// Sets or clears the value of [expire_time][crate::model::Volume::expire_time].
10434 ///
10435 /// # Example
10436 /// ```ignore,no_run
10437 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10438 /// use wkt::Timestamp;
10439 /// let x = Volume::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10440 /// let x = Volume::new().set_or_clear_expire_time(None::<Timestamp>);
10441 /// ```
10442 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10443 where
10444 T: std::convert::Into<wkt::Timestamp>,
10445 {
10446 self.expire_time = v.map(|x| x.into());
10447 self
10448 }
10449
10450 /// Sets the value of [instances][crate::model::Volume::instances].
10451 ///
10452 /// # Example
10453 /// ```ignore,no_run
10454 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10455 /// let x = Volume::new().set_instances(["a", "b", "c"]);
10456 /// ```
10457 pub fn set_instances<T, V>(mut self, v: T) -> Self
10458 where
10459 T: std::iter::IntoIterator<Item = V>,
10460 V: std::convert::Into<std::string::String>,
10461 {
10462 use std::iter::Iterator;
10463 self.instances = v.into_iter().map(|i| i.into()).collect();
10464 self
10465 }
10466
10467 /// Sets the value of [attached][crate::model::Volume::attached].
10468 ///
10469 /// # Example
10470 /// ```ignore,no_run
10471 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10472 /// let x = Volume::new().set_attached(true);
10473 /// ```
10474 pub fn set_attached<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10475 self.attached = v.into();
10476 self
10477 }
10478}
10479
10480impl wkt::message::Message for Volume {
10481 fn typename() -> &'static str {
10482 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume"
10483 }
10484}
10485
10486/// Defines additional types related to [Volume].
10487pub mod volume {
10488 #[allow(unused_imports)]
10489 use super::*;
10490
10491 /// Details about snapshot space reservation and usage on the storage volume.
10492 #[derive(Clone, Default, PartialEq)]
10493 #[non_exhaustive]
10494 pub struct SnapshotReservationDetail {
10495 /// The space on this storage volume reserved for snapshots, shown in GiB.
10496 pub reserved_space_gib: i64,
10497
10498 /// The percent of snapshot space on this storage volume actually being used
10499 /// by the snapshot copies. This value might be higher than 100% if the
10500 /// snapshot copies have overflowed into the data portion of the storage
10501 /// volume.
10502 pub reserved_space_used_percent: i32,
10503
10504 /// The amount, in GiB, of available space in this storage volume's reserved
10505 /// snapshot space.
10506 pub reserved_space_remaining_gib: i64,
10507
10508 /// Percent of the total Volume size reserved for snapshot copies.
10509 /// Enabling snapshots requires reserving 20% or more of
10510 /// the storage volume space for snapshots. Maximum reserved space for
10511 /// snapshots is 40%.
10512 /// Setting this field will effectively set snapshot_enabled to true.
10513 pub reserved_space_percent: i32,
10514
10515 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10516 }
10517
10518 impl SnapshotReservationDetail {
10519 pub fn new() -> Self {
10520 std::default::Default::default()
10521 }
10522
10523 /// Sets the value of [reserved_space_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_gib].
10524 ///
10525 /// # Example
10526 /// ```ignore,no_run
10527 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10528 /// let x = SnapshotReservationDetail::new().set_reserved_space_gib(42);
10529 /// ```
10530 pub fn set_reserved_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10531 self.reserved_space_gib = v.into();
10532 self
10533 }
10534
10535 /// Sets the value of [reserved_space_used_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_used_percent].
10536 ///
10537 /// # Example
10538 /// ```ignore,no_run
10539 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10540 /// let x = SnapshotReservationDetail::new().set_reserved_space_used_percent(42);
10541 /// ```
10542 pub fn set_reserved_space_used_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10543 self.reserved_space_used_percent = v.into();
10544 self
10545 }
10546
10547 /// Sets the value of [reserved_space_remaining_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_remaining_gib].
10548 ///
10549 /// # Example
10550 /// ```ignore,no_run
10551 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10552 /// let x = SnapshotReservationDetail::new().set_reserved_space_remaining_gib(42);
10553 /// ```
10554 pub fn set_reserved_space_remaining_gib<T: std::convert::Into<i64>>(
10555 mut self,
10556 v: T,
10557 ) -> Self {
10558 self.reserved_space_remaining_gib = v.into();
10559 self
10560 }
10561
10562 /// Sets the value of [reserved_space_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_percent].
10563 ///
10564 /// # Example
10565 /// ```ignore,no_run
10566 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10567 /// let x = SnapshotReservationDetail::new().set_reserved_space_percent(42);
10568 /// ```
10569 pub fn set_reserved_space_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10570 self.reserved_space_percent = v.into();
10571 self
10572 }
10573 }
10574
10575 impl wkt::message::Message for SnapshotReservationDetail {
10576 fn typename() -> &'static str {
10577 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume.SnapshotReservationDetail"
10578 }
10579 }
10580
10581 /// The storage type for a volume.
10582 ///
10583 /// # Working with unknown values
10584 ///
10585 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10586 /// additional enum variants at any time. Adding new variants is not considered
10587 /// a breaking change. Applications should write their code in anticipation of:
10588 ///
10589 /// - New values appearing in future releases of the client library, **and**
10590 /// - New values received dynamically, without application changes.
10591 ///
10592 /// Please consult the [Working with enums] section in the user guide for some
10593 /// guidelines.
10594 ///
10595 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10596 #[derive(Clone, Debug, PartialEq)]
10597 #[non_exhaustive]
10598 pub enum StorageType {
10599 /// The storage type for this volume is unknown.
10600 Unspecified,
10601 /// The storage type for this volume is SSD.
10602 Ssd,
10603 /// This storage type for this volume is HDD.
10604 Hdd,
10605 /// If set, the enum was initialized with an unknown value.
10606 ///
10607 /// Applications can examine the value using [StorageType::value] or
10608 /// [StorageType::name].
10609 UnknownValue(storage_type::UnknownValue),
10610 }
10611
10612 #[doc(hidden)]
10613 pub mod storage_type {
10614 #[allow(unused_imports)]
10615 use super::*;
10616 #[derive(Clone, Debug, PartialEq)]
10617 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10618 }
10619
10620 impl StorageType {
10621 /// Gets the enum value.
10622 ///
10623 /// Returns `None` if the enum contains an unknown value deserialized from
10624 /// the string representation of enums.
10625 pub fn value(&self) -> std::option::Option<i32> {
10626 match self {
10627 Self::Unspecified => std::option::Option::Some(0),
10628 Self::Ssd => std::option::Option::Some(1),
10629 Self::Hdd => std::option::Option::Some(2),
10630 Self::UnknownValue(u) => u.0.value(),
10631 }
10632 }
10633
10634 /// Gets the enum value as a string.
10635 ///
10636 /// Returns `None` if the enum contains an unknown value deserialized from
10637 /// the integer representation of enums.
10638 pub fn name(&self) -> std::option::Option<&str> {
10639 match self {
10640 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
10641 Self::Ssd => std::option::Option::Some("SSD"),
10642 Self::Hdd => std::option::Option::Some("HDD"),
10643 Self::UnknownValue(u) => u.0.name(),
10644 }
10645 }
10646 }
10647
10648 impl std::default::Default for StorageType {
10649 fn default() -> Self {
10650 use std::convert::From;
10651 Self::from(0)
10652 }
10653 }
10654
10655 impl std::fmt::Display for StorageType {
10656 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10657 wkt::internal::display_enum(f, self.name(), self.value())
10658 }
10659 }
10660
10661 impl std::convert::From<i32> for StorageType {
10662 fn from(value: i32) -> Self {
10663 match value {
10664 0 => Self::Unspecified,
10665 1 => Self::Ssd,
10666 2 => Self::Hdd,
10667 _ => Self::UnknownValue(storage_type::UnknownValue(
10668 wkt::internal::UnknownEnumValue::Integer(value),
10669 )),
10670 }
10671 }
10672 }
10673
10674 impl std::convert::From<&str> for StorageType {
10675 fn from(value: &str) -> Self {
10676 use std::string::ToString;
10677 match value {
10678 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
10679 "SSD" => Self::Ssd,
10680 "HDD" => Self::Hdd,
10681 _ => Self::UnknownValue(storage_type::UnknownValue(
10682 wkt::internal::UnknownEnumValue::String(value.to_string()),
10683 )),
10684 }
10685 }
10686 }
10687
10688 impl serde::ser::Serialize for StorageType {
10689 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10690 where
10691 S: serde::Serializer,
10692 {
10693 match self {
10694 Self::Unspecified => serializer.serialize_i32(0),
10695 Self::Ssd => serializer.serialize_i32(1),
10696 Self::Hdd => serializer.serialize_i32(2),
10697 Self::UnknownValue(u) => u.0.serialize(serializer),
10698 }
10699 }
10700 }
10701
10702 impl<'de> serde::de::Deserialize<'de> for StorageType {
10703 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10704 where
10705 D: serde::Deserializer<'de>,
10706 {
10707 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
10708 ".google.cloud.baremetalsolution.v2.Volume.StorageType",
10709 ))
10710 }
10711 }
10712
10713 /// The possible states for a storage volume.
10714 ///
10715 /// # Working with unknown values
10716 ///
10717 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10718 /// additional enum variants at any time. Adding new variants is not considered
10719 /// a breaking change. Applications should write their code in anticipation of:
10720 ///
10721 /// - New values appearing in future releases of the client library, **and**
10722 /// - New values received dynamically, without application changes.
10723 ///
10724 /// Please consult the [Working with enums] section in the user guide for some
10725 /// guidelines.
10726 ///
10727 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10728 #[derive(Clone, Debug, PartialEq)]
10729 #[non_exhaustive]
10730 pub enum State {
10731 /// The storage volume is in an unknown state.
10732 Unspecified,
10733 /// The storage volume is being created.
10734 Creating,
10735 /// The storage volume is ready for use.
10736 Ready,
10737 /// The storage volume has been requested to be deleted.
10738 Deleting,
10739 /// The storage volume is being updated.
10740 Updating,
10741 /// The storage volume is in cool off state. It will be deleted after
10742 /// `expire_time`.
10743 CoolOff,
10744 /// If set, the enum was initialized with an unknown value.
10745 ///
10746 /// Applications can examine the value using [State::value] or
10747 /// [State::name].
10748 UnknownValue(state::UnknownValue),
10749 }
10750
10751 #[doc(hidden)]
10752 pub mod state {
10753 #[allow(unused_imports)]
10754 use super::*;
10755 #[derive(Clone, Debug, PartialEq)]
10756 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10757 }
10758
10759 impl State {
10760 /// Gets the enum value.
10761 ///
10762 /// Returns `None` if the enum contains an unknown value deserialized from
10763 /// the string representation of enums.
10764 pub fn value(&self) -> std::option::Option<i32> {
10765 match self {
10766 Self::Unspecified => std::option::Option::Some(0),
10767 Self::Creating => std::option::Option::Some(1),
10768 Self::Ready => std::option::Option::Some(2),
10769 Self::Deleting => std::option::Option::Some(3),
10770 Self::Updating => std::option::Option::Some(4),
10771 Self::CoolOff => std::option::Option::Some(5),
10772 Self::UnknownValue(u) => u.0.value(),
10773 }
10774 }
10775
10776 /// Gets the enum value as a string.
10777 ///
10778 /// Returns `None` if the enum contains an unknown value deserialized from
10779 /// the integer representation of enums.
10780 pub fn name(&self) -> std::option::Option<&str> {
10781 match self {
10782 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10783 Self::Creating => std::option::Option::Some("CREATING"),
10784 Self::Ready => std::option::Option::Some("READY"),
10785 Self::Deleting => std::option::Option::Some("DELETING"),
10786 Self::Updating => std::option::Option::Some("UPDATING"),
10787 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
10788 Self::UnknownValue(u) => u.0.name(),
10789 }
10790 }
10791 }
10792
10793 impl std::default::Default for State {
10794 fn default() -> Self {
10795 use std::convert::From;
10796 Self::from(0)
10797 }
10798 }
10799
10800 impl std::fmt::Display for State {
10801 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10802 wkt::internal::display_enum(f, self.name(), self.value())
10803 }
10804 }
10805
10806 impl std::convert::From<i32> for State {
10807 fn from(value: i32) -> Self {
10808 match value {
10809 0 => Self::Unspecified,
10810 1 => Self::Creating,
10811 2 => Self::Ready,
10812 3 => Self::Deleting,
10813 4 => Self::Updating,
10814 5 => Self::CoolOff,
10815 _ => Self::UnknownValue(state::UnknownValue(
10816 wkt::internal::UnknownEnumValue::Integer(value),
10817 )),
10818 }
10819 }
10820 }
10821
10822 impl std::convert::From<&str> for State {
10823 fn from(value: &str) -> Self {
10824 use std::string::ToString;
10825 match value {
10826 "STATE_UNSPECIFIED" => Self::Unspecified,
10827 "CREATING" => Self::Creating,
10828 "READY" => Self::Ready,
10829 "DELETING" => Self::Deleting,
10830 "UPDATING" => Self::Updating,
10831 "COOL_OFF" => Self::CoolOff,
10832 _ => Self::UnknownValue(state::UnknownValue(
10833 wkt::internal::UnknownEnumValue::String(value.to_string()),
10834 )),
10835 }
10836 }
10837 }
10838
10839 impl serde::ser::Serialize for State {
10840 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10841 where
10842 S: serde::Serializer,
10843 {
10844 match self {
10845 Self::Unspecified => serializer.serialize_i32(0),
10846 Self::Creating => serializer.serialize_i32(1),
10847 Self::Ready => serializer.serialize_i32(2),
10848 Self::Deleting => serializer.serialize_i32(3),
10849 Self::Updating => serializer.serialize_i32(4),
10850 Self::CoolOff => serializer.serialize_i32(5),
10851 Self::UnknownValue(u) => u.0.serialize(serializer),
10852 }
10853 }
10854 }
10855
10856 impl<'de> serde::de::Deserialize<'de> for State {
10857 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10858 where
10859 D: serde::Deserializer<'de>,
10860 {
10861 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10862 ".google.cloud.baremetalsolution.v2.Volume.State",
10863 ))
10864 }
10865 }
10866
10867 /// The kinds of auto delete behavior to use when snapshot reserved space is
10868 /// full.
10869 ///
10870 /// # Working with unknown values
10871 ///
10872 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10873 /// additional enum variants at any time. Adding new variants is not considered
10874 /// a breaking change. Applications should write their code in anticipation of:
10875 ///
10876 /// - New values appearing in future releases of the client library, **and**
10877 /// - New values received dynamically, without application changes.
10878 ///
10879 /// Please consult the [Working with enums] section in the user guide for some
10880 /// guidelines.
10881 ///
10882 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10883 #[derive(Clone, Debug, PartialEq)]
10884 #[non_exhaustive]
10885 pub enum SnapshotAutoDeleteBehavior {
10886 /// The unspecified behavior.
10887 Unspecified,
10888 /// Don't delete any snapshots. This disables new snapshot creation, as
10889 /// long as the snapshot reserved space is full.
10890 Disabled,
10891 /// Delete the oldest snapshots first.
10892 OldestFirst,
10893 /// Delete the newest snapshots first.
10894 NewestFirst,
10895 /// If set, the enum was initialized with an unknown value.
10896 ///
10897 /// Applications can examine the value using [SnapshotAutoDeleteBehavior::value] or
10898 /// [SnapshotAutoDeleteBehavior::name].
10899 UnknownValue(snapshot_auto_delete_behavior::UnknownValue),
10900 }
10901
10902 #[doc(hidden)]
10903 pub mod snapshot_auto_delete_behavior {
10904 #[allow(unused_imports)]
10905 use super::*;
10906 #[derive(Clone, Debug, PartialEq)]
10907 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10908 }
10909
10910 impl SnapshotAutoDeleteBehavior {
10911 /// Gets the enum value.
10912 ///
10913 /// Returns `None` if the enum contains an unknown value deserialized from
10914 /// the string representation of enums.
10915 pub fn value(&self) -> std::option::Option<i32> {
10916 match self {
10917 Self::Unspecified => std::option::Option::Some(0),
10918 Self::Disabled => std::option::Option::Some(1),
10919 Self::OldestFirst => std::option::Option::Some(2),
10920 Self::NewestFirst => std::option::Option::Some(3),
10921 Self::UnknownValue(u) => u.0.value(),
10922 }
10923 }
10924
10925 /// Gets the enum value as a string.
10926 ///
10927 /// Returns `None` if the enum contains an unknown value deserialized from
10928 /// the integer representation of enums.
10929 pub fn name(&self) -> std::option::Option<&str> {
10930 match self {
10931 Self::Unspecified => {
10932 std::option::Option::Some("SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED")
10933 }
10934 Self::Disabled => std::option::Option::Some("DISABLED"),
10935 Self::OldestFirst => std::option::Option::Some("OLDEST_FIRST"),
10936 Self::NewestFirst => std::option::Option::Some("NEWEST_FIRST"),
10937 Self::UnknownValue(u) => u.0.name(),
10938 }
10939 }
10940 }
10941
10942 impl std::default::Default for SnapshotAutoDeleteBehavior {
10943 fn default() -> Self {
10944 use std::convert::From;
10945 Self::from(0)
10946 }
10947 }
10948
10949 impl std::fmt::Display for SnapshotAutoDeleteBehavior {
10950 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10951 wkt::internal::display_enum(f, self.name(), self.value())
10952 }
10953 }
10954
10955 impl std::convert::From<i32> for SnapshotAutoDeleteBehavior {
10956 fn from(value: i32) -> Self {
10957 match value {
10958 0 => Self::Unspecified,
10959 1 => Self::Disabled,
10960 2 => Self::OldestFirst,
10961 3 => Self::NewestFirst,
10962 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
10963 wkt::internal::UnknownEnumValue::Integer(value),
10964 )),
10965 }
10966 }
10967 }
10968
10969 impl std::convert::From<&str> for SnapshotAutoDeleteBehavior {
10970 fn from(value: &str) -> Self {
10971 use std::string::ToString;
10972 match value {
10973 "SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
10974 "DISABLED" => Self::Disabled,
10975 "OLDEST_FIRST" => Self::OldestFirst,
10976 "NEWEST_FIRST" => Self::NewestFirst,
10977 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
10978 wkt::internal::UnknownEnumValue::String(value.to_string()),
10979 )),
10980 }
10981 }
10982 }
10983
10984 impl serde::ser::Serialize for SnapshotAutoDeleteBehavior {
10985 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10986 where
10987 S: serde::Serializer,
10988 {
10989 match self {
10990 Self::Unspecified => serializer.serialize_i32(0),
10991 Self::Disabled => serializer.serialize_i32(1),
10992 Self::OldestFirst => serializer.serialize_i32(2),
10993 Self::NewestFirst => serializer.serialize_i32(3),
10994 Self::UnknownValue(u) => u.0.serialize(serializer),
10995 }
10996 }
10997 }
10998
10999 impl<'de> serde::de::Deserialize<'de> for SnapshotAutoDeleteBehavior {
11000 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11001 where
11002 D: serde::Deserializer<'de>,
11003 {
11004 deserializer.deserialize_any(
11005 wkt::internal::EnumVisitor::<SnapshotAutoDeleteBehavior>::new(
11006 ".google.cloud.baremetalsolution.v2.Volume.SnapshotAutoDeleteBehavior",
11007 ),
11008 )
11009 }
11010 }
11011
11012 /// Storage protocol.
11013 ///
11014 /// # Working with unknown values
11015 ///
11016 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11017 /// additional enum variants at any time. Adding new variants is not considered
11018 /// a breaking change. Applications should write their code in anticipation of:
11019 ///
11020 /// - New values appearing in future releases of the client library, **and**
11021 /// - New values received dynamically, without application changes.
11022 ///
11023 /// Please consult the [Working with enums] section in the user guide for some
11024 /// guidelines.
11025 ///
11026 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11027 #[derive(Clone, Debug, PartialEq)]
11028 #[non_exhaustive]
11029 pub enum Protocol {
11030 /// Value is not specified.
11031 Unspecified,
11032 /// Fibre Channel protocol.
11033 FibreChannel,
11034 /// NFS protocol means Volume is a NFS Share volume.
11035 /// Such volumes cannot be manipulated via Volumes API.
11036 Nfs,
11037 /// If set, the enum was initialized with an unknown value.
11038 ///
11039 /// Applications can examine the value using [Protocol::value] or
11040 /// [Protocol::name].
11041 UnknownValue(protocol::UnknownValue),
11042 }
11043
11044 #[doc(hidden)]
11045 pub mod protocol {
11046 #[allow(unused_imports)]
11047 use super::*;
11048 #[derive(Clone, Debug, PartialEq)]
11049 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11050 }
11051
11052 impl Protocol {
11053 /// Gets the enum value.
11054 ///
11055 /// Returns `None` if the enum contains an unknown value deserialized from
11056 /// the string representation of enums.
11057 pub fn value(&self) -> std::option::Option<i32> {
11058 match self {
11059 Self::Unspecified => std::option::Option::Some(0),
11060 Self::FibreChannel => std::option::Option::Some(1),
11061 Self::Nfs => std::option::Option::Some(2),
11062 Self::UnknownValue(u) => u.0.value(),
11063 }
11064 }
11065
11066 /// Gets the enum value as a string.
11067 ///
11068 /// Returns `None` if the enum contains an unknown value deserialized from
11069 /// the integer representation of enums.
11070 pub fn name(&self) -> std::option::Option<&str> {
11071 match self {
11072 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
11073 Self::FibreChannel => std::option::Option::Some("FIBRE_CHANNEL"),
11074 Self::Nfs => std::option::Option::Some("NFS"),
11075 Self::UnknownValue(u) => u.0.name(),
11076 }
11077 }
11078 }
11079
11080 impl std::default::Default for Protocol {
11081 fn default() -> Self {
11082 use std::convert::From;
11083 Self::from(0)
11084 }
11085 }
11086
11087 impl std::fmt::Display for Protocol {
11088 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11089 wkt::internal::display_enum(f, self.name(), self.value())
11090 }
11091 }
11092
11093 impl std::convert::From<i32> for Protocol {
11094 fn from(value: i32) -> Self {
11095 match value {
11096 0 => Self::Unspecified,
11097 1 => Self::FibreChannel,
11098 2 => Self::Nfs,
11099 _ => Self::UnknownValue(protocol::UnknownValue(
11100 wkt::internal::UnknownEnumValue::Integer(value),
11101 )),
11102 }
11103 }
11104 }
11105
11106 impl std::convert::From<&str> for Protocol {
11107 fn from(value: &str) -> Self {
11108 use std::string::ToString;
11109 match value {
11110 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
11111 "FIBRE_CHANNEL" => Self::FibreChannel,
11112 "NFS" => Self::Nfs,
11113 _ => Self::UnknownValue(protocol::UnknownValue(
11114 wkt::internal::UnknownEnumValue::String(value.to_string()),
11115 )),
11116 }
11117 }
11118 }
11119
11120 impl serde::ser::Serialize for Protocol {
11121 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11122 where
11123 S: serde::Serializer,
11124 {
11125 match self {
11126 Self::Unspecified => serializer.serialize_i32(0),
11127 Self::FibreChannel => serializer.serialize_i32(1),
11128 Self::Nfs => serializer.serialize_i32(2),
11129 Self::UnknownValue(u) => u.0.serialize(serializer),
11130 }
11131 }
11132 }
11133
11134 impl<'de> serde::de::Deserialize<'de> for Protocol {
11135 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11136 where
11137 D: serde::Deserializer<'de>,
11138 {
11139 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
11140 ".google.cloud.baremetalsolution.v2.Volume.Protocol",
11141 ))
11142 }
11143 }
11144
11145 /// The possible values for a workload profile.
11146 ///
11147 /// # Working with unknown values
11148 ///
11149 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11150 /// additional enum variants at any time. Adding new variants is not considered
11151 /// a breaking change. Applications should write their code in anticipation of:
11152 ///
11153 /// - New values appearing in future releases of the client library, **and**
11154 /// - New values received dynamically, without application changes.
11155 ///
11156 /// Please consult the [Working with enums] section in the user guide for some
11157 /// guidelines.
11158 ///
11159 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11160 #[derive(Clone, Debug, PartialEq)]
11161 #[non_exhaustive]
11162 pub enum WorkloadProfile {
11163 /// The workload profile is in an unknown state.
11164 Unspecified,
11165 /// The workload profile is generic.
11166 Generic,
11167 /// The workload profile is hana.
11168 Hana,
11169 /// If set, the enum was initialized with an unknown value.
11170 ///
11171 /// Applications can examine the value using [WorkloadProfile::value] or
11172 /// [WorkloadProfile::name].
11173 UnknownValue(workload_profile::UnknownValue),
11174 }
11175
11176 #[doc(hidden)]
11177 pub mod workload_profile {
11178 #[allow(unused_imports)]
11179 use super::*;
11180 #[derive(Clone, Debug, PartialEq)]
11181 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11182 }
11183
11184 impl WorkloadProfile {
11185 /// Gets the enum value.
11186 ///
11187 /// Returns `None` if the enum contains an unknown value deserialized from
11188 /// the string representation of enums.
11189 pub fn value(&self) -> std::option::Option<i32> {
11190 match self {
11191 Self::Unspecified => std::option::Option::Some(0),
11192 Self::Generic => std::option::Option::Some(1),
11193 Self::Hana => std::option::Option::Some(2),
11194 Self::UnknownValue(u) => u.0.value(),
11195 }
11196 }
11197
11198 /// Gets the enum value as a string.
11199 ///
11200 /// Returns `None` if the enum contains an unknown value deserialized from
11201 /// the integer representation of enums.
11202 pub fn name(&self) -> std::option::Option<&str> {
11203 match self {
11204 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
11205 Self::Generic => std::option::Option::Some("GENERIC"),
11206 Self::Hana => std::option::Option::Some("HANA"),
11207 Self::UnknownValue(u) => u.0.name(),
11208 }
11209 }
11210 }
11211
11212 impl std::default::Default for WorkloadProfile {
11213 fn default() -> Self {
11214 use std::convert::From;
11215 Self::from(0)
11216 }
11217 }
11218
11219 impl std::fmt::Display for WorkloadProfile {
11220 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11221 wkt::internal::display_enum(f, self.name(), self.value())
11222 }
11223 }
11224
11225 impl std::convert::From<i32> for WorkloadProfile {
11226 fn from(value: i32) -> Self {
11227 match value {
11228 0 => Self::Unspecified,
11229 1 => Self::Generic,
11230 2 => Self::Hana,
11231 _ => Self::UnknownValue(workload_profile::UnknownValue(
11232 wkt::internal::UnknownEnumValue::Integer(value),
11233 )),
11234 }
11235 }
11236 }
11237
11238 impl std::convert::From<&str> for WorkloadProfile {
11239 fn from(value: &str) -> Self {
11240 use std::string::ToString;
11241 match value {
11242 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
11243 "GENERIC" => Self::Generic,
11244 "HANA" => Self::Hana,
11245 _ => Self::UnknownValue(workload_profile::UnknownValue(
11246 wkt::internal::UnknownEnumValue::String(value.to_string()),
11247 )),
11248 }
11249 }
11250 }
11251
11252 impl serde::ser::Serialize for WorkloadProfile {
11253 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11254 where
11255 S: serde::Serializer,
11256 {
11257 match self {
11258 Self::Unspecified => serializer.serialize_i32(0),
11259 Self::Generic => serializer.serialize_i32(1),
11260 Self::Hana => serializer.serialize_i32(2),
11261 Self::UnknownValue(u) => u.0.serialize(serializer),
11262 }
11263 }
11264 }
11265
11266 impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
11267 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11268 where
11269 D: serde::Deserializer<'de>,
11270 {
11271 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
11272 ".google.cloud.baremetalsolution.v2.Volume.WorkloadProfile",
11273 ))
11274 }
11275 }
11276}
11277
11278/// Message for requesting storage volume information.
11279#[derive(Clone, Default, PartialEq)]
11280#[non_exhaustive]
11281pub struct GetVolumeRequest {
11282 /// Required. Name of the resource.
11283 pub name: std::string::String,
11284
11285 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11286}
11287
11288impl GetVolumeRequest {
11289 pub fn new() -> Self {
11290 std::default::Default::default()
11291 }
11292
11293 /// Sets the value of [name][crate::model::GetVolumeRequest::name].
11294 ///
11295 /// # Example
11296 /// ```ignore,no_run
11297 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeRequest;
11298 /// let x = GetVolumeRequest::new().set_name("example");
11299 /// ```
11300 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11301 self.name = v.into();
11302 self
11303 }
11304}
11305
11306impl wkt::message::Message for GetVolumeRequest {
11307 fn typename() -> &'static str {
11308 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeRequest"
11309 }
11310}
11311
11312/// Message for requesting a list of storage volumes.
11313#[derive(Clone, Default, PartialEq)]
11314#[non_exhaustive]
11315pub struct ListVolumesRequest {
11316 /// Required. Parent value for ListVolumesRequest.
11317 pub parent: std::string::String,
11318
11319 /// Requested page size. The server might return fewer items than requested.
11320 /// If unspecified, server will pick an appropriate default.
11321 pub page_size: i32,
11322
11323 /// A token identifying a page of results from the server.
11324 pub page_token: std::string::String,
11325
11326 /// List filter.
11327 pub filter: std::string::String,
11328
11329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11330}
11331
11332impl ListVolumesRequest {
11333 pub fn new() -> Self {
11334 std::default::Default::default()
11335 }
11336
11337 /// Sets the value of [parent][crate::model::ListVolumesRequest::parent].
11338 ///
11339 /// # Example
11340 /// ```ignore,no_run
11341 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11342 /// let x = ListVolumesRequest::new().set_parent("example");
11343 /// ```
11344 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11345 self.parent = v.into();
11346 self
11347 }
11348
11349 /// Sets the value of [page_size][crate::model::ListVolumesRequest::page_size].
11350 ///
11351 /// # Example
11352 /// ```ignore,no_run
11353 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11354 /// let x = ListVolumesRequest::new().set_page_size(42);
11355 /// ```
11356 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11357 self.page_size = v.into();
11358 self
11359 }
11360
11361 /// Sets the value of [page_token][crate::model::ListVolumesRequest::page_token].
11362 ///
11363 /// # Example
11364 /// ```ignore,no_run
11365 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11366 /// let x = ListVolumesRequest::new().set_page_token("example");
11367 /// ```
11368 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11369 self.page_token = v.into();
11370 self
11371 }
11372
11373 /// Sets the value of [filter][crate::model::ListVolumesRequest::filter].
11374 ///
11375 /// # Example
11376 /// ```ignore,no_run
11377 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11378 /// let x = ListVolumesRequest::new().set_filter("example");
11379 /// ```
11380 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11381 self.filter = v.into();
11382 self
11383 }
11384}
11385
11386impl wkt::message::Message for ListVolumesRequest {
11387 fn typename() -> &'static str {
11388 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesRequest"
11389 }
11390}
11391
11392/// Response message containing the list of storage volumes.
11393#[derive(Clone, Default, PartialEq)]
11394#[non_exhaustive]
11395pub struct ListVolumesResponse {
11396 /// The list of storage volumes.
11397 pub volumes: std::vec::Vec<crate::model::Volume>,
11398
11399 /// A token identifying a page of results from the server.
11400 pub next_page_token: std::string::String,
11401
11402 /// Locations that could not be reached.
11403 pub unreachable: std::vec::Vec<std::string::String>,
11404
11405 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11406}
11407
11408impl ListVolumesResponse {
11409 pub fn new() -> Self {
11410 std::default::Default::default()
11411 }
11412
11413 /// Sets the value of [volumes][crate::model::ListVolumesResponse::volumes].
11414 ///
11415 /// # Example
11416 /// ```ignore,no_run
11417 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11418 /// use google_cloud_baremetalsolution_v2::model::Volume;
11419 /// let x = ListVolumesResponse::new()
11420 /// .set_volumes([
11421 /// Volume::default()/* use setters */,
11422 /// Volume::default()/* use (different) setters */,
11423 /// ]);
11424 /// ```
11425 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11426 where
11427 T: std::iter::IntoIterator<Item = V>,
11428 V: std::convert::Into<crate::model::Volume>,
11429 {
11430 use std::iter::Iterator;
11431 self.volumes = v.into_iter().map(|i| i.into()).collect();
11432 self
11433 }
11434
11435 /// Sets the value of [next_page_token][crate::model::ListVolumesResponse::next_page_token].
11436 ///
11437 /// # Example
11438 /// ```ignore,no_run
11439 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11440 /// let x = ListVolumesResponse::new().set_next_page_token("example");
11441 /// ```
11442 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11443 self.next_page_token = v.into();
11444 self
11445 }
11446
11447 /// Sets the value of [unreachable][crate::model::ListVolumesResponse::unreachable].
11448 ///
11449 /// # Example
11450 /// ```ignore,no_run
11451 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11452 /// let x = ListVolumesResponse::new().set_unreachable(["a", "b", "c"]);
11453 /// ```
11454 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
11455 where
11456 T: std::iter::IntoIterator<Item = V>,
11457 V: std::convert::Into<std::string::String>,
11458 {
11459 use std::iter::Iterator;
11460 self.unreachable = v.into_iter().map(|i| i.into()).collect();
11461 self
11462 }
11463}
11464
11465impl wkt::message::Message for ListVolumesResponse {
11466 fn typename() -> &'static str {
11467 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesResponse"
11468 }
11469}
11470
11471#[doc(hidden)]
11472impl gax::paginator::internal::PageableResponse for ListVolumesResponse {
11473 type PageItem = crate::model::Volume;
11474
11475 fn items(self) -> std::vec::Vec<Self::PageItem> {
11476 self.volumes
11477 }
11478
11479 fn next_page_token(&self) -> std::string::String {
11480 use std::clone::Clone;
11481 self.next_page_token.clone()
11482 }
11483}
11484
11485/// Message for updating a volume.
11486#[derive(Clone, Default, PartialEq)]
11487#[non_exhaustive]
11488pub struct UpdateVolumeRequest {
11489 /// Required. The volume to update.
11490 ///
11491 /// The `name` field is used to identify the volume to update.
11492 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11493 pub volume: std::option::Option<crate::model::Volume>,
11494
11495 /// The list of fields to update.
11496 /// The only currently supported fields are:
11497 /// 'labels'
11498 pub update_mask: std::option::Option<wkt::FieldMask>,
11499
11500 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11501}
11502
11503impl UpdateVolumeRequest {
11504 pub fn new() -> Self {
11505 std::default::Default::default()
11506 }
11507
11508 /// Sets the value of [volume][crate::model::UpdateVolumeRequest::volume].
11509 ///
11510 /// # Example
11511 /// ```ignore,no_run
11512 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11513 /// use google_cloud_baremetalsolution_v2::model::Volume;
11514 /// let x = UpdateVolumeRequest::new().set_volume(Volume::default()/* use setters */);
11515 /// ```
11516 pub fn set_volume<T>(mut self, v: T) -> Self
11517 where
11518 T: std::convert::Into<crate::model::Volume>,
11519 {
11520 self.volume = std::option::Option::Some(v.into());
11521 self
11522 }
11523
11524 /// Sets or clears the value of [volume][crate::model::UpdateVolumeRequest::volume].
11525 ///
11526 /// # Example
11527 /// ```ignore,no_run
11528 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11529 /// use google_cloud_baremetalsolution_v2::model::Volume;
11530 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(Some(Volume::default()/* use setters */));
11531 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(None::<Volume>);
11532 /// ```
11533 pub fn set_or_clear_volume<T>(mut self, v: std::option::Option<T>) -> Self
11534 where
11535 T: std::convert::Into<crate::model::Volume>,
11536 {
11537 self.volume = v.map(|x| x.into());
11538 self
11539 }
11540
11541 /// Sets the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11542 ///
11543 /// # Example
11544 /// ```ignore,no_run
11545 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11546 /// use wkt::FieldMask;
11547 /// let x = UpdateVolumeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11548 /// ```
11549 pub fn set_update_mask<T>(mut self, v: T) -> Self
11550 where
11551 T: std::convert::Into<wkt::FieldMask>,
11552 {
11553 self.update_mask = std::option::Option::Some(v.into());
11554 self
11555 }
11556
11557 /// Sets or clears the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11558 ///
11559 /// # Example
11560 /// ```ignore,no_run
11561 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11562 /// use wkt::FieldMask;
11563 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11564 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11565 /// ```
11566 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11567 where
11568 T: std::convert::Into<wkt::FieldMask>,
11569 {
11570 self.update_mask = v.map(|x| x.into());
11571 self
11572 }
11573}
11574
11575impl wkt::message::Message for UpdateVolumeRequest {
11576 fn typename() -> &'static str {
11577 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateVolumeRequest"
11578 }
11579}
11580
11581/// Message requesting rename of a server.
11582#[derive(Clone, Default, PartialEq)]
11583#[non_exhaustive]
11584pub struct RenameVolumeRequest {
11585 /// Required. The `name` field is used to identify the volume.
11586 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11587 pub name: std::string::String,
11588
11589 /// Required. The new `id` of the volume.
11590 pub new_volume_id: std::string::String,
11591
11592 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11593}
11594
11595impl RenameVolumeRequest {
11596 pub fn new() -> Self {
11597 std::default::Default::default()
11598 }
11599
11600 /// Sets the value of [name][crate::model::RenameVolumeRequest::name].
11601 ///
11602 /// # Example
11603 /// ```ignore,no_run
11604 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11605 /// let x = RenameVolumeRequest::new().set_name("example");
11606 /// ```
11607 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11608 self.name = v.into();
11609 self
11610 }
11611
11612 /// Sets the value of [new_volume_id][crate::model::RenameVolumeRequest::new_volume_id].
11613 ///
11614 /// # Example
11615 /// ```ignore,no_run
11616 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11617 /// let x = RenameVolumeRequest::new().set_new_volume_id("example");
11618 /// ```
11619 pub fn set_new_volume_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11620 self.new_volume_id = v.into();
11621 self
11622 }
11623}
11624
11625impl wkt::message::Message for RenameVolumeRequest {
11626 fn typename() -> &'static str {
11627 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameVolumeRequest"
11628 }
11629}
11630
11631/// Request for skip volume cooloff and delete it.
11632#[derive(Clone, Default, PartialEq)]
11633#[non_exhaustive]
11634pub struct EvictVolumeRequest {
11635 /// Required. The name of the Volume.
11636 pub name: std::string::String,
11637
11638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11639}
11640
11641impl EvictVolumeRequest {
11642 pub fn new() -> Self {
11643 std::default::Default::default()
11644 }
11645
11646 /// Sets the value of [name][crate::model::EvictVolumeRequest::name].
11647 ///
11648 /// # Example
11649 /// ```ignore,no_run
11650 /// # use google_cloud_baremetalsolution_v2::model::EvictVolumeRequest;
11651 /// let x = EvictVolumeRequest::new().set_name("example");
11652 /// ```
11653 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11654 self.name = v.into();
11655 self
11656 }
11657}
11658
11659impl wkt::message::Message for EvictVolumeRequest {
11660 fn typename() -> &'static str {
11661 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictVolumeRequest"
11662 }
11663}
11664
11665/// Request for emergency resize Volume.
11666#[derive(Clone, Default, PartialEq)]
11667#[non_exhaustive]
11668pub struct ResizeVolumeRequest {
11669 /// Required. Volume to resize.
11670 pub volume: std::string::String,
11671
11672 /// New Volume size, in GiB.
11673 pub size_gib: i64,
11674
11675 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11676}
11677
11678impl ResizeVolumeRequest {
11679 pub fn new() -> Self {
11680 std::default::Default::default()
11681 }
11682
11683 /// Sets the value of [volume][crate::model::ResizeVolumeRequest::volume].
11684 ///
11685 /// # Example
11686 /// ```ignore,no_run
11687 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11688 /// let x = ResizeVolumeRequest::new().set_volume("example");
11689 /// ```
11690 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11691 self.volume = v.into();
11692 self
11693 }
11694
11695 /// Sets the value of [size_gib][crate::model::ResizeVolumeRequest::size_gib].
11696 ///
11697 /// # Example
11698 /// ```ignore,no_run
11699 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11700 /// let x = ResizeVolumeRequest::new().set_size_gib(42);
11701 /// ```
11702 pub fn set_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11703 self.size_gib = v.into();
11704 self
11705 }
11706}
11707
11708impl wkt::message::Message for ResizeVolumeRequest {
11709 fn typename() -> &'static str {
11710 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResizeVolumeRequest"
11711 }
11712}
11713
11714/// A snapshot of a volume. Only boot volumes can have snapshots.
11715#[derive(Clone, Default, PartialEq)]
11716#[non_exhaustive]
11717pub struct VolumeSnapshot {
11718 /// The name of the snapshot.
11719 pub name: std::string::String,
11720
11721 /// Output only. An identifier for the snapshot, generated by the backend.
11722 pub id: std::string::String,
11723
11724 /// The description of the snapshot.
11725 pub description: std::string::String,
11726
11727 /// Output only. The creation time of the snapshot.
11728 pub create_time: std::option::Option<wkt::Timestamp>,
11729
11730 /// Output only. The name of the volume which this snapshot belongs to.
11731 pub storage_volume: std::string::String,
11732
11733 /// Output only. The type of the snapshot which indicates whether it was
11734 /// scheduled or manual/ad-hoc.
11735 pub r#type: crate::model::volume_snapshot::SnapshotType,
11736
11737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11738}
11739
11740impl VolumeSnapshot {
11741 pub fn new() -> Self {
11742 std::default::Default::default()
11743 }
11744
11745 /// Sets the value of [name][crate::model::VolumeSnapshot::name].
11746 ///
11747 /// # Example
11748 /// ```ignore,no_run
11749 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11750 /// let x = VolumeSnapshot::new().set_name("example");
11751 /// ```
11752 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11753 self.name = v.into();
11754 self
11755 }
11756
11757 /// Sets the value of [id][crate::model::VolumeSnapshot::id].
11758 ///
11759 /// # Example
11760 /// ```ignore,no_run
11761 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11762 /// let x = VolumeSnapshot::new().set_id("example");
11763 /// ```
11764 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11765 self.id = v.into();
11766 self
11767 }
11768
11769 /// Sets the value of [description][crate::model::VolumeSnapshot::description].
11770 ///
11771 /// # Example
11772 /// ```ignore,no_run
11773 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11774 /// let x = VolumeSnapshot::new().set_description("example");
11775 /// ```
11776 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11777 self.description = v.into();
11778 self
11779 }
11780
11781 /// Sets the value of [create_time][crate::model::VolumeSnapshot::create_time].
11782 ///
11783 /// # Example
11784 /// ```ignore,no_run
11785 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11786 /// use wkt::Timestamp;
11787 /// let x = VolumeSnapshot::new().set_create_time(Timestamp::default()/* use setters */);
11788 /// ```
11789 pub fn set_create_time<T>(mut self, v: T) -> Self
11790 where
11791 T: std::convert::Into<wkt::Timestamp>,
11792 {
11793 self.create_time = std::option::Option::Some(v.into());
11794 self
11795 }
11796
11797 /// Sets or clears the value of [create_time][crate::model::VolumeSnapshot::create_time].
11798 ///
11799 /// # Example
11800 /// ```ignore,no_run
11801 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11802 /// use wkt::Timestamp;
11803 /// let x = VolumeSnapshot::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11804 /// let x = VolumeSnapshot::new().set_or_clear_create_time(None::<Timestamp>);
11805 /// ```
11806 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11807 where
11808 T: std::convert::Into<wkt::Timestamp>,
11809 {
11810 self.create_time = v.map(|x| x.into());
11811 self
11812 }
11813
11814 /// Sets the value of [storage_volume][crate::model::VolumeSnapshot::storage_volume].
11815 ///
11816 /// # Example
11817 /// ```ignore,no_run
11818 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11819 /// let x = VolumeSnapshot::new().set_storage_volume("example");
11820 /// ```
11821 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11822 self.storage_volume = v.into();
11823 self
11824 }
11825
11826 /// Sets the value of [r#type][crate::model::VolumeSnapshot::type].
11827 ///
11828 /// # Example
11829 /// ```ignore,no_run
11830 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11831 /// use google_cloud_baremetalsolution_v2::model::volume_snapshot::SnapshotType;
11832 /// let x0 = VolumeSnapshot::new().set_type(SnapshotType::AdHoc);
11833 /// let x1 = VolumeSnapshot::new().set_type(SnapshotType::Scheduled);
11834 /// ```
11835 pub fn set_type<T: std::convert::Into<crate::model::volume_snapshot::SnapshotType>>(
11836 mut self,
11837 v: T,
11838 ) -> Self {
11839 self.r#type = v.into();
11840 self
11841 }
11842}
11843
11844impl wkt::message::Message for VolumeSnapshot {
11845 fn typename() -> &'static str {
11846 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeSnapshot"
11847 }
11848}
11849
11850/// Defines additional types related to [VolumeSnapshot].
11851pub mod volume_snapshot {
11852 #[allow(unused_imports)]
11853 use super::*;
11854
11855 /// Represents the type of a snapshot.
11856 ///
11857 /// # Working with unknown values
11858 ///
11859 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11860 /// additional enum variants at any time. Adding new variants is not considered
11861 /// a breaking change. Applications should write their code in anticipation of:
11862 ///
11863 /// - New values appearing in future releases of the client library, **and**
11864 /// - New values received dynamically, without application changes.
11865 ///
11866 /// Please consult the [Working with enums] section in the user guide for some
11867 /// guidelines.
11868 ///
11869 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11870 #[derive(Clone, Debug, PartialEq)]
11871 #[non_exhaustive]
11872 pub enum SnapshotType {
11873 /// Type is not specified.
11874 Unspecified,
11875 /// Snapshot was taken manually by user.
11876 AdHoc,
11877 /// Snapshot was taken automatically as a part of a snapshot schedule.
11878 Scheduled,
11879 /// If set, the enum was initialized with an unknown value.
11880 ///
11881 /// Applications can examine the value using [SnapshotType::value] or
11882 /// [SnapshotType::name].
11883 UnknownValue(snapshot_type::UnknownValue),
11884 }
11885
11886 #[doc(hidden)]
11887 pub mod snapshot_type {
11888 #[allow(unused_imports)]
11889 use super::*;
11890 #[derive(Clone, Debug, PartialEq)]
11891 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11892 }
11893
11894 impl SnapshotType {
11895 /// Gets the enum value.
11896 ///
11897 /// Returns `None` if the enum contains an unknown value deserialized from
11898 /// the string representation of enums.
11899 pub fn value(&self) -> std::option::Option<i32> {
11900 match self {
11901 Self::Unspecified => std::option::Option::Some(0),
11902 Self::AdHoc => std::option::Option::Some(1),
11903 Self::Scheduled => std::option::Option::Some(2),
11904 Self::UnknownValue(u) => u.0.value(),
11905 }
11906 }
11907
11908 /// Gets the enum value as a string.
11909 ///
11910 /// Returns `None` if the enum contains an unknown value deserialized from
11911 /// the integer representation of enums.
11912 pub fn name(&self) -> std::option::Option<&str> {
11913 match self {
11914 Self::Unspecified => std::option::Option::Some("SNAPSHOT_TYPE_UNSPECIFIED"),
11915 Self::AdHoc => std::option::Option::Some("AD_HOC"),
11916 Self::Scheduled => std::option::Option::Some("SCHEDULED"),
11917 Self::UnknownValue(u) => u.0.name(),
11918 }
11919 }
11920 }
11921
11922 impl std::default::Default for SnapshotType {
11923 fn default() -> Self {
11924 use std::convert::From;
11925 Self::from(0)
11926 }
11927 }
11928
11929 impl std::fmt::Display for SnapshotType {
11930 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11931 wkt::internal::display_enum(f, self.name(), self.value())
11932 }
11933 }
11934
11935 impl std::convert::From<i32> for SnapshotType {
11936 fn from(value: i32) -> Self {
11937 match value {
11938 0 => Self::Unspecified,
11939 1 => Self::AdHoc,
11940 2 => Self::Scheduled,
11941 _ => Self::UnknownValue(snapshot_type::UnknownValue(
11942 wkt::internal::UnknownEnumValue::Integer(value),
11943 )),
11944 }
11945 }
11946 }
11947
11948 impl std::convert::From<&str> for SnapshotType {
11949 fn from(value: &str) -> Self {
11950 use std::string::ToString;
11951 match value {
11952 "SNAPSHOT_TYPE_UNSPECIFIED" => Self::Unspecified,
11953 "AD_HOC" => Self::AdHoc,
11954 "SCHEDULED" => Self::Scheduled,
11955 _ => Self::UnknownValue(snapshot_type::UnknownValue(
11956 wkt::internal::UnknownEnumValue::String(value.to_string()),
11957 )),
11958 }
11959 }
11960 }
11961
11962 impl serde::ser::Serialize for SnapshotType {
11963 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11964 where
11965 S: serde::Serializer,
11966 {
11967 match self {
11968 Self::Unspecified => serializer.serialize_i32(0),
11969 Self::AdHoc => serializer.serialize_i32(1),
11970 Self::Scheduled => serializer.serialize_i32(2),
11971 Self::UnknownValue(u) => u.0.serialize(serializer),
11972 }
11973 }
11974 }
11975
11976 impl<'de> serde::de::Deserialize<'de> for SnapshotType {
11977 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11978 where
11979 D: serde::Deserializer<'de>,
11980 {
11981 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotType>::new(
11982 ".google.cloud.baremetalsolution.v2.VolumeSnapshot.SnapshotType",
11983 ))
11984 }
11985 }
11986}
11987
11988/// Message for requesting volume snapshot information.
11989#[derive(Clone, Default, PartialEq)]
11990#[non_exhaustive]
11991pub struct GetVolumeSnapshotRequest {
11992 /// Required. The name of the snapshot.
11993 pub name: std::string::String,
11994
11995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11996}
11997
11998impl GetVolumeSnapshotRequest {
11999 pub fn new() -> Self {
12000 std::default::Default::default()
12001 }
12002
12003 /// Sets the value of [name][crate::model::GetVolumeSnapshotRequest::name].
12004 ///
12005 /// # Example
12006 /// ```ignore,no_run
12007 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeSnapshotRequest;
12008 /// let x = GetVolumeSnapshotRequest::new().set_name("example");
12009 /// ```
12010 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12011 self.name = v.into();
12012 self
12013 }
12014}
12015
12016impl wkt::message::Message for GetVolumeSnapshotRequest {
12017 fn typename() -> &'static str {
12018 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeSnapshotRequest"
12019 }
12020}
12021
12022/// Message for requesting a list of volume snapshots.
12023#[derive(Clone, Default, PartialEq)]
12024#[non_exhaustive]
12025pub struct ListVolumeSnapshotsRequest {
12026 /// Required. Parent value for ListVolumesRequest.
12027 pub parent: std::string::String,
12028
12029 /// Requested page size. The server might return fewer items than requested.
12030 /// If unspecified, server will pick an appropriate default.
12031 pub page_size: i32,
12032
12033 /// A token identifying a page of results from the server.
12034 pub page_token: std::string::String,
12035
12036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12037}
12038
12039impl ListVolumeSnapshotsRequest {
12040 pub fn new() -> Self {
12041 std::default::Default::default()
12042 }
12043
12044 /// Sets the value of [parent][crate::model::ListVolumeSnapshotsRequest::parent].
12045 ///
12046 /// # Example
12047 /// ```ignore,no_run
12048 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12049 /// let x = ListVolumeSnapshotsRequest::new().set_parent("example");
12050 /// ```
12051 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12052 self.parent = v.into();
12053 self
12054 }
12055
12056 /// Sets the value of [page_size][crate::model::ListVolumeSnapshotsRequest::page_size].
12057 ///
12058 /// # Example
12059 /// ```ignore,no_run
12060 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12061 /// let x = ListVolumeSnapshotsRequest::new().set_page_size(42);
12062 /// ```
12063 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12064 self.page_size = v.into();
12065 self
12066 }
12067
12068 /// Sets the value of [page_token][crate::model::ListVolumeSnapshotsRequest::page_token].
12069 ///
12070 /// # Example
12071 /// ```ignore,no_run
12072 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12073 /// let x = ListVolumeSnapshotsRequest::new().set_page_token("example");
12074 /// ```
12075 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12076 self.page_token = v.into();
12077 self
12078 }
12079}
12080
12081impl wkt::message::Message for ListVolumeSnapshotsRequest {
12082 fn typename() -> &'static str {
12083 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsRequest"
12084 }
12085}
12086
12087/// Response message containing the list of volume snapshots.
12088#[derive(Clone, Default, PartialEq)]
12089#[non_exhaustive]
12090pub struct ListVolumeSnapshotsResponse {
12091 /// The list of snapshots.
12092 pub volume_snapshots: std::vec::Vec<crate::model::VolumeSnapshot>,
12093
12094 /// A token identifying a page of results from the server.
12095 pub next_page_token: std::string::String,
12096
12097 /// Locations that could not be reached.
12098 pub unreachable: std::vec::Vec<std::string::String>,
12099
12100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12101}
12102
12103impl ListVolumeSnapshotsResponse {
12104 pub fn new() -> Self {
12105 std::default::Default::default()
12106 }
12107
12108 /// Sets the value of [volume_snapshots][crate::model::ListVolumeSnapshotsResponse::volume_snapshots].
12109 ///
12110 /// # Example
12111 /// ```ignore,no_run
12112 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12113 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12114 /// let x = ListVolumeSnapshotsResponse::new()
12115 /// .set_volume_snapshots([
12116 /// VolumeSnapshot::default()/* use setters */,
12117 /// VolumeSnapshot::default()/* use (different) setters */,
12118 /// ]);
12119 /// ```
12120 pub fn set_volume_snapshots<T, V>(mut self, v: T) -> Self
12121 where
12122 T: std::iter::IntoIterator<Item = V>,
12123 V: std::convert::Into<crate::model::VolumeSnapshot>,
12124 {
12125 use std::iter::Iterator;
12126 self.volume_snapshots = v.into_iter().map(|i| i.into()).collect();
12127 self
12128 }
12129
12130 /// Sets the value of [next_page_token][crate::model::ListVolumeSnapshotsResponse::next_page_token].
12131 ///
12132 /// # Example
12133 /// ```ignore,no_run
12134 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12135 /// let x = ListVolumeSnapshotsResponse::new().set_next_page_token("example");
12136 /// ```
12137 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12138 self.next_page_token = v.into();
12139 self
12140 }
12141
12142 /// Sets the value of [unreachable][crate::model::ListVolumeSnapshotsResponse::unreachable].
12143 ///
12144 /// # Example
12145 /// ```ignore,no_run
12146 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12147 /// let x = ListVolumeSnapshotsResponse::new().set_unreachable(["a", "b", "c"]);
12148 /// ```
12149 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
12150 where
12151 T: std::iter::IntoIterator<Item = V>,
12152 V: std::convert::Into<std::string::String>,
12153 {
12154 use std::iter::Iterator;
12155 self.unreachable = v.into_iter().map(|i| i.into()).collect();
12156 self
12157 }
12158}
12159
12160impl wkt::message::Message for ListVolumeSnapshotsResponse {
12161 fn typename() -> &'static str {
12162 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsResponse"
12163 }
12164}
12165
12166#[doc(hidden)]
12167impl gax::paginator::internal::PageableResponse for ListVolumeSnapshotsResponse {
12168 type PageItem = crate::model::VolumeSnapshot;
12169
12170 fn items(self) -> std::vec::Vec<Self::PageItem> {
12171 self.volume_snapshots
12172 }
12173
12174 fn next_page_token(&self) -> std::string::String {
12175 use std::clone::Clone;
12176 self.next_page_token.clone()
12177 }
12178}
12179
12180/// Message for deleting named Volume snapshot.
12181#[derive(Clone, Default, PartialEq)]
12182#[non_exhaustive]
12183pub struct DeleteVolumeSnapshotRequest {
12184 /// Required. The name of the snapshot to delete.
12185 pub name: std::string::String,
12186
12187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12188}
12189
12190impl DeleteVolumeSnapshotRequest {
12191 pub fn new() -> Self {
12192 std::default::Default::default()
12193 }
12194
12195 /// Sets the value of [name][crate::model::DeleteVolumeSnapshotRequest::name].
12196 ///
12197 /// # Example
12198 /// ```ignore,no_run
12199 /// # use google_cloud_baremetalsolution_v2::model::DeleteVolumeSnapshotRequest;
12200 /// let x = DeleteVolumeSnapshotRequest::new().set_name("example");
12201 /// ```
12202 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12203 self.name = v.into();
12204 self
12205 }
12206}
12207
12208impl wkt::message::Message for DeleteVolumeSnapshotRequest {
12209 fn typename() -> &'static str {
12210 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteVolumeSnapshotRequest"
12211 }
12212}
12213
12214/// Message for creating a volume snapshot.
12215#[derive(Clone, Default, PartialEq)]
12216#[non_exhaustive]
12217pub struct CreateVolumeSnapshotRequest {
12218 /// Required. The volume to snapshot.
12219 pub parent: std::string::String,
12220
12221 /// Required. The snapshot to create.
12222 pub volume_snapshot: std::option::Option<crate::model::VolumeSnapshot>,
12223
12224 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12225}
12226
12227impl CreateVolumeSnapshotRequest {
12228 pub fn new() -> Self {
12229 std::default::Default::default()
12230 }
12231
12232 /// Sets the value of [parent][crate::model::CreateVolumeSnapshotRequest::parent].
12233 ///
12234 /// # Example
12235 /// ```ignore,no_run
12236 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12237 /// let x = CreateVolumeSnapshotRequest::new().set_parent("example");
12238 /// ```
12239 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12240 self.parent = v.into();
12241 self
12242 }
12243
12244 /// Sets the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12245 ///
12246 /// # Example
12247 /// ```ignore,no_run
12248 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12249 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12250 /// let x = CreateVolumeSnapshotRequest::new().set_volume_snapshot(VolumeSnapshot::default()/* use setters */);
12251 /// ```
12252 pub fn set_volume_snapshot<T>(mut self, v: T) -> Self
12253 where
12254 T: std::convert::Into<crate::model::VolumeSnapshot>,
12255 {
12256 self.volume_snapshot = std::option::Option::Some(v.into());
12257 self
12258 }
12259
12260 /// Sets or clears the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12261 ///
12262 /// # Example
12263 /// ```ignore,no_run
12264 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12265 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12266 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(Some(VolumeSnapshot::default()/* use setters */));
12267 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(None::<VolumeSnapshot>);
12268 /// ```
12269 pub fn set_or_clear_volume_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
12270 where
12271 T: std::convert::Into<crate::model::VolumeSnapshot>,
12272 {
12273 self.volume_snapshot = v.map(|x| x.into());
12274 self
12275 }
12276}
12277
12278impl wkt::message::Message for CreateVolumeSnapshotRequest {
12279 fn typename() -> &'static str {
12280 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateVolumeSnapshotRequest"
12281 }
12282}
12283
12284/// Message for restoring a volume snapshot.
12285#[derive(Clone, Default, PartialEq)]
12286#[non_exhaustive]
12287pub struct RestoreVolumeSnapshotRequest {
12288 /// Required. Name of the snapshot which will be used to restore its parent
12289 /// volume.
12290 pub volume_snapshot: std::string::String,
12291
12292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12293}
12294
12295impl RestoreVolumeSnapshotRequest {
12296 pub fn new() -> Self {
12297 std::default::Default::default()
12298 }
12299
12300 /// Sets the value of [volume_snapshot][crate::model::RestoreVolumeSnapshotRequest::volume_snapshot].
12301 ///
12302 /// # Example
12303 /// ```ignore,no_run
12304 /// # use google_cloud_baremetalsolution_v2::model::RestoreVolumeSnapshotRequest;
12305 /// let x = RestoreVolumeSnapshotRequest::new().set_volume_snapshot("example");
12306 /// ```
12307 pub fn set_volume_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12308 self.volume_snapshot = v.into();
12309 self
12310 }
12311}
12312
12313impl wkt::message::Message for RestoreVolumeSnapshotRequest {
12314 fn typename() -> &'static str {
12315 "type.googleapis.com/google.cloud.baremetalsolution.v2.RestoreVolumeSnapshotRequest"
12316 }
12317}
12318
12319/// Performance tier of the Volume.
12320///
12321/// # Working with unknown values
12322///
12323/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12324/// additional enum variants at any time. Adding new variants is not considered
12325/// a breaking change. Applications should write their code in anticipation of:
12326///
12327/// - New values appearing in future releases of the client library, **and**
12328/// - New values received dynamically, without application changes.
12329///
12330/// Please consult the [Working with enums] section in the user guide for some
12331/// guidelines.
12332///
12333/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12334#[derive(Clone, Debug, PartialEq)]
12335#[non_exhaustive]
12336pub enum VolumePerformanceTier {
12337 /// Value is not specified.
12338 Unspecified,
12339 /// Regular volumes, shared aggregates.
12340 Shared,
12341 /// Assigned aggregates.
12342 Assigned,
12343 /// High throughput aggregates.
12344 Ht,
12345 /// If set, the enum was initialized with an unknown value.
12346 ///
12347 /// Applications can examine the value using [VolumePerformanceTier::value] or
12348 /// [VolumePerformanceTier::name].
12349 UnknownValue(volume_performance_tier::UnknownValue),
12350}
12351
12352#[doc(hidden)]
12353pub mod volume_performance_tier {
12354 #[allow(unused_imports)]
12355 use super::*;
12356 #[derive(Clone, Debug, PartialEq)]
12357 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12358}
12359
12360impl VolumePerformanceTier {
12361 /// Gets the enum value.
12362 ///
12363 /// Returns `None` if the enum contains an unknown value deserialized from
12364 /// the string representation of enums.
12365 pub fn value(&self) -> std::option::Option<i32> {
12366 match self {
12367 Self::Unspecified => std::option::Option::Some(0),
12368 Self::Shared => std::option::Option::Some(1),
12369 Self::Assigned => std::option::Option::Some(2),
12370 Self::Ht => std::option::Option::Some(3),
12371 Self::UnknownValue(u) => u.0.value(),
12372 }
12373 }
12374
12375 /// Gets the enum value as a string.
12376 ///
12377 /// Returns `None` if the enum contains an unknown value deserialized from
12378 /// the integer representation of enums.
12379 pub fn name(&self) -> std::option::Option<&str> {
12380 match self {
12381 Self::Unspecified => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_UNSPECIFIED"),
12382 Self::Shared => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_SHARED"),
12383 Self::Assigned => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_ASSIGNED"),
12384 Self::Ht => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_HT"),
12385 Self::UnknownValue(u) => u.0.name(),
12386 }
12387 }
12388}
12389
12390impl std::default::Default for VolumePerformanceTier {
12391 fn default() -> Self {
12392 use std::convert::From;
12393 Self::from(0)
12394 }
12395}
12396
12397impl std::fmt::Display for VolumePerformanceTier {
12398 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12399 wkt::internal::display_enum(f, self.name(), self.value())
12400 }
12401}
12402
12403impl std::convert::From<i32> for VolumePerformanceTier {
12404 fn from(value: i32) -> Self {
12405 match value {
12406 0 => Self::Unspecified,
12407 1 => Self::Shared,
12408 2 => Self::Assigned,
12409 3 => Self::Ht,
12410 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12411 wkt::internal::UnknownEnumValue::Integer(value),
12412 )),
12413 }
12414 }
12415}
12416
12417impl std::convert::From<&str> for VolumePerformanceTier {
12418 fn from(value: &str) -> Self {
12419 use std::string::ToString;
12420 match value {
12421 "VOLUME_PERFORMANCE_TIER_UNSPECIFIED" => Self::Unspecified,
12422 "VOLUME_PERFORMANCE_TIER_SHARED" => Self::Shared,
12423 "VOLUME_PERFORMANCE_TIER_ASSIGNED" => Self::Assigned,
12424 "VOLUME_PERFORMANCE_TIER_HT" => Self::Ht,
12425 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12426 wkt::internal::UnknownEnumValue::String(value.to_string()),
12427 )),
12428 }
12429 }
12430}
12431
12432impl serde::ser::Serialize for VolumePerformanceTier {
12433 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12434 where
12435 S: serde::Serializer,
12436 {
12437 match self {
12438 Self::Unspecified => serializer.serialize_i32(0),
12439 Self::Shared => serializer.serialize_i32(1),
12440 Self::Assigned => serializer.serialize_i32(2),
12441 Self::Ht => serializer.serialize_i32(3),
12442 Self::UnknownValue(u) => u.0.serialize(serializer),
12443 }
12444 }
12445}
12446
12447impl<'de> serde::de::Deserialize<'de> for VolumePerformanceTier {
12448 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12449 where
12450 D: serde::Deserializer<'de>,
12451 {
12452 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumePerformanceTier>::new(
12453 ".google.cloud.baremetalsolution.v2.VolumePerformanceTier",
12454 ))
12455 }
12456}
12457
12458/// The possible values for a workload profile.
12459///
12460/// # Working with unknown values
12461///
12462/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12463/// additional enum variants at any time. Adding new variants is not considered
12464/// a breaking change. Applications should write their code in anticipation of:
12465///
12466/// - New values appearing in future releases of the client library, **and**
12467/// - New values received dynamically, without application changes.
12468///
12469/// Please consult the [Working with enums] section in the user guide for some
12470/// guidelines.
12471///
12472/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12473#[derive(Clone, Debug, PartialEq)]
12474#[non_exhaustive]
12475pub enum WorkloadProfile {
12476 /// The workload profile is in an unknown state.
12477 Unspecified,
12478 /// The workload profile is generic.
12479 Generic,
12480 /// The workload profile is hana.
12481 Hana,
12482 /// If set, the enum was initialized with an unknown value.
12483 ///
12484 /// Applications can examine the value using [WorkloadProfile::value] or
12485 /// [WorkloadProfile::name].
12486 UnknownValue(workload_profile::UnknownValue),
12487}
12488
12489#[doc(hidden)]
12490pub mod workload_profile {
12491 #[allow(unused_imports)]
12492 use super::*;
12493 #[derive(Clone, Debug, PartialEq)]
12494 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12495}
12496
12497impl WorkloadProfile {
12498 /// Gets the enum value.
12499 ///
12500 /// Returns `None` if the enum contains an unknown value deserialized from
12501 /// the string representation of enums.
12502 pub fn value(&self) -> std::option::Option<i32> {
12503 match self {
12504 Self::Unspecified => std::option::Option::Some(0),
12505 Self::Generic => std::option::Option::Some(1),
12506 Self::Hana => std::option::Option::Some(2),
12507 Self::UnknownValue(u) => u.0.value(),
12508 }
12509 }
12510
12511 /// Gets the enum value as a string.
12512 ///
12513 /// Returns `None` if the enum contains an unknown value deserialized from
12514 /// the integer representation of enums.
12515 pub fn name(&self) -> std::option::Option<&str> {
12516 match self {
12517 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
12518 Self::Generic => std::option::Option::Some("WORKLOAD_PROFILE_GENERIC"),
12519 Self::Hana => std::option::Option::Some("WORKLOAD_PROFILE_HANA"),
12520 Self::UnknownValue(u) => u.0.name(),
12521 }
12522 }
12523}
12524
12525impl std::default::Default for WorkloadProfile {
12526 fn default() -> Self {
12527 use std::convert::From;
12528 Self::from(0)
12529 }
12530}
12531
12532impl std::fmt::Display for WorkloadProfile {
12533 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12534 wkt::internal::display_enum(f, self.name(), self.value())
12535 }
12536}
12537
12538impl std::convert::From<i32> for WorkloadProfile {
12539 fn from(value: i32) -> Self {
12540 match value {
12541 0 => Self::Unspecified,
12542 1 => Self::Generic,
12543 2 => Self::Hana,
12544 _ => Self::UnknownValue(workload_profile::UnknownValue(
12545 wkt::internal::UnknownEnumValue::Integer(value),
12546 )),
12547 }
12548 }
12549}
12550
12551impl std::convert::From<&str> for WorkloadProfile {
12552 fn from(value: &str) -> Self {
12553 use std::string::ToString;
12554 match value {
12555 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
12556 "WORKLOAD_PROFILE_GENERIC" => Self::Generic,
12557 "WORKLOAD_PROFILE_HANA" => Self::Hana,
12558 _ => Self::UnknownValue(workload_profile::UnknownValue(
12559 wkt::internal::UnknownEnumValue::String(value.to_string()),
12560 )),
12561 }
12562 }
12563}
12564
12565impl serde::ser::Serialize for WorkloadProfile {
12566 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12567 where
12568 S: serde::Serializer,
12569 {
12570 match self {
12571 Self::Unspecified => serializer.serialize_i32(0),
12572 Self::Generic => serializer.serialize_i32(1),
12573 Self::Hana => serializer.serialize_i32(2),
12574 Self::UnknownValue(u) => u.0.serialize(serializer),
12575 }
12576 }
12577}
12578
12579impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
12580 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12581 where
12582 D: serde::Deserializer<'de>,
12583 {
12584 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
12585 ".google.cloud.baremetalsolution.v2.WorkloadProfile",
12586 ))
12587 }
12588}