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 gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate lazy_static;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Represents the metadata from a long-running operation.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct OperationMetadata {
43 /// Output only. The time the operation was created.
44 pub create_time: std::option::Option<wkt::Timestamp>,
45
46 /// Output only. The time the operation finished running.
47 pub end_time: std::option::Option<wkt::Timestamp>,
48
49 /// Output only. Server-defined resource path for the target of the operation.
50 pub target: std::string::String,
51
52 /// Output only. Name of the action executed by the operation.
53 pub verb: std::string::String,
54
55 /// Output only. Human-readable status of the operation, if any.
56 pub status_message: std::string::String,
57
58 /// Output only. Identifies whether the user requested the cancellation
59 /// of the operation. Operations that have been successfully cancelled
60 /// have [Operation.error][] value with a
61 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
62 /// `Code.CANCELLED`.
63 ///
64 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
65 pub requested_cancellation: bool,
66
67 /// Output only. API version used with the operation.
68 pub api_version: std::string::String,
69
70 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
71}
72
73impl OperationMetadata {
74 pub fn new() -> Self {
75 std::default::Default::default()
76 }
77
78 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
79 ///
80 /// # Example
81 /// ```ignore,no_run
82 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
83 /// use wkt::Timestamp;
84 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
85 /// ```
86 pub fn set_create_time<T>(mut self, v: T) -> Self
87 where
88 T: std::convert::Into<wkt::Timestamp>,
89 {
90 self.create_time = std::option::Option::Some(v.into());
91 self
92 }
93
94 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
95 ///
96 /// # Example
97 /// ```ignore,no_run
98 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
99 /// use wkt::Timestamp;
100 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
101 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
102 /// ```
103 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
104 where
105 T: std::convert::Into<wkt::Timestamp>,
106 {
107 self.create_time = v.map(|x| x.into());
108 self
109 }
110
111 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
112 ///
113 /// # Example
114 /// ```ignore,no_run
115 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
116 /// use wkt::Timestamp;
117 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
118 /// ```
119 pub fn set_end_time<T>(mut self, v: T) -> Self
120 where
121 T: std::convert::Into<wkt::Timestamp>,
122 {
123 self.end_time = std::option::Option::Some(v.into());
124 self
125 }
126
127 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
128 ///
129 /// # Example
130 /// ```ignore,no_run
131 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
132 /// use wkt::Timestamp;
133 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
134 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
135 /// ```
136 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
137 where
138 T: std::convert::Into<wkt::Timestamp>,
139 {
140 self.end_time = v.map(|x| x.into());
141 self
142 }
143
144 /// Sets the value of [target][crate::model::OperationMetadata::target].
145 ///
146 /// # Example
147 /// ```ignore,no_run
148 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
149 /// let x = OperationMetadata::new().set_target("example");
150 /// ```
151 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
152 self.target = v.into();
153 self
154 }
155
156 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
157 ///
158 /// # Example
159 /// ```ignore,no_run
160 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
161 /// let x = OperationMetadata::new().set_verb("example");
162 /// ```
163 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
164 self.verb = v.into();
165 self
166 }
167
168 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
169 ///
170 /// # Example
171 /// ```ignore,no_run
172 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
173 /// let x = OperationMetadata::new().set_status_message("example");
174 /// ```
175 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
176 self.status_message = v.into();
177 self
178 }
179
180 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
181 ///
182 /// # Example
183 /// ```ignore,no_run
184 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
185 /// let x = OperationMetadata::new().set_requested_cancellation(true);
186 /// ```
187 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
188 self.requested_cancellation = v.into();
189 self
190 }
191
192 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
193 ///
194 /// # Example
195 /// ```ignore,no_run
196 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
197 /// let x = OperationMetadata::new().set_api_version("example");
198 /// ```
199 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
200 self.api_version = v.into();
201 self
202 }
203}
204
205impl wkt::message::Message for OperationMetadata {
206 fn typename() -> &'static str {
207 "type.googleapis.com/google.cloud.baremetalsolution.v2.OperationMetadata"
208 }
209}
210
211/// Response message from resetting a server.
212#[derive(Clone, Default, PartialEq)]
213#[non_exhaustive]
214pub struct ResetInstanceResponse {
215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
216}
217
218impl ResetInstanceResponse {
219 pub fn new() -> Self {
220 std::default::Default::default()
221 }
222}
223
224impl wkt::message::Message for ResetInstanceResponse {
225 fn typename() -> &'static str {
226 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceResponse"
227 }
228}
229
230/// A server.
231#[derive(Clone, Default, PartialEq)]
232#[non_exhaustive]
233pub struct Instance {
234 /// Immutable. The resource name of this `Instance`.
235 /// Resource names are schemeless URIs that follow the conventions in
236 /// <https://cloud.google.com/apis/design/resource_names>.
237 /// Format:
238 /// `projects/{project}/locations/{location}/instances/{instance}`
239 pub name: std::string::String,
240
241 /// Output only. An identifier for the `Instance`, generated by the backend.
242 pub id: std::string::String,
243
244 /// Output only. Create a time stamp.
245 pub create_time: std::option::Option<wkt::Timestamp>,
246
247 /// Output only. Update a time stamp.
248 pub update_time: std::option::Option<wkt::Timestamp>,
249
250 /// Immutable. The server type.
251 /// [Available server
252 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
253 pub machine_type: std::string::String,
254
255 /// Output only. The state of the server.
256 pub state: crate::model::instance::State,
257
258 /// True if you enable hyperthreading for the server, otherwise false.
259 /// The default value is false.
260 pub hyperthreading_enabled: bool,
261
262 /// Labels as key value pairs.
263 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
264
265 /// Immutable. List of LUNs associated with this server.
266 pub luns: std::vec::Vec<crate::model::Lun>,
267
268 /// Input only. List of Volumes to attach to this Instance on creation.
269 /// This field won't be populated in Get/List responses.
270 pub volumes: std::vec::Vec<crate::model::Volume>,
271
272 /// Output only. List of networks associated with this server.
273 pub networks: std::vec::Vec<crate::model::Network>,
274
275 /// Output only. True if the interactive serial console feature is enabled for
276 /// the instance, false otherwise. The default value is false.
277 pub interactive_serial_console_enabled: bool,
278
279 /// The OS image currently installed on the server.
280 pub os_image: std::string::String,
281
282 /// Immutable. Pod name.
283 /// Pod is an independent part of infrastructure.
284 /// Instance can be connected to the assets (networks, volumes) allocated
285 /// in the same pod only.
286 pub pod: std::string::String,
287
288 /// Instance network template name. For eg, bondaa-bondaa, bondab-nic, etc.
289 /// Generally, the template name follows the syntax of
290 /// "bond<bond_mode>" or "nic".
291 pub network_template: std::string::String,
292
293 /// List of logical interfaces for the instance. The number of logical
294 /// interfaces will be the same as number of hardware bond/nic on the chosen
295 /// network template. For the non-multivlan configurations (for eg, existing
296 /// servers) that use existing default network template (bondaa-bondaa), both
297 /// the Instance.networks field and the Instance.logical_interfaces fields will
298 /// be filled to ensure backward compatibility. For the others, only
299 /// Instance.logical_interfaces will be filled.
300 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
301
302 /// Output only. Text field about info for logging in.
303 pub login_info: std::string::String,
304
305 /// The workload profile for the instance.
306 pub workload_profile: crate::model::WorkloadProfile,
307
308 /// Output only. The firmware version for the instance.
309 pub firmware_version: std::string::String,
310
311 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
312}
313
314impl Instance {
315 pub fn new() -> Self {
316 std::default::Default::default()
317 }
318
319 /// Sets the value of [name][crate::model::Instance::name].
320 ///
321 /// # Example
322 /// ```ignore,no_run
323 /// # use google_cloud_baremetalsolution_v2::model::Instance;
324 /// let x = Instance::new().set_name("example");
325 /// ```
326 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
327 self.name = v.into();
328 self
329 }
330
331 /// Sets the value of [id][crate::model::Instance::id].
332 ///
333 /// # Example
334 /// ```ignore,no_run
335 /// # use google_cloud_baremetalsolution_v2::model::Instance;
336 /// let x = Instance::new().set_id("example");
337 /// ```
338 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
339 self.id = v.into();
340 self
341 }
342
343 /// Sets the value of [create_time][crate::model::Instance::create_time].
344 ///
345 /// # Example
346 /// ```ignore,no_run
347 /// # use google_cloud_baremetalsolution_v2::model::Instance;
348 /// use wkt::Timestamp;
349 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
350 /// ```
351 pub fn set_create_time<T>(mut self, v: T) -> Self
352 where
353 T: std::convert::Into<wkt::Timestamp>,
354 {
355 self.create_time = std::option::Option::Some(v.into());
356 self
357 }
358
359 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
360 ///
361 /// # Example
362 /// ```ignore,no_run
363 /// # use google_cloud_baremetalsolution_v2::model::Instance;
364 /// use wkt::Timestamp;
365 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
366 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
367 /// ```
368 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
369 where
370 T: std::convert::Into<wkt::Timestamp>,
371 {
372 self.create_time = v.map(|x| x.into());
373 self
374 }
375
376 /// Sets the value of [update_time][crate::model::Instance::update_time].
377 ///
378 /// # Example
379 /// ```ignore,no_run
380 /// # use google_cloud_baremetalsolution_v2::model::Instance;
381 /// use wkt::Timestamp;
382 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
383 /// ```
384 pub fn set_update_time<T>(mut self, v: T) -> Self
385 where
386 T: std::convert::Into<wkt::Timestamp>,
387 {
388 self.update_time = std::option::Option::Some(v.into());
389 self
390 }
391
392 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
393 ///
394 /// # Example
395 /// ```ignore,no_run
396 /// # use google_cloud_baremetalsolution_v2::model::Instance;
397 /// use wkt::Timestamp;
398 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
399 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
400 /// ```
401 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
402 where
403 T: std::convert::Into<wkt::Timestamp>,
404 {
405 self.update_time = v.map(|x| x.into());
406 self
407 }
408
409 /// Sets the value of [machine_type][crate::model::Instance::machine_type].
410 ///
411 /// # Example
412 /// ```ignore,no_run
413 /// # use google_cloud_baremetalsolution_v2::model::Instance;
414 /// let x = Instance::new().set_machine_type("example");
415 /// ```
416 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
417 self.machine_type = v.into();
418 self
419 }
420
421 /// Sets the value of [state][crate::model::Instance::state].
422 ///
423 /// # Example
424 /// ```ignore,no_run
425 /// # use google_cloud_baremetalsolution_v2::model::Instance;
426 /// use google_cloud_baremetalsolution_v2::model::instance::State;
427 /// let x0 = Instance::new().set_state(State::Provisioning);
428 /// let x1 = Instance::new().set_state(State::Running);
429 /// let x2 = Instance::new().set_state(State::Deleted);
430 /// ```
431 pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
432 self.state = v.into();
433 self
434 }
435
436 /// Sets the value of [hyperthreading_enabled][crate::model::Instance::hyperthreading_enabled].
437 ///
438 /// # Example
439 /// ```ignore,no_run
440 /// # use google_cloud_baremetalsolution_v2::model::Instance;
441 /// let x = Instance::new().set_hyperthreading_enabled(true);
442 /// ```
443 pub fn set_hyperthreading_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
444 self.hyperthreading_enabled = v.into();
445 self
446 }
447
448 /// Sets the value of [labels][crate::model::Instance::labels].
449 ///
450 /// # Example
451 /// ```ignore,no_run
452 /// # use google_cloud_baremetalsolution_v2::model::Instance;
453 /// let x = Instance::new().set_labels([
454 /// ("key0", "abc"),
455 /// ("key1", "xyz"),
456 /// ]);
457 /// ```
458 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
459 where
460 T: std::iter::IntoIterator<Item = (K, V)>,
461 K: std::convert::Into<std::string::String>,
462 V: std::convert::Into<std::string::String>,
463 {
464 use std::iter::Iterator;
465 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
466 self
467 }
468
469 /// Sets the value of [luns][crate::model::Instance::luns].
470 ///
471 /// # Example
472 /// ```ignore,no_run
473 /// # use google_cloud_baremetalsolution_v2::model::Instance;
474 /// use google_cloud_baremetalsolution_v2::model::Lun;
475 /// let x = Instance::new()
476 /// .set_luns([
477 /// Lun::default()/* use setters */,
478 /// Lun::default()/* use (different) setters */,
479 /// ]);
480 /// ```
481 pub fn set_luns<T, V>(mut self, v: T) -> Self
482 where
483 T: std::iter::IntoIterator<Item = V>,
484 V: std::convert::Into<crate::model::Lun>,
485 {
486 use std::iter::Iterator;
487 self.luns = v.into_iter().map(|i| i.into()).collect();
488 self
489 }
490
491 /// Sets the value of [volumes][crate::model::Instance::volumes].
492 ///
493 /// # Example
494 /// ```ignore,no_run
495 /// # use google_cloud_baremetalsolution_v2::model::Instance;
496 /// use google_cloud_baremetalsolution_v2::model::Volume;
497 /// let x = Instance::new()
498 /// .set_volumes([
499 /// Volume::default()/* use setters */,
500 /// Volume::default()/* use (different) setters */,
501 /// ]);
502 /// ```
503 pub fn set_volumes<T, V>(mut self, v: T) -> Self
504 where
505 T: std::iter::IntoIterator<Item = V>,
506 V: std::convert::Into<crate::model::Volume>,
507 {
508 use std::iter::Iterator;
509 self.volumes = v.into_iter().map(|i| i.into()).collect();
510 self
511 }
512
513 /// Sets the value of [networks][crate::model::Instance::networks].
514 ///
515 /// # Example
516 /// ```ignore,no_run
517 /// # use google_cloud_baremetalsolution_v2::model::Instance;
518 /// use google_cloud_baremetalsolution_v2::model::Network;
519 /// let x = Instance::new()
520 /// .set_networks([
521 /// Network::default()/* use setters */,
522 /// Network::default()/* use (different) setters */,
523 /// ]);
524 /// ```
525 pub fn set_networks<T, V>(mut self, v: T) -> Self
526 where
527 T: std::iter::IntoIterator<Item = V>,
528 V: std::convert::Into<crate::model::Network>,
529 {
530 use std::iter::Iterator;
531 self.networks = v.into_iter().map(|i| i.into()).collect();
532 self
533 }
534
535 /// Sets the value of [interactive_serial_console_enabled][crate::model::Instance::interactive_serial_console_enabled].
536 ///
537 /// # Example
538 /// ```ignore,no_run
539 /// # use google_cloud_baremetalsolution_v2::model::Instance;
540 /// let x = Instance::new().set_interactive_serial_console_enabled(true);
541 /// ```
542 pub fn set_interactive_serial_console_enabled<T: std::convert::Into<bool>>(
543 mut self,
544 v: T,
545 ) -> Self {
546 self.interactive_serial_console_enabled = v.into();
547 self
548 }
549
550 /// Sets the value of [os_image][crate::model::Instance::os_image].
551 ///
552 /// # Example
553 /// ```ignore,no_run
554 /// # use google_cloud_baremetalsolution_v2::model::Instance;
555 /// let x = Instance::new().set_os_image("example");
556 /// ```
557 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
558 self.os_image = v.into();
559 self
560 }
561
562 /// Sets the value of [pod][crate::model::Instance::pod].
563 ///
564 /// # Example
565 /// ```ignore,no_run
566 /// # use google_cloud_baremetalsolution_v2::model::Instance;
567 /// let x = Instance::new().set_pod("example");
568 /// ```
569 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
570 self.pod = v.into();
571 self
572 }
573
574 /// Sets the value of [network_template][crate::model::Instance::network_template].
575 ///
576 /// # Example
577 /// ```ignore,no_run
578 /// # use google_cloud_baremetalsolution_v2::model::Instance;
579 /// let x = Instance::new().set_network_template("example");
580 /// ```
581 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
582 mut self,
583 v: T,
584 ) -> Self {
585 self.network_template = v.into();
586 self
587 }
588
589 /// Sets the value of [logical_interfaces][crate::model::Instance::logical_interfaces].
590 ///
591 /// # Example
592 /// ```ignore,no_run
593 /// # use google_cloud_baremetalsolution_v2::model::Instance;
594 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
595 /// let x = Instance::new()
596 /// .set_logical_interfaces([
597 /// LogicalInterface::default()/* use setters */,
598 /// LogicalInterface::default()/* use (different) setters */,
599 /// ]);
600 /// ```
601 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
602 where
603 T: std::iter::IntoIterator<Item = V>,
604 V: std::convert::Into<crate::model::LogicalInterface>,
605 {
606 use std::iter::Iterator;
607 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
608 self
609 }
610
611 /// Sets the value of [login_info][crate::model::Instance::login_info].
612 ///
613 /// # Example
614 /// ```ignore,no_run
615 /// # use google_cloud_baremetalsolution_v2::model::Instance;
616 /// let x = Instance::new().set_login_info("example");
617 /// ```
618 pub fn set_login_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
619 self.login_info = v.into();
620 self
621 }
622
623 /// Sets the value of [workload_profile][crate::model::Instance::workload_profile].
624 ///
625 /// # Example
626 /// ```ignore,no_run
627 /// # use google_cloud_baremetalsolution_v2::model::Instance;
628 /// use google_cloud_baremetalsolution_v2::model::WorkloadProfile;
629 /// let x0 = Instance::new().set_workload_profile(WorkloadProfile::Generic);
630 /// let x1 = Instance::new().set_workload_profile(WorkloadProfile::Hana);
631 /// ```
632 pub fn set_workload_profile<T: std::convert::Into<crate::model::WorkloadProfile>>(
633 mut self,
634 v: T,
635 ) -> Self {
636 self.workload_profile = v.into();
637 self
638 }
639
640 /// Sets the value of [firmware_version][crate::model::Instance::firmware_version].
641 ///
642 /// # Example
643 /// ```ignore,no_run
644 /// # use google_cloud_baremetalsolution_v2::model::Instance;
645 /// let x = Instance::new().set_firmware_version("example");
646 /// ```
647 pub fn set_firmware_version<T: std::convert::Into<std::string::String>>(
648 mut self,
649 v: T,
650 ) -> Self {
651 self.firmware_version = v.into();
652 self
653 }
654}
655
656impl wkt::message::Message for Instance {
657 fn typename() -> &'static str {
658 "type.googleapis.com/google.cloud.baremetalsolution.v2.Instance"
659 }
660}
661
662/// Defines additional types related to [Instance].
663pub mod instance {
664 #[allow(unused_imports)]
665 use super::*;
666
667 /// The possible states for this server.
668 ///
669 /// # Working with unknown values
670 ///
671 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
672 /// additional enum variants at any time. Adding new variants is not considered
673 /// a breaking change. Applications should write their code in anticipation of:
674 ///
675 /// - New values appearing in future releases of the client library, **and**
676 /// - New values received dynamically, without application changes.
677 ///
678 /// Please consult the [Working with enums] section in the user guide for some
679 /// guidelines.
680 ///
681 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
682 #[derive(Clone, Debug, PartialEq)]
683 #[non_exhaustive]
684 pub enum State {
685 /// The server is in an unknown state.
686 Unspecified,
687 /// The server is being provisioned.
688 Provisioning,
689 /// The server is running.
690 Running,
691 /// The server has been deleted.
692 Deleted,
693 /// The server is being updated.
694 Updating,
695 /// The server is starting.
696 Starting,
697 /// The server is stopping.
698 Stopping,
699 /// The server is shutdown.
700 Shutdown,
701 /// If set, the enum was initialized with an unknown value.
702 ///
703 /// Applications can examine the value using [State::value] or
704 /// [State::name].
705 UnknownValue(state::UnknownValue),
706 }
707
708 #[doc(hidden)]
709 pub mod state {
710 #[allow(unused_imports)]
711 use super::*;
712 #[derive(Clone, Debug, PartialEq)]
713 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
714 }
715
716 impl State {
717 /// Gets the enum value.
718 ///
719 /// Returns `None` if the enum contains an unknown value deserialized from
720 /// the string representation of enums.
721 pub fn value(&self) -> std::option::Option<i32> {
722 match self {
723 Self::Unspecified => std::option::Option::Some(0),
724 Self::Provisioning => std::option::Option::Some(1),
725 Self::Running => std::option::Option::Some(2),
726 Self::Deleted => std::option::Option::Some(3),
727 Self::Updating => std::option::Option::Some(4),
728 Self::Starting => std::option::Option::Some(5),
729 Self::Stopping => std::option::Option::Some(6),
730 Self::Shutdown => std::option::Option::Some(7),
731 Self::UnknownValue(u) => u.0.value(),
732 }
733 }
734
735 /// Gets the enum value as a string.
736 ///
737 /// Returns `None` if the enum contains an unknown value deserialized from
738 /// the integer representation of enums.
739 pub fn name(&self) -> std::option::Option<&str> {
740 match self {
741 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
742 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
743 Self::Running => std::option::Option::Some("RUNNING"),
744 Self::Deleted => std::option::Option::Some("DELETED"),
745 Self::Updating => std::option::Option::Some("UPDATING"),
746 Self::Starting => std::option::Option::Some("STARTING"),
747 Self::Stopping => std::option::Option::Some("STOPPING"),
748 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
749 Self::UnknownValue(u) => u.0.name(),
750 }
751 }
752 }
753
754 impl std::default::Default for State {
755 fn default() -> Self {
756 use std::convert::From;
757 Self::from(0)
758 }
759 }
760
761 impl std::fmt::Display for State {
762 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
763 wkt::internal::display_enum(f, self.name(), self.value())
764 }
765 }
766
767 impl std::convert::From<i32> for State {
768 fn from(value: i32) -> Self {
769 match value {
770 0 => Self::Unspecified,
771 1 => Self::Provisioning,
772 2 => Self::Running,
773 3 => Self::Deleted,
774 4 => Self::Updating,
775 5 => Self::Starting,
776 6 => Self::Stopping,
777 7 => Self::Shutdown,
778 _ => Self::UnknownValue(state::UnknownValue(
779 wkt::internal::UnknownEnumValue::Integer(value),
780 )),
781 }
782 }
783 }
784
785 impl std::convert::From<&str> for State {
786 fn from(value: &str) -> Self {
787 use std::string::ToString;
788 match value {
789 "STATE_UNSPECIFIED" => Self::Unspecified,
790 "PROVISIONING" => Self::Provisioning,
791 "RUNNING" => Self::Running,
792 "DELETED" => Self::Deleted,
793 "UPDATING" => Self::Updating,
794 "STARTING" => Self::Starting,
795 "STOPPING" => Self::Stopping,
796 "SHUTDOWN" => Self::Shutdown,
797 _ => Self::UnknownValue(state::UnknownValue(
798 wkt::internal::UnknownEnumValue::String(value.to_string()),
799 )),
800 }
801 }
802 }
803
804 impl serde::ser::Serialize for State {
805 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
806 where
807 S: serde::Serializer,
808 {
809 match self {
810 Self::Unspecified => serializer.serialize_i32(0),
811 Self::Provisioning => serializer.serialize_i32(1),
812 Self::Running => serializer.serialize_i32(2),
813 Self::Deleted => serializer.serialize_i32(3),
814 Self::Updating => serializer.serialize_i32(4),
815 Self::Starting => serializer.serialize_i32(5),
816 Self::Stopping => serializer.serialize_i32(6),
817 Self::Shutdown => serializer.serialize_i32(7),
818 Self::UnknownValue(u) => u.0.serialize(serializer),
819 }
820 }
821 }
822
823 impl<'de> serde::de::Deserialize<'de> for State {
824 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
825 where
826 D: serde::Deserializer<'de>,
827 {
828 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
829 ".google.cloud.baremetalsolution.v2.Instance.State",
830 ))
831 }
832 }
833}
834
835/// Message for requesting server information.
836#[derive(Clone, Default, PartialEq)]
837#[non_exhaustive]
838pub struct GetInstanceRequest {
839 /// Required. Name of the resource.
840 pub name: std::string::String,
841
842 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
843}
844
845impl GetInstanceRequest {
846 pub fn new() -> Self {
847 std::default::Default::default()
848 }
849
850 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
851 ///
852 /// # Example
853 /// ```ignore,no_run
854 /// # use google_cloud_baremetalsolution_v2::model::GetInstanceRequest;
855 /// let x = GetInstanceRequest::new().set_name("example");
856 /// ```
857 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
858 self.name = v.into();
859 self
860 }
861}
862
863impl wkt::message::Message for GetInstanceRequest {
864 fn typename() -> &'static str {
865 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetInstanceRequest"
866 }
867}
868
869/// Message for requesting the list of servers.
870#[derive(Clone, Default, PartialEq)]
871#[non_exhaustive]
872pub struct ListInstancesRequest {
873 /// Required. Parent value for ListInstancesRequest.
874 pub parent: std::string::String,
875
876 /// Requested page size. Server may return fewer items than requested.
877 /// If unspecified, the server will pick an appropriate default.
878 pub page_size: i32,
879
880 /// A token identifying a page of results from the server.
881 pub page_token: std::string::String,
882
883 /// List filter.
884 pub filter: std::string::String,
885
886 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
887}
888
889impl ListInstancesRequest {
890 pub fn new() -> Self {
891 std::default::Default::default()
892 }
893
894 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
895 ///
896 /// # Example
897 /// ```ignore,no_run
898 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
899 /// let x = ListInstancesRequest::new().set_parent("example");
900 /// ```
901 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
902 self.parent = v.into();
903 self
904 }
905
906 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
907 ///
908 /// # Example
909 /// ```ignore,no_run
910 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
911 /// let x = ListInstancesRequest::new().set_page_size(42);
912 /// ```
913 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
914 self.page_size = v.into();
915 self
916 }
917
918 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
919 ///
920 /// # Example
921 /// ```ignore,no_run
922 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
923 /// let x = ListInstancesRequest::new().set_page_token("example");
924 /// ```
925 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
926 self.page_token = v.into();
927 self
928 }
929
930 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
931 ///
932 /// # Example
933 /// ```ignore,no_run
934 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
935 /// let x = ListInstancesRequest::new().set_filter("example");
936 /// ```
937 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
938 self.filter = v.into();
939 self
940 }
941}
942
943impl wkt::message::Message for ListInstancesRequest {
944 fn typename() -> &'static str {
945 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesRequest"
946 }
947}
948
949/// Response message for the list of servers.
950#[derive(Clone, Default, PartialEq)]
951#[non_exhaustive]
952pub struct ListInstancesResponse {
953 /// The list of servers.
954 pub instances: std::vec::Vec<crate::model::Instance>,
955
956 /// A token identifying a page of results from the server.
957 pub next_page_token: std::string::String,
958
959 /// Locations that could not be reached.
960 pub unreachable: std::vec::Vec<std::string::String>,
961
962 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
963}
964
965impl ListInstancesResponse {
966 pub fn new() -> Self {
967 std::default::Default::default()
968 }
969
970 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
971 ///
972 /// # Example
973 /// ```ignore,no_run
974 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
975 /// use google_cloud_baremetalsolution_v2::model::Instance;
976 /// let x = ListInstancesResponse::new()
977 /// .set_instances([
978 /// Instance::default()/* use setters */,
979 /// Instance::default()/* use (different) setters */,
980 /// ]);
981 /// ```
982 pub fn set_instances<T, V>(mut self, v: T) -> Self
983 where
984 T: std::iter::IntoIterator<Item = V>,
985 V: std::convert::Into<crate::model::Instance>,
986 {
987 use std::iter::Iterator;
988 self.instances = v.into_iter().map(|i| i.into()).collect();
989 self
990 }
991
992 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
993 ///
994 /// # Example
995 /// ```ignore,no_run
996 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
997 /// let x = ListInstancesResponse::new().set_next_page_token("example");
998 /// ```
999 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1000 self.next_page_token = v.into();
1001 self
1002 }
1003
1004 /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
1005 ///
1006 /// # Example
1007 /// ```ignore,no_run
1008 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
1009 /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
1010 /// ```
1011 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1012 where
1013 T: std::iter::IntoIterator<Item = V>,
1014 V: std::convert::Into<std::string::String>,
1015 {
1016 use std::iter::Iterator;
1017 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1018 self
1019 }
1020}
1021
1022impl wkt::message::Message for ListInstancesResponse {
1023 fn typename() -> &'static str {
1024 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesResponse"
1025 }
1026}
1027
1028#[doc(hidden)]
1029impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
1030 type PageItem = crate::model::Instance;
1031
1032 fn items(self) -> std::vec::Vec<Self::PageItem> {
1033 self.instances
1034 }
1035
1036 fn next_page_token(&self) -> std::string::String {
1037 use std::clone::Clone;
1038 self.next_page_token.clone()
1039 }
1040}
1041
1042/// Message requesting to updating a server.
1043#[derive(Clone, Default, PartialEq)]
1044#[non_exhaustive]
1045pub struct UpdateInstanceRequest {
1046 /// Required. The server to update.
1047 ///
1048 /// The `name` field is used to identify the instance to update.
1049 /// Format: projects/{project}/locations/{location}/instances/{instance}
1050 pub instance: std::option::Option<crate::model::Instance>,
1051
1052 /// The list of fields to update.
1053 /// The currently supported fields are:
1054 /// `labels`
1055 /// `hyperthreading_enabled`
1056 /// `os_image`
1057 pub update_mask: std::option::Option<wkt::FieldMask>,
1058
1059 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1060}
1061
1062impl UpdateInstanceRequest {
1063 pub fn new() -> Self {
1064 std::default::Default::default()
1065 }
1066
1067 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
1068 ///
1069 /// # Example
1070 /// ```ignore,no_run
1071 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1072 /// use google_cloud_baremetalsolution_v2::model::Instance;
1073 /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
1074 /// ```
1075 pub fn set_instance<T>(mut self, v: T) -> Self
1076 where
1077 T: std::convert::Into<crate::model::Instance>,
1078 {
1079 self.instance = std::option::Option::Some(v.into());
1080 self
1081 }
1082
1083 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
1084 ///
1085 /// # Example
1086 /// ```ignore,no_run
1087 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1088 /// use google_cloud_baremetalsolution_v2::model::Instance;
1089 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
1090 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
1091 /// ```
1092 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1093 where
1094 T: std::convert::Into<crate::model::Instance>,
1095 {
1096 self.instance = v.map(|x| x.into());
1097 self
1098 }
1099
1100 /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1101 ///
1102 /// # Example
1103 /// ```ignore,no_run
1104 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1105 /// use wkt::FieldMask;
1106 /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1107 /// ```
1108 pub fn set_update_mask<T>(mut self, v: T) -> Self
1109 where
1110 T: std::convert::Into<wkt::FieldMask>,
1111 {
1112 self.update_mask = std::option::Option::Some(v.into());
1113 self
1114 }
1115
1116 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1117 ///
1118 /// # Example
1119 /// ```ignore,no_run
1120 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1121 /// use wkt::FieldMask;
1122 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1123 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1124 /// ```
1125 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1126 where
1127 T: std::convert::Into<wkt::FieldMask>,
1128 {
1129 self.update_mask = v.map(|x| x.into());
1130 self
1131 }
1132}
1133
1134impl wkt::message::Message for UpdateInstanceRequest {
1135 fn typename() -> &'static str {
1136 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateInstanceRequest"
1137 }
1138}
1139
1140/// Message requesting rename of a server.
1141#[derive(Clone, Default, PartialEq)]
1142#[non_exhaustive]
1143pub struct RenameInstanceRequest {
1144 /// Required. The `name` field is used to identify the instance.
1145 /// Format: projects/{project}/locations/{location}/instances/{instance}
1146 pub name: std::string::String,
1147
1148 /// Required. The new `id` of the instance.
1149 pub new_instance_id: std::string::String,
1150
1151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1152}
1153
1154impl RenameInstanceRequest {
1155 pub fn new() -> Self {
1156 std::default::Default::default()
1157 }
1158
1159 /// Sets the value of [name][crate::model::RenameInstanceRequest::name].
1160 ///
1161 /// # Example
1162 /// ```ignore,no_run
1163 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1164 /// let x = RenameInstanceRequest::new().set_name("example");
1165 /// ```
1166 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1167 self.name = v.into();
1168 self
1169 }
1170
1171 /// Sets the value of [new_instance_id][crate::model::RenameInstanceRequest::new_instance_id].
1172 ///
1173 /// # Example
1174 /// ```ignore,no_run
1175 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1176 /// let x = RenameInstanceRequest::new().set_new_instance_id("example");
1177 /// ```
1178 pub fn set_new_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1179 self.new_instance_id = v.into();
1180 self
1181 }
1182}
1183
1184impl wkt::message::Message for RenameInstanceRequest {
1185 fn typename() -> &'static str {
1186 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameInstanceRequest"
1187 }
1188}
1189
1190/// Message requesting to reset a server.
1191#[derive(Clone, Default, PartialEq)]
1192#[non_exhaustive]
1193pub struct ResetInstanceRequest {
1194 /// Required. Name of the resource.
1195 pub name: std::string::String,
1196
1197 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1198}
1199
1200impl ResetInstanceRequest {
1201 pub fn new() -> Self {
1202 std::default::Default::default()
1203 }
1204
1205 /// Sets the value of [name][crate::model::ResetInstanceRequest::name].
1206 ///
1207 /// # Example
1208 /// ```ignore,no_run
1209 /// # use google_cloud_baremetalsolution_v2::model::ResetInstanceRequest;
1210 /// let x = ResetInstanceRequest::new().set_name("example");
1211 /// ```
1212 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1213 self.name = v.into();
1214 self
1215 }
1216}
1217
1218impl wkt::message::Message for ResetInstanceRequest {
1219 fn typename() -> &'static str {
1220 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceRequest"
1221 }
1222}
1223
1224/// Message requesting to start a server.
1225#[derive(Clone, Default, PartialEq)]
1226#[non_exhaustive]
1227pub struct StartInstanceRequest {
1228 /// Required. Name of the resource.
1229 pub name: std::string::String,
1230
1231 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1232}
1233
1234impl StartInstanceRequest {
1235 pub fn new() -> Self {
1236 std::default::Default::default()
1237 }
1238
1239 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
1240 ///
1241 /// # Example
1242 /// ```ignore,no_run
1243 /// # use google_cloud_baremetalsolution_v2::model::StartInstanceRequest;
1244 /// let x = StartInstanceRequest::new().set_name("example");
1245 /// ```
1246 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1247 self.name = v.into();
1248 self
1249 }
1250}
1251
1252impl wkt::message::Message for StartInstanceRequest {
1253 fn typename() -> &'static str {
1254 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceRequest"
1255 }
1256}
1257
1258/// Response message from starting a server.
1259#[derive(Clone, Default, PartialEq)]
1260#[non_exhaustive]
1261pub struct StartInstanceResponse {
1262 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1263}
1264
1265impl StartInstanceResponse {
1266 pub fn new() -> Self {
1267 std::default::Default::default()
1268 }
1269}
1270
1271impl wkt::message::Message for StartInstanceResponse {
1272 fn typename() -> &'static str {
1273 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceResponse"
1274 }
1275}
1276
1277/// Message requesting to stop a server.
1278#[derive(Clone, Default, PartialEq)]
1279#[non_exhaustive]
1280pub struct StopInstanceRequest {
1281 /// Required. Name of the resource.
1282 pub name: std::string::String,
1283
1284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1285}
1286
1287impl StopInstanceRequest {
1288 pub fn new() -> Self {
1289 std::default::Default::default()
1290 }
1291
1292 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
1293 ///
1294 /// # Example
1295 /// ```ignore,no_run
1296 /// # use google_cloud_baremetalsolution_v2::model::StopInstanceRequest;
1297 /// let x = StopInstanceRequest::new().set_name("example");
1298 /// ```
1299 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1300 self.name = v.into();
1301 self
1302 }
1303}
1304
1305impl wkt::message::Message for StopInstanceRequest {
1306 fn typename() -> &'static str {
1307 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceRequest"
1308 }
1309}
1310
1311/// Response message from stopping a server.
1312#[derive(Clone, Default, PartialEq)]
1313#[non_exhaustive]
1314pub struct StopInstanceResponse {
1315 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1316}
1317
1318impl StopInstanceResponse {
1319 pub fn new() -> Self {
1320 std::default::Default::default()
1321 }
1322}
1323
1324impl wkt::message::Message for StopInstanceResponse {
1325 fn typename() -> &'static str {
1326 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceResponse"
1327 }
1328}
1329
1330/// Message for enabling the interactive serial console on an instance.
1331#[derive(Clone, Default, PartialEq)]
1332#[non_exhaustive]
1333pub struct EnableInteractiveSerialConsoleRequest {
1334 /// Required. Name of the resource.
1335 pub name: std::string::String,
1336
1337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1338}
1339
1340impl EnableInteractiveSerialConsoleRequest {
1341 pub fn new() -> Self {
1342 std::default::Default::default()
1343 }
1344
1345 /// Sets the value of [name][crate::model::EnableInteractiveSerialConsoleRequest::name].
1346 ///
1347 /// # Example
1348 /// ```ignore,no_run
1349 /// # use google_cloud_baremetalsolution_v2::model::EnableInteractiveSerialConsoleRequest;
1350 /// let x = EnableInteractiveSerialConsoleRequest::new().set_name("example");
1351 /// ```
1352 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1353 self.name = v.into();
1354 self
1355 }
1356}
1357
1358impl wkt::message::Message for EnableInteractiveSerialConsoleRequest {
1359 fn typename() -> &'static str {
1360 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleRequest"
1361 }
1362}
1363
1364/// Message for response of EnableInteractiveSerialConsole.
1365#[derive(Clone, Default, PartialEq)]
1366#[non_exhaustive]
1367pub struct EnableInteractiveSerialConsoleResponse {
1368 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1369}
1370
1371impl EnableInteractiveSerialConsoleResponse {
1372 pub fn new() -> Self {
1373 std::default::Default::default()
1374 }
1375}
1376
1377impl wkt::message::Message for EnableInteractiveSerialConsoleResponse {
1378 fn typename() -> &'static str {
1379 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleResponse"
1380 }
1381}
1382
1383/// Message for disabling the interactive serial console on an instance.
1384#[derive(Clone, Default, PartialEq)]
1385#[non_exhaustive]
1386pub struct DisableInteractiveSerialConsoleRequest {
1387 /// Required. Name of the resource.
1388 pub name: std::string::String,
1389
1390 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1391}
1392
1393impl DisableInteractiveSerialConsoleRequest {
1394 pub fn new() -> Self {
1395 std::default::Default::default()
1396 }
1397
1398 /// Sets the value of [name][crate::model::DisableInteractiveSerialConsoleRequest::name].
1399 ///
1400 /// # Example
1401 /// ```ignore,no_run
1402 /// # use google_cloud_baremetalsolution_v2::model::DisableInteractiveSerialConsoleRequest;
1403 /// let x = DisableInteractiveSerialConsoleRequest::new().set_name("example");
1404 /// ```
1405 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1406 self.name = v.into();
1407 self
1408 }
1409}
1410
1411impl wkt::message::Message for DisableInteractiveSerialConsoleRequest {
1412 fn typename() -> &'static str {
1413 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleRequest"
1414 }
1415}
1416
1417/// Message for response of DisableInteractiveSerialConsole.
1418#[derive(Clone, Default, PartialEq)]
1419#[non_exhaustive]
1420pub struct DisableInteractiveSerialConsoleResponse {
1421 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1422}
1423
1424impl DisableInteractiveSerialConsoleResponse {
1425 pub fn new() -> Self {
1426 std::default::Default::default()
1427 }
1428}
1429
1430impl wkt::message::Message for DisableInteractiveSerialConsoleResponse {
1431 fn typename() -> &'static str {
1432 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleResponse"
1433 }
1434}
1435
1436/// Message for detach specific LUN from an Instance.
1437#[derive(Clone, Default, PartialEq)]
1438#[non_exhaustive]
1439pub struct DetachLunRequest {
1440 /// Required. Name of the instance.
1441 pub instance: std::string::String,
1442
1443 /// Required. Name of the Lun to detach.
1444 pub lun: std::string::String,
1445
1446 /// If true, performs lun unmapping without instance reboot.
1447 pub skip_reboot: bool,
1448
1449 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1450}
1451
1452impl DetachLunRequest {
1453 pub fn new() -> Self {
1454 std::default::Default::default()
1455 }
1456
1457 /// Sets the value of [instance][crate::model::DetachLunRequest::instance].
1458 ///
1459 /// # Example
1460 /// ```ignore,no_run
1461 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1462 /// let x = DetachLunRequest::new().set_instance("example");
1463 /// ```
1464 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1465 self.instance = v.into();
1466 self
1467 }
1468
1469 /// Sets the value of [lun][crate::model::DetachLunRequest::lun].
1470 ///
1471 /// # Example
1472 /// ```ignore,no_run
1473 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1474 /// let x = DetachLunRequest::new().set_lun("example");
1475 /// ```
1476 pub fn set_lun<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1477 self.lun = v.into();
1478 self
1479 }
1480
1481 /// Sets the value of [skip_reboot][crate::model::DetachLunRequest::skip_reboot].
1482 ///
1483 /// # Example
1484 /// ```ignore,no_run
1485 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1486 /// let x = DetachLunRequest::new().set_skip_reboot(true);
1487 /// ```
1488 pub fn set_skip_reboot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1489 self.skip_reboot = v.into();
1490 self
1491 }
1492}
1493
1494impl wkt::message::Message for DetachLunRequest {
1495 fn typename() -> &'static str {
1496 "type.googleapis.com/google.cloud.baremetalsolution.v2.DetachLunRequest"
1497 }
1498}
1499
1500/// Network template.
1501#[derive(Clone, Default, PartialEq)]
1502#[non_exhaustive]
1503pub struct ServerNetworkTemplate {
1504 /// Output only. Template's unique name. The full resource name follows the
1505 /// pattern:
1506 /// `projects/{project}/locations/{location}/serverNetworkTemplate/{server_network_template}`
1507 /// Generally, the {server_network_template} follows the syntax of
1508 /// "bond<interface_type_index><bond_mode>" or "nic<interface_type_index>".
1509 pub name: std::string::String,
1510
1511 /// Instance types this template is applicable to.
1512 pub applicable_instance_types: std::vec::Vec<std::string::String>,
1513
1514 /// Logical interfaces.
1515 pub logical_interfaces: std::vec::Vec<crate::model::server_network_template::LogicalInterface>,
1516
1517 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1518}
1519
1520impl ServerNetworkTemplate {
1521 pub fn new() -> Self {
1522 std::default::Default::default()
1523 }
1524
1525 /// Sets the value of [name][crate::model::ServerNetworkTemplate::name].
1526 ///
1527 /// # Example
1528 /// ```ignore,no_run
1529 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1530 /// let x = ServerNetworkTemplate::new().set_name("example");
1531 /// ```
1532 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1533 self.name = v.into();
1534 self
1535 }
1536
1537 /// Sets the value of [applicable_instance_types][crate::model::ServerNetworkTemplate::applicable_instance_types].
1538 ///
1539 /// # Example
1540 /// ```ignore,no_run
1541 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1542 /// let x = ServerNetworkTemplate::new().set_applicable_instance_types(["a", "b", "c"]);
1543 /// ```
1544 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
1545 where
1546 T: std::iter::IntoIterator<Item = V>,
1547 V: std::convert::Into<std::string::String>,
1548 {
1549 use std::iter::Iterator;
1550 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
1551 self
1552 }
1553
1554 /// Sets the value of [logical_interfaces][crate::model::ServerNetworkTemplate::logical_interfaces].
1555 ///
1556 /// # Example
1557 /// ```ignore,no_run
1558 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1559 /// use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1560 /// let x = ServerNetworkTemplate::new()
1561 /// .set_logical_interfaces([
1562 /// LogicalInterface::default()/* use setters */,
1563 /// LogicalInterface::default()/* use (different) setters */,
1564 /// ]);
1565 /// ```
1566 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
1567 where
1568 T: std::iter::IntoIterator<Item = V>,
1569 V: std::convert::Into<crate::model::server_network_template::LogicalInterface>,
1570 {
1571 use std::iter::Iterator;
1572 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
1573 self
1574 }
1575}
1576
1577impl wkt::message::Message for ServerNetworkTemplate {
1578 fn typename() -> &'static str {
1579 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate"
1580 }
1581}
1582
1583/// Defines additional types related to [ServerNetworkTemplate].
1584pub mod server_network_template {
1585 #[allow(unused_imports)]
1586 use super::*;
1587
1588 /// Logical interface.
1589 #[derive(Clone, Default, PartialEq)]
1590 #[non_exhaustive]
1591 pub struct LogicalInterface {
1592 /// Interface name.
1593 /// This is not a globally unique identifier.
1594 /// Name is unique only inside the ServerNetworkTemplate. This is of syntax
1595 /// \<bond\><interface_type_index><bond_mode> or \<nic\><interface_type_index>
1596 /// and forms part of the network template name.
1597 pub name: std::string::String,
1598
1599 /// Interface type.
1600 pub r#type: crate::model::server_network_template::logical_interface::InterfaceType,
1601
1602 /// If true, interface must have network connected.
1603 pub required: bool,
1604
1605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1606 }
1607
1608 impl LogicalInterface {
1609 pub fn new() -> Self {
1610 std::default::Default::default()
1611 }
1612
1613 /// Sets the value of [name][crate::model::server_network_template::LogicalInterface::name].
1614 ///
1615 /// # Example
1616 /// ```ignore,no_run
1617 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1618 /// let x = LogicalInterface::new().set_name("example");
1619 /// ```
1620 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1621 self.name = v.into();
1622 self
1623 }
1624
1625 /// Sets the value of [r#type][crate::model::server_network_template::LogicalInterface::type].
1626 ///
1627 /// # Example
1628 /// ```ignore,no_run
1629 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1630 /// use google_cloud_baremetalsolution_v2::model::server_network_template::logical_interface::InterfaceType;
1631 /// let x0 = LogicalInterface::new().set_type(InterfaceType::Bond);
1632 /// let x1 = LogicalInterface::new().set_type(InterfaceType::Nic);
1633 /// ```
1634 pub fn set_type<
1635 T: std::convert::Into<
1636 crate::model::server_network_template::logical_interface::InterfaceType,
1637 >,
1638 >(
1639 mut self,
1640 v: T,
1641 ) -> Self {
1642 self.r#type = v.into();
1643 self
1644 }
1645
1646 /// Sets the value of [required][crate::model::server_network_template::LogicalInterface::required].
1647 ///
1648 /// # Example
1649 /// ```ignore,no_run
1650 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1651 /// let x = LogicalInterface::new().set_required(true);
1652 /// ```
1653 pub fn set_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1654 self.required = v.into();
1655 self
1656 }
1657 }
1658
1659 impl wkt::message::Message for LogicalInterface {
1660 fn typename() -> &'static str {
1661 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface"
1662 }
1663 }
1664
1665 /// Defines additional types related to [LogicalInterface].
1666 pub mod logical_interface {
1667 #[allow(unused_imports)]
1668 use super::*;
1669
1670 /// Interface type.
1671 ///
1672 /// # Working with unknown values
1673 ///
1674 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1675 /// additional enum variants at any time. Adding new variants is not considered
1676 /// a breaking change. Applications should write their code in anticipation of:
1677 ///
1678 /// - New values appearing in future releases of the client library, **and**
1679 /// - New values received dynamically, without application changes.
1680 ///
1681 /// Please consult the [Working with enums] section in the user guide for some
1682 /// guidelines.
1683 ///
1684 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1685 #[derive(Clone, Debug, PartialEq)]
1686 #[non_exhaustive]
1687 pub enum InterfaceType {
1688 /// Unspecified value.
1689 Unspecified,
1690 /// Bond interface type.
1691 Bond,
1692 /// NIC interface type.
1693 Nic,
1694 /// If set, the enum was initialized with an unknown value.
1695 ///
1696 /// Applications can examine the value using [InterfaceType::value] or
1697 /// [InterfaceType::name].
1698 UnknownValue(interface_type::UnknownValue),
1699 }
1700
1701 #[doc(hidden)]
1702 pub mod interface_type {
1703 #[allow(unused_imports)]
1704 use super::*;
1705 #[derive(Clone, Debug, PartialEq)]
1706 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1707 }
1708
1709 impl InterfaceType {
1710 /// Gets the enum value.
1711 ///
1712 /// Returns `None` if the enum contains an unknown value deserialized from
1713 /// the string representation of enums.
1714 pub fn value(&self) -> std::option::Option<i32> {
1715 match self {
1716 Self::Unspecified => std::option::Option::Some(0),
1717 Self::Bond => std::option::Option::Some(1),
1718 Self::Nic => std::option::Option::Some(2),
1719 Self::UnknownValue(u) => u.0.value(),
1720 }
1721 }
1722
1723 /// Gets the enum value as a string.
1724 ///
1725 /// Returns `None` if the enum contains an unknown value deserialized from
1726 /// the integer representation of enums.
1727 pub fn name(&self) -> std::option::Option<&str> {
1728 match self {
1729 Self::Unspecified => std::option::Option::Some("INTERFACE_TYPE_UNSPECIFIED"),
1730 Self::Bond => std::option::Option::Some("BOND"),
1731 Self::Nic => std::option::Option::Some("NIC"),
1732 Self::UnknownValue(u) => u.0.name(),
1733 }
1734 }
1735 }
1736
1737 impl std::default::Default for InterfaceType {
1738 fn default() -> Self {
1739 use std::convert::From;
1740 Self::from(0)
1741 }
1742 }
1743
1744 impl std::fmt::Display for InterfaceType {
1745 fn fmt(
1746 &self,
1747 f: &mut std::fmt::Formatter<'_>,
1748 ) -> std::result::Result<(), std::fmt::Error> {
1749 wkt::internal::display_enum(f, self.name(), self.value())
1750 }
1751 }
1752
1753 impl std::convert::From<i32> for InterfaceType {
1754 fn from(value: i32) -> Self {
1755 match value {
1756 0 => Self::Unspecified,
1757 1 => Self::Bond,
1758 2 => Self::Nic,
1759 _ => Self::UnknownValue(interface_type::UnknownValue(
1760 wkt::internal::UnknownEnumValue::Integer(value),
1761 )),
1762 }
1763 }
1764 }
1765
1766 impl std::convert::From<&str> for InterfaceType {
1767 fn from(value: &str) -> Self {
1768 use std::string::ToString;
1769 match value {
1770 "INTERFACE_TYPE_UNSPECIFIED" => Self::Unspecified,
1771 "BOND" => Self::Bond,
1772 "NIC" => Self::Nic,
1773 _ => Self::UnknownValue(interface_type::UnknownValue(
1774 wkt::internal::UnknownEnumValue::String(value.to_string()),
1775 )),
1776 }
1777 }
1778 }
1779
1780 impl serde::ser::Serialize for InterfaceType {
1781 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1782 where
1783 S: serde::Serializer,
1784 {
1785 match self {
1786 Self::Unspecified => serializer.serialize_i32(0),
1787 Self::Bond => serializer.serialize_i32(1),
1788 Self::Nic => serializer.serialize_i32(2),
1789 Self::UnknownValue(u) => u.0.serialize(serializer),
1790 }
1791 }
1792 }
1793
1794 impl<'de> serde::de::Deserialize<'de> for InterfaceType {
1795 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1796 where
1797 D: serde::Deserializer<'de>,
1798 {
1799 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InterfaceType>::new(
1800 ".google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface.InterfaceType"))
1801 }
1802 }
1803 }
1804}
1805
1806/// A storage volume logical unit number (LUN).
1807#[derive(Clone, Default, PartialEq)]
1808#[non_exhaustive]
1809pub struct Lun {
1810 /// Output only. The name of the LUN.
1811 pub name: std::string::String,
1812
1813 /// An identifier for the LUN, generated by the backend.
1814 pub id: std::string::String,
1815
1816 /// The state of this storage volume.
1817 pub state: crate::model::lun::State,
1818
1819 /// The size of this LUN, in gigabytes.
1820 pub size_gb: i64,
1821
1822 /// The LUN multiprotocol type ensures the characteristics of the LUN are
1823 /// optimized for each operating system.
1824 pub multiprotocol_type: crate::model::lun::MultiprotocolType,
1825
1826 /// Display the storage volume for this LUN.
1827 pub storage_volume: std::string::String,
1828
1829 /// Display if this LUN can be shared between multiple physical servers.
1830 pub shareable: bool,
1831
1832 /// Display if this LUN is a boot LUN.
1833 pub boot_lun: bool,
1834
1835 /// The storage type for this LUN.
1836 pub storage_type: crate::model::lun::StorageType,
1837
1838 /// The WWID for this LUN.
1839 pub wwid: std::string::String,
1840
1841 /// Output only. Time after which LUN will be fully deleted.
1842 /// It is filled only for LUNs in COOL_OFF state.
1843 pub expire_time: std::option::Option<wkt::Timestamp>,
1844
1845 /// Output only. Instances this Lun is attached to.
1846 pub instances: std::vec::Vec<std::string::String>,
1847
1848 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1849}
1850
1851impl Lun {
1852 pub fn new() -> Self {
1853 std::default::Default::default()
1854 }
1855
1856 /// Sets the value of [name][crate::model::Lun::name].
1857 ///
1858 /// # Example
1859 /// ```ignore,no_run
1860 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1861 /// let x = Lun::new().set_name("example");
1862 /// ```
1863 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1864 self.name = v.into();
1865 self
1866 }
1867
1868 /// Sets the value of [id][crate::model::Lun::id].
1869 ///
1870 /// # Example
1871 /// ```ignore,no_run
1872 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1873 /// let x = Lun::new().set_id("example");
1874 /// ```
1875 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1876 self.id = v.into();
1877 self
1878 }
1879
1880 /// Sets the value of [state][crate::model::Lun::state].
1881 ///
1882 /// # Example
1883 /// ```ignore,no_run
1884 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1885 /// use google_cloud_baremetalsolution_v2::model::lun::State;
1886 /// let x0 = Lun::new().set_state(State::Creating);
1887 /// let x1 = Lun::new().set_state(State::Updating);
1888 /// let x2 = Lun::new().set_state(State::Ready);
1889 /// ```
1890 pub fn set_state<T: std::convert::Into<crate::model::lun::State>>(mut self, v: T) -> Self {
1891 self.state = v.into();
1892 self
1893 }
1894
1895 /// Sets the value of [size_gb][crate::model::Lun::size_gb].
1896 ///
1897 /// # Example
1898 /// ```ignore,no_run
1899 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1900 /// let x = Lun::new().set_size_gb(42);
1901 /// ```
1902 pub fn set_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1903 self.size_gb = v.into();
1904 self
1905 }
1906
1907 /// Sets the value of [multiprotocol_type][crate::model::Lun::multiprotocol_type].
1908 ///
1909 /// # Example
1910 /// ```ignore,no_run
1911 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1912 /// use google_cloud_baremetalsolution_v2::model::lun::MultiprotocolType;
1913 /// let x0 = Lun::new().set_multiprotocol_type(MultiprotocolType::Linux);
1914 /// ```
1915 pub fn set_multiprotocol_type<T: std::convert::Into<crate::model::lun::MultiprotocolType>>(
1916 mut self,
1917 v: T,
1918 ) -> Self {
1919 self.multiprotocol_type = v.into();
1920 self
1921 }
1922
1923 /// Sets the value of [storage_volume][crate::model::Lun::storage_volume].
1924 ///
1925 /// # Example
1926 /// ```ignore,no_run
1927 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1928 /// let x = Lun::new().set_storage_volume("example");
1929 /// ```
1930 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1931 self.storage_volume = v.into();
1932 self
1933 }
1934
1935 /// Sets the value of [shareable][crate::model::Lun::shareable].
1936 ///
1937 /// # Example
1938 /// ```ignore,no_run
1939 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1940 /// let x = Lun::new().set_shareable(true);
1941 /// ```
1942 pub fn set_shareable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1943 self.shareable = v.into();
1944 self
1945 }
1946
1947 /// Sets the value of [boot_lun][crate::model::Lun::boot_lun].
1948 ///
1949 /// # Example
1950 /// ```ignore,no_run
1951 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1952 /// let x = Lun::new().set_boot_lun(true);
1953 /// ```
1954 pub fn set_boot_lun<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1955 self.boot_lun = v.into();
1956 self
1957 }
1958
1959 /// Sets the value of [storage_type][crate::model::Lun::storage_type].
1960 ///
1961 /// # Example
1962 /// ```ignore,no_run
1963 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1964 /// use google_cloud_baremetalsolution_v2::model::lun::StorageType;
1965 /// let x0 = Lun::new().set_storage_type(StorageType::Ssd);
1966 /// let x1 = Lun::new().set_storage_type(StorageType::Hdd);
1967 /// ```
1968 pub fn set_storage_type<T: std::convert::Into<crate::model::lun::StorageType>>(
1969 mut self,
1970 v: T,
1971 ) -> Self {
1972 self.storage_type = v.into();
1973 self
1974 }
1975
1976 /// Sets the value of [wwid][crate::model::Lun::wwid].
1977 ///
1978 /// # Example
1979 /// ```ignore,no_run
1980 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1981 /// let x = Lun::new().set_wwid("example");
1982 /// ```
1983 pub fn set_wwid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1984 self.wwid = v.into();
1985 self
1986 }
1987
1988 /// Sets the value of [expire_time][crate::model::Lun::expire_time].
1989 ///
1990 /// # Example
1991 /// ```ignore,no_run
1992 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1993 /// use wkt::Timestamp;
1994 /// let x = Lun::new().set_expire_time(Timestamp::default()/* use setters */);
1995 /// ```
1996 pub fn set_expire_time<T>(mut self, v: T) -> Self
1997 where
1998 T: std::convert::Into<wkt::Timestamp>,
1999 {
2000 self.expire_time = std::option::Option::Some(v.into());
2001 self
2002 }
2003
2004 /// Sets or clears the value of [expire_time][crate::model::Lun::expire_time].
2005 ///
2006 /// # Example
2007 /// ```ignore,no_run
2008 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2009 /// use wkt::Timestamp;
2010 /// let x = Lun::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2011 /// let x = Lun::new().set_or_clear_expire_time(None::<Timestamp>);
2012 /// ```
2013 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2014 where
2015 T: std::convert::Into<wkt::Timestamp>,
2016 {
2017 self.expire_time = v.map(|x| x.into());
2018 self
2019 }
2020
2021 /// Sets the value of [instances][crate::model::Lun::instances].
2022 ///
2023 /// # Example
2024 /// ```ignore,no_run
2025 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2026 /// let x = Lun::new().set_instances(["a", "b", "c"]);
2027 /// ```
2028 pub fn set_instances<T, V>(mut self, v: T) -> Self
2029 where
2030 T: std::iter::IntoIterator<Item = V>,
2031 V: std::convert::Into<std::string::String>,
2032 {
2033 use std::iter::Iterator;
2034 self.instances = v.into_iter().map(|i| i.into()).collect();
2035 self
2036 }
2037}
2038
2039impl wkt::message::Message for Lun {
2040 fn typename() -> &'static str {
2041 "type.googleapis.com/google.cloud.baremetalsolution.v2.Lun"
2042 }
2043}
2044
2045/// Defines additional types related to [Lun].
2046pub mod lun {
2047 #[allow(unused_imports)]
2048 use super::*;
2049
2050 /// The possible states for the LUN.
2051 ///
2052 /// # Working with unknown values
2053 ///
2054 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2055 /// additional enum variants at any time. Adding new variants is not considered
2056 /// a breaking change. Applications should write their code in anticipation of:
2057 ///
2058 /// - New values appearing in future releases of the client library, **and**
2059 /// - New values received dynamically, without application changes.
2060 ///
2061 /// Please consult the [Working with enums] section in the user guide for some
2062 /// guidelines.
2063 ///
2064 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2065 #[derive(Clone, Debug, PartialEq)]
2066 #[non_exhaustive]
2067 pub enum State {
2068 /// The LUN is in an unknown state.
2069 Unspecified,
2070 /// The LUN is being created.
2071 Creating,
2072 /// The LUN is being updated.
2073 Updating,
2074 /// The LUN is ready for use.
2075 Ready,
2076 /// The LUN has been requested to be deleted.
2077 Deleting,
2078 /// The LUN is in cool off state. It will be deleted after `expire_time`.
2079 CoolOff,
2080 /// If set, the enum was initialized with an unknown value.
2081 ///
2082 /// Applications can examine the value using [State::value] or
2083 /// [State::name].
2084 UnknownValue(state::UnknownValue),
2085 }
2086
2087 #[doc(hidden)]
2088 pub mod state {
2089 #[allow(unused_imports)]
2090 use super::*;
2091 #[derive(Clone, Debug, PartialEq)]
2092 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2093 }
2094
2095 impl State {
2096 /// Gets the enum value.
2097 ///
2098 /// Returns `None` if the enum contains an unknown value deserialized from
2099 /// the string representation of enums.
2100 pub fn value(&self) -> std::option::Option<i32> {
2101 match self {
2102 Self::Unspecified => std::option::Option::Some(0),
2103 Self::Creating => std::option::Option::Some(1),
2104 Self::Updating => std::option::Option::Some(2),
2105 Self::Ready => std::option::Option::Some(3),
2106 Self::Deleting => std::option::Option::Some(4),
2107 Self::CoolOff => std::option::Option::Some(5),
2108 Self::UnknownValue(u) => u.0.value(),
2109 }
2110 }
2111
2112 /// Gets the enum value as a string.
2113 ///
2114 /// Returns `None` if the enum contains an unknown value deserialized from
2115 /// the integer representation of enums.
2116 pub fn name(&self) -> std::option::Option<&str> {
2117 match self {
2118 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2119 Self::Creating => std::option::Option::Some("CREATING"),
2120 Self::Updating => std::option::Option::Some("UPDATING"),
2121 Self::Ready => std::option::Option::Some("READY"),
2122 Self::Deleting => std::option::Option::Some("DELETING"),
2123 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
2124 Self::UnknownValue(u) => u.0.name(),
2125 }
2126 }
2127 }
2128
2129 impl std::default::Default for State {
2130 fn default() -> Self {
2131 use std::convert::From;
2132 Self::from(0)
2133 }
2134 }
2135
2136 impl std::fmt::Display for State {
2137 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2138 wkt::internal::display_enum(f, self.name(), self.value())
2139 }
2140 }
2141
2142 impl std::convert::From<i32> for State {
2143 fn from(value: i32) -> Self {
2144 match value {
2145 0 => Self::Unspecified,
2146 1 => Self::Creating,
2147 2 => Self::Updating,
2148 3 => Self::Ready,
2149 4 => Self::Deleting,
2150 5 => Self::CoolOff,
2151 _ => Self::UnknownValue(state::UnknownValue(
2152 wkt::internal::UnknownEnumValue::Integer(value),
2153 )),
2154 }
2155 }
2156 }
2157
2158 impl std::convert::From<&str> for State {
2159 fn from(value: &str) -> Self {
2160 use std::string::ToString;
2161 match value {
2162 "STATE_UNSPECIFIED" => Self::Unspecified,
2163 "CREATING" => Self::Creating,
2164 "UPDATING" => Self::Updating,
2165 "READY" => Self::Ready,
2166 "DELETING" => Self::Deleting,
2167 "COOL_OFF" => Self::CoolOff,
2168 _ => Self::UnknownValue(state::UnknownValue(
2169 wkt::internal::UnknownEnumValue::String(value.to_string()),
2170 )),
2171 }
2172 }
2173 }
2174
2175 impl serde::ser::Serialize for State {
2176 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2177 where
2178 S: serde::Serializer,
2179 {
2180 match self {
2181 Self::Unspecified => serializer.serialize_i32(0),
2182 Self::Creating => serializer.serialize_i32(1),
2183 Self::Updating => serializer.serialize_i32(2),
2184 Self::Ready => serializer.serialize_i32(3),
2185 Self::Deleting => serializer.serialize_i32(4),
2186 Self::CoolOff => serializer.serialize_i32(5),
2187 Self::UnknownValue(u) => u.0.serialize(serializer),
2188 }
2189 }
2190 }
2191
2192 impl<'de> serde::de::Deserialize<'de> for State {
2193 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2194 where
2195 D: serde::Deserializer<'de>,
2196 {
2197 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2198 ".google.cloud.baremetalsolution.v2.Lun.State",
2199 ))
2200 }
2201 }
2202
2203 /// Display the operating systems present for the LUN multiprotocol type.
2204 ///
2205 /// # Working with unknown values
2206 ///
2207 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2208 /// additional enum variants at any time. Adding new variants is not considered
2209 /// a breaking change. Applications should write their code in anticipation of:
2210 ///
2211 /// - New values appearing in future releases of the client library, **and**
2212 /// - New values received dynamically, without application changes.
2213 ///
2214 /// Please consult the [Working with enums] section in the user guide for some
2215 /// guidelines.
2216 ///
2217 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2218 #[derive(Clone, Debug, PartialEq)]
2219 #[non_exhaustive]
2220 pub enum MultiprotocolType {
2221 /// Server has no OS specified.
2222 Unspecified,
2223 /// Server with Linux OS.
2224 Linux,
2225 /// If set, the enum was initialized with an unknown value.
2226 ///
2227 /// Applications can examine the value using [MultiprotocolType::value] or
2228 /// [MultiprotocolType::name].
2229 UnknownValue(multiprotocol_type::UnknownValue),
2230 }
2231
2232 #[doc(hidden)]
2233 pub mod multiprotocol_type {
2234 #[allow(unused_imports)]
2235 use super::*;
2236 #[derive(Clone, Debug, PartialEq)]
2237 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2238 }
2239
2240 impl MultiprotocolType {
2241 /// Gets the enum value.
2242 ///
2243 /// Returns `None` if the enum contains an unknown value deserialized from
2244 /// the string representation of enums.
2245 pub fn value(&self) -> std::option::Option<i32> {
2246 match self {
2247 Self::Unspecified => std::option::Option::Some(0),
2248 Self::Linux => std::option::Option::Some(1),
2249 Self::UnknownValue(u) => u.0.value(),
2250 }
2251 }
2252
2253 /// Gets the enum value as a string.
2254 ///
2255 /// Returns `None` if the enum contains an unknown value deserialized from
2256 /// the integer representation of enums.
2257 pub fn name(&self) -> std::option::Option<&str> {
2258 match self {
2259 Self::Unspecified => std::option::Option::Some("MULTIPROTOCOL_TYPE_UNSPECIFIED"),
2260 Self::Linux => std::option::Option::Some("LINUX"),
2261 Self::UnknownValue(u) => u.0.name(),
2262 }
2263 }
2264 }
2265
2266 impl std::default::Default for MultiprotocolType {
2267 fn default() -> Self {
2268 use std::convert::From;
2269 Self::from(0)
2270 }
2271 }
2272
2273 impl std::fmt::Display for MultiprotocolType {
2274 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2275 wkt::internal::display_enum(f, self.name(), self.value())
2276 }
2277 }
2278
2279 impl std::convert::From<i32> for MultiprotocolType {
2280 fn from(value: i32) -> Self {
2281 match value {
2282 0 => Self::Unspecified,
2283 1 => Self::Linux,
2284 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2285 wkt::internal::UnknownEnumValue::Integer(value),
2286 )),
2287 }
2288 }
2289 }
2290
2291 impl std::convert::From<&str> for MultiprotocolType {
2292 fn from(value: &str) -> Self {
2293 use std::string::ToString;
2294 match value {
2295 "MULTIPROTOCOL_TYPE_UNSPECIFIED" => Self::Unspecified,
2296 "LINUX" => Self::Linux,
2297 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2298 wkt::internal::UnknownEnumValue::String(value.to_string()),
2299 )),
2300 }
2301 }
2302 }
2303
2304 impl serde::ser::Serialize for MultiprotocolType {
2305 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2306 where
2307 S: serde::Serializer,
2308 {
2309 match self {
2310 Self::Unspecified => serializer.serialize_i32(0),
2311 Self::Linux => serializer.serialize_i32(1),
2312 Self::UnknownValue(u) => u.0.serialize(serializer),
2313 }
2314 }
2315 }
2316
2317 impl<'de> serde::de::Deserialize<'de> for MultiprotocolType {
2318 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2319 where
2320 D: serde::Deserializer<'de>,
2321 {
2322 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MultiprotocolType>::new(
2323 ".google.cloud.baremetalsolution.v2.Lun.MultiprotocolType",
2324 ))
2325 }
2326 }
2327
2328 /// The storage types for a LUN.
2329 ///
2330 /// # Working with unknown values
2331 ///
2332 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2333 /// additional enum variants at any time. Adding new variants is not considered
2334 /// a breaking change. Applications should write their code in anticipation of:
2335 ///
2336 /// - New values appearing in future releases of the client library, **and**
2337 /// - New values received dynamically, without application changes.
2338 ///
2339 /// Please consult the [Working with enums] section in the user guide for some
2340 /// guidelines.
2341 ///
2342 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2343 #[derive(Clone, Debug, PartialEq)]
2344 #[non_exhaustive]
2345 pub enum StorageType {
2346 /// The storage type for this LUN is unknown.
2347 Unspecified,
2348 /// This storage type for this LUN is SSD.
2349 Ssd,
2350 /// This storage type for this LUN is HDD.
2351 Hdd,
2352 /// If set, the enum was initialized with an unknown value.
2353 ///
2354 /// Applications can examine the value using [StorageType::value] or
2355 /// [StorageType::name].
2356 UnknownValue(storage_type::UnknownValue),
2357 }
2358
2359 #[doc(hidden)]
2360 pub mod storage_type {
2361 #[allow(unused_imports)]
2362 use super::*;
2363 #[derive(Clone, Debug, PartialEq)]
2364 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2365 }
2366
2367 impl StorageType {
2368 /// Gets the enum value.
2369 ///
2370 /// Returns `None` if the enum contains an unknown value deserialized from
2371 /// the string representation of enums.
2372 pub fn value(&self) -> std::option::Option<i32> {
2373 match self {
2374 Self::Unspecified => std::option::Option::Some(0),
2375 Self::Ssd => std::option::Option::Some(1),
2376 Self::Hdd => std::option::Option::Some(2),
2377 Self::UnknownValue(u) => u.0.value(),
2378 }
2379 }
2380
2381 /// Gets the enum value as a string.
2382 ///
2383 /// Returns `None` if the enum contains an unknown value deserialized from
2384 /// the integer representation of enums.
2385 pub fn name(&self) -> std::option::Option<&str> {
2386 match self {
2387 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
2388 Self::Ssd => std::option::Option::Some("SSD"),
2389 Self::Hdd => std::option::Option::Some("HDD"),
2390 Self::UnknownValue(u) => u.0.name(),
2391 }
2392 }
2393 }
2394
2395 impl std::default::Default for StorageType {
2396 fn default() -> Self {
2397 use std::convert::From;
2398 Self::from(0)
2399 }
2400 }
2401
2402 impl std::fmt::Display for StorageType {
2403 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2404 wkt::internal::display_enum(f, self.name(), self.value())
2405 }
2406 }
2407
2408 impl std::convert::From<i32> for StorageType {
2409 fn from(value: i32) -> Self {
2410 match value {
2411 0 => Self::Unspecified,
2412 1 => Self::Ssd,
2413 2 => Self::Hdd,
2414 _ => Self::UnknownValue(storage_type::UnknownValue(
2415 wkt::internal::UnknownEnumValue::Integer(value),
2416 )),
2417 }
2418 }
2419 }
2420
2421 impl std::convert::From<&str> for StorageType {
2422 fn from(value: &str) -> Self {
2423 use std::string::ToString;
2424 match value {
2425 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
2426 "SSD" => Self::Ssd,
2427 "HDD" => Self::Hdd,
2428 _ => Self::UnknownValue(storage_type::UnknownValue(
2429 wkt::internal::UnknownEnumValue::String(value.to_string()),
2430 )),
2431 }
2432 }
2433 }
2434
2435 impl serde::ser::Serialize for StorageType {
2436 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2437 where
2438 S: serde::Serializer,
2439 {
2440 match self {
2441 Self::Unspecified => serializer.serialize_i32(0),
2442 Self::Ssd => serializer.serialize_i32(1),
2443 Self::Hdd => serializer.serialize_i32(2),
2444 Self::UnknownValue(u) => u.0.serialize(serializer),
2445 }
2446 }
2447 }
2448
2449 impl<'de> serde::de::Deserialize<'de> for StorageType {
2450 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2451 where
2452 D: serde::Deserializer<'de>,
2453 {
2454 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
2455 ".google.cloud.baremetalsolution.v2.Lun.StorageType",
2456 ))
2457 }
2458 }
2459}
2460
2461/// Message for requesting storage lun information.
2462#[derive(Clone, Default, PartialEq)]
2463#[non_exhaustive]
2464pub struct GetLunRequest {
2465 /// Required. Name of the resource.
2466 pub name: std::string::String,
2467
2468 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2469}
2470
2471impl GetLunRequest {
2472 pub fn new() -> Self {
2473 std::default::Default::default()
2474 }
2475
2476 /// Sets the value of [name][crate::model::GetLunRequest::name].
2477 ///
2478 /// # Example
2479 /// ```ignore,no_run
2480 /// # use google_cloud_baremetalsolution_v2::model::GetLunRequest;
2481 /// let x = GetLunRequest::new().set_name("example");
2482 /// ```
2483 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2484 self.name = v.into();
2485 self
2486 }
2487}
2488
2489impl wkt::message::Message for GetLunRequest {
2490 fn typename() -> &'static str {
2491 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetLunRequest"
2492 }
2493}
2494
2495/// Message for requesting a list of storage volume luns.
2496#[derive(Clone, Default, PartialEq)]
2497#[non_exhaustive]
2498pub struct ListLunsRequest {
2499 /// Required. Parent value for ListLunsRequest.
2500 pub parent: std::string::String,
2501
2502 /// Requested page size. The server might return fewer items than requested.
2503 /// If unspecified, server will pick an appropriate default.
2504 pub page_size: i32,
2505
2506 /// A token identifying a page of results from the server.
2507 pub page_token: std::string::String,
2508
2509 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2510}
2511
2512impl ListLunsRequest {
2513 pub fn new() -> Self {
2514 std::default::Default::default()
2515 }
2516
2517 /// Sets the value of [parent][crate::model::ListLunsRequest::parent].
2518 ///
2519 /// # Example
2520 /// ```ignore,no_run
2521 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2522 /// let x = ListLunsRequest::new().set_parent("example");
2523 /// ```
2524 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2525 self.parent = v.into();
2526 self
2527 }
2528
2529 /// Sets the value of [page_size][crate::model::ListLunsRequest::page_size].
2530 ///
2531 /// # Example
2532 /// ```ignore,no_run
2533 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2534 /// let x = ListLunsRequest::new().set_page_size(42);
2535 /// ```
2536 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2537 self.page_size = v.into();
2538 self
2539 }
2540
2541 /// Sets the value of [page_token][crate::model::ListLunsRequest::page_token].
2542 ///
2543 /// # Example
2544 /// ```ignore,no_run
2545 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2546 /// let x = ListLunsRequest::new().set_page_token("example");
2547 /// ```
2548 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2549 self.page_token = v.into();
2550 self
2551 }
2552}
2553
2554impl wkt::message::Message for ListLunsRequest {
2555 fn typename() -> &'static str {
2556 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsRequest"
2557 }
2558}
2559
2560/// Response message containing the list of storage volume luns.
2561#[derive(Clone, Default, PartialEq)]
2562#[non_exhaustive]
2563pub struct ListLunsResponse {
2564 /// The list of luns.
2565 pub luns: std::vec::Vec<crate::model::Lun>,
2566
2567 /// A token identifying a page of results from the server.
2568 pub next_page_token: std::string::String,
2569
2570 /// Locations that could not be reached.
2571 pub unreachable: std::vec::Vec<std::string::String>,
2572
2573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2574}
2575
2576impl ListLunsResponse {
2577 pub fn new() -> Self {
2578 std::default::Default::default()
2579 }
2580
2581 /// Sets the value of [luns][crate::model::ListLunsResponse::luns].
2582 ///
2583 /// # Example
2584 /// ```ignore,no_run
2585 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2586 /// use google_cloud_baremetalsolution_v2::model::Lun;
2587 /// let x = ListLunsResponse::new()
2588 /// .set_luns([
2589 /// Lun::default()/* use setters */,
2590 /// Lun::default()/* use (different) setters */,
2591 /// ]);
2592 /// ```
2593 pub fn set_luns<T, V>(mut self, v: T) -> Self
2594 where
2595 T: std::iter::IntoIterator<Item = V>,
2596 V: std::convert::Into<crate::model::Lun>,
2597 {
2598 use std::iter::Iterator;
2599 self.luns = v.into_iter().map(|i| i.into()).collect();
2600 self
2601 }
2602
2603 /// Sets the value of [next_page_token][crate::model::ListLunsResponse::next_page_token].
2604 ///
2605 /// # Example
2606 /// ```ignore,no_run
2607 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2608 /// let x = ListLunsResponse::new().set_next_page_token("example");
2609 /// ```
2610 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2611 self.next_page_token = v.into();
2612 self
2613 }
2614
2615 /// Sets the value of [unreachable][crate::model::ListLunsResponse::unreachable].
2616 ///
2617 /// # Example
2618 /// ```ignore,no_run
2619 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2620 /// let x = ListLunsResponse::new().set_unreachable(["a", "b", "c"]);
2621 /// ```
2622 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2623 where
2624 T: std::iter::IntoIterator<Item = V>,
2625 V: std::convert::Into<std::string::String>,
2626 {
2627 use std::iter::Iterator;
2628 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2629 self
2630 }
2631}
2632
2633impl wkt::message::Message for ListLunsResponse {
2634 fn typename() -> &'static str {
2635 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsResponse"
2636 }
2637}
2638
2639#[doc(hidden)]
2640impl google_cloud_gax::paginator::internal::PageableResponse for ListLunsResponse {
2641 type PageItem = crate::model::Lun;
2642
2643 fn items(self) -> std::vec::Vec<Self::PageItem> {
2644 self.luns
2645 }
2646
2647 fn next_page_token(&self) -> std::string::String {
2648 use std::clone::Clone;
2649 self.next_page_token.clone()
2650 }
2651}
2652
2653/// Request for skip lun cooloff and delete it.
2654#[derive(Clone, Default, PartialEq)]
2655#[non_exhaustive]
2656pub struct EvictLunRequest {
2657 /// Required. The name of the lun.
2658 pub name: std::string::String,
2659
2660 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2661}
2662
2663impl EvictLunRequest {
2664 pub fn new() -> Self {
2665 std::default::Default::default()
2666 }
2667
2668 /// Sets the value of [name][crate::model::EvictLunRequest::name].
2669 ///
2670 /// # Example
2671 /// ```ignore,no_run
2672 /// # use google_cloud_baremetalsolution_v2::model::EvictLunRequest;
2673 /// let x = EvictLunRequest::new().set_name("example");
2674 /// ```
2675 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2676 self.name = v.into();
2677 self
2678 }
2679}
2680
2681impl wkt::message::Message for EvictLunRequest {
2682 fn typename() -> &'static str {
2683 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictLunRequest"
2684 }
2685}
2686
2687/// A Network.
2688#[derive(Clone, Default, PartialEq)]
2689#[non_exhaustive]
2690pub struct Network {
2691 /// Output only. The resource name of this `Network`.
2692 /// Resource names are schemeless URIs that follow the conventions in
2693 /// <https://cloud.google.com/apis/design/resource_names>.
2694 /// Format:
2695 /// `projects/{project}/locations/{location}/networks/{network}`
2696 pub name: std::string::String,
2697
2698 /// An identifier for the `Network`, generated by the backend.
2699 pub id: std::string::String,
2700
2701 /// The type of this network.
2702 pub r#type: crate::model::network::Type,
2703
2704 /// IP address configured.
2705 pub ip_address: std::string::String,
2706
2707 /// List of physical interfaces.
2708 pub mac_address: std::vec::Vec<std::string::String>,
2709
2710 /// The Network state.
2711 pub state: crate::model::network::State,
2712
2713 /// The vlan id of the Network.
2714 pub vlan_id: std::string::String,
2715
2716 /// The cidr of the Network.
2717 pub cidr: std::string::String,
2718
2719 /// The vrf for the Network.
2720 pub vrf: std::option::Option<crate::model::Vrf>,
2721
2722 /// Labels as key value pairs.
2723 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2724
2725 /// IP range for reserved for services (e.g. NFS).
2726 pub services_cidr: std::string::String,
2727
2728 /// List of IP address reservations in this network.
2729 /// When updating this field, an error will be generated if a reservation
2730 /// conflicts with an IP address already allocated to a physical server.
2731 pub reservations: std::vec::Vec<crate::model::NetworkAddressReservation>,
2732
2733 /// Output only. Pod name.
2734 pub pod: std::string::String,
2735
2736 /// Input only. List of mount points to attach the network to.
2737 pub mount_points: std::vec::Vec<crate::model::NetworkMountPoint>,
2738
2739 /// Whether network uses standard frames or jumbo ones.
2740 pub jumbo_frames_enabled: bool,
2741
2742 /// Output only. Gateway ip address.
2743 pub gateway_ip: std::string::String,
2744
2745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2746}
2747
2748impl Network {
2749 pub fn new() -> Self {
2750 std::default::Default::default()
2751 }
2752
2753 /// Sets the value of [name][crate::model::Network::name].
2754 ///
2755 /// # Example
2756 /// ```ignore,no_run
2757 /// # use google_cloud_baremetalsolution_v2::model::Network;
2758 /// let x = Network::new().set_name("example");
2759 /// ```
2760 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2761 self.name = v.into();
2762 self
2763 }
2764
2765 /// Sets the value of [id][crate::model::Network::id].
2766 ///
2767 /// # Example
2768 /// ```ignore,no_run
2769 /// # use google_cloud_baremetalsolution_v2::model::Network;
2770 /// let x = Network::new().set_id("example");
2771 /// ```
2772 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2773 self.id = v.into();
2774 self
2775 }
2776
2777 /// Sets the value of [r#type][crate::model::Network::type].
2778 ///
2779 /// # Example
2780 /// ```ignore,no_run
2781 /// # use google_cloud_baremetalsolution_v2::model::Network;
2782 /// use google_cloud_baremetalsolution_v2::model::network::Type;
2783 /// let x0 = Network::new().set_type(Type::Client);
2784 /// let x1 = Network::new().set_type(Type::Private);
2785 /// ```
2786 pub fn set_type<T: std::convert::Into<crate::model::network::Type>>(mut self, v: T) -> Self {
2787 self.r#type = v.into();
2788 self
2789 }
2790
2791 /// Sets the value of [ip_address][crate::model::Network::ip_address].
2792 ///
2793 /// # Example
2794 /// ```ignore,no_run
2795 /// # use google_cloud_baremetalsolution_v2::model::Network;
2796 /// let x = Network::new().set_ip_address("example");
2797 /// ```
2798 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2799 self.ip_address = v.into();
2800 self
2801 }
2802
2803 /// Sets the value of [mac_address][crate::model::Network::mac_address].
2804 ///
2805 /// # Example
2806 /// ```ignore,no_run
2807 /// # use google_cloud_baremetalsolution_v2::model::Network;
2808 /// let x = Network::new().set_mac_address(["a", "b", "c"]);
2809 /// ```
2810 pub fn set_mac_address<T, V>(mut self, v: T) -> Self
2811 where
2812 T: std::iter::IntoIterator<Item = V>,
2813 V: std::convert::Into<std::string::String>,
2814 {
2815 use std::iter::Iterator;
2816 self.mac_address = v.into_iter().map(|i| i.into()).collect();
2817 self
2818 }
2819
2820 /// Sets the value of [state][crate::model::Network::state].
2821 ///
2822 /// # Example
2823 /// ```ignore,no_run
2824 /// # use google_cloud_baremetalsolution_v2::model::Network;
2825 /// use google_cloud_baremetalsolution_v2::model::network::State;
2826 /// let x0 = Network::new().set_state(State::Provisioning);
2827 /// let x1 = Network::new().set_state(State::Provisioned);
2828 /// let x2 = Network::new().set_state(State::Deprovisioning);
2829 /// ```
2830 pub fn set_state<T: std::convert::Into<crate::model::network::State>>(mut self, v: T) -> Self {
2831 self.state = v.into();
2832 self
2833 }
2834
2835 /// Sets the value of [vlan_id][crate::model::Network::vlan_id].
2836 ///
2837 /// # Example
2838 /// ```ignore,no_run
2839 /// # use google_cloud_baremetalsolution_v2::model::Network;
2840 /// let x = Network::new().set_vlan_id("example");
2841 /// ```
2842 pub fn set_vlan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2843 self.vlan_id = v.into();
2844 self
2845 }
2846
2847 /// Sets the value of [cidr][crate::model::Network::cidr].
2848 ///
2849 /// # Example
2850 /// ```ignore,no_run
2851 /// # use google_cloud_baremetalsolution_v2::model::Network;
2852 /// let x = Network::new().set_cidr("example");
2853 /// ```
2854 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2855 self.cidr = v.into();
2856 self
2857 }
2858
2859 /// Sets the value of [vrf][crate::model::Network::vrf].
2860 ///
2861 /// # Example
2862 /// ```ignore,no_run
2863 /// # use google_cloud_baremetalsolution_v2::model::Network;
2864 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2865 /// let x = Network::new().set_vrf(Vrf::default()/* use setters */);
2866 /// ```
2867 pub fn set_vrf<T>(mut self, v: T) -> Self
2868 where
2869 T: std::convert::Into<crate::model::Vrf>,
2870 {
2871 self.vrf = std::option::Option::Some(v.into());
2872 self
2873 }
2874
2875 /// Sets or clears the value of [vrf][crate::model::Network::vrf].
2876 ///
2877 /// # Example
2878 /// ```ignore,no_run
2879 /// # use google_cloud_baremetalsolution_v2::model::Network;
2880 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2881 /// let x = Network::new().set_or_clear_vrf(Some(Vrf::default()/* use setters */));
2882 /// let x = Network::new().set_or_clear_vrf(None::<Vrf>);
2883 /// ```
2884 pub fn set_or_clear_vrf<T>(mut self, v: std::option::Option<T>) -> Self
2885 where
2886 T: std::convert::Into<crate::model::Vrf>,
2887 {
2888 self.vrf = v.map(|x| x.into());
2889 self
2890 }
2891
2892 /// Sets the value of [labels][crate::model::Network::labels].
2893 ///
2894 /// # Example
2895 /// ```ignore,no_run
2896 /// # use google_cloud_baremetalsolution_v2::model::Network;
2897 /// let x = Network::new().set_labels([
2898 /// ("key0", "abc"),
2899 /// ("key1", "xyz"),
2900 /// ]);
2901 /// ```
2902 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2903 where
2904 T: std::iter::IntoIterator<Item = (K, V)>,
2905 K: std::convert::Into<std::string::String>,
2906 V: std::convert::Into<std::string::String>,
2907 {
2908 use std::iter::Iterator;
2909 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2910 self
2911 }
2912
2913 /// Sets the value of [services_cidr][crate::model::Network::services_cidr].
2914 ///
2915 /// # Example
2916 /// ```ignore,no_run
2917 /// # use google_cloud_baremetalsolution_v2::model::Network;
2918 /// let x = Network::new().set_services_cidr("example");
2919 /// ```
2920 pub fn set_services_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2921 self.services_cidr = v.into();
2922 self
2923 }
2924
2925 /// Sets the value of [reservations][crate::model::Network::reservations].
2926 ///
2927 /// # Example
2928 /// ```ignore,no_run
2929 /// # use google_cloud_baremetalsolution_v2::model::Network;
2930 /// use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
2931 /// let x = Network::new()
2932 /// .set_reservations([
2933 /// NetworkAddressReservation::default()/* use setters */,
2934 /// NetworkAddressReservation::default()/* use (different) setters */,
2935 /// ]);
2936 /// ```
2937 pub fn set_reservations<T, V>(mut self, v: T) -> Self
2938 where
2939 T: std::iter::IntoIterator<Item = V>,
2940 V: std::convert::Into<crate::model::NetworkAddressReservation>,
2941 {
2942 use std::iter::Iterator;
2943 self.reservations = v.into_iter().map(|i| i.into()).collect();
2944 self
2945 }
2946
2947 /// Sets the value of [pod][crate::model::Network::pod].
2948 ///
2949 /// # Example
2950 /// ```ignore,no_run
2951 /// # use google_cloud_baremetalsolution_v2::model::Network;
2952 /// let x = Network::new().set_pod("example");
2953 /// ```
2954 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2955 self.pod = v.into();
2956 self
2957 }
2958
2959 /// Sets the value of [mount_points][crate::model::Network::mount_points].
2960 ///
2961 /// # Example
2962 /// ```ignore,no_run
2963 /// # use google_cloud_baremetalsolution_v2::model::Network;
2964 /// use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
2965 /// let x = Network::new()
2966 /// .set_mount_points([
2967 /// NetworkMountPoint::default()/* use setters */,
2968 /// NetworkMountPoint::default()/* use (different) setters */,
2969 /// ]);
2970 /// ```
2971 pub fn set_mount_points<T, V>(mut self, v: T) -> Self
2972 where
2973 T: std::iter::IntoIterator<Item = V>,
2974 V: std::convert::Into<crate::model::NetworkMountPoint>,
2975 {
2976 use std::iter::Iterator;
2977 self.mount_points = v.into_iter().map(|i| i.into()).collect();
2978 self
2979 }
2980
2981 /// Sets the value of [jumbo_frames_enabled][crate::model::Network::jumbo_frames_enabled].
2982 ///
2983 /// # Example
2984 /// ```ignore,no_run
2985 /// # use google_cloud_baremetalsolution_v2::model::Network;
2986 /// let x = Network::new().set_jumbo_frames_enabled(true);
2987 /// ```
2988 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2989 self.jumbo_frames_enabled = v.into();
2990 self
2991 }
2992
2993 /// Sets the value of [gateway_ip][crate::model::Network::gateway_ip].
2994 ///
2995 /// # Example
2996 /// ```ignore,no_run
2997 /// # use google_cloud_baremetalsolution_v2::model::Network;
2998 /// let x = Network::new().set_gateway_ip("example");
2999 /// ```
3000 pub fn set_gateway_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3001 self.gateway_ip = v.into();
3002 self
3003 }
3004}
3005
3006impl wkt::message::Message for Network {
3007 fn typename() -> &'static str {
3008 "type.googleapis.com/google.cloud.baremetalsolution.v2.Network"
3009 }
3010}
3011
3012/// Defines additional types related to [Network].
3013pub mod network {
3014 #[allow(unused_imports)]
3015 use super::*;
3016
3017 /// Network type.
3018 ///
3019 /// # Working with unknown values
3020 ///
3021 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3022 /// additional enum variants at any time. Adding new variants is not considered
3023 /// a breaking change. Applications should write their code in anticipation of:
3024 ///
3025 /// - New values appearing in future releases of the client library, **and**
3026 /// - New values received dynamically, without application changes.
3027 ///
3028 /// Please consult the [Working with enums] section in the user guide for some
3029 /// guidelines.
3030 ///
3031 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3032 #[derive(Clone, Debug, PartialEq)]
3033 #[non_exhaustive]
3034 pub enum Type {
3035 /// Unspecified value.
3036 Unspecified,
3037 /// Client network, a network peered to a Google Cloud VPC.
3038 Client,
3039 /// Private network, a network local to the Bare Metal Solution environment.
3040 Private,
3041 /// If set, the enum was initialized with an unknown value.
3042 ///
3043 /// Applications can examine the value using [Type::value] or
3044 /// [Type::name].
3045 UnknownValue(r#type::UnknownValue),
3046 }
3047
3048 #[doc(hidden)]
3049 pub mod r#type {
3050 #[allow(unused_imports)]
3051 use super::*;
3052 #[derive(Clone, Debug, PartialEq)]
3053 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3054 }
3055
3056 impl Type {
3057 /// Gets the enum value.
3058 ///
3059 /// Returns `None` if the enum contains an unknown value deserialized from
3060 /// the string representation of enums.
3061 pub fn value(&self) -> std::option::Option<i32> {
3062 match self {
3063 Self::Unspecified => std::option::Option::Some(0),
3064 Self::Client => std::option::Option::Some(1),
3065 Self::Private => std::option::Option::Some(2),
3066 Self::UnknownValue(u) => u.0.value(),
3067 }
3068 }
3069
3070 /// Gets the enum value as a string.
3071 ///
3072 /// Returns `None` if the enum contains an unknown value deserialized from
3073 /// the integer representation of enums.
3074 pub fn name(&self) -> std::option::Option<&str> {
3075 match self {
3076 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
3077 Self::Client => std::option::Option::Some("CLIENT"),
3078 Self::Private => std::option::Option::Some("PRIVATE"),
3079 Self::UnknownValue(u) => u.0.name(),
3080 }
3081 }
3082 }
3083
3084 impl std::default::Default for Type {
3085 fn default() -> Self {
3086 use std::convert::From;
3087 Self::from(0)
3088 }
3089 }
3090
3091 impl std::fmt::Display for Type {
3092 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3093 wkt::internal::display_enum(f, self.name(), self.value())
3094 }
3095 }
3096
3097 impl std::convert::From<i32> for Type {
3098 fn from(value: i32) -> Self {
3099 match value {
3100 0 => Self::Unspecified,
3101 1 => Self::Client,
3102 2 => Self::Private,
3103 _ => Self::UnknownValue(r#type::UnknownValue(
3104 wkt::internal::UnknownEnumValue::Integer(value),
3105 )),
3106 }
3107 }
3108 }
3109
3110 impl std::convert::From<&str> for Type {
3111 fn from(value: &str) -> Self {
3112 use std::string::ToString;
3113 match value {
3114 "TYPE_UNSPECIFIED" => Self::Unspecified,
3115 "CLIENT" => Self::Client,
3116 "PRIVATE" => Self::Private,
3117 _ => Self::UnknownValue(r#type::UnknownValue(
3118 wkt::internal::UnknownEnumValue::String(value.to_string()),
3119 )),
3120 }
3121 }
3122 }
3123
3124 impl serde::ser::Serialize for Type {
3125 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3126 where
3127 S: serde::Serializer,
3128 {
3129 match self {
3130 Self::Unspecified => serializer.serialize_i32(0),
3131 Self::Client => serializer.serialize_i32(1),
3132 Self::Private => serializer.serialize_i32(2),
3133 Self::UnknownValue(u) => u.0.serialize(serializer),
3134 }
3135 }
3136 }
3137
3138 impl<'de> serde::de::Deserialize<'de> for Type {
3139 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3140 where
3141 D: serde::Deserializer<'de>,
3142 {
3143 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
3144 ".google.cloud.baremetalsolution.v2.Network.Type",
3145 ))
3146 }
3147 }
3148
3149 /// The possible states for this Network.
3150 ///
3151 /// # Working with unknown values
3152 ///
3153 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3154 /// additional enum variants at any time. Adding new variants is not considered
3155 /// a breaking change. Applications should write their code in anticipation of:
3156 ///
3157 /// - New values appearing in future releases of the client library, **and**
3158 /// - New values received dynamically, without application changes.
3159 ///
3160 /// Please consult the [Working with enums] section in the user guide for some
3161 /// guidelines.
3162 ///
3163 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3164 #[derive(Clone, Debug, PartialEq)]
3165 #[non_exhaustive]
3166 pub enum State {
3167 /// The Network is in an unknown state.
3168 Unspecified,
3169 /// The Network is provisioning.
3170 Provisioning,
3171 /// The Network has been provisioned.
3172 Provisioned,
3173 /// The Network is being deprovisioned.
3174 Deprovisioning,
3175 /// The Network is being updated.
3176 Updating,
3177 /// If set, the enum was initialized with an unknown value.
3178 ///
3179 /// Applications can examine the value using [State::value] or
3180 /// [State::name].
3181 UnknownValue(state::UnknownValue),
3182 }
3183
3184 #[doc(hidden)]
3185 pub mod state {
3186 #[allow(unused_imports)]
3187 use super::*;
3188 #[derive(Clone, Debug, PartialEq)]
3189 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3190 }
3191
3192 impl State {
3193 /// Gets the enum value.
3194 ///
3195 /// Returns `None` if the enum contains an unknown value deserialized from
3196 /// the string representation of enums.
3197 pub fn value(&self) -> std::option::Option<i32> {
3198 match self {
3199 Self::Unspecified => std::option::Option::Some(0),
3200 Self::Provisioning => std::option::Option::Some(1),
3201 Self::Provisioned => std::option::Option::Some(2),
3202 Self::Deprovisioning => std::option::Option::Some(3),
3203 Self::Updating => std::option::Option::Some(4),
3204 Self::UnknownValue(u) => u.0.value(),
3205 }
3206 }
3207
3208 /// Gets the enum value as a string.
3209 ///
3210 /// Returns `None` if the enum contains an unknown value deserialized from
3211 /// the integer representation of enums.
3212 pub fn name(&self) -> std::option::Option<&str> {
3213 match self {
3214 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3215 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3216 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3217 Self::Deprovisioning => std::option::Option::Some("DEPROVISIONING"),
3218 Self::Updating => std::option::Option::Some("UPDATING"),
3219 Self::UnknownValue(u) => u.0.name(),
3220 }
3221 }
3222 }
3223
3224 impl std::default::Default for State {
3225 fn default() -> Self {
3226 use std::convert::From;
3227 Self::from(0)
3228 }
3229 }
3230
3231 impl std::fmt::Display for State {
3232 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3233 wkt::internal::display_enum(f, self.name(), self.value())
3234 }
3235 }
3236
3237 impl std::convert::From<i32> for State {
3238 fn from(value: i32) -> Self {
3239 match value {
3240 0 => Self::Unspecified,
3241 1 => Self::Provisioning,
3242 2 => Self::Provisioned,
3243 3 => Self::Deprovisioning,
3244 4 => Self::Updating,
3245 _ => Self::UnknownValue(state::UnknownValue(
3246 wkt::internal::UnknownEnumValue::Integer(value),
3247 )),
3248 }
3249 }
3250 }
3251
3252 impl std::convert::From<&str> for State {
3253 fn from(value: &str) -> Self {
3254 use std::string::ToString;
3255 match value {
3256 "STATE_UNSPECIFIED" => Self::Unspecified,
3257 "PROVISIONING" => Self::Provisioning,
3258 "PROVISIONED" => Self::Provisioned,
3259 "DEPROVISIONING" => Self::Deprovisioning,
3260 "UPDATING" => Self::Updating,
3261 _ => Self::UnknownValue(state::UnknownValue(
3262 wkt::internal::UnknownEnumValue::String(value.to_string()),
3263 )),
3264 }
3265 }
3266 }
3267
3268 impl serde::ser::Serialize for State {
3269 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3270 where
3271 S: serde::Serializer,
3272 {
3273 match self {
3274 Self::Unspecified => serializer.serialize_i32(0),
3275 Self::Provisioning => serializer.serialize_i32(1),
3276 Self::Provisioned => serializer.serialize_i32(2),
3277 Self::Deprovisioning => serializer.serialize_i32(3),
3278 Self::Updating => serializer.serialize_i32(4),
3279 Self::UnknownValue(u) => u.0.serialize(serializer),
3280 }
3281 }
3282 }
3283
3284 impl<'de> serde::de::Deserialize<'de> for State {
3285 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3286 where
3287 D: serde::Deserializer<'de>,
3288 {
3289 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3290 ".google.cloud.baremetalsolution.v2.Network.State",
3291 ))
3292 }
3293 }
3294}
3295
3296/// A reservation of one or more addresses in a network.
3297#[derive(Clone, Default, PartialEq)]
3298#[non_exhaustive]
3299pub struct NetworkAddressReservation {
3300 /// The first address of this reservation block.
3301 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3302 pub start_address: std::string::String,
3303
3304 /// The last address of this reservation block, inclusive. I.e., for cases when
3305 /// reservations are only single addresses, end_address and start_address will
3306 /// be the same.
3307 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3308 pub end_address: std::string::String,
3309
3310 /// A note about this reservation, intended for human consumption.
3311 pub note: std::string::String,
3312
3313 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3314}
3315
3316impl NetworkAddressReservation {
3317 pub fn new() -> Self {
3318 std::default::Default::default()
3319 }
3320
3321 /// Sets the value of [start_address][crate::model::NetworkAddressReservation::start_address].
3322 ///
3323 /// # Example
3324 /// ```ignore,no_run
3325 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3326 /// let x = NetworkAddressReservation::new().set_start_address("example");
3327 /// ```
3328 pub fn set_start_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3329 self.start_address = v.into();
3330 self
3331 }
3332
3333 /// Sets the value of [end_address][crate::model::NetworkAddressReservation::end_address].
3334 ///
3335 /// # Example
3336 /// ```ignore,no_run
3337 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3338 /// let x = NetworkAddressReservation::new().set_end_address("example");
3339 /// ```
3340 pub fn set_end_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3341 self.end_address = v.into();
3342 self
3343 }
3344
3345 /// Sets the value of [note][crate::model::NetworkAddressReservation::note].
3346 ///
3347 /// # Example
3348 /// ```ignore,no_run
3349 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3350 /// let x = NetworkAddressReservation::new().set_note("example");
3351 /// ```
3352 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3353 self.note = v.into();
3354 self
3355 }
3356}
3357
3358impl wkt::message::Message for NetworkAddressReservation {
3359 fn typename() -> &'static str {
3360 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkAddressReservation"
3361 }
3362}
3363
3364/// A network VRF.
3365#[derive(Clone, Default, PartialEq)]
3366#[non_exhaustive]
3367pub struct Vrf {
3368 /// The name of the VRF.
3369 pub name: std::string::String,
3370
3371 /// The possible state of VRF.
3372 pub state: crate::model::vrf::State,
3373
3374 /// The QOS policy applied to this VRF.
3375 /// The value is only meaningful when all the vlan attachments have the same
3376 /// QoS. This field should not be used for new integrations, use vlan
3377 /// attachment level qos instead. The field is left for backward-compatibility.
3378 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3379
3380 /// The list of VLAN attachments for the VRF.
3381 pub vlan_attachments: std::vec::Vec<crate::model::vrf::VlanAttachment>,
3382
3383 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3384}
3385
3386impl Vrf {
3387 pub fn new() -> Self {
3388 std::default::Default::default()
3389 }
3390
3391 /// Sets the value of [name][crate::model::Vrf::name].
3392 ///
3393 /// # Example
3394 /// ```ignore,no_run
3395 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3396 /// let x = Vrf::new().set_name("example");
3397 /// ```
3398 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3399 self.name = v.into();
3400 self
3401 }
3402
3403 /// Sets the value of [state][crate::model::Vrf::state].
3404 ///
3405 /// # Example
3406 /// ```ignore,no_run
3407 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3408 /// use google_cloud_baremetalsolution_v2::model::vrf::State;
3409 /// let x0 = Vrf::new().set_state(State::Provisioning);
3410 /// let x1 = Vrf::new().set_state(State::Provisioned);
3411 /// ```
3412 pub fn set_state<T: std::convert::Into<crate::model::vrf::State>>(mut self, v: T) -> Self {
3413 self.state = v.into();
3414 self
3415 }
3416
3417 /// Sets the value of [qos_policy][crate::model::Vrf::qos_policy].
3418 ///
3419 /// # Example
3420 /// ```ignore,no_run
3421 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3422 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3423 /// let x = Vrf::new().set_qos_policy(QosPolicy::default()/* use setters */);
3424 /// ```
3425 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3426 where
3427 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3428 {
3429 self.qos_policy = std::option::Option::Some(v.into());
3430 self
3431 }
3432
3433 /// Sets or clears the value of [qos_policy][crate::model::Vrf::qos_policy].
3434 ///
3435 /// # Example
3436 /// ```ignore,no_run
3437 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3438 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3439 /// let x = Vrf::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3440 /// let x = Vrf::new().set_or_clear_qos_policy(None::<QosPolicy>);
3441 /// ```
3442 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3443 where
3444 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3445 {
3446 self.qos_policy = v.map(|x| x.into());
3447 self
3448 }
3449
3450 /// Sets the value of [vlan_attachments][crate::model::Vrf::vlan_attachments].
3451 ///
3452 /// # Example
3453 /// ```ignore,no_run
3454 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3455 /// use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3456 /// let x = Vrf::new()
3457 /// .set_vlan_attachments([
3458 /// VlanAttachment::default()/* use setters */,
3459 /// VlanAttachment::default()/* use (different) setters */,
3460 /// ]);
3461 /// ```
3462 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
3463 where
3464 T: std::iter::IntoIterator<Item = V>,
3465 V: std::convert::Into<crate::model::vrf::VlanAttachment>,
3466 {
3467 use std::iter::Iterator;
3468 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
3469 self
3470 }
3471}
3472
3473impl wkt::message::Message for Vrf {
3474 fn typename() -> &'static str {
3475 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF"
3476 }
3477}
3478
3479/// Defines additional types related to [Vrf].
3480pub mod vrf {
3481 #[allow(unused_imports)]
3482 use super::*;
3483
3484 /// QOS policy parameters.
3485 #[derive(Clone, Default, PartialEq)]
3486 #[non_exhaustive]
3487 pub struct QosPolicy {
3488 /// The bandwidth permitted by the QOS policy, in gbps.
3489 pub bandwidth_gbps: f64,
3490
3491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3492 }
3493
3494 impl QosPolicy {
3495 pub fn new() -> Self {
3496 std::default::Default::default()
3497 }
3498
3499 /// Sets the value of [bandwidth_gbps][crate::model::vrf::QosPolicy::bandwidth_gbps].
3500 ///
3501 /// # Example
3502 /// ```ignore,no_run
3503 /// # use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3504 /// let x = QosPolicy::new().set_bandwidth_gbps(42.0);
3505 /// ```
3506 pub fn set_bandwidth_gbps<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3507 self.bandwidth_gbps = v.into();
3508 self
3509 }
3510 }
3511
3512 impl wkt::message::Message for QosPolicy {
3513 fn typename() -> &'static str {
3514 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.QosPolicy"
3515 }
3516 }
3517
3518 /// VLAN attachment details.
3519 #[derive(Clone, Default, PartialEq)]
3520 #[non_exhaustive]
3521 pub struct VlanAttachment {
3522 /// The peer vlan ID of the attachment.
3523 pub peer_vlan_id: i64,
3524
3525 /// The peer IP of the attachment.
3526 pub peer_ip: std::string::String,
3527
3528 /// The router IP of the attachment.
3529 pub router_ip: std::string::String,
3530
3531 /// Input only. Pairing key.
3532 pub pairing_key: std::string::String,
3533
3534 /// The QOS policy applied to this VLAN attachment.
3535 /// This value should be preferred to using qos at vrf level.
3536 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3537
3538 /// Immutable. The identifier of the attachment within vrf.
3539 pub id: std::string::String,
3540
3541 /// Optional. The name of the vlan attachment within vrf. This is of the form
3542 /// projects/{project_number}/regions/{region}/interconnectAttachments/{interconnect_attachment}
3543 pub interconnect_attachment: std::string::String,
3544
3545 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3546 }
3547
3548 impl VlanAttachment {
3549 pub fn new() -> Self {
3550 std::default::Default::default()
3551 }
3552
3553 /// Sets the value of [peer_vlan_id][crate::model::vrf::VlanAttachment::peer_vlan_id].
3554 ///
3555 /// # Example
3556 /// ```ignore,no_run
3557 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3558 /// let x = VlanAttachment::new().set_peer_vlan_id(42);
3559 /// ```
3560 pub fn set_peer_vlan_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3561 self.peer_vlan_id = v.into();
3562 self
3563 }
3564
3565 /// Sets the value of [peer_ip][crate::model::vrf::VlanAttachment::peer_ip].
3566 ///
3567 /// # Example
3568 /// ```ignore,no_run
3569 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3570 /// let x = VlanAttachment::new().set_peer_ip("example");
3571 /// ```
3572 pub fn set_peer_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3573 self.peer_ip = v.into();
3574 self
3575 }
3576
3577 /// Sets the value of [router_ip][crate::model::vrf::VlanAttachment::router_ip].
3578 ///
3579 /// # Example
3580 /// ```ignore,no_run
3581 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3582 /// let x = VlanAttachment::new().set_router_ip("example");
3583 /// ```
3584 pub fn set_router_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3585 self.router_ip = v.into();
3586 self
3587 }
3588
3589 /// Sets the value of [pairing_key][crate::model::vrf::VlanAttachment::pairing_key].
3590 ///
3591 /// # Example
3592 /// ```ignore,no_run
3593 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3594 /// let x = VlanAttachment::new().set_pairing_key("example");
3595 /// ```
3596 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3597 self.pairing_key = v.into();
3598 self
3599 }
3600
3601 /// Sets the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3602 ///
3603 /// # Example
3604 /// ```ignore,no_run
3605 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3606 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3607 /// let x = VlanAttachment::new().set_qos_policy(QosPolicy::default()/* use setters */);
3608 /// ```
3609 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3610 where
3611 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3612 {
3613 self.qos_policy = std::option::Option::Some(v.into());
3614 self
3615 }
3616
3617 /// Sets or clears the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3618 ///
3619 /// # Example
3620 /// ```ignore,no_run
3621 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3622 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3623 /// let x = VlanAttachment::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3624 /// let x = VlanAttachment::new().set_or_clear_qos_policy(None::<QosPolicy>);
3625 /// ```
3626 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3627 where
3628 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3629 {
3630 self.qos_policy = v.map(|x| x.into());
3631 self
3632 }
3633
3634 /// Sets the value of [id][crate::model::vrf::VlanAttachment::id].
3635 ///
3636 /// # Example
3637 /// ```ignore,no_run
3638 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3639 /// let x = VlanAttachment::new().set_id("example");
3640 /// ```
3641 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3642 self.id = v.into();
3643 self
3644 }
3645
3646 /// Sets the value of [interconnect_attachment][crate::model::vrf::VlanAttachment::interconnect_attachment].
3647 ///
3648 /// # Example
3649 /// ```ignore,no_run
3650 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3651 /// let x = VlanAttachment::new().set_interconnect_attachment("example");
3652 /// ```
3653 pub fn set_interconnect_attachment<T: std::convert::Into<std::string::String>>(
3654 mut self,
3655 v: T,
3656 ) -> Self {
3657 self.interconnect_attachment = v.into();
3658 self
3659 }
3660 }
3661
3662 impl wkt::message::Message for VlanAttachment {
3663 fn typename() -> &'static str {
3664 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.VlanAttachment"
3665 }
3666 }
3667
3668 /// The possible states for this VRF.
3669 ///
3670 /// # Working with unknown values
3671 ///
3672 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3673 /// additional enum variants at any time. Adding new variants is not considered
3674 /// a breaking change. Applications should write their code in anticipation of:
3675 ///
3676 /// - New values appearing in future releases of the client library, **and**
3677 /// - New values received dynamically, without application changes.
3678 ///
3679 /// Please consult the [Working with enums] section in the user guide for some
3680 /// guidelines.
3681 ///
3682 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3683 #[derive(Clone, Debug, PartialEq)]
3684 #[non_exhaustive]
3685 pub enum State {
3686 /// The unspecified state.
3687 Unspecified,
3688 /// The vrf is provisioning.
3689 Provisioning,
3690 /// The vrf is provisioned.
3691 Provisioned,
3692 /// If set, the enum was initialized with an unknown value.
3693 ///
3694 /// Applications can examine the value using [State::value] or
3695 /// [State::name].
3696 UnknownValue(state::UnknownValue),
3697 }
3698
3699 #[doc(hidden)]
3700 pub mod state {
3701 #[allow(unused_imports)]
3702 use super::*;
3703 #[derive(Clone, Debug, PartialEq)]
3704 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3705 }
3706
3707 impl State {
3708 /// Gets the enum value.
3709 ///
3710 /// Returns `None` if the enum contains an unknown value deserialized from
3711 /// the string representation of enums.
3712 pub fn value(&self) -> std::option::Option<i32> {
3713 match self {
3714 Self::Unspecified => std::option::Option::Some(0),
3715 Self::Provisioning => std::option::Option::Some(1),
3716 Self::Provisioned => std::option::Option::Some(2),
3717 Self::UnknownValue(u) => u.0.value(),
3718 }
3719 }
3720
3721 /// Gets the enum value as a string.
3722 ///
3723 /// Returns `None` if the enum contains an unknown value deserialized from
3724 /// the integer representation of enums.
3725 pub fn name(&self) -> std::option::Option<&str> {
3726 match self {
3727 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3728 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3729 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3730 Self::UnknownValue(u) => u.0.name(),
3731 }
3732 }
3733 }
3734
3735 impl std::default::Default for State {
3736 fn default() -> Self {
3737 use std::convert::From;
3738 Self::from(0)
3739 }
3740 }
3741
3742 impl std::fmt::Display for State {
3743 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3744 wkt::internal::display_enum(f, self.name(), self.value())
3745 }
3746 }
3747
3748 impl std::convert::From<i32> for State {
3749 fn from(value: i32) -> Self {
3750 match value {
3751 0 => Self::Unspecified,
3752 1 => Self::Provisioning,
3753 2 => Self::Provisioned,
3754 _ => Self::UnknownValue(state::UnknownValue(
3755 wkt::internal::UnknownEnumValue::Integer(value),
3756 )),
3757 }
3758 }
3759 }
3760
3761 impl std::convert::From<&str> for State {
3762 fn from(value: &str) -> Self {
3763 use std::string::ToString;
3764 match value {
3765 "STATE_UNSPECIFIED" => Self::Unspecified,
3766 "PROVISIONING" => Self::Provisioning,
3767 "PROVISIONED" => Self::Provisioned,
3768 _ => Self::UnknownValue(state::UnknownValue(
3769 wkt::internal::UnknownEnumValue::String(value.to_string()),
3770 )),
3771 }
3772 }
3773 }
3774
3775 impl serde::ser::Serialize for State {
3776 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3777 where
3778 S: serde::Serializer,
3779 {
3780 match self {
3781 Self::Unspecified => serializer.serialize_i32(0),
3782 Self::Provisioning => serializer.serialize_i32(1),
3783 Self::Provisioned => serializer.serialize_i32(2),
3784 Self::UnknownValue(u) => u.0.serialize(serializer),
3785 }
3786 }
3787 }
3788
3789 impl<'de> serde::de::Deserialize<'de> for State {
3790 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3791 where
3792 D: serde::Deserializer<'de>,
3793 {
3794 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3795 ".google.cloud.baremetalsolution.v2.VRF.State",
3796 ))
3797 }
3798 }
3799}
3800
3801/// Each logical interface represents a logical abstraction of the underlying
3802/// physical interface (for eg. bond, nic) of the instance. Each logical
3803/// interface can effectively map to multiple network-IP pairs and still be
3804/// mapped to one underlying physical interface.
3805#[derive(Clone, Default, PartialEq)]
3806#[non_exhaustive]
3807pub struct LogicalInterface {
3808 /// List of logical network interfaces within a logical interface.
3809 pub logical_network_interfaces:
3810 std::vec::Vec<crate::model::logical_interface::LogicalNetworkInterface>,
3811
3812 /// Interface name. This is of syntax \<bond\><bond_mode> or \<nic\> and
3813 /// forms part of the network template name.
3814 pub name: std::string::String,
3815
3816 /// The index of the logical interface mapping to the index of the hardware
3817 /// bond or nic on the chosen network template. This field is deprecated.
3818 #[deprecated]
3819 pub interface_index: i32,
3820
3821 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3822}
3823
3824impl LogicalInterface {
3825 pub fn new() -> Self {
3826 std::default::Default::default()
3827 }
3828
3829 /// Sets the value of [logical_network_interfaces][crate::model::LogicalInterface::logical_network_interfaces].
3830 ///
3831 /// # Example
3832 /// ```ignore,no_run
3833 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3834 /// use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3835 /// let x = LogicalInterface::new()
3836 /// .set_logical_network_interfaces([
3837 /// LogicalNetworkInterface::default()/* use setters */,
3838 /// LogicalNetworkInterface::default()/* use (different) setters */,
3839 /// ]);
3840 /// ```
3841 pub fn set_logical_network_interfaces<T, V>(mut self, v: T) -> Self
3842 where
3843 T: std::iter::IntoIterator<Item = V>,
3844 V: std::convert::Into<crate::model::logical_interface::LogicalNetworkInterface>,
3845 {
3846 use std::iter::Iterator;
3847 self.logical_network_interfaces = v.into_iter().map(|i| i.into()).collect();
3848 self
3849 }
3850
3851 /// Sets the value of [name][crate::model::LogicalInterface::name].
3852 ///
3853 /// # Example
3854 /// ```ignore,no_run
3855 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3856 /// let x = LogicalInterface::new().set_name("example");
3857 /// ```
3858 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3859 self.name = v.into();
3860 self
3861 }
3862
3863 /// Sets the value of [interface_index][crate::model::LogicalInterface::interface_index].
3864 ///
3865 /// # Example
3866 /// ```ignore,no_run
3867 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3868 /// let x = LogicalInterface::new().set_interface_index(42);
3869 /// ```
3870 #[deprecated]
3871 pub fn set_interface_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3872 self.interface_index = v.into();
3873 self
3874 }
3875}
3876
3877impl wkt::message::Message for LogicalInterface {
3878 fn typename() -> &'static str {
3879 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface"
3880 }
3881}
3882
3883/// Defines additional types related to [LogicalInterface].
3884pub mod logical_interface {
3885 #[allow(unused_imports)]
3886 use super::*;
3887
3888 /// Each logical network interface is effectively a network and IP pair.
3889 #[derive(Clone, Default, PartialEq)]
3890 #[non_exhaustive]
3891 pub struct LogicalNetworkInterface {
3892 /// Name of the network
3893 pub network: std::string::String,
3894
3895 /// IP address in the network
3896 pub ip_address: std::string::String,
3897
3898 /// Whether this interface is the default gateway for the instance. Only
3899 /// one interface can be the default gateway for the instance.
3900 pub default_gateway: bool,
3901
3902 /// Type of network.
3903 pub network_type: crate::model::network::Type,
3904
3905 /// An identifier for the `Network`, generated by the backend.
3906 pub id: std::string::String,
3907
3908 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3909 }
3910
3911 impl LogicalNetworkInterface {
3912 pub fn new() -> Self {
3913 std::default::Default::default()
3914 }
3915
3916 /// Sets the value of [network][crate::model::logical_interface::LogicalNetworkInterface::network].
3917 ///
3918 /// # Example
3919 /// ```ignore,no_run
3920 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3921 /// let x = LogicalNetworkInterface::new().set_network("example");
3922 /// ```
3923 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3924 self.network = v.into();
3925 self
3926 }
3927
3928 /// Sets the value of [ip_address][crate::model::logical_interface::LogicalNetworkInterface::ip_address].
3929 ///
3930 /// # Example
3931 /// ```ignore,no_run
3932 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3933 /// let x = LogicalNetworkInterface::new().set_ip_address("example");
3934 /// ```
3935 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3936 self.ip_address = v.into();
3937 self
3938 }
3939
3940 /// Sets the value of [default_gateway][crate::model::logical_interface::LogicalNetworkInterface::default_gateway].
3941 ///
3942 /// # Example
3943 /// ```ignore,no_run
3944 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3945 /// let x = LogicalNetworkInterface::new().set_default_gateway(true);
3946 /// ```
3947 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3948 self.default_gateway = v.into();
3949 self
3950 }
3951
3952 /// Sets the value of [network_type][crate::model::logical_interface::LogicalNetworkInterface::network_type].
3953 ///
3954 /// # Example
3955 /// ```ignore,no_run
3956 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3957 /// use google_cloud_baremetalsolution_v2::model::network::Type;
3958 /// let x0 = LogicalNetworkInterface::new().set_network_type(Type::Client);
3959 /// let x1 = LogicalNetworkInterface::new().set_network_type(Type::Private);
3960 /// ```
3961 pub fn set_network_type<T: std::convert::Into<crate::model::network::Type>>(
3962 mut self,
3963 v: T,
3964 ) -> Self {
3965 self.network_type = v.into();
3966 self
3967 }
3968
3969 /// Sets the value of [id][crate::model::logical_interface::LogicalNetworkInterface::id].
3970 ///
3971 /// # Example
3972 /// ```ignore,no_run
3973 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3974 /// let x = LogicalNetworkInterface::new().set_id("example");
3975 /// ```
3976 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3977 self.id = v.into();
3978 self
3979 }
3980 }
3981
3982 impl wkt::message::Message for LogicalNetworkInterface {
3983 fn typename() -> &'static str {
3984 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface.LogicalNetworkInterface"
3985 }
3986 }
3987}
3988
3989/// Message for requesting network information.
3990#[derive(Clone, Default, PartialEq)]
3991#[non_exhaustive]
3992pub struct GetNetworkRequest {
3993 /// Required. Name of the resource.
3994 pub name: std::string::String,
3995
3996 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3997}
3998
3999impl GetNetworkRequest {
4000 pub fn new() -> Self {
4001 std::default::Default::default()
4002 }
4003
4004 /// Sets the value of [name][crate::model::GetNetworkRequest::name].
4005 ///
4006 /// # Example
4007 /// ```ignore,no_run
4008 /// # use google_cloud_baremetalsolution_v2::model::GetNetworkRequest;
4009 /// let x = GetNetworkRequest::new().set_name("example");
4010 /// ```
4011 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4012 self.name = v.into();
4013 self
4014 }
4015}
4016
4017impl wkt::message::Message for GetNetworkRequest {
4018 fn typename() -> &'static str {
4019 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNetworkRequest"
4020 }
4021}
4022
4023/// Message for requesting a list of networks.
4024#[derive(Clone, Default, PartialEq)]
4025#[non_exhaustive]
4026pub struct ListNetworksRequest {
4027 /// Required. Parent value for ListNetworksRequest.
4028 pub parent: std::string::String,
4029
4030 /// Requested page size. The server might return fewer items than requested.
4031 /// If unspecified, server will pick an appropriate default.
4032 pub page_size: i32,
4033
4034 /// A token identifying a page of results from the server.
4035 pub page_token: std::string::String,
4036
4037 /// List filter.
4038 pub filter: std::string::String,
4039
4040 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4041}
4042
4043impl ListNetworksRequest {
4044 pub fn new() -> Self {
4045 std::default::Default::default()
4046 }
4047
4048 /// Sets the value of [parent][crate::model::ListNetworksRequest::parent].
4049 ///
4050 /// # Example
4051 /// ```ignore,no_run
4052 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4053 /// let x = ListNetworksRequest::new().set_parent("example");
4054 /// ```
4055 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4056 self.parent = v.into();
4057 self
4058 }
4059
4060 /// Sets the value of [page_size][crate::model::ListNetworksRequest::page_size].
4061 ///
4062 /// # Example
4063 /// ```ignore,no_run
4064 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4065 /// let x = ListNetworksRequest::new().set_page_size(42);
4066 /// ```
4067 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4068 self.page_size = v.into();
4069 self
4070 }
4071
4072 /// Sets the value of [page_token][crate::model::ListNetworksRequest::page_token].
4073 ///
4074 /// # Example
4075 /// ```ignore,no_run
4076 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4077 /// let x = ListNetworksRequest::new().set_page_token("example");
4078 /// ```
4079 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4080 self.page_token = v.into();
4081 self
4082 }
4083
4084 /// Sets the value of [filter][crate::model::ListNetworksRequest::filter].
4085 ///
4086 /// # Example
4087 /// ```ignore,no_run
4088 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4089 /// let x = ListNetworksRequest::new().set_filter("example");
4090 /// ```
4091 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4092 self.filter = v.into();
4093 self
4094 }
4095}
4096
4097impl wkt::message::Message for ListNetworksRequest {
4098 fn typename() -> &'static str {
4099 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksRequest"
4100 }
4101}
4102
4103/// Response message containing the list of networks.
4104#[derive(Clone, Default, PartialEq)]
4105#[non_exhaustive]
4106pub struct ListNetworksResponse {
4107 /// The list of networks.
4108 pub networks: std::vec::Vec<crate::model::Network>,
4109
4110 /// A token identifying a page of results from the server.
4111 pub next_page_token: std::string::String,
4112
4113 /// Locations that could not be reached.
4114 pub unreachable: std::vec::Vec<std::string::String>,
4115
4116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4117}
4118
4119impl ListNetworksResponse {
4120 pub fn new() -> Self {
4121 std::default::Default::default()
4122 }
4123
4124 /// Sets the value of [networks][crate::model::ListNetworksResponse::networks].
4125 ///
4126 /// # Example
4127 /// ```ignore,no_run
4128 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4129 /// use google_cloud_baremetalsolution_v2::model::Network;
4130 /// let x = ListNetworksResponse::new()
4131 /// .set_networks([
4132 /// Network::default()/* use setters */,
4133 /// Network::default()/* use (different) setters */,
4134 /// ]);
4135 /// ```
4136 pub fn set_networks<T, V>(mut self, v: T) -> Self
4137 where
4138 T: std::iter::IntoIterator<Item = V>,
4139 V: std::convert::Into<crate::model::Network>,
4140 {
4141 use std::iter::Iterator;
4142 self.networks = v.into_iter().map(|i| i.into()).collect();
4143 self
4144 }
4145
4146 /// Sets the value of [next_page_token][crate::model::ListNetworksResponse::next_page_token].
4147 ///
4148 /// # Example
4149 /// ```ignore,no_run
4150 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4151 /// let x = ListNetworksResponse::new().set_next_page_token("example");
4152 /// ```
4153 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4154 self.next_page_token = v.into();
4155 self
4156 }
4157
4158 /// Sets the value of [unreachable][crate::model::ListNetworksResponse::unreachable].
4159 ///
4160 /// # Example
4161 /// ```ignore,no_run
4162 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4163 /// let x = ListNetworksResponse::new().set_unreachable(["a", "b", "c"]);
4164 /// ```
4165 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4166 where
4167 T: std::iter::IntoIterator<Item = V>,
4168 V: std::convert::Into<std::string::String>,
4169 {
4170 use std::iter::Iterator;
4171 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4172 self
4173 }
4174}
4175
4176impl wkt::message::Message for ListNetworksResponse {
4177 fn typename() -> &'static str {
4178 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksResponse"
4179 }
4180}
4181
4182#[doc(hidden)]
4183impl google_cloud_gax::paginator::internal::PageableResponse for ListNetworksResponse {
4184 type PageItem = crate::model::Network;
4185
4186 fn items(self) -> std::vec::Vec<Self::PageItem> {
4187 self.networks
4188 }
4189
4190 fn next_page_token(&self) -> std::string::String {
4191 use std::clone::Clone;
4192 self.next_page_token.clone()
4193 }
4194}
4195
4196/// Message requesting to updating a network.
4197#[derive(Clone, Default, PartialEq)]
4198#[non_exhaustive]
4199pub struct UpdateNetworkRequest {
4200 /// Required. The network to update.
4201 ///
4202 /// The `name` field is used to identify the instance to update.
4203 /// Format: projects/{project}/locations/{location}/networks/{network}
4204 pub network: std::option::Option<crate::model::Network>,
4205
4206 /// The list of fields to update.
4207 /// The only currently supported fields are:
4208 /// `labels`, `reservations`, `vrf.vlan_attachments`
4209 pub update_mask: std::option::Option<wkt::FieldMask>,
4210
4211 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4212}
4213
4214impl UpdateNetworkRequest {
4215 pub fn new() -> Self {
4216 std::default::Default::default()
4217 }
4218
4219 /// Sets the value of [network][crate::model::UpdateNetworkRequest::network].
4220 ///
4221 /// # Example
4222 /// ```ignore,no_run
4223 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4224 /// use google_cloud_baremetalsolution_v2::model::Network;
4225 /// let x = UpdateNetworkRequest::new().set_network(Network::default()/* use setters */);
4226 /// ```
4227 pub fn set_network<T>(mut self, v: T) -> Self
4228 where
4229 T: std::convert::Into<crate::model::Network>,
4230 {
4231 self.network = std::option::Option::Some(v.into());
4232 self
4233 }
4234
4235 /// Sets or clears the value of [network][crate::model::UpdateNetworkRequest::network].
4236 ///
4237 /// # Example
4238 /// ```ignore,no_run
4239 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4240 /// use google_cloud_baremetalsolution_v2::model::Network;
4241 /// let x = UpdateNetworkRequest::new().set_or_clear_network(Some(Network::default()/* use setters */));
4242 /// let x = UpdateNetworkRequest::new().set_or_clear_network(None::<Network>);
4243 /// ```
4244 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4245 where
4246 T: std::convert::Into<crate::model::Network>,
4247 {
4248 self.network = v.map(|x| x.into());
4249 self
4250 }
4251
4252 /// Sets the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4253 ///
4254 /// # Example
4255 /// ```ignore,no_run
4256 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4257 /// use wkt::FieldMask;
4258 /// let x = UpdateNetworkRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4259 /// ```
4260 pub fn set_update_mask<T>(mut self, v: T) -> Self
4261 where
4262 T: std::convert::Into<wkt::FieldMask>,
4263 {
4264 self.update_mask = std::option::Option::Some(v.into());
4265 self
4266 }
4267
4268 /// Sets or clears the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4269 ///
4270 /// # Example
4271 /// ```ignore,no_run
4272 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4273 /// use wkt::FieldMask;
4274 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4275 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4276 /// ```
4277 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4278 where
4279 T: std::convert::Into<wkt::FieldMask>,
4280 {
4281 self.update_mask = v.map(|x| x.into());
4282 self
4283 }
4284}
4285
4286impl wkt::message::Message for UpdateNetworkRequest {
4287 fn typename() -> &'static str {
4288 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNetworkRequest"
4289 }
4290}
4291
4292/// Network with all used IP addresses.
4293#[derive(Clone, Default, PartialEq)]
4294#[non_exhaustive]
4295pub struct NetworkUsage {
4296 /// Network.
4297 pub network: std::option::Option<crate::model::Network>,
4298
4299 /// All used IP addresses in this network.
4300 pub used_ips: std::vec::Vec<std::string::String>,
4301
4302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4303}
4304
4305impl NetworkUsage {
4306 pub fn new() -> Self {
4307 std::default::Default::default()
4308 }
4309
4310 /// Sets the value of [network][crate::model::NetworkUsage::network].
4311 ///
4312 /// # Example
4313 /// ```ignore,no_run
4314 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4315 /// use google_cloud_baremetalsolution_v2::model::Network;
4316 /// let x = NetworkUsage::new().set_network(Network::default()/* use setters */);
4317 /// ```
4318 pub fn set_network<T>(mut self, v: T) -> Self
4319 where
4320 T: std::convert::Into<crate::model::Network>,
4321 {
4322 self.network = std::option::Option::Some(v.into());
4323 self
4324 }
4325
4326 /// Sets or clears the value of [network][crate::model::NetworkUsage::network].
4327 ///
4328 /// # Example
4329 /// ```ignore,no_run
4330 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4331 /// use google_cloud_baremetalsolution_v2::model::Network;
4332 /// let x = NetworkUsage::new().set_or_clear_network(Some(Network::default()/* use setters */));
4333 /// let x = NetworkUsage::new().set_or_clear_network(None::<Network>);
4334 /// ```
4335 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4336 where
4337 T: std::convert::Into<crate::model::Network>,
4338 {
4339 self.network = v.map(|x| x.into());
4340 self
4341 }
4342
4343 /// Sets the value of [used_ips][crate::model::NetworkUsage::used_ips].
4344 ///
4345 /// # Example
4346 /// ```ignore,no_run
4347 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4348 /// let x = NetworkUsage::new().set_used_ips(["a", "b", "c"]);
4349 /// ```
4350 pub fn set_used_ips<T, V>(mut self, v: T) -> Self
4351 where
4352 T: std::iter::IntoIterator<Item = V>,
4353 V: std::convert::Into<std::string::String>,
4354 {
4355 use std::iter::Iterator;
4356 self.used_ips = v.into_iter().map(|i| i.into()).collect();
4357 self
4358 }
4359}
4360
4361impl wkt::message::Message for NetworkUsage {
4362 fn typename() -> &'static str {
4363 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkUsage"
4364 }
4365}
4366
4367/// Request to get networks with IPs.
4368#[derive(Clone, Default, PartialEq)]
4369#[non_exhaustive]
4370pub struct ListNetworkUsageRequest {
4371 /// Required. Parent value (project and location).
4372 pub location: std::string::String,
4373
4374 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4375}
4376
4377impl ListNetworkUsageRequest {
4378 pub fn new() -> Self {
4379 std::default::Default::default()
4380 }
4381
4382 /// Sets the value of [location][crate::model::ListNetworkUsageRequest::location].
4383 ///
4384 /// # Example
4385 /// ```ignore,no_run
4386 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageRequest;
4387 /// let x = ListNetworkUsageRequest::new().set_location("example");
4388 /// ```
4389 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4390 self.location = v.into();
4391 self
4392 }
4393}
4394
4395impl wkt::message::Message for ListNetworkUsageRequest {
4396 fn typename() -> &'static str {
4397 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageRequest"
4398 }
4399}
4400
4401/// Response with Networks with IPs
4402#[derive(Clone, Default, PartialEq)]
4403#[non_exhaustive]
4404pub struct ListNetworkUsageResponse {
4405 /// Networks with IPs.
4406 pub networks: std::vec::Vec<crate::model::NetworkUsage>,
4407
4408 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4409}
4410
4411impl ListNetworkUsageResponse {
4412 pub fn new() -> Self {
4413 std::default::Default::default()
4414 }
4415
4416 /// Sets the value of [networks][crate::model::ListNetworkUsageResponse::networks].
4417 ///
4418 /// # Example
4419 /// ```ignore,no_run
4420 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageResponse;
4421 /// use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4422 /// let x = ListNetworkUsageResponse::new()
4423 /// .set_networks([
4424 /// NetworkUsage::default()/* use setters */,
4425 /// NetworkUsage::default()/* use (different) setters */,
4426 /// ]);
4427 /// ```
4428 pub fn set_networks<T, V>(mut self, v: T) -> Self
4429 where
4430 T: std::iter::IntoIterator<Item = V>,
4431 V: std::convert::Into<crate::model::NetworkUsage>,
4432 {
4433 use std::iter::Iterator;
4434 self.networks = v.into_iter().map(|i| i.into()).collect();
4435 self
4436 }
4437}
4438
4439impl wkt::message::Message for ListNetworkUsageResponse {
4440 fn typename() -> &'static str {
4441 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageResponse"
4442 }
4443}
4444
4445/// Mount point for a network.
4446#[derive(Clone, Default, PartialEq)]
4447#[non_exhaustive]
4448pub struct NetworkMountPoint {
4449 /// Instance to attach network to.
4450 pub instance: std::string::String,
4451
4452 /// Logical interface to detach from.
4453 pub logical_interface: std::string::String,
4454
4455 /// Network should be a default gateway.
4456 pub default_gateway: bool,
4457
4458 /// Ip address of the server.
4459 pub ip_address: std::string::String,
4460
4461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4462}
4463
4464impl NetworkMountPoint {
4465 pub fn new() -> Self {
4466 std::default::Default::default()
4467 }
4468
4469 /// Sets the value of [instance][crate::model::NetworkMountPoint::instance].
4470 ///
4471 /// # Example
4472 /// ```ignore,no_run
4473 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4474 /// let x = NetworkMountPoint::new().set_instance("example");
4475 /// ```
4476 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4477 self.instance = v.into();
4478 self
4479 }
4480
4481 /// Sets the value of [logical_interface][crate::model::NetworkMountPoint::logical_interface].
4482 ///
4483 /// # Example
4484 /// ```ignore,no_run
4485 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4486 /// let x = NetworkMountPoint::new().set_logical_interface("example");
4487 /// ```
4488 pub fn set_logical_interface<T: std::convert::Into<std::string::String>>(
4489 mut self,
4490 v: T,
4491 ) -> Self {
4492 self.logical_interface = v.into();
4493 self
4494 }
4495
4496 /// Sets the value of [default_gateway][crate::model::NetworkMountPoint::default_gateway].
4497 ///
4498 /// # Example
4499 /// ```ignore,no_run
4500 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4501 /// let x = NetworkMountPoint::new().set_default_gateway(true);
4502 /// ```
4503 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4504 self.default_gateway = v.into();
4505 self
4506 }
4507
4508 /// Sets the value of [ip_address][crate::model::NetworkMountPoint::ip_address].
4509 ///
4510 /// # Example
4511 /// ```ignore,no_run
4512 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4513 /// let x = NetworkMountPoint::new().set_ip_address("example");
4514 /// ```
4515 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4516 self.ip_address = v.into();
4517 self
4518 }
4519}
4520
4521impl wkt::message::Message for NetworkMountPoint {
4522 fn typename() -> &'static str {
4523 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkMountPoint"
4524 }
4525}
4526
4527/// Message requesting rename of a server.
4528#[derive(Clone, Default, PartialEq)]
4529#[non_exhaustive]
4530pub struct RenameNetworkRequest {
4531 /// Required. The `name` field is used to identify the network.
4532 /// Format: projects/{project}/locations/{location}/networks/{network}
4533 pub name: std::string::String,
4534
4535 /// Required. The new `id` of the network.
4536 pub new_network_id: std::string::String,
4537
4538 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4539}
4540
4541impl RenameNetworkRequest {
4542 pub fn new() -> Self {
4543 std::default::Default::default()
4544 }
4545
4546 /// Sets the value of [name][crate::model::RenameNetworkRequest::name].
4547 ///
4548 /// # Example
4549 /// ```ignore,no_run
4550 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4551 /// let x = RenameNetworkRequest::new().set_name("example");
4552 /// ```
4553 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4554 self.name = v.into();
4555 self
4556 }
4557
4558 /// Sets the value of [new_network_id][crate::model::RenameNetworkRequest::new_network_id].
4559 ///
4560 /// # Example
4561 /// ```ignore,no_run
4562 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4563 /// let x = RenameNetworkRequest::new().set_new_network_id("example");
4564 /// ```
4565 pub fn set_new_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4566 self.new_network_id = v.into();
4567 self
4568 }
4569}
4570
4571impl wkt::message::Message for RenameNetworkRequest {
4572 fn typename() -> &'static str {
4573 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNetworkRequest"
4574 }
4575}
4576
4577/// An NFS share.
4578#[derive(Clone, Default, PartialEq)]
4579#[non_exhaustive]
4580pub struct NfsShare {
4581 /// Immutable. The name of the NFS share.
4582 pub name: std::string::String,
4583
4584 /// Output only. An identifier for the NFS share, generated by the backend.
4585 /// This field will be deprecated in the future, use `id` instead.
4586 pub nfs_share_id: std::string::String,
4587
4588 /// Output only. An identifier for the NFS share, generated by the backend.
4589 /// This is the same value as nfs_share_id and will replace it in the future.
4590 pub id: std::string::String,
4591
4592 /// Output only. The state of the NFS share.
4593 pub state: crate::model::nfs_share::State,
4594
4595 /// Output only. The underlying volume of the share. Created automatically
4596 /// during provisioning.
4597 pub volume: std::string::String,
4598
4599 /// List of allowed access points.
4600 pub allowed_clients: std::vec::Vec<crate::model::nfs_share::AllowedClient>,
4601
4602 /// Labels as key value pairs.
4603 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4604
4605 /// The requested size, in GiB.
4606 pub requested_size_gib: i64,
4607
4608 /// Immutable. The storage type of the underlying volume.
4609 pub storage_type: crate::model::nfs_share::StorageType,
4610
4611 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4612}
4613
4614impl NfsShare {
4615 pub fn new() -> Self {
4616 std::default::Default::default()
4617 }
4618
4619 /// Sets the value of [name][crate::model::NfsShare::name].
4620 ///
4621 /// # Example
4622 /// ```ignore,no_run
4623 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4624 /// let x = NfsShare::new().set_name("example");
4625 /// ```
4626 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4627 self.name = v.into();
4628 self
4629 }
4630
4631 /// Sets the value of [nfs_share_id][crate::model::NfsShare::nfs_share_id].
4632 ///
4633 /// # Example
4634 /// ```ignore,no_run
4635 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4636 /// let x = NfsShare::new().set_nfs_share_id("example");
4637 /// ```
4638 pub fn set_nfs_share_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4639 self.nfs_share_id = v.into();
4640 self
4641 }
4642
4643 /// Sets the value of [id][crate::model::NfsShare::id].
4644 ///
4645 /// # Example
4646 /// ```ignore,no_run
4647 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4648 /// let x = NfsShare::new().set_id("example");
4649 /// ```
4650 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4651 self.id = v.into();
4652 self
4653 }
4654
4655 /// Sets the value of [state][crate::model::NfsShare::state].
4656 ///
4657 /// # Example
4658 /// ```ignore,no_run
4659 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4660 /// use google_cloud_baremetalsolution_v2::model::nfs_share::State;
4661 /// let x0 = NfsShare::new().set_state(State::Provisioned);
4662 /// let x1 = NfsShare::new().set_state(State::Creating);
4663 /// let x2 = NfsShare::new().set_state(State::Updating);
4664 /// ```
4665 pub fn set_state<T: std::convert::Into<crate::model::nfs_share::State>>(
4666 mut self,
4667 v: T,
4668 ) -> Self {
4669 self.state = v.into();
4670 self
4671 }
4672
4673 /// Sets the value of [volume][crate::model::NfsShare::volume].
4674 ///
4675 /// # Example
4676 /// ```ignore,no_run
4677 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4678 /// let x = NfsShare::new().set_volume("example");
4679 /// ```
4680 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4681 self.volume = v.into();
4682 self
4683 }
4684
4685 /// Sets the value of [allowed_clients][crate::model::NfsShare::allowed_clients].
4686 ///
4687 /// # Example
4688 /// ```ignore,no_run
4689 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4690 /// use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4691 /// let x = NfsShare::new()
4692 /// .set_allowed_clients([
4693 /// AllowedClient::default()/* use setters */,
4694 /// AllowedClient::default()/* use (different) setters */,
4695 /// ]);
4696 /// ```
4697 pub fn set_allowed_clients<T, V>(mut self, v: T) -> Self
4698 where
4699 T: std::iter::IntoIterator<Item = V>,
4700 V: std::convert::Into<crate::model::nfs_share::AllowedClient>,
4701 {
4702 use std::iter::Iterator;
4703 self.allowed_clients = v.into_iter().map(|i| i.into()).collect();
4704 self
4705 }
4706
4707 /// Sets the value of [labels][crate::model::NfsShare::labels].
4708 ///
4709 /// # Example
4710 /// ```ignore,no_run
4711 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4712 /// let x = NfsShare::new().set_labels([
4713 /// ("key0", "abc"),
4714 /// ("key1", "xyz"),
4715 /// ]);
4716 /// ```
4717 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4718 where
4719 T: std::iter::IntoIterator<Item = (K, V)>,
4720 K: std::convert::Into<std::string::String>,
4721 V: std::convert::Into<std::string::String>,
4722 {
4723 use std::iter::Iterator;
4724 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4725 self
4726 }
4727
4728 /// Sets the value of [requested_size_gib][crate::model::NfsShare::requested_size_gib].
4729 ///
4730 /// # Example
4731 /// ```ignore,no_run
4732 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4733 /// let x = NfsShare::new().set_requested_size_gib(42);
4734 /// ```
4735 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4736 self.requested_size_gib = v.into();
4737 self
4738 }
4739
4740 /// Sets the value of [storage_type][crate::model::NfsShare::storage_type].
4741 ///
4742 /// # Example
4743 /// ```ignore,no_run
4744 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4745 /// use google_cloud_baremetalsolution_v2::model::nfs_share::StorageType;
4746 /// let x0 = NfsShare::new().set_storage_type(StorageType::Ssd);
4747 /// let x1 = NfsShare::new().set_storage_type(StorageType::Hdd);
4748 /// ```
4749 pub fn set_storage_type<T: std::convert::Into<crate::model::nfs_share::StorageType>>(
4750 mut self,
4751 v: T,
4752 ) -> Self {
4753 self.storage_type = v.into();
4754 self
4755 }
4756}
4757
4758impl wkt::message::Message for NfsShare {
4759 fn typename() -> &'static str {
4760 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare"
4761 }
4762}
4763
4764/// Defines additional types related to [NfsShare].
4765pub mod nfs_share {
4766 #[allow(unused_imports)]
4767 use super::*;
4768
4769 /// Represents an 'access point' for the share.
4770 #[derive(Clone, Default, PartialEq)]
4771 #[non_exhaustive]
4772 pub struct AllowedClient {
4773 /// The network the access point sits on.
4774 pub network: std::string::String,
4775
4776 /// Output only. The IP address of the share on this network. Assigned
4777 /// automatically during provisioning based on the network's services_cidr.
4778 pub share_ip: std::string::String,
4779
4780 /// The subnet of IP addresses permitted to access the share.
4781 pub allowed_clients_cidr: std::string::String,
4782
4783 /// Mount permissions.
4784 pub mount_permissions: crate::model::nfs_share::MountPermissions,
4785
4786 /// Allow dev flag. Which controls whether to allow creation of devices.
4787 pub allow_dev: bool,
4788
4789 /// Allow the setuid flag.
4790 pub allow_suid: bool,
4791
4792 /// Disable root squashing, which is a feature of NFS.
4793 /// Root squash is a special mapping of the remote superuser (root) identity
4794 /// when using identity authentication.
4795 pub no_root_squash: bool,
4796
4797 /// Output only. The path to access NFS, in format shareIP:/InstanceID
4798 /// InstanceID is the generated ID instead of customer provided name.
4799 /// example like "10.0.0.0:/g123456789-nfs001"
4800 pub nfs_path: std::string::String,
4801
4802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4803 }
4804
4805 impl AllowedClient {
4806 pub fn new() -> Self {
4807 std::default::Default::default()
4808 }
4809
4810 /// Sets the value of [network][crate::model::nfs_share::AllowedClient::network].
4811 ///
4812 /// # Example
4813 /// ```ignore,no_run
4814 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4815 /// let x = AllowedClient::new().set_network("example");
4816 /// ```
4817 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4818 self.network = v.into();
4819 self
4820 }
4821
4822 /// Sets the value of [share_ip][crate::model::nfs_share::AllowedClient::share_ip].
4823 ///
4824 /// # Example
4825 /// ```ignore,no_run
4826 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4827 /// let x = AllowedClient::new().set_share_ip("example");
4828 /// ```
4829 pub fn set_share_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4830 self.share_ip = v.into();
4831 self
4832 }
4833
4834 /// Sets the value of [allowed_clients_cidr][crate::model::nfs_share::AllowedClient::allowed_clients_cidr].
4835 ///
4836 /// # Example
4837 /// ```ignore,no_run
4838 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4839 /// let x = AllowedClient::new().set_allowed_clients_cidr("example");
4840 /// ```
4841 pub fn set_allowed_clients_cidr<T: std::convert::Into<std::string::String>>(
4842 mut self,
4843 v: T,
4844 ) -> Self {
4845 self.allowed_clients_cidr = v.into();
4846 self
4847 }
4848
4849 /// Sets the value of [mount_permissions][crate::model::nfs_share::AllowedClient::mount_permissions].
4850 ///
4851 /// # Example
4852 /// ```ignore,no_run
4853 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4854 /// use google_cloud_baremetalsolution_v2::model::nfs_share::MountPermissions;
4855 /// let x0 = AllowedClient::new().set_mount_permissions(MountPermissions::Read);
4856 /// let x1 = AllowedClient::new().set_mount_permissions(MountPermissions::ReadWrite);
4857 /// ```
4858 pub fn set_mount_permissions<
4859 T: std::convert::Into<crate::model::nfs_share::MountPermissions>,
4860 >(
4861 mut self,
4862 v: T,
4863 ) -> Self {
4864 self.mount_permissions = v.into();
4865 self
4866 }
4867
4868 /// Sets the value of [allow_dev][crate::model::nfs_share::AllowedClient::allow_dev].
4869 ///
4870 /// # Example
4871 /// ```ignore,no_run
4872 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4873 /// let x = AllowedClient::new().set_allow_dev(true);
4874 /// ```
4875 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4876 self.allow_dev = v.into();
4877 self
4878 }
4879
4880 /// Sets the value of [allow_suid][crate::model::nfs_share::AllowedClient::allow_suid].
4881 ///
4882 /// # Example
4883 /// ```ignore,no_run
4884 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4885 /// let x = AllowedClient::new().set_allow_suid(true);
4886 /// ```
4887 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4888 self.allow_suid = v.into();
4889 self
4890 }
4891
4892 /// Sets the value of [no_root_squash][crate::model::nfs_share::AllowedClient::no_root_squash].
4893 ///
4894 /// # Example
4895 /// ```ignore,no_run
4896 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4897 /// let x = AllowedClient::new().set_no_root_squash(true);
4898 /// ```
4899 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4900 self.no_root_squash = v.into();
4901 self
4902 }
4903
4904 /// Sets the value of [nfs_path][crate::model::nfs_share::AllowedClient::nfs_path].
4905 ///
4906 /// # Example
4907 /// ```ignore,no_run
4908 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4909 /// let x = AllowedClient::new().set_nfs_path("example");
4910 /// ```
4911 pub fn set_nfs_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4912 self.nfs_path = v.into();
4913 self
4914 }
4915 }
4916
4917 impl wkt::message::Message for AllowedClient {
4918 fn typename() -> &'static str {
4919 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare.AllowedClient"
4920 }
4921 }
4922
4923 /// The possible states for this NFS share.
4924 ///
4925 /// # Working with unknown values
4926 ///
4927 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4928 /// additional enum variants at any time. Adding new variants is not considered
4929 /// a breaking change. Applications should write their code in anticipation of:
4930 ///
4931 /// - New values appearing in future releases of the client library, **and**
4932 /// - New values received dynamically, without application changes.
4933 ///
4934 /// Please consult the [Working with enums] section in the user guide for some
4935 /// guidelines.
4936 ///
4937 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4938 #[derive(Clone, Debug, PartialEq)]
4939 #[non_exhaustive]
4940 pub enum State {
4941 /// The share is in an unknown state.
4942 Unspecified,
4943 /// The share has been provisioned.
4944 Provisioned,
4945 /// The NFS Share is being created.
4946 Creating,
4947 /// The NFS Share is being updated.
4948 Updating,
4949 /// The NFS Share has been requested to be deleted.
4950 Deleting,
4951 /// If set, the enum was initialized with an unknown value.
4952 ///
4953 /// Applications can examine the value using [State::value] or
4954 /// [State::name].
4955 UnknownValue(state::UnknownValue),
4956 }
4957
4958 #[doc(hidden)]
4959 pub mod state {
4960 #[allow(unused_imports)]
4961 use super::*;
4962 #[derive(Clone, Debug, PartialEq)]
4963 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4964 }
4965
4966 impl State {
4967 /// Gets the enum value.
4968 ///
4969 /// Returns `None` if the enum contains an unknown value deserialized from
4970 /// the string representation of enums.
4971 pub fn value(&self) -> std::option::Option<i32> {
4972 match self {
4973 Self::Unspecified => std::option::Option::Some(0),
4974 Self::Provisioned => std::option::Option::Some(1),
4975 Self::Creating => std::option::Option::Some(2),
4976 Self::Updating => std::option::Option::Some(3),
4977 Self::Deleting => std::option::Option::Some(4),
4978 Self::UnknownValue(u) => u.0.value(),
4979 }
4980 }
4981
4982 /// Gets the enum value as a string.
4983 ///
4984 /// Returns `None` if the enum contains an unknown value deserialized from
4985 /// the integer representation of enums.
4986 pub fn name(&self) -> std::option::Option<&str> {
4987 match self {
4988 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4989 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
4990 Self::Creating => std::option::Option::Some("CREATING"),
4991 Self::Updating => std::option::Option::Some("UPDATING"),
4992 Self::Deleting => std::option::Option::Some("DELETING"),
4993 Self::UnknownValue(u) => u.0.name(),
4994 }
4995 }
4996 }
4997
4998 impl std::default::Default for State {
4999 fn default() -> Self {
5000 use std::convert::From;
5001 Self::from(0)
5002 }
5003 }
5004
5005 impl std::fmt::Display for State {
5006 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5007 wkt::internal::display_enum(f, self.name(), self.value())
5008 }
5009 }
5010
5011 impl std::convert::From<i32> for State {
5012 fn from(value: i32) -> Self {
5013 match value {
5014 0 => Self::Unspecified,
5015 1 => Self::Provisioned,
5016 2 => Self::Creating,
5017 3 => Self::Updating,
5018 4 => Self::Deleting,
5019 _ => Self::UnknownValue(state::UnknownValue(
5020 wkt::internal::UnknownEnumValue::Integer(value),
5021 )),
5022 }
5023 }
5024 }
5025
5026 impl std::convert::From<&str> for State {
5027 fn from(value: &str) -> Self {
5028 use std::string::ToString;
5029 match value {
5030 "STATE_UNSPECIFIED" => Self::Unspecified,
5031 "PROVISIONED" => Self::Provisioned,
5032 "CREATING" => Self::Creating,
5033 "UPDATING" => Self::Updating,
5034 "DELETING" => Self::Deleting,
5035 _ => Self::UnknownValue(state::UnknownValue(
5036 wkt::internal::UnknownEnumValue::String(value.to_string()),
5037 )),
5038 }
5039 }
5040 }
5041
5042 impl serde::ser::Serialize for State {
5043 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5044 where
5045 S: serde::Serializer,
5046 {
5047 match self {
5048 Self::Unspecified => serializer.serialize_i32(0),
5049 Self::Provisioned => serializer.serialize_i32(1),
5050 Self::Creating => serializer.serialize_i32(2),
5051 Self::Updating => serializer.serialize_i32(3),
5052 Self::Deleting => serializer.serialize_i32(4),
5053 Self::UnknownValue(u) => u.0.serialize(serializer),
5054 }
5055 }
5056 }
5057
5058 impl<'de> serde::de::Deserialize<'de> for State {
5059 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5060 where
5061 D: serde::Deserializer<'de>,
5062 {
5063 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5064 ".google.cloud.baremetalsolution.v2.NfsShare.State",
5065 ))
5066 }
5067 }
5068
5069 /// The possible mount permissions.
5070 ///
5071 /// # Working with unknown values
5072 ///
5073 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5074 /// additional enum variants at any time. Adding new variants is not considered
5075 /// a breaking change. Applications should write their code in anticipation of:
5076 ///
5077 /// - New values appearing in future releases of the client library, **and**
5078 /// - New values received dynamically, without application changes.
5079 ///
5080 /// Please consult the [Working with enums] section in the user guide for some
5081 /// guidelines.
5082 ///
5083 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5084 #[derive(Clone, Debug, PartialEq)]
5085 #[non_exhaustive]
5086 pub enum MountPermissions {
5087 /// Permissions were not specified.
5088 Unspecified,
5089 /// NFS share can be mount with read-only permissions.
5090 Read,
5091 /// NFS share can be mount with read-write permissions.
5092 ReadWrite,
5093 /// If set, the enum was initialized with an unknown value.
5094 ///
5095 /// Applications can examine the value using [MountPermissions::value] or
5096 /// [MountPermissions::name].
5097 UnknownValue(mount_permissions::UnknownValue),
5098 }
5099
5100 #[doc(hidden)]
5101 pub mod mount_permissions {
5102 #[allow(unused_imports)]
5103 use super::*;
5104 #[derive(Clone, Debug, PartialEq)]
5105 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5106 }
5107
5108 impl MountPermissions {
5109 /// Gets the enum value.
5110 ///
5111 /// Returns `None` if the enum contains an unknown value deserialized from
5112 /// the string representation of enums.
5113 pub fn value(&self) -> std::option::Option<i32> {
5114 match self {
5115 Self::Unspecified => std::option::Option::Some(0),
5116 Self::Read => std::option::Option::Some(1),
5117 Self::ReadWrite => std::option::Option::Some(2),
5118 Self::UnknownValue(u) => u.0.value(),
5119 }
5120 }
5121
5122 /// Gets the enum value as a string.
5123 ///
5124 /// Returns `None` if the enum contains an unknown value deserialized from
5125 /// the integer representation of enums.
5126 pub fn name(&self) -> std::option::Option<&str> {
5127 match self {
5128 Self::Unspecified => std::option::Option::Some("MOUNT_PERMISSIONS_UNSPECIFIED"),
5129 Self::Read => std::option::Option::Some("READ"),
5130 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
5131 Self::UnknownValue(u) => u.0.name(),
5132 }
5133 }
5134 }
5135
5136 impl std::default::Default for MountPermissions {
5137 fn default() -> Self {
5138 use std::convert::From;
5139 Self::from(0)
5140 }
5141 }
5142
5143 impl std::fmt::Display for MountPermissions {
5144 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5145 wkt::internal::display_enum(f, self.name(), self.value())
5146 }
5147 }
5148
5149 impl std::convert::From<i32> for MountPermissions {
5150 fn from(value: i32) -> Self {
5151 match value {
5152 0 => Self::Unspecified,
5153 1 => Self::Read,
5154 2 => Self::ReadWrite,
5155 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5156 wkt::internal::UnknownEnumValue::Integer(value),
5157 )),
5158 }
5159 }
5160 }
5161
5162 impl std::convert::From<&str> for MountPermissions {
5163 fn from(value: &str) -> Self {
5164 use std::string::ToString;
5165 match value {
5166 "MOUNT_PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
5167 "READ" => Self::Read,
5168 "READ_WRITE" => Self::ReadWrite,
5169 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5170 wkt::internal::UnknownEnumValue::String(value.to_string()),
5171 )),
5172 }
5173 }
5174 }
5175
5176 impl serde::ser::Serialize for MountPermissions {
5177 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5178 where
5179 S: serde::Serializer,
5180 {
5181 match self {
5182 Self::Unspecified => serializer.serialize_i32(0),
5183 Self::Read => serializer.serialize_i32(1),
5184 Self::ReadWrite => serializer.serialize_i32(2),
5185 Self::UnknownValue(u) => u.0.serialize(serializer),
5186 }
5187 }
5188 }
5189
5190 impl<'de> serde::de::Deserialize<'de> for MountPermissions {
5191 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5192 where
5193 D: serde::Deserializer<'de>,
5194 {
5195 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MountPermissions>::new(
5196 ".google.cloud.baremetalsolution.v2.NfsShare.MountPermissions",
5197 ))
5198 }
5199 }
5200
5201 /// The storage type for a volume.
5202 ///
5203 /// # Working with unknown values
5204 ///
5205 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5206 /// additional enum variants at any time. Adding new variants is not considered
5207 /// a breaking change. Applications should write their code in anticipation of:
5208 ///
5209 /// - New values appearing in future releases of the client library, **and**
5210 /// - New values received dynamically, without application changes.
5211 ///
5212 /// Please consult the [Working with enums] section in the user guide for some
5213 /// guidelines.
5214 ///
5215 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5216 #[derive(Clone, Debug, PartialEq)]
5217 #[non_exhaustive]
5218 pub enum StorageType {
5219 /// The storage type for this volume is unknown.
5220 Unspecified,
5221 /// The storage type for this volume is SSD.
5222 Ssd,
5223 /// This storage type for this volume is HDD.
5224 Hdd,
5225 /// If set, the enum was initialized with an unknown value.
5226 ///
5227 /// Applications can examine the value using [StorageType::value] or
5228 /// [StorageType::name].
5229 UnknownValue(storage_type::UnknownValue),
5230 }
5231
5232 #[doc(hidden)]
5233 pub mod storage_type {
5234 #[allow(unused_imports)]
5235 use super::*;
5236 #[derive(Clone, Debug, PartialEq)]
5237 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5238 }
5239
5240 impl StorageType {
5241 /// Gets the enum value.
5242 ///
5243 /// Returns `None` if the enum contains an unknown value deserialized from
5244 /// the string representation of enums.
5245 pub fn value(&self) -> std::option::Option<i32> {
5246 match self {
5247 Self::Unspecified => std::option::Option::Some(0),
5248 Self::Ssd => std::option::Option::Some(1),
5249 Self::Hdd => std::option::Option::Some(2),
5250 Self::UnknownValue(u) => u.0.value(),
5251 }
5252 }
5253
5254 /// Gets the enum value as a string.
5255 ///
5256 /// Returns `None` if the enum contains an unknown value deserialized from
5257 /// the integer representation of enums.
5258 pub fn name(&self) -> std::option::Option<&str> {
5259 match self {
5260 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
5261 Self::Ssd => std::option::Option::Some("SSD"),
5262 Self::Hdd => std::option::Option::Some("HDD"),
5263 Self::UnknownValue(u) => u.0.name(),
5264 }
5265 }
5266 }
5267
5268 impl std::default::Default for StorageType {
5269 fn default() -> Self {
5270 use std::convert::From;
5271 Self::from(0)
5272 }
5273 }
5274
5275 impl std::fmt::Display for StorageType {
5276 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5277 wkt::internal::display_enum(f, self.name(), self.value())
5278 }
5279 }
5280
5281 impl std::convert::From<i32> for StorageType {
5282 fn from(value: i32) -> Self {
5283 match value {
5284 0 => Self::Unspecified,
5285 1 => Self::Ssd,
5286 2 => Self::Hdd,
5287 _ => Self::UnknownValue(storage_type::UnknownValue(
5288 wkt::internal::UnknownEnumValue::Integer(value),
5289 )),
5290 }
5291 }
5292 }
5293
5294 impl std::convert::From<&str> for StorageType {
5295 fn from(value: &str) -> Self {
5296 use std::string::ToString;
5297 match value {
5298 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
5299 "SSD" => Self::Ssd,
5300 "HDD" => Self::Hdd,
5301 _ => Self::UnknownValue(storage_type::UnknownValue(
5302 wkt::internal::UnknownEnumValue::String(value.to_string()),
5303 )),
5304 }
5305 }
5306 }
5307
5308 impl serde::ser::Serialize for StorageType {
5309 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5310 where
5311 S: serde::Serializer,
5312 {
5313 match self {
5314 Self::Unspecified => serializer.serialize_i32(0),
5315 Self::Ssd => serializer.serialize_i32(1),
5316 Self::Hdd => serializer.serialize_i32(2),
5317 Self::UnknownValue(u) => u.0.serialize(serializer),
5318 }
5319 }
5320 }
5321
5322 impl<'de> serde::de::Deserialize<'de> for StorageType {
5323 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5324 where
5325 D: serde::Deserializer<'de>,
5326 {
5327 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
5328 ".google.cloud.baremetalsolution.v2.NfsShare.StorageType",
5329 ))
5330 }
5331 }
5332}
5333
5334/// Message for requesting NFS share information.
5335#[derive(Clone, Default, PartialEq)]
5336#[non_exhaustive]
5337pub struct GetNfsShareRequest {
5338 /// Required. Name of the resource.
5339 pub name: std::string::String,
5340
5341 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5342}
5343
5344impl GetNfsShareRequest {
5345 pub fn new() -> Self {
5346 std::default::Default::default()
5347 }
5348
5349 /// Sets the value of [name][crate::model::GetNfsShareRequest::name].
5350 ///
5351 /// # Example
5352 /// ```ignore,no_run
5353 /// # use google_cloud_baremetalsolution_v2::model::GetNfsShareRequest;
5354 /// let x = GetNfsShareRequest::new().set_name("example");
5355 /// ```
5356 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5357 self.name = v.into();
5358 self
5359 }
5360}
5361
5362impl wkt::message::Message for GetNfsShareRequest {
5363 fn typename() -> &'static str {
5364 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNfsShareRequest"
5365 }
5366}
5367
5368/// Message for requesting a list of NFS shares.
5369#[derive(Clone, Default, PartialEq)]
5370#[non_exhaustive]
5371pub struct ListNfsSharesRequest {
5372 /// Required. Parent value for ListNfsSharesRequest.
5373 pub parent: std::string::String,
5374
5375 /// Requested page size. The server might return fewer items than requested.
5376 /// If unspecified, server will pick an appropriate default.
5377 pub page_size: i32,
5378
5379 /// A token identifying a page of results from the server.
5380 pub page_token: std::string::String,
5381
5382 /// List filter.
5383 pub filter: std::string::String,
5384
5385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5386}
5387
5388impl ListNfsSharesRequest {
5389 pub fn new() -> Self {
5390 std::default::Default::default()
5391 }
5392
5393 /// Sets the value of [parent][crate::model::ListNfsSharesRequest::parent].
5394 ///
5395 /// # Example
5396 /// ```ignore,no_run
5397 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5398 /// let x = ListNfsSharesRequest::new().set_parent("example");
5399 /// ```
5400 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5401 self.parent = v.into();
5402 self
5403 }
5404
5405 /// Sets the value of [page_size][crate::model::ListNfsSharesRequest::page_size].
5406 ///
5407 /// # Example
5408 /// ```ignore,no_run
5409 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5410 /// let x = ListNfsSharesRequest::new().set_page_size(42);
5411 /// ```
5412 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5413 self.page_size = v.into();
5414 self
5415 }
5416
5417 /// Sets the value of [page_token][crate::model::ListNfsSharesRequest::page_token].
5418 ///
5419 /// # Example
5420 /// ```ignore,no_run
5421 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5422 /// let x = ListNfsSharesRequest::new().set_page_token("example");
5423 /// ```
5424 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5425 self.page_token = v.into();
5426 self
5427 }
5428
5429 /// Sets the value of [filter][crate::model::ListNfsSharesRequest::filter].
5430 ///
5431 /// # Example
5432 /// ```ignore,no_run
5433 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5434 /// let x = ListNfsSharesRequest::new().set_filter("example");
5435 /// ```
5436 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5437 self.filter = v.into();
5438 self
5439 }
5440}
5441
5442impl wkt::message::Message for ListNfsSharesRequest {
5443 fn typename() -> &'static str {
5444 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesRequest"
5445 }
5446}
5447
5448/// Response message containing the list of NFS shares.
5449#[derive(Clone, Default, PartialEq)]
5450#[non_exhaustive]
5451pub struct ListNfsSharesResponse {
5452 /// The list of NFS shares.
5453 pub nfs_shares: std::vec::Vec<crate::model::NfsShare>,
5454
5455 /// A token identifying a page of results from the server.
5456 pub next_page_token: std::string::String,
5457
5458 /// Locations that could not be reached.
5459 pub unreachable: std::vec::Vec<std::string::String>,
5460
5461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5462}
5463
5464impl ListNfsSharesResponse {
5465 pub fn new() -> Self {
5466 std::default::Default::default()
5467 }
5468
5469 /// Sets the value of [nfs_shares][crate::model::ListNfsSharesResponse::nfs_shares].
5470 ///
5471 /// # Example
5472 /// ```ignore,no_run
5473 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5474 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5475 /// let x = ListNfsSharesResponse::new()
5476 /// .set_nfs_shares([
5477 /// NfsShare::default()/* use setters */,
5478 /// NfsShare::default()/* use (different) setters */,
5479 /// ]);
5480 /// ```
5481 pub fn set_nfs_shares<T, V>(mut self, v: T) -> Self
5482 where
5483 T: std::iter::IntoIterator<Item = V>,
5484 V: std::convert::Into<crate::model::NfsShare>,
5485 {
5486 use std::iter::Iterator;
5487 self.nfs_shares = v.into_iter().map(|i| i.into()).collect();
5488 self
5489 }
5490
5491 /// Sets the value of [next_page_token][crate::model::ListNfsSharesResponse::next_page_token].
5492 ///
5493 /// # Example
5494 /// ```ignore,no_run
5495 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5496 /// let x = ListNfsSharesResponse::new().set_next_page_token("example");
5497 /// ```
5498 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5499 self.next_page_token = v.into();
5500 self
5501 }
5502
5503 /// Sets the value of [unreachable][crate::model::ListNfsSharesResponse::unreachable].
5504 ///
5505 /// # Example
5506 /// ```ignore,no_run
5507 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5508 /// let x = ListNfsSharesResponse::new().set_unreachable(["a", "b", "c"]);
5509 /// ```
5510 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5511 where
5512 T: std::iter::IntoIterator<Item = V>,
5513 V: std::convert::Into<std::string::String>,
5514 {
5515 use std::iter::Iterator;
5516 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5517 self
5518 }
5519}
5520
5521impl wkt::message::Message for ListNfsSharesResponse {
5522 fn typename() -> &'static str {
5523 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesResponse"
5524 }
5525}
5526
5527#[doc(hidden)]
5528impl google_cloud_gax::paginator::internal::PageableResponse for ListNfsSharesResponse {
5529 type PageItem = crate::model::NfsShare;
5530
5531 fn items(self) -> std::vec::Vec<Self::PageItem> {
5532 self.nfs_shares
5533 }
5534
5535 fn next_page_token(&self) -> std::string::String {
5536 use std::clone::Clone;
5537 self.next_page_token.clone()
5538 }
5539}
5540
5541/// Message requesting to updating an NFS share.
5542#[derive(Clone, Default, PartialEq)]
5543#[non_exhaustive]
5544pub struct UpdateNfsShareRequest {
5545 /// Required. The NFS share to update.
5546 ///
5547 /// The `name` field is used to identify the NFS share to update.
5548 /// Format: projects/{project}/locations/{location}/nfsShares/{nfs_share}
5549 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5550
5551 /// The list of fields to update.
5552 /// The only currently supported fields are:
5553 /// `labels`
5554 /// `allowed_clients`
5555 pub update_mask: std::option::Option<wkt::FieldMask>,
5556
5557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5558}
5559
5560impl UpdateNfsShareRequest {
5561 pub fn new() -> Self {
5562 std::default::Default::default()
5563 }
5564
5565 /// Sets the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5566 ///
5567 /// # Example
5568 /// ```ignore,no_run
5569 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5570 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5571 /// let x = UpdateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5572 /// ```
5573 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5574 where
5575 T: std::convert::Into<crate::model::NfsShare>,
5576 {
5577 self.nfs_share = std::option::Option::Some(v.into());
5578 self
5579 }
5580
5581 /// Sets or clears the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5582 ///
5583 /// # Example
5584 /// ```ignore,no_run
5585 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5586 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5587 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5588 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5589 /// ```
5590 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5591 where
5592 T: std::convert::Into<crate::model::NfsShare>,
5593 {
5594 self.nfs_share = v.map(|x| x.into());
5595 self
5596 }
5597
5598 /// Sets the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5599 ///
5600 /// # Example
5601 /// ```ignore,no_run
5602 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5603 /// use wkt::FieldMask;
5604 /// let x = UpdateNfsShareRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5605 /// ```
5606 pub fn set_update_mask<T>(mut self, v: T) -> Self
5607 where
5608 T: std::convert::Into<wkt::FieldMask>,
5609 {
5610 self.update_mask = std::option::Option::Some(v.into());
5611 self
5612 }
5613
5614 /// Sets or clears the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5615 ///
5616 /// # Example
5617 /// ```ignore,no_run
5618 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5619 /// use wkt::FieldMask;
5620 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5621 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5622 /// ```
5623 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5624 where
5625 T: std::convert::Into<wkt::FieldMask>,
5626 {
5627 self.update_mask = v.map(|x| x.into());
5628 self
5629 }
5630}
5631
5632impl wkt::message::Message for UpdateNfsShareRequest {
5633 fn typename() -> &'static str {
5634 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNfsShareRequest"
5635 }
5636}
5637
5638/// Message requesting rename of a server.
5639#[derive(Clone, Default, PartialEq)]
5640#[non_exhaustive]
5641pub struct RenameNfsShareRequest {
5642 /// Required. The `name` field is used to identify the nfsshare.
5643 /// Format: projects/{project}/locations/{location}/nfsshares/{nfsshare}
5644 pub name: std::string::String,
5645
5646 /// Required. The new `id` of the nfsshare.
5647 pub new_nfsshare_id: std::string::String,
5648
5649 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5650}
5651
5652impl RenameNfsShareRequest {
5653 pub fn new() -> Self {
5654 std::default::Default::default()
5655 }
5656
5657 /// Sets the value of [name][crate::model::RenameNfsShareRequest::name].
5658 ///
5659 /// # Example
5660 /// ```ignore,no_run
5661 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5662 /// let x = RenameNfsShareRequest::new().set_name("example");
5663 /// ```
5664 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5665 self.name = v.into();
5666 self
5667 }
5668
5669 /// Sets the value of [new_nfsshare_id][crate::model::RenameNfsShareRequest::new_nfsshare_id].
5670 ///
5671 /// # Example
5672 /// ```ignore,no_run
5673 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5674 /// let x = RenameNfsShareRequest::new().set_new_nfsshare_id("example");
5675 /// ```
5676 pub fn set_new_nfsshare_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5677 self.new_nfsshare_id = v.into();
5678 self
5679 }
5680}
5681
5682impl wkt::message::Message for RenameNfsShareRequest {
5683 fn typename() -> &'static str {
5684 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNfsShareRequest"
5685 }
5686}
5687
5688/// Message for creating an NFS share.
5689#[derive(Clone, Default, PartialEq)]
5690#[non_exhaustive]
5691pub struct CreateNfsShareRequest {
5692 /// Required. The parent project and location.
5693 pub parent: std::string::String,
5694
5695 /// Required. The NfsShare to create.
5696 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5697
5698 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5699}
5700
5701impl CreateNfsShareRequest {
5702 pub fn new() -> Self {
5703 std::default::Default::default()
5704 }
5705
5706 /// Sets the value of [parent][crate::model::CreateNfsShareRequest::parent].
5707 ///
5708 /// # Example
5709 /// ```ignore,no_run
5710 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5711 /// let x = CreateNfsShareRequest::new().set_parent("example");
5712 /// ```
5713 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5714 self.parent = v.into();
5715 self
5716 }
5717
5718 /// Sets the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5719 ///
5720 /// # Example
5721 /// ```ignore,no_run
5722 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5723 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5724 /// let x = CreateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5725 /// ```
5726 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5727 where
5728 T: std::convert::Into<crate::model::NfsShare>,
5729 {
5730 self.nfs_share = std::option::Option::Some(v.into());
5731 self
5732 }
5733
5734 /// Sets or clears the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5735 ///
5736 /// # Example
5737 /// ```ignore,no_run
5738 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5739 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5740 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5741 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5742 /// ```
5743 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5744 where
5745 T: std::convert::Into<crate::model::NfsShare>,
5746 {
5747 self.nfs_share = v.map(|x| x.into());
5748 self
5749 }
5750}
5751
5752impl wkt::message::Message for CreateNfsShareRequest {
5753 fn typename() -> &'static str {
5754 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateNfsShareRequest"
5755 }
5756}
5757
5758/// Message for deleting an NFS share.
5759#[derive(Clone, Default, PartialEq)]
5760#[non_exhaustive]
5761pub struct DeleteNfsShareRequest {
5762 /// Required. The name of the NFS share to delete.
5763 pub name: std::string::String,
5764
5765 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5766}
5767
5768impl DeleteNfsShareRequest {
5769 pub fn new() -> Self {
5770 std::default::Default::default()
5771 }
5772
5773 /// Sets the value of [name][crate::model::DeleteNfsShareRequest::name].
5774 ///
5775 /// # Example
5776 /// ```ignore,no_run
5777 /// # use google_cloud_baremetalsolution_v2::model::DeleteNfsShareRequest;
5778 /// let x = DeleteNfsShareRequest::new().set_name("example");
5779 /// ```
5780 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5781 self.name = v.into();
5782 self
5783 }
5784}
5785
5786impl wkt::message::Message for DeleteNfsShareRequest {
5787 fn typename() -> &'static str {
5788 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteNfsShareRequest"
5789 }
5790}
5791
5792/// Operation System image.
5793#[derive(Clone, Default, PartialEq)]
5794#[non_exhaustive]
5795pub struct OSImage {
5796 /// Output only. OS Image's unique name.
5797 pub name: std::string::String,
5798
5799 /// OS Image code.
5800 pub code: std::string::String,
5801
5802 /// OS Image description.
5803 pub description: std::string::String,
5804
5805 /// Instance types this image is applicable to.
5806 /// [Available
5807 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
5808 pub applicable_instance_types: std::vec::Vec<std::string::String>,
5809
5810 /// Network templates that can be used with this OS Image.
5811 pub supported_network_templates: std::vec::Vec<std::string::String>,
5812
5813 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5814}
5815
5816impl OSImage {
5817 pub fn new() -> Self {
5818 std::default::Default::default()
5819 }
5820
5821 /// Sets the value of [name][crate::model::OSImage::name].
5822 ///
5823 /// # Example
5824 /// ```ignore,no_run
5825 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5826 /// let x = OSImage::new().set_name("example");
5827 /// ```
5828 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5829 self.name = v.into();
5830 self
5831 }
5832
5833 /// Sets the value of [code][crate::model::OSImage::code].
5834 ///
5835 /// # Example
5836 /// ```ignore,no_run
5837 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5838 /// let x = OSImage::new().set_code("example");
5839 /// ```
5840 pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5841 self.code = v.into();
5842 self
5843 }
5844
5845 /// Sets the value of [description][crate::model::OSImage::description].
5846 ///
5847 /// # Example
5848 /// ```ignore,no_run
5849 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5850 /// let x = OSImage::new().set_description("example");
5851 /// ```
5852 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5853 self.description = v.into();
5854 self
5855 }
5856
5857 /// Sets the value of [applicable_instance_types][crate::model::OSImage::applicable_instance_types].
5858 ///
5859 /// # Example
5860 /// ```ignore,no_run
5861 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5862 /// let x = OSImage::new().set_applicable_instance_types(["a", "b", "c"]);
5863 /// ```
5864 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
5865 where
5866 T: std::iter::IntoIterator<Item = V>,
5867 V: std::convert::Into<std::string::String>,
5868 {
5869 use std::iter::Iterator;
5870 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
5871 self
5872 }
5873
5874 /// Sets the value of [supported_network_templates][crate::model::OSImage::supported_network_templates].
5875 ///
5876 /// # Example
5877 /// ```ignore,no_run
5878 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5879 /// let x = OSImage::new().set_supported_network_templates(["a", "b", "c"]);
5880 /// ```
5881 pub fn set_supported_network_templates<T, V>(mut self, v: T) -> Self
5882 where
5883 T: std::iter::IntoIterator<Item = V>,
5884 V: std::convert::Into<std::string::String>,
5885 {
5886 use std::iter::Iterator;
5887 self.supported_network_templates = v.into_iter().map(|i| i.into()).collect();
5888 self
5889 }
5890}
5891
5892impl wkt::message::Message for OSImage {
5893 fn typename() -> &'static str {
5894 "type.googleapis.com/google.cloud.baremetalsolution.v2.OSImage"
5895 }
5896}
5897
5898/// Request for getting all available OS images.
5899#[derive(Clone, Default, PartialEq)]
5900#[non_exhaustive]
5901pub struct ListOSImagesRequest {
5902 /// Required. Parent value for ListProvisioningQuotasRequest.
5903 pub parent: std::string::String,
5904
5905 /// Requested page size. The server might return fewer items than requested.
5906 /// If unspecified, server will pick an appropriate default.
5907 /// Notice that page_size field is not supported and won't be respected in
5908 /// the API request for now, will be updated when pagination is supported.
5909 pub page_size: i32,
5910
5911 /// A token identifying a page of results from the server.
5912 pub page_token: std::string::String,
5913
5914 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5915}
5916
5917impl ListOSImagesRequest {
5918 pub fn new() -> Self {
5919 std::default::Default::default()
5920 }
5921
5922 /// Sets the value of [parent][crate::model::ListOSImagesRequest::parent].
5923 ///
5924 /// # Example
5925 /// ```ignore,no_run
5926 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5927 /// let x = ListOSImagesRequest::new().set_parent("example");
5928 /// ```
5929 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5930 self.parent = v.into();
5931 self
5932 }
5933
5934 /// Sets the value of [page_size][crate::model::ListOSImagesRequest::page_size].
5935 ///
5936 /// # Example
5937 /// ```ignore,no_run
5938 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5939 /// let x = ListOSImagesRequest::new().set_page_size(42);
5940 /// ```
5941 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5942 self.page_size = v.into();
5943 self
5944 }
5945
5946 /// Sets the value of [page_token][crate::model::ListOSImagesRequest::page_token].
5947 ///
5948 /// # Example
5949 /// ```ignore,no_run
5950 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5951 /// let x = ListOSImagesRequest::new().set_page_token("example");
5952 /// ```
5953 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5954 self.page_token = v.into();
5955 self
5956 }
5957}
5958
5959impl wkt::message::Message for ListOSImagesRequest {
5960 fn typename() -> &'static str {
5961 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesRequest"
5962 }
5963}
5964
5965/// Request for getting all available OS images.
5966#[derive(Clone, Default, PartialEq)]
5967#[non_exhaustive]
5968pub struct ListOSImagesResponse {
5969 /// The OS images available.
5970 pub os_images: std::vec::Vec<crate::model::OSImage>,
5971
5972 /// Token to retrieve the next page of results, or empty if there are no more
5973 /// results in the list.
5974 pub next_page_token: std::string::String,
5975
5976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5977}
5978
5979impl ListOSImagesResponse {
5980 pub fn new() -> Self {
5981 std::default::Default::default()
5982 }
5983
5984 /// Sets the value of [os_images][crate::model::ListOSImagesResponse::os_images].
5985 ///
5986 /// # Example
5987 /// ```ignore,no_run
5988 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
5989 /// use google_cloud_baremetalsolution_v2::model::OSImage;
5990 /// let x = ListOSImagesResponse::new()
5991 /// .set_os_images([
5992 /// OSImage::default()/* use setters */,
5993 /// OSImage::default()/* use (different) setters */,
5994 /// ]);
5995 /// ```
5996 pub fn set_os_images<T, V>(mut self, v: T) -> Self
5997 where
5998 T: std::iter::IntoIterator<Item = V>,
5999 V: std::convert::Into<crate::model::OSImage>,
6000 {
6001 use std::iter::Iterator;
6002 self.os_images = v.into_iter().map(|i| i.into()).collect();
6003 self
6004 }
6005
6006 /// Sets the value of [next_page_token][crate::model::ListOSImagesResponse::next_page_token].
6007 ///
6008 /// # Example
6009 /// ```ignore,no_run
6010 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
6011 /// let x = ListOSImagesResponse::new().set_next_page_token("example");
6012 /// ```
6013 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6014 self.next_page_token = v.into();
6015 self
6016 }
6017}
6018
6019impl wkt::message::Message for ListOSImagesResponse {
6020 fn typename() -> &'static str {
6021 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesResponse"
6022 }
6023}
6024
6025#[doc(hidden)]
6026impl google_cloud_gax::paginator::internal::PageableResponse for ListOSImagesResponse {
6027 type PageItem = crate::model::OSImage;
6028
6029 fn items(self) -> std::vec::Vec<Self::PageItem> {
6030 self.os_images
6031 }
6032
6033 fn next_page_token(&self) -> std::string::String {
6034 use std::clone::Clone;
6035 self.next_page_token.clone()
6036 }
6037}
6038
6039/// A provisioning configuration.
6040#[derive(Clone, Default, PartialEq)]
6041#[non_exhaustive]
6042pub struct ProvisioningConfig {
6043 /// Output only. The system-generated name of the provisioning config. This
6044 /// follows the UUID format.
6045 pub name: std::string::String,
6046
6047 /// Instances to be created.
6048 pub instances: std::vec::Vec<crate::model::InstanceConfig>,
6049
6050 /// Networks to be created.
6051 pub networks: std::vec::Vec<crate::model::NetworkConfig>,
6052
6053 /// Volumes to be created.
6054 pub volumes: std::vec::Vec<crate::model::VolumeConfig>,
6055
6056 /// A generated ticket id to track provisioning request.
6057 pub ticket_id: std::string::String,
6058
6059 /// A service account to enable customers to access instance credentials upon
6060 /// handover.
6061 pub handover_service_account: std::string::String,
6062
6063 /// Email provided to send a confirmation with provisioning config to.
6064 /// Deprecated in favour of email field in request messages.
6065 #[deprecated]
6066 pub email: std::string::String,
6067
6068 /// Output only. State of ProvisioningConfig.
6069 pub state: crate::model::provisioning_config::State,
6070
6071 /// Optional. Location name of this ProvisioningConfig.
6072 /// It is optional only for Intake UI transition period.
6073 pub location: std::string::String,
6074
6075 /// Output only. Last update timestamp.
6076 pub update_time: std::option::Option<wkt::Timestamp>,
6077
6078 /// Output only. URI to Cloud Console UI view of this provisioning config.
6079 pub cloud_console_uri: std::string::String,
6080
6081 /// If true, VPC SC is enabled for the cluster.
6082 pub vpc_sc_enabled: bool,
6083
6084 /// Optional status messages associated with the FAILED state.
6085 pub status_message: std::string::String,
6086
6087 /// Optional. The user-defined identifier of the provisioning config.
6088 pub custom_id: std::string::String,
6089
6090 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6091}
6092
6093impl ProvisioningConfig {
6094 pub fn new() -> Self {
6095 std::default::Default::default()
6096 }
6097
6098 /// Sets the value of [name][crate::model::ProvisioningConfig::name].
6099 ///
6100 /// # Example
6101 /// ```ignore,no_run
6102 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6103 /// let x = ProvisioningConfig::new().set_name("example");
6104 /// ```
6105 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6106 self.name = v.into();
6107 self
6108 }
6109
6110 /// Sets the value of [instances][crate::model::ProvisioningConfig::instances].
6111 ///
6112 /// # Example
6113 /// ```ignore,no_run
6114 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6115 /// use google_cloud_baremetalsolution_v2::model::InstanceConfig;
6116 /// let x = ProvisioningConfig::new()
6117 /// .set_instances([
6118 /// InstanceConfig::default()/* use setters */,
6119 /// InstanceConfig::default()/* use (different) setters */,
6120 /// ]);
6121 /// ```
6122 pub fn set_instances<T, V>(mut self, v: T) -> Self
6123 where
6124 T: std::iter::IntoIterator<Item = V>,
6125 V: std::convert::Into<crate::model::InstanceConfig>,
6126 {
6127 use std::iter::Iterator;
6128 self.instances = v.into_iter().map(|i| i.into()).collect();
6129 self
6130 }
6131
6132 /// Sets the value of [networks][crate::model::ProvisioningConfig::networks].
6133 ///
6134 /// # Example
6135 /// ```ignore,no_run
6136 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6137 /// use google_cloud_baremetalsolution_v2::model::NetworkConfig;
6138 /// let x = ProvisioningConfig::new()
6139 /// .set_networks([
6140 /// NetworkConfig::default()/* use setters */,
6141 /// NetworkConfig::default()/* use (different) setters */,
6142 /// ]);
6143 /// ```
6144 pub fn set_networks<T, V>(mut self, v: T) -> Self
6145 where
6146 T: std::iter::IntoIterator<Item = V>,
6147 V: std::convert::Into<crate::model::NetworkConfig>,
6148 {
6149 use std::iter::Iterator;
6150 self.networks = v.into_iter().map(|i| i.into()).collect();
6151 self
6152 }
6153
6154 /// Sets the value of [volumes][crate::model::ProvisioningConfig::volumes].
6155 ///
6156 /// # Example
6157 /// ```ignore,no_run
6158 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6159 /// use google_cloud_baremetalsolution_v2::model::VolumeConfig;
6160 /// let x = ProvisioningConfig::new()
6161 /// .set_volumes([
6162 /// VolumeConfig::default()/* use setters */,
6163 /// VolumeConfig::default()/* use (different) setters */,
6164 /// ]);
6165 /// ```
6166 pub fn set_volumes<T, V>(mut self, v: T) -> Self
6167 where
6168 T: std::iter::IntoIterator<Item = V>,
6169 V: std::convert::Into<crate::model::VolumeConfig>,
6170 {
6171 use std::iter::Iterator;
6172 self.volumes = v.into_iter().map(|i| i.into()).collect();
6173 self
6174 }
6175
6176 /// Sets the value of [ticket_id][crate::model::ProvisioningConfig::ticket_id].
6177 ///
6178 /// # Example
6179 /// ```ignore,no_run
6180 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6181 /// let x = ProvisioningConfig::new().set_ticket_id("example");
6182 /// ```
6183 pub fn set_ticket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6184 self.ticket_id = v.into();
6185 self
6186 }
6187
6188 /// Sets the value of [handover_service_account][crate::model::ProvisioningConfig::handover_service_account].
6189 ///
6190 /// # Example
6191 /// ```ignore,no_run
6192 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6193 /// let x = ProvisioningConfig::new().set_handover_service_account("example");
6194 /// ```
6195 pub fn set_handover_service_account<T: std::convert::Into<std::string::String>>(
6196 mut self,
6197 v: T,
6198 ) -> Self {
6199 self.handover_service_account = v.into();
6200 self
6201 }
6202
6203 /// Sets the value of [email][crate::model::ProvisioningConfig::email].
6204 ///
6205 /// # Example
6206 /// ```ignore,no_run
6207 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6208 /// let x = ProvisioningConfig::new().set_email("example");
6209 /// ```
6210 #[deprecated]
6211 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6212 self.email = v.into();
6213 self
6214 }
6215
6216 /// Sets the value of [state][crate::model::ProvisioningConfig::state].
6217 ///
6218 /// # Example
6219 /// ```ignore,no_run
6220 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6221 /// use google_cloud_baremetalsolution_v2::model::provisioning_config::State;
6222 /// let x0 = ProvisioningConfig::new().set_state(State::Draft);
6223 /// let x1 = ProvisioningConfig::new().set_state(State::Submitted);
6224 /// let x2 = ProvisioningConfig::new().set_state(State::Provisioning);
6225 /// ```
6226 pub fn set_state<T: std::convert::Into<crate::model::provisioning_config::State>>(
6227 mut self,
6228 v: T,
6229 ) -> Self {
6230 self.state = v.into();
6231 self
6232 }
6233
6234 /// Sets the value of [location][crate::model::ProvisioningConfig::location].
6235 ///
6236 /// # Example
6237 /// ```ignore,no_run
6238 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6239 /// let x = ProvisioningConfig::new().set_location("example");
6240 /// ```
6241 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6242 self.location = v.into();
6243 self
6244 }
6245
6246 /// Sets the value of [update_time][crate::model::ProvisioningConfig::update_time].
6247 ///
6248 /// # Example
6249 /// ```ignore,no_run
6250 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6251 /// use wkt::Timestamp;
6252 /// let x = ProvisioningConfig::new().set_update_time(Timestamp::default()/* use setters */);
6253 /// ```
6254 pub fn set_update_time<T>(mut self, v: T) -> Self
6255 where
6256 T: std::convert::Into<wkt::Timestamp>,
6257 {
6258 self.update_time = std::option::Option::Some(v.into());
6259 self
6260 }
6261
6262 /// Sets or clears the value of [update_time][crate::model::ProvisioningConfig::update_time].
6263 ///
6264 /// # Example
6265 /// ```ignore,no_run
6266 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6267 /// use wkt::Timestamp;
6268 /// let x = ProvisioningConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6269 /// let x = ProvisioningConfig::new().set_or_clear_update_time(None::<Timestamp>);
6270 /// ```
6271 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6272 where
6273 T: std::convert::Into<wkt::Timestamp>,
6274 {
6275 self.update_time = v.map(|x| x.into());
6276 self
6277 }
6278
6279 /// Sets the value of [cloud_console_uri][crate::model::ProvisioningConfig::cloud_console_uri].
6280 ///
6281 /// # Example
6282 /// ```ignore,no_run
6283 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6284 /// let x = ProvisioningConfig::new().set_cloud_console_uri("example");
6285 /// ```
6286 pub fn set_cloud_console_uri<T: std::convert::Into<std::string::String>>(
6287 mut self,
6288 v: T,
6289 ) -> Self {
6290 self.cloud_console_uri = v.into();
6291 self
6292 }
6293
6294 /// Sets the value of [vpc_sc_enabled][crate::model::ProvisioningConfig::vpc_sc_enabled].
6295 ///
6296 /// # Example
6297 /// ```ignore,no_run
6298 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6299 /// let x = ProvisioningConfig::new().set_vpc_sc_enabled(true);
6300 /// ```
6301 pub fn set_vpc_sc_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6302 self.vpc_sc_enabled = v.into();
6303 self
6304 }
6305
6306 /// Sets the value of [status_message][crate::model::ProvisioningConfig::status_message].
6307 ///
6308 /// # Example
6309 /// ```ignore,no_run
6310 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6311 /// let x = ProvisioningConfig::new().set_status_message("example");
6312 /// ```
6313 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6314 self.status_message = v.into();
6315 self
6316 }
6317
6318 /// Sets the value of [custom_id][crate::model::ProvisioningConfig::custom_id].
6319 ///
6320 /// # Example
6321 /// ```ignore,no_run
6322 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6323 /// let x = ProvisioningConfig::new().set_custom_id("example");
6324 /// ```
6325 pub fn set_custom_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6326 self.custom_id = v.into();
6327 self
6328 }
6329}
6330
6331impl wkt::message::Message for ProvisioningConfig {
6332 fn typename() -> &'static str {
6333 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningConfig"
6334 }
6335}
6336
6337/// Defines additional types related to [ProvisioningConfig].
6338pub mod provisioning_config {
6339 #[allow(unused_imports)]
6340 use super::*;
6341
6342 /// The possible states for this ProvisioningConfig.
6343 ///
6344 /// # Working with unknown values
6345 ///
6346 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6347 /// additional enum variants at any time. Adding new variants is not considered
6348 /// a breaking change. Applications should write their code in anticipation of:
6349 ///
6350 /// - New values appearing in future releases of the client library, **and**
6351 /// - New values received dynamically, without application changes.
6352 ///
6353 /// Please consult the [Working with enums] section in the user guide for some
6354 /// guidelines.
6355 ///
6356 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6357 #[derive(Clone, Debug, PartialEq)]
6358 #[non_exhaustive]
6359 pub enum State {
6360 /// State wasn't specified.
6361 Unspecified,
6362 /// ProvisioningConfig is a draft and can be freely modified.
6363 Draft,
6364 /// ProvisioningConfig was already submitted and cannot be modified.
6365 Submitted,
6366 /// ProvisioningConfig was in the provisioning state. Initially this state
6367 /// comes from the work order table in big query when SNOW is used. Later
6368 /// this field can be set by the work order API.
6369 Provisioning,
6370 /// ProvisioningConfig was provisioned, meaning the resources exist.
6371 Provisioned,
6372 /// ProvisioningConfig was validated. A validation tool will be run to
6373 /// set this state.
6374 Validated,
6375 /// ProvisioningConfig was canceled.
6376 Cancelled,
6377 /// The request is submitted for provisioning, with error return.
6378 Failed,
6379 /// If set, the enum was initialized with an unknown value.
6380 ///
6381 /// Applications can examine the value using [State::value] or
6382 /// [State::name].
6383 UnknownValue(state::UnknownValue),
6384 }
6385
6386 #[doc(hidden)]
6387 pub mod state {
6388 #[allow(unused_imports)]
6389 use super::*;
6390 #[derive(Clone, Debug, PartialEq)]
6391 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6392 }
6393
6394 impl State {
6395 /// Gets the enum value.
6396 ///
6397 /// Returns `None` if the enum contains an unknown value deserialized from
6398 /// the string representation of enums.
6399 pub fn value(&self) -> std::option::Option<i32> {
6400 match self {
6401 Self::Unspecified => std::option::Option::Some(0),
6402 Self::Draft => std::option::Option::Some(1),
6403 Self::Submitted => std::option::Option::Some(2),
6404 Self::Provisioning => std::option::Option::Some(3),
6405 Self::Provisioned => std::option::Option::Some(4),
6406 Self::Validated => std::option::Option::Some(5),
6407 Self::Cancelled => std::option::Option::Some(6),
6408 Self::Failed => std::option::Option::Some(7),
6409 Self::UnknownValue(u) => u.0.value(),
6410 }
6411 }
6412
6413 /// Gets the enum value as a string.
6414 ///
6415 /// Returns `None` if the enum contains an unknown value deserialized from
6416 /// the integer representation of enums.
6417 pub fn name(&self) -> std::option::Option<&str> {
6418 match self {
6419 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6420 Self::Draft => std::option::Option::Some("DRAFT"),
6421 Self::Submitted => std::option::Option::Some("SUBMITTED"),
6422 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
6423 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
6424 Self::Validated => std::option::Option::Some("VALIDATED"),
6425 Self::Cancelled => std::option::Option::Some("CANCELLED"),
6426 Self::Failed => std::option::Option::Some("FAILED"),
6427 Self::UnknownValue(u) => u.0.name(),
6428 }
6429 }
6430 }
6431
6432 impl std::default::Default for State {
6433 fn default() -> Self {
6434 use std::convert::From;
6435 Self::from(0)
6436 }
6437 }
6438
6439 impl std::fmt::Display for State {
6440 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6441 wkt::internal::display_enum(f, self.name(), self.value())
6442 }
6443 }
6444
6445 impl std::convert::From<i32> for State {
6446 fn from(value: i32) -> Self {
6447 match value {
6448 0 => Self::Unspecified,
6449 1 => Self::Draft,
6450 2 => Self::Submitted,
6451 3 => Self::Provisioning,
6452 4 => Self::Provisioned,
6453 5 => Self::Validated,
6454 6 => Self::Cancelled,
6455 7 => Self::Failed,
6456 _ => Self::UnknownValue(state::UnknownValue(
6457 wkt::internal::UnknownEnumValue::Integer(value),
6458 )),
6459 }
6460 }
6461 }
6462
6463 impl std::convert::From<&str> for State {
6464 fn from(value: &str) -> Self {
6465 use std::string::ToString;
6466 match value {
6467 "STATE_UNSPECIFIED" => Self::Unspecified,
6468 "DRAFT" => Self::Draft,
6469 "SUBMITTED" => Self::Submitted,
6470 "PROVISIONING" => Self::Provisioning,
6471 "PROVISIONED" => Self::Provisioned,
6472 "VALIDATED" => Self::Validated,
6473 "CANCELLED" => Self::Cancelled,
6474 "FAILED" => Self::Failed,
6475 _ => Self::UnknownValue(state::UnknownValue(
6476 wkt::internal::UnknownEnumValue::String(value.to_string()),
6477 )),
6478 }
6479 }
6480 }
6481
6482 impl serde::ser::Serialize for State {
6483 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6484 where
6485 S: serde::Serializer,
6486 {
6487 match self {
6488 Self::Unspecified => serializer.serialize_i32(0),
6489 Self::Draft => serializer.serialize_i32(1),
6490 Self::Submitted => serializer.serialize_i32(2),
6491 Self::Provisioning => serializer.serialize_i32(3),
6492 Self::Provisioned => serializer.serialize_i32(4),
6493 Self::Validated => serializer.serialize_i32(5),
6494 Self::Cancelled => serializer.serialize_i32(6),
6495 Self::Failed => serializer.serialize_i32(7),
6496 Self::UnknownValue(u) => u.0.serialize(serializer),
6497 }
6498 }
6499 }
6500
6501 impl<'de> serde::de::Deserialize<'de> for State {
6502 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6503 where
6504 D: serde::Deserializer<'de>,
6505 {
6506 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6507 ".google.cloud.baremetalsolution.v2.ProvisioningConfig.State",
6508 ))
6509 }
6510 }
6511}
6512
6513/// Request for SubmitProvisioningConfig.
6514#[derive(Clone, Default, PartialEq)]
6515#[non_exhaustive]
6516pub struct SubmitProvisioningConfigRequest {
6517 /// Required. The parent project and location containing the
6518 /// ProvisioningConfig.
6519 pub parent: std::string::String,
6520
6521 /// Required. The ProvisioningConfig to create.
6522 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6523
6524 /// Optional. Email provided to send a confirmation with provisioning config
6525 /// to.
6526 pub email: std::string::String,
6527
6528 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6529}
6530
6531impl SubmitProvisioningConfigRequest {
6532 pub fn new() -> Self {
6533 std::default::Default::default()
6534 }
6535
6536 /// Sets the value of [parent][crate::model::SubmitProvisioningConfigRequest::parent].
6537 ///
6538 /// # Example
6539 /// ```ignore,no_run
6540 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6541 /// let x = SubmitProvisioningConfigRequest::new().set_parent("example");
6542 /// ```
6543 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6544 self.parent = v.into();
6545 self
6546 }
6547
6548 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6549 ///
6550 /// # Example
6551 /// ```ignore,no_run
6552 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6553 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6554 /// let x = SubmitProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6555 /// ```
6556 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6557 where
6558 T: std::convert::Into<crate::model::ProvisioningConfig>,
6559 {
6560 self.provisioning_config = std::option::Option::Some(v.into());
6561 self
6562 }
6563
6564 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6565 ///
6566 /// # Example
6567 /// ```ignore,no_run
6568 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6569 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6570 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6571 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6572 /// ```
6573 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6574 where
6575 T: std::convert::Into<crate::model::ProvisioningConfig>,
6576 {
6577 self.provisioning_config = v.map(|x| x.into());
6578 self
6579 }
6580
6581 /// Sets the value of [email][crate::model::SubmitProvisioningConfigRequest::email].
6582 ///
6583 /// # Example
6584 /// ```ignore,no_run
6585 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6586 /// let x = SubmitProvisioningConfigRequest::new().set_email("example");
6587 /// ```
6588 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6589 self.email = v.into();
6590 self
6591 }
6592}
6593
6594impl wkt::message::Message for SubmitProvisioningConfigRequest {
6595 fn typename() -> &'static str {
6596 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigRequest"
6597 }
6598}
6599
6600/// Response for SubmitProvisioningConfig.
6601#[derive(Clone, Default, PartialEq)]
6602#[non_exhaustive]
6603pub struct SubmitProvisioningConfigResponse {
6604 /// The submitted provisioning config.
6605 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6606
6607 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6608}
6609
6610impl SubmitProvisioningConfigResponse {
6611 pub fn new() -> Self {
6612 std::default::Default::default()
6613 }
6614
6615 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6616 ///
6617 /// # Example
6618 /// ```ignore,no_run
6619 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6620 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6621 /// let x = SubmitProvisioningConfigResponse::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6622 /// ```
6623 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6624 where
6625 T: std::convert::Into<crate::model::ProvisioningConfig>,
6626 {
6627 self.provisioning_config = std::option::Option::Some(v.into());
6628 self
6629 }
6630
6631 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6632 ///
6633 /// # Example
6634 /// ```ignore,no_run
6635 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6636 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6637 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6638 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6639 /// ```
6640 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6641 where
6642 T: std::convert::Into<crate::model::ProvisioningConfig>,
6643 {
6644 self.provisioning_config = v.map(|x| x.into());
6645 self
6646 }
6647}
6648
6649impl wkt::message::Message for SubmitProvisioningConfigResponse {
6650 fn typename() -> &'static str {
6651 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigResponse"
6652 }
6653}
6654
6655/// A provisioning quota for a given project.
6656#[derive(Clone, Default, PartialEq)]
6657#[non_exhaustive]
6658pub struct ProvisioningQuota {
6659 /// Output only. The name of the provisioning quota.
6660 pub name: std::string::String,
6661
6662 /// The asset type of this provisioning quota.
6663 pub asset_type: crate::model::provisioning_quota::AssetType,
6664
6665 /// The gcp service of the provisioning quota.
6666 pub gcp_service: std::string::String,
6667
6668 /// The specific location of the provisioining quota.
6669 pub location: std::string::String,
6670
6671 /// The available count of the provisioning quota.
6672 pub available_count: i32,
6673
6674 /// The quota of one asset type.
6675 pub quota: std::option::Option<crate::model::provisioning_quota::Quota>,
6676
6677 /// Available quantity based on asset type.
6678 pub availability: std::option::Option<crate::model::provisioning_quota::Availability>,
6679
6680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6681}
6682
6683impl ProvisioningQuota {
6684 pub fn new() -> Self {
6685 std::default::Default::default()
6686 }
6687
6688 /// Sets the value of [name][crate::model::ProvisioningQuota::name].
6689 ///
6690 /// # Example
6691 /// ```ignore,no_run
6692 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6693 /// let x = ProvisioningQuota::new().set_name("example");
6694 /// ```
6695 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6696 self.name = v.into();
6697 self
6698 }
6699
6700 /// Sets the value of [asset_type][crate::model::ProvisioningQuota::asset_type].
6701 ///
6702 /// # Example
6703 /// ```ignore,no_run
6704 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6705 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::AssetType;
6706 /// let x0 = ProvisioningQuota::new().set_asset_type(AssetType::Server);
6707 /// let x1 = ProvisioningQuota::new().set_asset_type(AssetType::Storage);
6708 /// let x2 = ProvisioningQuota::new().set_asset_type(AssetType::Network);
6709 /// ```
6710 pub fn set_asset_type<T: std::convert::Into<crate::model::provisioning_quota::AssetType>>(
6711 mut self,
6712 v: T,
6713 ) -> Self {
6714 self.asset_type = v.into();
6715 self
6716 }
6717
6718 /// Sets the value of [gcp_service][crate::model::ProvisioningQuota::gcp_service].
6719 ///
6720 /// # Example
6721 /// ```ignore,no_run
6722 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6723 /// let x = ProvisioningQuota::new().set_gcp_service("example");
6724 /// ```
6725 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6726 self.gcp_service = v.into();
6727 self
6728 }
6729
6730 /// Sets the value of [location][crate::model::ProvisioningQuota::location].
6731 ///
6732 /// # Example
6733 /// ```ignore,no_run
6734 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6735 /// let x = ProvisioningQuota::new().set_location("example");
6736 /// ```
6737 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6738 self.location = v.into();
6739 self
6740 }
6741
6742 /// Sets the value of [available_count][crate::model::ProvisioningQuota::available_count].
6743 ///
6744 /// # Example
6745 /// ```ignore,no_run
6746 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6747 /// let x = ProvisioningQuota::new().set_available_count(42);
6748 /// ```
6749 pub fn set_available_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6750 self.available_count = v.into();
6751 self
6752 }
6753
6754 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota].
6755 ///
6756 /// Note that all the setters affecting `quota` are mutually
6757 /// exclusive.
6758 ///
6759 /// # Example
6760 /// ```ignore,no_run
6761 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6762 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6763 /// let x = ProvisioningQuota::new().set_quota(Some(
6764 /// google_cloud_baremetalsolution_v2::model::provisioning_quota::Quota::InstanceQuota(InstanceQuota::default().into())));
6765 /// ```
6766 pub fn set_quota<
6767 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Quota>>,
6768 >(
6769 mut self,
6770 v: T,
6771 ) -> Self {
6772 self.quota = v.into();
6773 self
6774 }
6775
6776 /// The value of [quota][crate::model::ProvisioningQuota::quota]
6777 /// if it holds a `InstanceQuota`, `None` if the field is not set or
6778 /// holds a different branch.
6779 pub fn instance_quota(
6780 &self,
6781 ) -> std::option::Option<&std::boxed::Box<crate::model::InstanceQuota>> {
6782 #[allow(unreachable_patterns)]
6783 self.quota.as_ref().and_then(|v| match v {
6784 crate::model::provisioning_quota::Quota::InstanceQuota(v) => {
6785 std::option::Option::Some(v)
6786 }
6787 _ => std::option::Option::None,
6788 })
6789 }
6790
6791 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota]
6792 /// to hold a `InstanceQuota`.
6793 ///
6794 /// Note that all the setters affecting `quota` are
6795 /// mutually exclusive.
6796 ///
6797 /// # Example
6798 /// ```ignore,no_run
6799 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6800 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6801 /// let x = ProvisioningQuota::new().set_instance_quota(InstanceQuota::default()/* use setters */);
6802 /// assert!(x.instance_quota().is_some());
6803 /// ```
6804 pub fn set_instance_quota<
6805 T: std::convert::Into<std::boxed::Box<crate::model::InstanceQuota>>,
6806 >(
6807 mut self,
6808 v: T,
6809 ) -> Self {
6810 self.quota = std::option::Option::Some(
6811 crate::model::provisioning_quota::Quota::InstanceQuota(v.into()),
6812 );
6813 self
6814 }
6815
6816 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability].
6817 ///
6818 /// Note that all the setters affecting `availability` are mutually
6819 /// exclusive.
6820 ///
6821 /// # Example
6822 /// ```ignore,no_run
6823 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6824 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::Availability;
6825 /// let x = ProvisioningQuota::new().set_availability(Some(Availability::ServerCount(42)));
6826 /// ```
6827 pub fn set_availability<
6828 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Availability>>,
6829 >(
6830 mut self,
6831 v: T,
6832 ) -> Self {
6833 self.availability = v.into();
6834 self
6835 }
6836
6837 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6838 /// if it holds a `ServerCount`, `None` if the field is not set or
6839 /// holds a different branch.
6840 pub fn server_count(&self) -> std::option::Option<&i64> {
6841 #[allow(unreachable_patterns)]
6842 self.availability.as_ref().and_then(|v| match v {
6843 crate::model::provisioning_quota::Availability::ServerCount(v) => {
6844 std::option::Option::Some(v)
6845 }
6846 _ => std::option::Option::None,
6847 })
6848 }
6849
6850 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6851 /// to hold a `ServerCount`.
6852 ///
6853 /// Note that all the setters affecting `availability` are
6854 /// mutually exclusive.
6855 ///
6856 /// # Example
6857 /// ```ignore,no_run
6858 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6859 /// let x = ProvisioningQuota::new().set_server_count(42);
6860 /// assert!(x.server_count().is_some());
6861 /// assert!(x.network_bandwidth().is_none());
6862 /// assert!(x.storage_gib().is_none());
6863 /// ```
6864 pub fn set_server_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6865 self.availability = std::option::Option::Some(
6866 crate::model::provisioning_quota::Availability::ServerCount(v.into()),
6867 );
6868 self
6869 }
6870
6871 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6872 /// if it holds a `NetworkBandwidth`, `None` if the field is not set or
6873 /// holds a different branch.
6874 pub fn network_bandwidth(&self) -> std::option::Option<&i64> {
6875 #[allow(unreachable_patterns)]
6876 self.availability.as_ref().and_then(|v| match v {
6877 crate::model::provisioning_quota::Availability::NetworkBandwidth(v) => {
6878 std::option::Option::Some(v)
6879 }
6880 _ => std::option::Option::None,
6881 })
6882 }
6883
6884 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6885 /// to hold a `NetworkBandwidth`.
6886 ///
6887 /// Note that all the setters affecting `availability` are
6888 /// mutually exclusive.
6889 ///
6890 /// # Example
6891 /// ```ignore,no_run
6892 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6893 /// let x = ProvisioningQuota::new().set_network_bandwidth(42);
6894 /// assert!(x.network_bandwidth().is_some());
6895 /// assert!(x.server_count().is_none());
6896 /// assert!(x.storage_gib().is_none());
6897 /// ```
6898 pub fn set_network_bandwidth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6899 self.availability = std::option::Option::Some(
6900 crate::model::provisioning_quota::Availability::NetworkBandwidth(v.into()),
6901 );
6902 self
6903 }
6904
6905 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6906 /// if it holds a `StorageGib`, `None` if the field is not set or
6907 /// holds a different branch.
6908 pub fn storage_gib(&self) -> std::option::Option<&i64> {
6909 #[allow(unreachable_patterns)]
6910 self.availability.as_ref().and_then(|v| match v {
6911 crate::model::provisioning_quota::Availability::StorageGib(v) => {
6912 std::option::Option::Some(v)
6913 }
6914 _ => std::option::Option::None,
6915 })
6916 }
6917
6918 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6919 /// to hold a `StorageGib`.
6920 ///
6921 /// Note that all the setters affecting `availability` are
6922 /// mutually exclusive.
6923 ///
6924 /// # Example
6925 /// ```ignore,no_run
6926 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6927 /// let x = ProvisioningQuota::new().set_storage_gib(42);
6928 /// assert!(x.storage_gib().is_some());
6929 /// assert!(x.server_count().is_none());
6930 /// assert!(x.network_bandwidth().is_none());
6931 /// ```
6932 pub fn set_storage_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6933 self.availability = std::option::Option::Some(
6934 crate::model::provisioning_quota::Availability::StorageGib(v.into()),
6935 );
6936 self
6937 }
6938}
6939
6940impl wkt::message::Message for ProvisioningQuota {
6941 fn typename() -> &'static str {
6942 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningQuota"
6943 }
6944}
6945
6946/// Defines additional types related to [ProvisioningQuota].
6947pub mod provisioning_quota {
6948 #[allow(unused_imports)]
6949 use super::*;
6950
6951 /// The available asset types for intake.
6952 ///
6953 /// # Working with unknown values
6954 ///
6955 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6956 /// additional enum variants at any time. Adding new variants is not considered
6957 /// a breaking change. Applications should write their code in anticipation of:
6958 ///
6959 /// - New values appearing in future releases of the client library, **and**
6960 /// - New values received dynamically, without application changes.
6961 ///
6962 /// Please consult the [Working with enums] section in the user guide for some
6963 /// guidelines.
6964 ///
6965 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6966 #[derive(Clone, Debug, PartialEq)]
6967 #[non_exhaustive]
6968 pub enum AssetType {
6969 /// The unspecified type.
6970 Unspecified,
6971 /// The server asset type.
6972 Server,
6973 /// The storage asset type.
6974 Storage,
6975 /// The network asset type.
6976 Network,
6977 /// If set, the enum was initialized with an unknown value.
6978 ///
6979 /// Applications can examine the value using [AssetType::value] or
6980 /// [AssetType::name].
6981 UnknownValue(asset_type::UnknownValue),
6982 }
6983
6984 #[doc(hidden)]
6985 pub mod asset_type {
6986 #[allow(unused_imports)]
6987 use super::*;
6988 #[derive(Clone, Debug, PartialEq)]
6989 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6990 }
6991
6992 impl AssetType {
6993 /// Gets the enum value.
6994 ///
6995 /// Returns `None` if the enum contains an unknown value deserialized from
6996 /// the string representation of enums.
6997 pub fn value(&self) -> std::option::Option<i32> {
6998 match self {
6999 Self::Unspecified => std::option::Option::Some(0),
7000 Self::Server => std::option::Option::Some(1),
7001 Self::Storage => std::option::Option::Some(2),
7002 Self::Network => std::option::Option::Some(3),
7003 Self::UnknownValue(u) => u.0.value(),
7004 }
7005 }
7006
7007 /// Gets the enum value as a string.
7008 ///
7009 /// Returns `None` if the enum contains an unknown value deserialized from
7010 /// the integer representation of enums.
7011 pub fn name(&self) -> std::option::Option<&str> {
7012 match self {
7013 Self::Unspecified => std::option::Option::Some("ASSET_TYPE_UNSPECIFIED"),
7014 Self::Server => std::option::Option::Some("ASSET_TYPE_SERVER"),
7015 Self::Storage => std::option::Option::Some("ASSET_TYPE_STORAGE"),
7016 Self::Network => std::option::Option::Some("ASSET_TYPE_NETWORK"),
7017 Self::UnknownValue(u) => u.0.name(),
7018 }
7019 }
7020 }
7021
7022 impl std::default::Default for AssetType {
7023 fn default() -> Self {
7024 use std::convert::From;
7025 Self::from(0)
7026 }
7027 }
7028
7029 impl std::fmt::Display for AssetType {
7030 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7031 wkt::internal::display_enum(f, self.name(), self.value())
7032 }
7033 }
7034
7035 impl std::convert::From<i32> for AssetType {
7036 fn from(value: i32) -> Self {
7037 match value {
7038 0 => Self::Unspecified,
7039 1 => Self::Server,
7040 2 => Self::Storage,
7041 3 => Self::Network,
7042 _ => Self::UnknownValue(asset_type::UnknownValue(
7043 wkt::internal::UnknownEnumValue::Integer(value),
7044 )),
7045 }
7046 }
7047 }
7048
7049 impl std::convert::From<&str> for AssetType {
7050 fn from(value: &str) -> Self {
7051 use std::string::ToString;
7052 match value {
7053 "ASSET_TYPE_UNSPECIFIED" => Self::Unspecified,
7054 "ASSET_TYPE_SERVER" => Self::Server,
7055 "ASSET_TYPE_STORAGE" => Self::Storage,
7056 "ASSET_TYPE_NETWORK" => Self::Network,
7057 _ => Self::UnknownValue(asset_type::UnknownValue(
7058 wkt::internal::UnknownEnumValue::String(value.to_string()),
7059 )),
7060 }
7061 }
7062 }
7063
7064 impl serde::ser::Serialize for AssetType {
7065 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7066 where
7067 S: serde::Serializer,
7068 {
7069 match self {
7070 Self::Unspecified => serializer.serialize_i32(0),
7071 Self::Server => serializer.serialize_i32(1),
7072 Self::Storage => serializer.serialize_i32(2),
7073 Self::Network => serializer.serialize_i32(3),
7074 Self::UnknownValue(u) => u.0.serialize(serializer),
7075 }
7076 }
7077 }
7078
7079 impl<'de> serde::de::Deserialize<'de> for AssetType {
7080 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7081 where
7082 D: serde::Deserializer<'de>,
7083 {
7084 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AssetType>::new(
7085 ".google.cloud.baremetalsolution.v2.ProvisioningQuota.AssetType",
7086 ))
7087 }
7088 }
7089
7090 /// The quota of one asset type.
7091 #[derive(Clone, Debug, PartialEq)]
7092 #[non_exhaustive]
7093 pub enum Quota {
7094 /// Instance quota.
7095 InstanceQuota(std::boxed::Box<crate::model::InstanceQuota>),
7096 }
7097
7098 /// Available quantity based on asset type.
7099 #[derive(Clone, Debug, PartialEq)]
7100 #[non_exhaustive]
7101 pub enum Availability {
7102 /// Server count.
7103 ServerCount(i64),
7104 /// Network bandwidth, Gbps
7105 NetworkBandwidth(i64),
7106 /// Storage size (GB).
7107 StorageGib(i64),
7108 }
7109}
7110
7111/// Message for requesting the list of provisioning quotas.
7112#[derive(Clone, Default, PartialEq)]
7113#[non_exhaustive]
7114pub struct ListProvisioningQuotasRequest {
7115 /// Required. Parent value for ListProvisioningQuotasRequest.
7116 pub parent: std::string::String,
7117
7118 /// Requested page size. The server might return fewer items than requested.
7119 /// If unspecified, server will pick an appropriate default.
7120 /// Notice that page_size field is not supported and won't be respected in
7121 /// the API request for now, will be updated when pagination is supported.
7122 pub page_size: i32,
7123
7124 /// A token identifying a page of results from the server.
7125 pub page_token: std::string::String,
7126
7127 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7128}
7129
7130impl ListProvisioningQuotasRequest {
7131 pub fn new() -> Self {
7132 std::default::Default::default()
7133 }
7134
7135 /// Sets the value of [parent][crate::model::ListProvisioningQuotasRequest::parent].
7136 ///
7137 /// # Example
7138 /// ```ignore,no_run
7139 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7140 /// let x = ListProvisioningQuotasRequest::new().set_parent("example");
7141 /// ```
7142 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7143 self.parent = v.into();
7144 self
7145 }
7146
7147 /// Sets the value of [page_size][crate::model::ListProvisioningQuotasRequest::page_size].
7148 ///
7149 /// # Example
7150 /// ```ignore,no_run
7151 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7152 /// let x = ListProvisioningQuotasRequest::new().set_page_size(42);
7153 /// ```
7154 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7155 self.page_size = v.into();
7156 self
7157 }
7158
7159 /// Sets the value of [page_token][crate::model::ListProvisioningQuotasRequest::page_token].
7160 ///
7161 /// # Example
7162 /// ```ignore,no_run
7163 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7164 /// let x = ListProvisioningQuotasRequest::new().set_page_token("example");
7165 /// ```
7166 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7167 self.page_token = v.into();
7168 self
7169 }
7170}
7171
7172impl wkt::message::Message for ListProvisioningQuotasRequest {
7173 fn typename() -> &'static str {
7174 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasRequest"
7175 }
7176}
7177
7178/// Response message for the list of provisioning quotas.
7179#[derive(Clone, Default, PartialEq)]
7180#[non_exhaustive]
7181pub struct ListProvisioningQuotasResponse {
7182 /// The provisioning quotas registered in this project.
7183 pub provisioning_quotas: std::vec::Vec<crate::model::ProvisioningQuota>,
7184
7185 /// Token to retrieve the next page of results, or empty if there are no more
7186 /// results in the list.
7187 pub next_page_token: std::string::String,
7188
7189 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7190}
7191
7192impl ListProvisioningQuotasResponse {
7193 pub fn new() -> Self {
7194 std::default::Default::default()
7195 }
7196
7197 /// Sets the value of [provisioning_quotas][crate::model::ListProvisioningQuotasResponse::provisioning_quotas].
7198 ///
7199 /// # Example
7200 /// ```ignore,no_run
7201 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7202 /// use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7203 /// let x = ListProvisioningQuotasResponse::new()
7204 /// .set_provisioning_quotas([
7205 /// ProvisioningQuota::default()/* use setters */,
7206 /// ProvisioningQuota::default()/* use (different) setters */,
7207 /// ]);
7208 /// ```
7209 pub fn set_provisioning_quotas<T, V>(mut self, v: T) -> Self
7210 where
7211 T: std::iter::IntoIterator<Item = V>,
7212 V: std::convert::Into<crate::model::ProvisioningQuota>,
7213 {
7214 use std::iter::Iterator;
7215 self.provisioning_quotas = v.into_iter().map(|i| i.into()).collect();
7216 self
7217 }
7218
7219 /// Sets the value of [next_page_token][crate::model::ListProvisioningQuotasResponse::next_page_token].
7220 ///
7221 /// # Example
7222 /// ```ignore,no_run
7223 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7224 /// let x = ListProvisioningQuotasResponse::new().set_next_page_token("example");
7225 /// ```
7226 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7227 self.next_page_token = v.into();
7228 self
7229 }
7230}
7231
7232impl wkt::message::Message for ListProvisioningQuotasResponse {
7233 fn typename() -> &'static str {
7234 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasResponse"
7235 }
7236}
7237
7238#[doc(hidden)]
7239impl google_cloud_gax::paginator::internal::PageableResponse for ListProvisioningQuotasResponse {
7240 type PageItem = crate::model::ProvisioningQuota;
7241
7242 fn items(self) -> std::vec::Vec<Self::PageItem> {
7243 self.provisioning_quotas
7244 }
7245
7246 fn next_page_token(&self) -> std::string::String {
7247 use std::clone::Clone;
7248 self.next_page_token.clone()
7249 }
7250}
7251
7252/// Configuration parameters for a new instance.
7253#[derive(Clone, Default, PartialEq)]
7254#[non_exhaustive]
7255pub struct InstanceConfig {
7256 /// Output only. The name of the instance config.
7257 pub name: std::string::String,
7258
7259 /// A transient unique identifier to idenfity an instance within an
7260 /// ProvisioningConfig request.
7261 pub id: std::string::String,
7262
7263 /// Instance type.
7264 /// [Available
7265 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7266 pub instance_type: std::string::String,
7267
7268 /// Whether the instance should be provisioned with Hyperthreading enabled.
7269 pub hyperthreading: bool,
7270
7271 /// OS image to initialize the instance.
7272 /// [Available
7273 /// images](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7274 pub os_image: std::string::String,
7275
7276 /// Client network address. Filled if InstanceConfig.multivlan_config is false.
7277 #[deprecated]
7278 pub client_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7279
7280 /// Private network address, if any. Filled if InstanceConfig.multivlan_config
7281 /// is false.
7282 #[deprecated]
7283 pub private_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7284
7285 /// User note field, it can be used by customers to add additional information
7286 /// for the BMS Ops team .
7287 pub user_note: std::string::String,
7288
7289 /// If true networks can be from different projects of the same vendor account.
7290 pub account_networks_enabled: bool,
7291
7292 /// The type of network configuration on the instance.
7293 pub network_config: crate::model::instance_config::NetworkConfig,
7294
7295 /// Server network template name. Filled if InstanceConfig.multivlan_config is
7296 /// true.
7297 pub network_template: std::string::String,
7298
7299 /// List of logical interfaces for the instance. The number of logical
7300 /// interfaces will be the same as number of hardware bond/nic on the chosen
7301 /// network template. Filled if InstanceConfig.multivlan_config is true.
7302 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
7303
7304 /// List of names of ssh keys used to provision the instance.
7305 pub ssh_key_names: std::vec::Vec<std::string::String>,
7306
7307 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7308}
7309
7310impl InstanceConfig {
7311 pub fn new() -> Self {
7312 std::default::Default::default()
7313 }
7314
7315 /// Sets the value of [name][crate::model::InstanceConfig::name].
7316 ///
7317 /// # Example
7318 /// ```ignore,no_run
7319 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7320 /// let x = InstanceConfig::new().set_name("example");
7321 /// ```
7322 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7323 self.name = v.into();
7324 self
7325 }
7326
7327 /// Sets the value of [id][crate::model::InstanceConfig::id].
7328 ///
7329 /// # Example
7330 /// ```ignore,no_run
7331 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7332 /// let x = InstanceConfig::new().set_id("example");
7333 /// ```
7334 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7335 self.id = v.into();
7336 self
7337 }
7338
7339 /// Sets the value of [instance_type][crate::model::InstanceConfig::instance_type].
7340 ///
7341 /// # Example
7342 /// ```ignore,no_run
7343 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7344 /// let x = InstanceConfig::new().set_instance_type("example");
7345 /// ```
7346 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7347 self.instance_type = v.into();
7348 self
7349 }
7350
7351 /// Sets the value of [hyperthreading][crate::model::InstanceConfig::hyperthreading].
7352 ///
7353 /// # Example
7354 /// ```ignore,no_run
7355 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7356 /// let x = InstanceConfig::new().set_hyperthreading(true);
7357 /// ```
7358 pub fn set_hyperthreading<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7359 self.hyperthreading = v.into();
7360 self
7361 }
7362
7363 /// Sets the value of [os_image][crate::model::InstanceConfig::os_image].
7364 ///
7365 /// # Example
7366 /// ```ignore,no_run
7367 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7368 /// let x = InstanceConfig::new().set_os_image("example");
7369 /// ```
7370 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7371 self.os_image = v.into();
7372 self
7373 }
7374
7375 /// Sets the value of [client_network][crate::model::InstanceConfig::client_network].
7376 ///
7377 /// # Example
7378 /// ```ignore,no_run
7379 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7380 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7381 /// let x = InstanceConfig::new().set_client_network(NetworkAddress::default()/* use setters */);
7382 /// ```
7383 #[deprecated]
7384 pub fn set_client_network<T>(mut self, v: T) -> Self
7385 where
7386 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7387 {
7388 self.client_network = std::option::Option::Some(v.into());
7389 self
7390 }
7391
7392 /// Sets or clears the value of [client_network][crate::model::InstanceConfig::client_network].
7393 ///
7394 /// # Example
7395 /// ```ignore,no_run
7396 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7397 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7398 /// let x = InstanceConfig::new().set_or_clear_client_network(Some(NetworkAddress::default()/* use setters */));
7399 /// let x = InstanceConfig::new().set_or_clear_client_network(None::<NetworkAddress>);
7400 /// ```
7401 #[deprecated]
7402 pub fn set_or_clear_client_network<T>(mut self, v: std::option::Option<T>) -> Self
7403 where
7404 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7405 {
7406 self.client_network = v.map(|x| x.into());
7407 self
7408 }
7409
7410 /// Sets the value of [private_network][crate::model::InstanceConfig::private_network].
7411 ///
7412 /// # Example
7413 /// ```ignore,no_run
7414 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7415 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7416 /// let x = InstanceConfig::new().set_private_network(NetworkAddress::default()/* use setters */);
7417 /// ```
7418 #[deprecated]
7419 pub fn set_private_network<T>(mut self, v: T) -> Self
7420 where
7421 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7422 {
7423 self.private_network = std::option::Option::Some(v.into());
7424 self
7425 }
7426
7427 /// Sets or clears the value of [private_network][crate::model::InstanceConfig::private_network].
7428 ///
7429 /// # Example
7430 /// ```ignore,no_run
7431 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7432 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7433 /// let x = InstanceConfig::new().set_or_clear_private_network(Some(NetworkAddress::default()/* use setters */));
7434 /// let x = InstanceConfig::new().set_or_clear_private_network(None::<NetworkAddress>);
7435 /// ```
7436 #[deprecated]
7437 pub fn set_or_clear_private_network<T>(mut self, v: std::option::Option<T>) -> Self
7438 where
7439 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7440 {
7441 self.private_network = v.map(|x| x.into());
7442 self
7443 }
7444
7445 /// Sets the value of [user_note][crate::model::InstanceConfig::user_note].
7446 ///
7447 /// # Example
7448 /// ```ignore,no_run
7449 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7450 /// let x = InstanceConfig::new().set_user_note("example");
7451 /// ```
7452 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7453 self.user_note = v.into();
7454 self
7455 }
7456
7457 /// Sets the value of [account_networks_enabled][crate::model::InstanceConfig::account_networks_enabled].
7458 ///
7459 /// # Example
7460 /// ```ignore,no_run
7461 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7462 /// let x = InstanceConfig::new().set_account_networks_enabled(true);
7463 /// ```
7464 pub fn set_account_networks_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7465 self.account_networks_enabled = v.into();
7466 self
7467 }
7468
7469 /// Sets the value of [network_config][crate::model::InstanceConfig::network_config].
7470 ///
7471 /// # Example
7472 /// ```ignore,no_run
7473 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7474 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkConfig;
7475 /// let x0 = InstanceConfig::new().set_network_config(NetworkConfig::SingleVlan);
7476 /// let x1 = InstanceConfig::new().set_network_config(NetworkConfig::MultiVlan);
7477 /// ```
7478 pub fn set_network_config<
7479 T: std::convert::Into<crate::model::instance_config::NetworkConfig>,
7480 >(
7481 mut self,
7482 v: T,
7483 ) -> Self {
7484 self.network_config = v.into();
7485 self
7486 }
7487
7488 /// Sets the value of [network_template][crate::model::InstanceConfig::network_template].
7489 ///
7490 /// # Example
7491 /// ```ignore,no_run
7492 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7493 /// let x = InstanceConfig::new().set_network_template("example");
7494 /// ```
7495 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
7496 mut self,
7497 v: T,
7498 ) -> Self {
7499 self.network_template = v.into();
7500 self
7501 }
7502
7503 /// Sets the value of [logical_interfaces][crate::model::InstanceConfig::logical_interfaces].
7504 ///
7505 /// # Example
7506 /// ```ignore,no_run
7507 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7508 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
7509 /// let x = InstanceConfig::new()
7510 /// .set_logical_interfaces([
7511 /// LogicalInterface::default()/* use setters */,
7512 /// LogicalInterface::default()/* use (different) setters */,
7513 /// ]);
7514 /// ```
7515 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
7516 where
7517 T: std::iter::IntoIterator<Item = V>,
7518 V: std::convert::Into<crate::model::LogicalInterface>,
7519 {
7520 use std::iter::Iterator;
7521 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
7522 self
7523 }
7524
7525 /// Sets the value of [ssh_key_names][crate::model::InstanceConfig::ssh_key_names].
7526 ///
7527 /// # Example
7528 /// ```ignore,no_run
7529 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7530 /// let x = InstanceConfig::new().set_ssh_key_names(["a", "b", "c"]);
7531 /// ```
7532 pub fn set_ssh_key_names<T, V>(mut self, v: T) -> Self
7533 where
7534 T: std::iter::IntoIterator<Item = V>,
7535 V: std::convert::Into<std::string::String>,
7536 {
7537 use std::iter::Iterator;
7538 self.ssh_key_names = v.into_iter().map(|i| i.into()).collect();
7539 self
7540 }
7541}
7542
7543impl wkt::message::Message for InstanceConfig {
7544 fn typename() -> &'static str {
7545 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig"
7546 }
7547}
7548
7549/// Defines additional types related to [InstanceConfig].
7550pub mod instance_config {
7551 #[allow(unused_imports)]
7552 use super::*;
7553
7554 /// A network.
7555 #[derive(Clone, Default, PartialEq)]
7556 #[non_exhaustive]
7557 pub struct NetworkAddress {
7558 /// Id of the network to use, within the same ProvisioningConfig request.
7559 pub network_id: std::string::String,
7560
7561 /// IPv4 address to be assigned to the server.
7562 pub address: std::string::String,
7563
7564 /// Name of the existing network to use.
7565 pub existing_network_id: std::string::String,
7566
7567 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7568 }
7569
7570 impl NetworkAddress {
7571 pub fn new() -> Self {
7572 std::default::Default::default()
7573 }
7574
7575 /// Sets the value of [network_id][crate::model::instance_config::NetworkAddress::network_id].
7576 ///
7577 /// # Example
7578 /// ```ignore,no_run
7579 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7580 /// let x = NetworkAddress::new().set_network_id("example");
7581 /// ```
7582 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7583 self.network_id = v.into();
7584 self
7585 }
7586
7587 /// Sets the value of [address][crate::model::instance_config::NetworkAddress::address].
7588 ///
7589 /// # Example
7590 /// ```ignore,no_run
7591 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7592 /// let x = NetworkAddress::new().set_address("example");
7593 /// ```
7594 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7595 self.address = v.into();
7596 self
7597 }
7598
7599 /// Sets the value of [existing_network_id][crate::model::instance_config::NetworkAddress::existing_network_id].
7600 ///
7601 /// # Example
7602 /// ```ignore,no_run
7603 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7604 /// let x = NetworkAddress::new().set_existing_network_id("example");
7605 /// ```
7606 pub fn set_existing_network_id<T: std::convert::Into<std::string::String>>(
7607 mut self,
7608 v: T,
7609 ) -> Self {
7610 self.existing_network_id = v.into();
7611 self
7612 }
7613 }
7614
7615 impl wkt::message::Message for NetworkAddress {
7616 fn typename() -> &'static str {
7617 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig.NetworkAddress"
7618 }
7619 }
7620
7621 /// The network configuration of the instance.
7622 ///
7623 /// # Working with unknown values
7624 ///
7625 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7626 /// additional enum variants at any time. Adding new variants is not considered
7627 /// a breaking change. Applications should write their code in anticipation of:
7628 ///
7629 /// - New values appearing in future releases of the client library, **and**
7630 /// - New values received dynamically, without application changes.
7631 ///
7632 /// Please consult the [Working with enums] section in the user guide for some
7633 /// guidelines.
7634 ///
7635 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7636 #[derive(Clone, Debug, PartialEq)]
7637 #[non_exhaustive]
7638 pub enum NetworkConfig {
7639 /// The unspecified network configuration.
7640 NetworkconfigUnspecified,
7641 /// Instance part of single client network and single private network.
7642 SingleVlan,
7643 /// Instance part of multiple (or single) client networks and private
7644 /// networks.
7645 MultiVlan,
7646 /// If set, the enum was initialized with an unknown value.
7647 ///
7648 /// Applications can examine the value using [NetworkConfig::value] or
7649 /// [NetworkConfig::name].
7650 UnknownValue(network_config::UnknownValue),
7651 }
7652
7653 #[doc(hidden)]
7654 pub mod network_config {
7655 #[allow(unused_imports)]
7656 use super::*;
7657 #[derive(Clone, Debug, PartialEq)]
7658 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7659 }
7660
7661 impl NetworkConfig {
7662 /// Gets the enum value.
7663 ///
7664 /// Returns `None` if the enum contains an unknown value deserialized from
7665 /// the string representation of enums.
7666 pub fn value(&self) -> std::option::Option<i32> {
7667 match self {
7668 Self::NetworkconfigUnspecified => std::option::Option::Some(0),
7669 Self::SingleVlan => std::option::Option::Some(1),
7670 Self::MultiVlan => std::option::Option::Some(2),
7671 Self::UnknownValue(u) => u.0.value(),
7672 }
7673 }
7674
7675 /// Gets the enum value as a string.
7676 ///
7677 /// Returns `None` if the enum contains an unknown value deserialized from
7678 /// the integer representation of enums.
7679 pub fn name(&self) -> std::option::Option<&str> {
7680 match self {
7681 Self::NetworkconfigUnspecified => {
7682 std::option::Option::Some("NETWORKCONFIG_UNSPECIFIED")
7683 }
7684 Self::SingleVlan => std::option::Option::Some("SINGLE_VLAN"),
7685 Self::MultiVlan => std::option::Option::Some("MULTI_VLAN"),
7686 Self::UnknownValue(u) => u.0.name(),
7687 }
7688 }
7689 }
7690
7691 impl std::default::Default for NetworkConfig {
7692 fn default() -> Self {
7693 use std::convert::From;
7694 Self::from(0)
7695 }
7696 }
7697
7698 impl std::fmt::Display for NetworkConfig {
7699 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7700 wkt::internal::display_enum(f, self.name(), self.value())
7701 }
7702 }
7703
7704 impl std::convert::From<i32> for NetworkConfig {
7705 fn from(value: i32) -> Self {
7706 match value {
7707 0 => Self::NetworkconfigUnspecified,
7708 1 => Self::SingleVlan,
7709 2 => Self::MultiVlan,
7710 _ => Self::UnknownValue(network_config::UnknownValue(
7711 wkt::internal::UnknownEnumValue::Integer(value),
7712 )),
7713 }
7714 }
7715 }
7716
7717 impl std::convert::From<&str> for NetworkConfig {
7718 fn from(value: &str) -> Self {
7719 use std::string::ToString;
7720 match value {
7721 "NETWORKCONFIG_UNSPECIFIED" => Self::NetworkconfigUnspecified,
7722 "SINGLE_VLAN" => Self::SingleVlan,
7723 "MULTI_VLAN" => Self::MultiVlan,
7724 _ => Self::UnknownValue(network_config::UnknownValue(
7725 wkt::internal::UnknownEnumValue::String(value.to_string()),
7726 )),
7727 }
7728 }
7729 }
7730
7731 impl serde::ser::Serialize for NetworkConfig {
7732 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7733 where
7734 S: serde::Serializer,
7735 {
7736 match self {
7737 Self::NetworkconfigUnspecified => serializer.serialize_i32(0),
7738 Self::SingleVlan => serializer.serialize_i32(1),
7739 Self::MultiVlan => serializer.serialize_i32(2),
7740 Self::UnknownValue(u) => u.0.serialize(serializer),
7741 }
7742 }
7743 }
7744
7745 impl<'de> serde::de::Deserialize<'de> for NetworkConfig {
7746 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7747 where
7748 D: serde::Deserializer<'de>,
7749 {
7750 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NetworkConfig>::new(
7751 ".google.cloud.baremetalsolution.v2.InstanceConfig.NetworkConfig",
7752 ))
7753 }
7754 }
7755}
7756
7757/// Configuration parameters for a new volume.
7758#[derive(Clone, Default, PartialEq)]
7759#[non_exhaustive]
7760pub struct VolumeConfig {
7761 /// Output only. The name of the volume config.
7762 pub name: std::string::String,
7763
7764 /// A transient unique identifier to identify a volume within an
7765 /// ProvisioningConfig request.
7766 pub id: std::string::String,
7767
7768 /// Whether snapshots should be enabled.
7769 pub snapshots_enabled: bool,
7770
7771 /// The type of this Volume.
7772 pub r#type: crate::model::volume_config::Type,
7773
7774 /// Volume protocol.
7775 pub protocol: crate::model::volume_config::Protocol,
7776
7777 /// The requested size of this volume, in GB.
7778 pub size_gb: i32,
7779
7780 /// LUN ranges to be configured. Set only when protocol is PROTOCOL_FC.
7781 pub lun_ranges: std::vec::Vec<crate::model::volume_config::LunRange>,
7782
7783 /// Machine ids connected to this volume. Set only when protocol is
7784 /// PROTOCOL_FC.
7785 pub machine_ids: std::vec::Vec<std::string::String>,
7786
7787 /// NFS exports. Set only when protocol is PROTOCOL_NFS.
7788 pub nfs_exports: std::vec::Vec<crate::model::volume_config::NfsExport>,
7789
7790 /// User note field, it can be used by customers to add additional information
7791 /// for the BMS Ops team .
7792 pub user_note: std::string::String,
7793
7794 /// The GCP service of the storage volume. Available gcp_service are in
7795 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
7796 pub gcp_service: std::string::String,
7797
7798 /// Performance tier of the Volume.
7799 /// Default is SHARED.
7800 pub performance_tier: crate::model::VolumePerformanceTier,
7801
7802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7803}
7804
7805impl VolumeConfig {
7806 pub fn new() -> Self {
7807 std::default::Default::default()
7808 }
7809
7810 /// Sets the value of [name][crate::model::VolumeConfig::name].
7811 ///
7812 /// # Example
7813 /// ```ignore,no_run
7814 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7815 /// let x = VolumeConfig::new().set_name("example");
7816 /// ```
7817 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7818 self.name = v.into();
7819 self
7820 }
7821
7822 /// Sets the value of [id][crate::model::VolumeConfig::id].
7823 ///
7824 /// # Example
7825 /// ```ignore,no_run
7826 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7827 /// let x = VolumeConfig::new().set_id("example");
7828 /// ```
7829 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7830 self.id = v.into();
7831 self
7832 }
7833
7834 /// Sets the value of [snapshots_enabled][crate::model::VolumeConfig::snapshots_enabled].
7835 ///
7836 /// # Example
7837 /// ```ignore,no_run
7838 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7839 /// let x = VolumeConfig::new().set_snapshots_enabled(true);
7840 /// ```
7841 pub fn set_snapshots_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7842 self.snapshots_enabled = v.into();
7843 self
7844 }
7845
7846 /// Sets the value of [r#type][crate::model::VolumeConfig::type].
7847 ///
7848 /// # Example
7849 /// ```ignore,no_run
7850 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7851 /// use google_cloud_baremetalsolution_v2::model::volume_config::Type;
7852 /// let x0 = VolumeConfig::new().set_type(Type::Flash);
7853 /// let x1 = VolumeConfig::new().set_type(Type::Disk);
7854 /// ```
7855 pub fn set_type<T: std::convert::Into<crate::model::volume_config::Type>>(
7856 mut self,
7857 v: T,
7858 ) -> Self {
7859 self.r#type = v.into();
7860 self
7861 }
7862
7863 /// Sets the value of [protocol][crate::model::VolumeConfig::protocol].
7864 ///
7865 /// # Example
7866 /// ```ignore,no_run
7867 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7868 /// use google_cloud_baremetalsolution_v2::model::volume_config::Protocol;
7869 /// let x0 = VolumeConfig::new().set_protocol(Protocol::Fc);
7870 /// let x1 = VolumeConfig::new().set_protocol(Protocol::Nfs);
7871 /// ```
7872 pub fn set_protocol<T: std::convert::Into<crate::model::volume_config::Protocol>>(
7873 mut self,
7874 v: T,
7875 ) -> Self {
7876 self.protocol = v.into();
7877 self
7878 }
7879
7880 /// Sets the value of [size_gb][crate::model::VolumeConfig::size_gb].
7881 ///
7882 /// # Example
7883 /// ```ignore,no_run
7884 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7885 /// let x = VolumeConfig::new().set_size_gb(42);
7886 /// ```
7887 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7888 self.size_gb = v.into();
7889 self
7890 }
7891
7892 /// Sets the value of [lun_ranges][crate::model::VolumeConfig::lun_ranges].
7893 ///
7894 /// # Example
7895 /// ```ignore,no_run
7896 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7897 /// use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
7898 /// let x = VolumeConfig::new()
7899 /// .set_lun_ranges([
7900 /// LunRange::default()/* use setters */,
7901 /// LunRange::default()/* use (different) setters */,
7902 /// ]);
7903 /// ```
7904 pub fn set_lun_ranges<T, V>(mut self, v: T) -> Self
7905 where
7906 T: std::iter::IntoIterator<Item = V>,
7907 V: std::convert::Into<crate::model::volume_config::LunRange>,
7908 {
7909 use std::iter::Iterator;
7910 self.lun_ranges = v.into_iter().map(|i| i.into()).collect();
7911 self
7912 }
7913
7914 /// Sets the value of [machine_ids][crate::model::VolumeConfig::machine_ids].
7915 ///
7916 /// # Example
7917 /// ```ignore,no_run
7918 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7919 /// let x = VolumeConfig::new().set_machine_ids(["a", "b", "c"]);
7920 /// ```
7921 pub fn set_machine_ids<T, V>(mut self, v: T) -> Self
7922 where
7923 T: std::iter::IntoIterator<Item = V>,
7924 V: std::convert::Into<std::string::String>,
7925 {
7926 use std::iter::Iterator;
7927 self.machine_ids = v.into_iter().map(|i| i.into()).collect();
7928 self
7929 }
7930
7931 /// Sets the value of [nfs_exports][crate::model::VolumeConfig::nfs_exports].
7932 ///
7933 /// # Example
7934 /// ```ignore,no_run
7935 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7936 /// use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
7937 /// let x = VolumeConfig::new()
7938 /// .set_nfs_exports([
7939 /// NfsExport::default()/* use setters */,
7940 /// NfsExport::default()/* use (different) setters */,
7941 /// ]);
7942 /// ```
7943 pub fn set_nfs_exports<T, V>(mut self, v: T) -> Self
7944 where
7945 T: std::iter::IntoIterator<Item = V>,
7946 V: std::convert::Into<crate::model::volume_config::NfsExport>,
7947 {
7948 use std::iter::Iterator;
7949 self.nfs_exports = v.into_iter().map(|i| i.into()).collect();
7950 self
7951 }
7952
7953 /// Sets the value of [user_note][crate::model::VolumeConfig::user_note].
7954 ///
7955 /// # Example
7956 /// ```ignore,no_run
7957 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7958 /// let x = VolumeConfig::new().set_user_note("example");
7959 /// ```
7960 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7961 self.user_note = v.into();
7962 self
7963 }
7964
7965 /// Sets the value of [gcp_service][crate::model::VolumeConfig::gcp_service].
7966 ///
7967 /// # Example
7968 /// ```ignore,no_run
7969 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7970 /// let x = VolumeConfig::new().set_gcp_service("example");
7971 /// ```
7972 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7973 self.gcp_service = v.into();
7974 self
7975 }
7976
7977 /// Sets the value of [performance_tier][crate::model::VolumeConfig::performance_tier].
7978 ///
7979 /// # Example
7980 /// ```ignore,no_run
7981 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7982 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
7983 /// let x0 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Shared);
7984 /// let x1 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Assigned);
7985 /// let x2 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Ht);
7986 /// ```
7987 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
7988 mut self,
7989 v: T,
7990 ) -> Self {
7991 self.performance_tier = v.into();
7992 self
7993 }
7994}
7995
7996impl wkt::message::Message for VolumeConfig {
7997 fn typename() -> &'static str {
7998 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig"
7999 }
8000}
8001
8002/// Defines additional types related to [VolumeConfig].
8003pub mod volume_config {
8004 #[allow(unused_imports)]
8005 use super::*;
8006
8007 /// A LUN(Logical Unit Number) range.
8008 #[derive(Clone, Default, PartialEq)]
8009 #[non_exhaustive]
8010 pub struct LunRange {
8011 /// Number of LUNs to create.
8012 pub quantity: i32,
8013
8014 /// The requested size of each LUN, in GB.
8015 pub size_gb: i32,
8016
8017 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8018 }
8019
8020 impl LunRange {
8021 pub fn new() -> Self {
8022 std::default::Default::default()
8023 }
8024
8025 /// Sets the value of [quantity][crate::model::volume_config::LunRange::quantity].
8026 ///
8027 /// # Example
8028 /// ```ignore,no_run
8029 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8030 /// let x = LunRange::new().set_quantity(42);
8031 /// ```
8032 pub fn set_quantity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8033 self.quantity = v.into();
8034 self
8035 }
8036
8037 /// Sets the value of [size_gb][crate::model::volume_config::LunRange::size_gb].
8038 ///
8039 /// # Example
8040 /// ```ignore,no_run
8041 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8042 /// let x = LunRange::new().set_size_gb(42);
8043 /// ```
8044 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8045 self.size_gb = v.into();
8046 self
8047 }
8048 }
8049
8050 impl wkt::message::Message for LunRange {
8051 fn typename() -> &'static str {
8052 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.LunRange"
8053 }
8054 }
8055
8056 /// A NFS export entry.
8057 #[derive(Clone, Default, PartialEq)]
8058 #[non_exhaustive]
8059 pub struct NfsExport {
8060 /// Network to use to publish the export.
8061 pub network_id: std::string::String,
8062
8063 /// Export permissions.
8064 pub permissions: crate::model::volume_config::nfs_export::Permissions,
8065
8066 /// Disable root squashing, which is a feature of NFS.
8067 /// Root squash is a special mapping of the remote superuser (root) identity
8068 /// when using identity authentication.
8069 pub no_root_squash: bool,
8070
8071 /// Allow the setuid flag.
8072 pub allow_suid: bool,
8073
8074 /// Allow dev flag in NfsShare AllowedClientsRequest.
8075 pub allow_dev: bool,
8076
8077 /// A client object.
8078 pub client: std::option::Option<crate::model::volume_config::nfs_export::Client>,
8079
8080 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8081 }
8082
8083 impl NfsExport {
8084 pub fn new() -> Self {
8085 std::default::Default::default()
8086 }
8087
8088 /// Sets the value of [network_id][crate::model::volume_config::NfsExport::network_id].
8089 ///
8090 /// # Example
8091 /// ```ignore,no_run
8092 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8093 /// let x = NfsExport::new().set_network_id("example");
8094 /// ```
8095 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8096 self.network_id = v.into();
8097 self
8098 }
8099
8100 /// Sets the value of [permissions][crate::model::volume_config::NfsExport::permissions].
8101 ///
8102 /// # Example
8103 /// ```ignore,no_run
8104 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8105 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Permissions;
8106 /// let x0 = NfsExport::new().set_permissions(Permissions::ReadOnly);
8107 /// let x1 = NfsExport::new().set_permissions(Permissions::ReadWrite);
8108 /// ```
8109 pub fn set_permissions<
8110 T: std::convert::Into<crate::model::volume_config::nfs_export::Permissions>,
8111 >(
8112 mut self,
8113 v: T,
8114 ) -> Self {
8115 self.permissions = v.into();
8116 self
8117 }
8118
8119 /// Sets the value of [no_root_squash][crate::model::volume_config::NfsExport::no_root_squash].
8120 ///
8121 /// # Example
8122 /// ```ignore,no_run
8123 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8124 /// let x = NfsExport::new().set_no_root_squash(true);
8125 /// ```
8126 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8127 self.no_root_squash = v.into();
8128 self
8129 }
8130
8131 /// Sets the value of [allow_suid][crate::model::volume_config::NfsExport::allow_suid].
8132 ///
8133 /// # Example
8134 /// ```ignore,no_run
8135 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8136 /// let x = NfsExport::new().set_allow_suid(true);
8137 /// ```
8138 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8139 self.allow_suid = v.into();
8140 self
8141 }
8142
8143 /// Sets the value of [allow_dev][crate::model::volume_config::NfsExport::allow_dev].
8144 ///
8145 /// # Example
8146 /// ```ignore,no_run
8147 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8148 /// let x = NfsExport::new().set_allow_dev(true);
8149 /// ```
8150 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8151 self.allow_dev = v.into();
8152 self
8153 }
8154
8155 /// Sets the value of [client][crate::model::volume_config::NfsExport::client].
8156 ///
8157 /// Note that all the setters affecting `client` are mutually
8158 /// exclusive.
8159 ///
8160 /// # Example
8161 /// ```ignore,no_run
8162 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8163 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Client;
8164 /// let x = NfsExport::new().set_client(Some(Client::MachineId("example".to_string())));
8165 /// ```
8166 pub fn set_client<
8167 T: std::convert::Into<
8168 std::option::Option<crate::model::volume_config::nfs_export::Client>,
8169 >,
8170 >(
8171 mut self,
8172 v: T,
8173 ) -> Self {
8174 self.client = v.into();
8175 self
8176 }
8177
8178 /// The value of [client][crate::model::volume_config::NfsExport::client]
8179 /// if it holds a `MachineId`, `None` if the field is not set or
8180 /// holds a different branch.
8181 pub fn machine_id(&self) -> std::option::Option<&std::string::String> {
8182 #[allow(unreachable_patterns)]
8183 self.client.as_ref().and_then(|v| match v {
8184 crate::model::volume_config::nfs_export::Client::MachineId(v) => {
8185 std::option::Option::Some(v)
8186 }
8187 _ => std::option::Option::None,
8188 })
8189 }
8190
8191 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8192 /// to hold a `MachineId`.
8193 ///
8194 /// Note that all the setters affecting `client` are
8195 /// mutually exclusive.
8196 ///
8197 /// # Example
8198 /// ```ignore,no_run
8199 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8200 /// let x = NfsExport::new().set_machine_id("example");
8201 /// assert!(x.machine_id().is_some());
8202 /// assert!(x.cidr().is_none());
8203 /// ```
8204 pub fn set_machine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8205 self.client = std::option::Option::Some(
8206 crate::model::volume_config::nfs_export::Client::MachineId(v.into()),
8207 );
8208 self
8209 }
8210
8211 /// The value of [client][crate::model::volume_config::NfsExport::client]
8212 /// if it holds a `Cidr`, `None` if the field is not set or
8213 /// holds a different branch.
8214 pub fn cidr(&self) -> std::option::Option<&std::string::String> {
8215 #[allow(unreachable_patterns)]
8216 self.client.as_ref().and_then(|v| match v {
8217 crate::model::volume_config::nfs_export::Client::Cidr(v) => {
8218 std::option::Option::Some(v)
8219 }
8220 _ => std::option::Option::None,
8221 })
8222 }
8223
8224 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8225 /// to hold a `Cidr`.
8226 ///
8227 /// Note that all the setters affecting `client` are
8228 /// mutually exclusive.
8229 ///
8230 /// # Example
8231 /// ```ignore,no_run
8232 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8233 /// let x = NfsExport::new().set_cidr("example");
8234 /// assert!(x.cidr().is_some());
8235 /// assert!(x.machine_id().is_none());
8236 /// ```
8237 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8238 self.client = std::option::Option::Some(
8239 crate::model::volume_config::nfs_export::Client::Cidr(v.into()),
8240 );
8241 self
8242 }
8243 }
8244
8245 impl wkt::message::Message for NfsExport {
8246 fn typename() -> &'static str {
8247 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport"
8248 }
8249 }
8250
8251 /// Defines additional types related to [NfsExport].
8252 pub mod nfs_export {
8253 #[allow(unused_imports)]
8254 use super::*;
8255
8256 /// Permissions that can granted for an export.
8257 ///
8258 /// # Working with unknown values
8259 ///
8260 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8261 /// additional enum variants at any time. Adding new variants is not considered
8262 /// a breaking change. Applications should write their code in anticipation of:
8263 ///
8264 /// - New values appearing in future releases of the client library, **and**
8265 /// - New values received dynamically, without application changes.
8266 ///
8267 /// Please consult the [Working with enums] section in the user guide for some
8268 /// guidelines.
8269 ///
8270 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8271 #[derive(Clone, Debug, PartialEq)]
8272 #[non_exhaustive]
8273 pub enum Permissions {
8274 /// Unspecified value.
8275 Unspecified,
8276 /// Read-only permission.
8277 ReadOnly,
8278 /// Read-write permission.
8279 ReadWrite,
8280 /// If set, the enum was initialized with an unknown value.
8281 ///
8282 /// Applications can examine the value using [Permissions::value] or
8283 /// [Permissions::name].
8284 UnknownValue(permissions::UnknownValue),
8285 }
8286
8287 #[doc(hidden)]
8288 pub mod permissions {
8289 #[allow(unused_imports)]
8290 use super::*;
8291 #[derive(Clone, Debug, PartialEq)]
8292 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8293 }
8294
8295 impl Permissions {
8296 /// Gets the enum value.
8297 ///
8298 /// Returns `None` if the enum contains an unknown value deserialized from
8299 /// the string representation of enums.
8300 pub fn value(&self) -> std::option::Option<i32> {
8301 match self {
8302 Self::Unspecified => std::option::Option::Some(0),
8303 Self::ReadOnly => std::option::Option::Some(1),
8304 Self::ReadWrite => std::option::Option::Some(2),
8305 Self::UnknownValue(u) => u.0.value(),
8306 }
8307 }
8308
8309 /// Gets the enum value as a string.
8310 ///
8311 /// Returns `None` if the enum contains an unknown value deserialized from
8312 /// the integer representation of enums.
8313 pub fn name(&self) -> std::option::Option<&str> {
8314 match self {
8315 Self::Unspecified => std::option::Option::Some("PERMISSIONS_UNSPECIFIED"),
8316 Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
8317 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
8318 Self::UnknownValue(u) => u.0.name(),
8319 }
8320 }
8321 }
8322
8323 impl std::default::Default for Permissions {
8324 fn default() -> Self {
8325 use std::convert::From;
8326 Self::from(0)
8327 }
8328 }
8329
8330 impl std::fmt::Display for Permissions {
8331 fn fmt(
8332 &self,
8333 f: &mut std::fmt::Formatter<'_>,
8334 ) -> std::result::Result<(), std::fmt::Error> {
8335 wkt::internal::display_enum(f, self.name(), self.value())
8336 }
8337 }
8338
8339 impl std::convert::From<i32> for Permissions {
8340 fn from(value: i32) -> Self {
8341 match value {
8342 0 => Self::Unspecified,
8343 1 => Self::ReadOnly,
8344 2 => Self::ReadWrite,
8345 _ => Self::UnknownValue(permissions::UnknownValue(
8346 wkt::internal::UnknownEnumValue::Integer(value),
8347 )),
8348 }
8349 }
8350 }
8351
8352 impl std::convert::From<&str> for Permissions {
8353 fn from(value: &str) -> Self {
8354 use std::string::ToString;
8355 match value {
8356 "PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
8357 "READ_ONLY" => Self::ReadOnly,
8358 "READ_WRITE" => Self::ReadWrite,
8359 _ => Self::UnknownValue(permissions::UnknownValue(
8360 wkt::internal::UnknownEnumValue::String(value.to_string()),
8361 )),
8362 }
8363 }
8364 }
8365
8366 impl serde::ser::Serialize for Permissions {
8367 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8368 where
8369 S: serde::Serializer,
8370 {
8371 match self {
8372 Self::Unspecified => serializer.serialize_i32(0),
8373 Self::ReadOnly => serializer.serialize_i32(1),
8374 Self::ReadWrite => serializer.serialize_i32(2),
8375 Self::UnknownValue(u) => u.0.serialize(serializer),
8376 }
8377 }
8378 }
8379
8380 impl<'de> serde::de::Deserialize<'de> for Permissions {
8381 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8382 where
8383 D: serde::Deserializer<'de>,
8384 {
8385 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Permissions>::new(
8386 ".google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport.Permissions",
8387 ))
8388 }
8389 }
8390
8391 /// A client object.
8392 #[derive(Clone, Debug, PartialEq)]
8393 #[non_exhaustive]
8394 pub enum Client {
8395 /// Either a single machine, identified by an ID, or a comma-separated
8396 /// list of machine IDs.
8397 MachineId(std::string::String),
8398 /// A CIDR range.
8399 Cidr(std::string::String),
8400 }
8401 }
8402
8403 /// The types of Volumes.
8404 ///
8405 /// # Working with unknown values
8406 ///
8407 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8408 /// additional enum variants at any time. Adding new variants is not considered
8409 /// a breaking change. Applications should write their code in anticipation of:
8410 ///
8411 /// - New values appearing in future releases of the client library, **and**
8412 /// - New values received dynamically, without application changes.
8413 ///
8414 /// Please consult the [Working with enums] section in the user guide for some
8415 /// guidelines.
8416 ///
8417 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8418 #[derive(Clone, Debug, PartialEq)]
8419 #[non_exhaustive]
8420 pub enum Type {
8421 /// The unspecified type.
8422 Unspecified,
8423 /// This Volume is on flash.
8424 Flash,
8425 /// This Volume is on disk.
8426 Disk,
8427 /// If set, the enum was initialized with an unknown value.
8428 ///
8429 /// Applications can examine the value using [Type::value] or
8430 /// [Type::name].
8431 UnknownValue(r#type::UnknownValue),
8432 }
8433
8434 #[doc(hidden)]
8435 pub mod r#type {
8436 #[allow(unused_imports)]
8437 use super::*;
8438 #[derive(Clone, Debug, PartialEq)]
8439 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8440 }
8441
8442 impl Type {
8443 /// Gets the enum value.
8444 ///
8445 /// Returns `None` if the enum contains an unknown value deserialized from
8446 /// the string representation of enums.
8447 pub fn value(&self) -> std::option::Option<i32> {
8448 match self {
8449 Self::Unspecified => std::option::Option::Some(0),
8450 Self::Flash => std::option::Option::Some(1),
8451 Self::Disk => std::option::Option::Some(2),
8452 Self::UnknownValue(u) => u.0.value(),
8453 }
8454 }
8455
8456 /// Gets the enum value as a string.
8457 ///
8458 /// Returns `None` if the enum contains an unknown value deserialized from
8459 /// the integer representation of enums.
8460 pub fn name(&self) -> std::option::Option<&str> {
8461 match self {
8462 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8463 Self::Flash => std::option::Option::Some("FLASH"),
8464 Self::Disk => std::option::Option::Some("DISK"),
8465 Self::UnknownValue(u) => u.0.name(),
8466 }
8467 }
8468 }
8469
8470 impl std::default::Default for Type {
8471 fn default() -> Self {
8472 use std::convert::From;
8473 Self::from(0)
8474 }
8475 }
8476
8477 impl std::fmt::Display for Type {
8478 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8479 wkt::internal::display_enum(f, self.name(), self.value())
8480 }
8481 }
8482
8483 impl std::convert::From<i32> for Type {
8484 fn from(value: i32) -> Self {
8485 match value {
8486 0 => Self::Unspecified,
8487 1 => Self::Flash,
8488 2 => Self::Disk,
8489 _ => Self::UnknownValue(r#type::UnknownValue(
8490 wkt::internal::UnknownEnumValue::Integer(value),
8491 )),
8492 }
8493 }
8494 }
8495
8496 impl std::convert::From<&str> for Type {
8497 fn from(value: &str) -> Self {
8498 use std::string::ToString;
8499 match value {
8500 "TYPE_UNSPECIFIED" => Self::Unspecified,
8501 "FLASH" => Self::Flash,
8502 "DISK" => Self::Disk,
8503 _ => Self::UnknownValue(r#type::UnknownValue(
8504 wkt::internal::UnknownEnumValue::String(value.to_string()),
8505 )),
8506 }
8507 }
8508 }
8509
8510 impl serde::ser::Serialize for Type {
8511 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8512 where
8513 S: serde::Serializer,
8514 {
8515 match self {
8516 Self::Unspecified => serializer.serialize_i32(0),
8517 Self::Flash => serializer.serialize_i32(1),
8518 Self::Disk => serializer.serialize_i32(2),
8519 Self::UnknownValue(u) => u.0.serialize(serializer),
8520 }
8521 }
8522 }
8523
8524 impl<'de> serde::de::Deserialize<'de> for Type {
8525 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8526 where
8527 D: serde::Deserializer<'de>,
8528 {
8529 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
8530 ".google.cloud.baremetalsolution.v2.VolumeConfig.Type",
8531 ))
8532 }
8533 }
8534
8535 /// The protocol used to access the volume.
8536 ///
8537 /// # Working with unknown values
8538 ///
8539 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8540 /// additional enum variants at any time. Adding new variants is not considered
8541 /// a breaking change. Applications should write their code in anticipation of:
8542 ///
8543 /// - New values appearing in future releases of the client library, **and**
8544 /// - New values received dynamically, without application changes.
8545 ///
8546 /// Please consult the [Working with enums] section in the user guide for some
8547 /// guidelines.
8548 ///
8549 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8550 #[derive(Clone, Debug, PartialEq)]
8551 #[non_exhaustive]
8552 pub enum Protocol {
8553 /// Unspecified value.
8554 Unspecified,
8555 /// Fibre channel.
8556 Fc,
8557 /// Network file system.
8558 Nfs,
8559 /// If set, the enum was initialized with an unknown value.
8560 ///
8561 /// Applications can examine the value using [Protocol::value] or
8562 /// [Protocol::name].
8563 UnknownValue(protocol::UnknownValue),
8564 }
8565
8566 #[doc(hidden)]
8567 pub mod protocol {
8568 #[allow(unused_imports)]
8569 use super::*;
8570 #[derive(Clone, Debug, PartialEq)]
8571 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8572 }
8573
8574 impl Protocol {
8575 /// Gets the enum value.
8576 ///
8577 /// Returns `None` if the enum contains an unknown value deserialized from
8578 /// the string representation of enums.
8579 pub fn value(&self) -> std::option::Option<i32> {
8580 match self {
8581 Self::Unspecified => std::option::Option::Some(0),
8582 Self::Fc => std::option::Option::Some(1),
8583 Self::Nfs => std::option::Option::Some(2),
8584 Self::UnknownValue(u) => u.0.value(),
8585 }
8586 }
8587
8588 /// Gets the enum value as a string.
8589 ///
8590 /// Returns `None` if the enum contains an unknown value deserialized from
8591 /// the integer representation of enums.
8592 pub fn name(&self) -> std::option::Option<&str> {
8593 match self {
8594 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
8595 Self::Fc => std::option::Option::Some("PROTOCOL_FC"),
8596 Self::Nfs => std::option::Option::Some("PROTOCOL_NFS"),
8597 Self::UnknownValue(u) => u.0.name(),
8598 }
8599 }
8600 }
8601
8602 impl std::default::Default for Protocol {
8603 fn default() -> Self {
8604 use std::convert::From;
8605 Self::from(0)
8606 }
8607 }
8608
8609 impl std::fmt::Display for Protocol {
8610 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8611 wkt::internal::display_enum(f, self.name(), self.value())
8612 }
8613 }
8614
8615 impl std::convert::From<i32> for Protocol {
8616 fn from(value: i32) -> Self {
8617 match value {
8618 0 => Self::Unspecified,
8619 1 => Self::Fc,
8620 2 => Self::Nfs,
8621 _ => Self::UnknownValue(protocol::UnknownValue(
8622 wkt::internal::UnknownEnumValue::Integer(value),
8623 )),
8624 }
8625 }
8626 }
8627
8628 impl std::convert::From<&str> for Protocol {
8629 fn from(value: &str) -> Self {
8630 use std::string::ToString;
8631 match value {
8632 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
8633 "PROTOCOL_FC" => Self::Fc,
8634 "PROTOCOL_NFS" => Self::Nfs,
8635 _ => Self::UnknownValue(protocol::UnknownValue(
8636 wkt::internal::UnknownEnumValue::String(value.to_string()),
8637 )),
8638 }
8639 }
8640 }
8641
8642 impl serde::ser::Serialize for Protocol {
8643 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8644 where
8645 S: serde::Serializer,
8646 {
8647 match self {
8648 Self::Unspecified => serializer.serialize_i32(0),
8649 Self::Fc => serializer.serialize_i32(1),
8650 Self::Nfs => serializer.serialize_i32(2),
8651 Self::UnknownValue(u) => u.0.serialize(serializer),
8652 }
8653 }
8654 }
8655
8656 impl<'de> serde::de::Deserialize<'de> for Protocol {
8657 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8658 where
8659 D: serde::Deserializer<'de>,
8660 {
8661 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
8662 ".google.cloud.baremetalsolution.v2.VolumeConfig.Protocol",
8663 ))
8664 }
8665 }
8666}
8667
8668/// Configuration parameters for a new network.
8669#[derive(Clone, Default, PartialEq)]
8670#[non_exhaustive]
8671pub struct NetworkConfig {
8672 /// Output only. The name of the network config.
8673 pub name: std::string::String,
8674
8675 /// A transient unique identifier to identify a volume within an
8676 /// ProvisioningConfig request.
8677 pub id: std::string::String,
8678
8679 /// The type of this network, either Client or Private.
8680 pub r#type: crate::model::network_config::Type,
8681
8682 /// Interconnect bandwidth. Set only when type is CLIENT.
8683 pub bandwidth: crate::model::network_config::Bandwidth,
8684
8685 /// List of VLAN attachments. As of now there are always 2 attachments, but it
8686 /// is going to change in the future (multi vlan).
8687 pub vlan_attachments: std::vec::Vec<crate::model::network_config::IntakeVlanAttachment>,
8688
8689 /// CIDR range of the network.
8690 pub cidr: std::string::String,
8691
8692 /// Service CIDR, if any.
8693 pub service_cidr: crate::model::network_config::ServiceCidr,
8694
8695 /// User note field, it can be used by customers to add additional information
8696 /// for the BMS Ops team .
8697 pub user_note: std::string::String,
8698
8699 /// The GCP service of the network. Available gcp_service are in
8700 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
8701 pub gcp_service: std::string::String,
8702
8703 /// Whether the VLAN attachment pair is located in the same project.
8704 pub vlan_same_project: bool,
8705
8706 /// The JumboFramesEnabled option for customer to set.
8707 pub jumbo_frames_enabled: bool,
8708
8709 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8710}
8711
8712impl NetworkConfig {
8713 pub fn new() -> Self {
8714 std::default::Default::default()
8715 }
8716
8717 /// Sets the value of [name][crate::model::NetworkConfig::name].
8718 ///
8719 /// # Example
8720 /// ```ignore,no_run
8721 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8722 /// let x = NetworkConfig::new().set_name("example");
8723 /// ```
8724 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8725 self.name = v.into();
8726 self
8727 }
8728
8729 /// Sets the value of [id][crate::model::NetworkConfig::id].
8730 ///
8731 /// # Example
8732 /// ```ignore,no_run
8733 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8734 /// let x = NetworkConfig::new().set_id("example");
8735 /// ```
8736 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8737 self.id = v.into();
8738 self
8739 }
8740
8741 /// Sets the value of [r#type][crate::model::NetworkConfig::type].
8742 ///
8743 /// # Example
8744 /// ```ignore,no_run
8745 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8746 /// use google_cloud_baremetalsolution_v2::model::network_config::Type;
8747 /// let x0 = NetworkConfig::new().set_type(Type::Client);
8748 /// let x1 = NetworkConfig::new().set_type(Type::Private);
8749 /// ```
8750 pub fn set_type<T: std::convert::Into<crate::model::network_config::Type>>(
8751 mut self,
8752 v: T,
8753 ) -> Self {
8754 self.r#type = v.into();
8755 self
8756 }
8757
8758 /// Sets the value of [bandwidth][crate::model::NetworkConfig::bandwidth].
8759 ///
8760 /// # Example
8761 /// ```ignore,no_run
8762 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8763 /// use google_cloud_baremetalsolution_v2::model::network_config::Bandwidth;
8764 /// let x0 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw1Gbps);
8765 /// let x1 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw2Gbps);
8766 /// let x2 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw5Gbps);
8767 /// ```
8768 pub fn set_bandwidth<T: std::convert::Into<crate::model::network_config::Bandwidth>>(
8769 mut self,
8770 v: T,
8771 ) -> Self {
8772 self.bandwidth = v.into();
8773 self
8774 }
8775
8776 /// Sets the value of [vlan_attachments][crate::model::NetworkConfig::vlan_attachments].
8777 ///
8778 /// # Example
8779 /// ```ignore,no_run
8780 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8781 /// use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8782 /// let x = NetworkConfig::new()
8783 /// .set_vlan_attachments([
8784 /// IntakeVlanAttachment::default()/* use setters */,
8785 /// IntakeVlanAttachment::default()/* use (different) setters */,
8786 /// ]);
8787 /// ```
8788 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
8789 where
8790 T: std::iter::IntoIterator<Item = V>,
8791 V: std::convert::Into<crate::model::network_config::IntakeVlanAttachment>,
8792 {
8793 use std::iter::Iterator;
8794 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
8795 self
8796 }
8797
8798 /// Sets the value of [cidr][crate::model::NetworkConfig::cidr].
8799 ///
8800 /// # Example
8801 /// ```ignore,no_run
8802 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8803 /// let x = NetworkConfig::new().set_cidr("example");
8804 /// ```
8805 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8806 self.cidr = v.into();
8807 self
8808 }
8809
8810 /// Sets the value of [service_cidr][crate::model::NetworkConfig::service_cidr].
8811 ///
8812 /// # Example
8813 /// ```ignore,no_run
8814 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8815 /// use google_cloud_baremetalsolution_v2::model::network_config::ServiceCidr;
8816 /// let x0 = NetworkConfig::new().set_service_cidr(ServiceCidr::Disabled);
8817 /// let x1 = NetworkConfig::new().set_service_cidr(ServiceCidr::High26);
8818 /// let x2 = NetworkConfig::new().set_service_cidr(ServiceCidr::High27);
8819 /// ```
8820 pub fn set_service_cidr<T: std::convert::Into<crate::model::network_config::ServiceCidr>>(
8821 mut self,
8822 v: T,
8823 ) -> Self {
8824 self.service_cidr = v.into();
8825 self
8826 }
8827
8828 /// Sets the value of [user_note][crate::model::NetworkConfig::user_note].
8829 ///
8830 /// # Example
8831 /// ```ignore,no_run
8832 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8833 /// let x = NetworkConfig::new().set_user_note("example");
8834 /// ```
8835 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8836 self.user_note = v.into();
8837 self
8838 }
8839
8840 /// Sets the value of [gcp_service][crate::model::NetworkConfig::gcp_service].
8841 ///
8842 /// # Example
8843 /// ```ignore,no_run
8844 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8845 /// let x = NetworkConfig::new().set_gcp_service("example");
8846 /// ```
8847 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8848 self.gcp_service = v.into();
8849 self
8850 }
8851
8852 /// Sets the value of [vlan_same_project][crate::model::NetworkConfig::vlan_same_project].
8853 ///
8854 /// # Example
8855 /// ```ignore,no_run
8856 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8857 /// let x = NetworkConfig::new().set_vlan_same_project(true);
8858 /// ```
8859 pub fn set_vlan_same_project<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8860 self.vlan_same_project = v.into();
8861 self
8862 }
8863
8864 /// Sets the value of [jumbo_frames_enabled][crate::model::NetworkConfig::jumbo_frames_enabled].
8865 ///
8866 /// # Example
8867 /// ```ignore,no_run
8868 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8869 /// let x = NetworkConfig::new().set_jumbo_frames_enabled(true);
8870 /// ```
8871 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8872 self.jumbo_frames_enabled = v.into();
8873 self
8874 }
8875}
8876
8877impl wkt::message::Message for NetworkConfig {
8878 fn typename() -> &'static str {
8879 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig"
8880 }
8881}
8882
8883/// Defines additional types related to [NetworkConfig].
8884pub mod network_config {
8885 #[allow(unused_imports)]
8886 use super::*;
8887
8888 /// A GCP vlan attachment.
8889 #[derive(Clone, Default, PartialEq)]
8890 #[non_exhaustive]
8891 pub struct IntakeVlanAttachment {
8892 /// Identifier of the VLAN attachment.
8893 pub id: std::string::String,
8894
8895 /// Attachment pairing key.
8896 pub pairing_key: std::string::String,
8897
8898 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8899 }
8900
8901 impl IntakeVlanAttachment {
8902 pub fn new() -> Self {
8903 std::default::Default::default()
8904 }
8905
8906 /// Sets the value of [id][crate::model::network_config::IntakeVlanAttachment::id].
8907 ///
8908 /// # Example
8909 /// ```ignore,no_run
8910 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8911 /// let x = IntakeVlanAttachment::new().set_id("example");
8912 /// ```
8913 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8914 self.id = v.into();
8915 self
8916 }
8917
8918 /// Sets the value of [pairing_key][crate::model::network_config::IntakeVlanAttachment::pairing_key].
8919 ///
8920 /// # Example
8921 /// ```ignore,no_run
8922 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8923 /// let x = IntakeVlanAttachment::new().set_pairing_key("example");
8924 /// ```
8925 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8926 self.pairing_key = v.into();
8927 self
8928 }
8929 }
8930
8931 impl wkt::message::Message for IntakeVlanAttachment {
8932 fn typename() -> &'static str {
8933 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig.IntakeVlanAttachment"
8934 }
8935 }
8936
8937 /// Network type.
8938 ///
8939 /// # Working with unknown values
8940 ///
8941 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8942 /// additional enum variants at any time. Adding new variants is not considered
8943 /// a breaking change. Applications should write their code in anticipation of:
8944 ///
8945 /// - New values appearing in future releases of the client library, **and**
8946 /// - New values received dynamically, without application changes.
8947 ///
8948 /// Please consult the [Working with enums] section in the user guide for some
8949 /// guidelines.
8950 ///
8951 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8952 #[derive(Clone, Debug, PartialEq)]
8953 #[non_exhaustive]
8954 pub enum Type {
8955 /// Unspecified value.
8956 Unspecified,
8957 /// Client network, that is a network peered to a GCP VPC.
8958 Client,
8959 /// Private network, that is a network local to the BMS POD.
8960 Private,
8961 /// If set, the enum was initialized with an unknown value.
8962 ///
8963 /// Applications can examine the value using [Type::value] or
8964 /// [Type::name].
8965 UnknownValue(r#type::UnknownValue),
8966 }
8967
8968 #[doc(hidden)]
8969 pub mod r#type {
8970 #[allow(unused_imports)]
8971 use super::*;
8972 #[derive(Clone, Debug, PartialEq)]
8973 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8974 }
8975
8976 impl Type {
8977 /// Gets the enum value.
8978 ///
8979 /// Returns `None` if the enum contains an unknown value deserialized from
8980 /// the string representation of enums.
8981 pub fn value(&self) -> std::option::Option<i32> {
8982 match self {
8983 Self::Unspecified => std::option::Option::Some(0),
8984 Self::Client => std::option::Option::Some(1),
8985 Self::Private => std::option::Option::Some(2),
8986 Self::UnknownValue(u) => u.0.value(),
8987 }
8988 }
8989
8990 /// Gets the enum value as a string.
8991 ///
8992 /// Returns `None` if the enum contains an unknown value deserialized from
8993 /// the integer representation of enums.
8994 pub fn name(&self) -> std::option::Option<&str> {
8995 match self {
8996 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8997 Self::Client => std::option::Option::Some("CLIENT"),
8998 Self::Private => std::option::Option::Some("PRIVATE"),
8999 Self::UnknownValue(u) => u.0.name(),
9000 }
9001 }
9002 }
9003
9004 impl std::default::Default for Type {
9005 fn default() -> Self {
9006 use std::convert::From;
9007 Self::from(0)
9008 }
9009 }
9010
9011 impl std::fmt::Display for Type {
9012 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9013 wkt::internal::display_enum(f, self.name(), self.value())
9014 }
9015 }
9016
9017 impl std::convert::From<i32> for Type {
9018 fn from(value: i32) -> Self {
9019 match value {
9020 0 => Self::Unspecified,
9021 1 => Self::Client,
9022 2 => Self::Private,
9023 _ => Self::UnknownValue(r#type::UnknownValue(
9024 wkt::internal::UnknownEnumValue::Integer(value),
9025 )),
9026 }
9027 }
9028 }
9029
9030 impl std::convert::From<&str> for Type {
9031 fn from(value: &str) -> Self {
9032 use std::string::ToString;
9033 match value {
9034 "TYPE_UNSPECIFIED" => Self::Unspecified,
9035 "CLIENT" => Self::Client,
9036 "PRIVATE" => Self::Private,
9037 _ => Self::UnknownValue(r#type::UnknownValue(
9038 wkt::internal::UnknownEnumValue::String(value.to_string()),
9039 )),
9040 }
9041 }
9042 }
9043
9044 impl serde::ser::Serialize for Type {
9045 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9046 where
9047 S: serde::Serializer,
9048 {
9049 match self {
9050 Self::Unspecified => serializer.serialize_i32(0),
9051 Self::Client => serializer.serialize_i32(1),
9052 Self::Private => serializer.serialize_i32(2),
9053 Self::UnknownValue(u) => u.0.serialize(serializer),
9054 }
9055 }
9056 }
9057
9058 impl<'de> serde::de::Deserialize<'de> for Type {
9059 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9060 where
9061 D: serde::Deserializer<'de>,
9062 {
9063 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
9064 ".google.cloud.baremetalsolution.v2.NetworkConfig.Type",
9065 ))
9066 }
9067 }
9068
9069 /// Interconnect bandwidth.
9070 ///
9071 /// # Working with unknown values
9072 ///
9073 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9074 /// additional enum variants at any time. Adding new variants is not considered
9075 /// a breaking change. Applications should write their code in anticipation of:
9076 ///
9077 /// - New values appearing in future releases of the client library, **and**
9078 /// - New values received dynamically, without application changes.
9079 ///
9080 /// Please consult the [Working with enums] section in the user guide for some
9081 /// guidelines.
9082 ///
9083 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9084 #[derive(Clone, Debug, PartialEq)]
9085 #[non_exhaustive]
9086 pub enum Bandwidth {
9087 /// Unspecified value.
9088 Unspecified,
9089 /// 1 Gbps.
9090 Bw1Gbps,
9091 /// 2 Gbps.
9092 Bw2Gbps,
9093 /// 5 Gbps.
9094 Bw5Gbps,
9095 /// 10 Gbps.
9096 Bw10Gbps,
9097 /// If set, the enum was initialized with an unknown value.
9098 ///
9099 /// Applications can examine the value using [Bandwidth::value] or
9100 /// [Bandwidth::name].
9101 UnknownValue(bandwidth::UnknownValue),
9102 }
9103
9104 #[doc(hidden)]
9105 pub mod bandwidth {
9106 #[allow(unused_imports)]
9107 use super::*;
9108 #[derive(Clone, Debug, PartialEq)]
9109 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9110 }
9111
9112 impl Bandwidth {
9113 /// Gets the enum value.
9114 ///
9115 /// Returns `None` if the enum contains an unknown value deserialized from
9116 /// the string representation of enums.
9117 pub fn value(&self) -> std::option::Option<i32> {
9118 match self {
9119 Self::Unspecified => std::option::Option::Some(0),
9120 Self::Bw1Gbps => std::option::Option::Some(1),
9121 Self::Bw2Gbps => std::option::Option::Some(2),
9122 Self::Bw5Gbps => std::option::Option::Some(3),
9123 Self::Bw10Gbps => std::option::Option::Some(4),
9124 Self::UnknownValue(u) => u.0.value(),
9125 }
9126 }
9127
9128 /// Gets the enum value as a string.
9129 ///
9130 /// Returns `None` if the enum contains an unknown value deserialized from
9131 /// the integer representation of enums.
9132 pub fn name(&self) -> std::option::Option<&str> {
9133 match self {
9134 Self::Unspecified => std::option::Option::Some("BANDWIDTH_UNSPECIFIED"),
9135 Self::Bw1Gbps => std::option::Option::Some("BW_1_GBPS"),
9136 Self::Bw2Gbps => std::option::Option::Some("BW_2_GBPS"),
9137 Self::Bw5Gbps => std::option::Option::Some("BW_5_GBPS"),
9138 Self::Bw10Gbps => std::option::Option::Some("BW_10_GBPS"),
9139 Self::UnknownValue(u) => u.0.name(),
9140 }
9141 }
9142 }
9143
9144 impl std::default::Default for Bandwidth {
9145 fn default() -> Self {
9146 use std::convert::From;
9147 Self::from(0)
9148 }
9149 }
9150
9151 impl std::fmt::Display for Bandwidth {
9152 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9153 wkt::internal::display_enum(f, self.name(), self.value())
9154 }
9155 }
9156
9157 impl std::convert::From<i32> for Bandwidth {
9158 fn from(value: i32) -> Self {
9159 match value {
9160 0 => Self::Unspecified,
9161 1 => Self::Bw1Gbps,
9162 2 => Self::Bw2Gbps,
9163 3 => Self::Bw5Gbps,
9164 4 => Self::Bw10Gbps,
9165 _ => Self::UnknownValue(bandwidth::UnknownValue(
9166 wkt::internal::UnknownEnumValue::Integer(value),
9167 )),
9168 }
9169 }
9170 }
9171
9172 impl std::convert::From<&str> for Bandwidth {
9173 fn from(value: &str) -> Self {
9174 use std::string::ToString;
9175 match value {
9176 "BANDWIDTH_UNSPECIFIED" => Self::Unspecified,
9177 "BW_1_GBPS" => Self::Bw1Gbps,
9178 "BW_2_GBPS" => Self::Bw2Gbps,
9179 "BW_5_GBPS" => Self::Bw5Gbps,
9180 "BW_10_GBPS" => Self::Bw10Gbps,
9181 _ => Self::UnknownValue(bandwidth::UnknownValue(
9182 wkt::internal::UnknownEnumValue::String(value.to_string()),
9183 )),
9184 }
9185 }
9186 }
9187
9188 impl serde::ser::Serialize for Bandwidth {
9189 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9190 where
9191 S: serde::Serializer,
9192 {
9193 match self {
9194 Self::Unspecified => serializer.serialize_i32(0),
9195 Self::Bw1Gbps => serializer.serialize_i32(1),
9196 Self::Bw2Gbps => serializer.serialize_i32(2),
9197 Self::Bw5Gbps => serializer.serialize_i32(3),
9198 Self::Bw10Gbps => serializer.serialize_i32(4),
9199 Self::UnknownValue(u) => u.0.serialize(serializer),
9200 }
9201 }
9202 }
9203
9204 impl<'de> serde::de::Deserialize<'de> for Bandwidth {
9205 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9206 where
9207 D: serde::Deserializer<'de>,
9208 {
9209 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Bandwidth>::new(
9210 ".google.cloud.baremetalsolution.v2.NetworkConfig.Bandwidth",
9211 ))
9212 }
9213 }
9214
9215 /// Service network block.
9216 ///
9217 /// # Working with unknown values
9218 ///
9219 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9220 /// additional enum variants at any time. Adding new variants is not considered
9221 /// a breaking change. Applications should write their code in anticipation of:
9222 ///
9223 /// - New values appearing in future releases of the client library, **and**
9224 /// - New values received dynamically, without application changes.
9225 ///
9226 /// Please consult the [Working with enums] section in the user guide for some
9227 /// guidelines.
9228 ///
9229 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9230 #[derive(Clone, Debug, PartialEq)]
9231 #[non_exhaustive]
9232 pub enum ServiceCidr {
9233 /// Unspecified value.
9234 Unspecified,
9235 /// Services are disabled for the given network.
9236 Disabled,
9237 /// Use the highest /26 block of the network to host services.
9238 High26,
9239 /// Use the highest /27 block of the network to host services.
9240 High27,
9241 /// Use the highest /28 block of the network to host services.
9242 High28,
9243 /// If set, the enum was initialized with an unknown value.
9244 ///
9245 /// Applications can examine the value using [ServiceCidr::value] or
9246 /// [ServiceCidr::name].
9247 UnknownValue(service_cidr::UnknownValue),
9248 }
9249
9250 #[doc(hidden)]
9251 pub mod service_cidr {
9252 #[allow(unused_imports)]
9253 use super::*;
9254 #[derive(Clone, Debug, PartialEq)]
9255 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9256 }
9257
9258 impl ServiceCidr {
9259 /// Gets the enum value.
9260 ///
9261 /// Returns `None` if the enum contains an unknown value deserialized from
9262 /// the string representation of enums.
9263 pub fn value(&self) -> std::option::Option<i32> {
9264 match self {
9265 Self::Unspecified => std::option::Option::Some(0),
9266 Self::Disabled => std::option::Option::Some(1),
9267 Self::High26 => std::option::Option::Some(2),
9268 Self::High27 => std::option::Option::Some(3),
9269 Self::High28 => std::option::Option::Some(4),
9270 Self::UnknownValue(u) => u.0.value(),
9271 }
9272 }
9273
9274 /// Gets the enum value as a string.
9275 ///
9276 /// Returns `None` if the enum contains an unknown value deserialized from
9277 /// the integer representation of enums.
9278 pub fn name(&self) -> std::option::Option<&str> {
9279 match self {
9280 Self::Unspecified => std::option::Option::Some("SERVICE_CIDR_UNSPECIFIED"),
9281 Self::Disabled => std::option::Option::Some("DISABLED"),
9282 Self::High26 => std::option::Option::Some("HIGH_26"),
9283 Self::High27 => std::option::Option::Some("HIGH_27"),
9284 Self::High28 => std::option::Option::Some("HIGH_28"),
9285 Self::UnknownValue(u) => u.0.name(),
9286 }
9287 }
9288 }
9289
9290 impl std::default::Default for ServiceCidr {
9291 fn default() -> Self {
9292 use std::convert::From;
9293 Self::from(0)
9294 }
9295 }
9296
9297 impl std::fmt::Display for ServiceCidr {
9298 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9299 wkt::internal::display_enum(f, self.name(), self.value())
9300 }
9301 }
9302
9303 impl std::convert::From<i32> for ServiceCidr {
9304 fn from(value: i32) -> Self {
9305 match value {
9306 0 => Self::Unspecified,
9307 1 => Self::Disabled,
9308 2 => Self::High26,
9309 3 => Self::High27,
9310 4 => Self::High28,
9311 _ => Self::UnknownValue(service_cidr::UnknownValue(
9312 wkt::internal::UnknownEnumValue::Integer(value),
9313 )),
9314 }
9315 }
9316 }
9317
9318 impl std::convert::From<&str> for ServiceCidr {
9319 fn from(value: &str) -> Self {
9320 use std::string::ToString;
9321 match value {
9322 "SERVICE_CIDR_UNSPECIFIED" => Self::Unspecified,
9323 "DISABLED" => Self::Disabled,
9324 "HIGH_26" => Self::High26,
9325 "HIGH_27" => Self::High27,
9326 "HIGH_28" => Self::High28,
9327 _ => Self::UnknownValue(service_cidr::UnknownValue(
9328 wkt::internal::UnknownEnumValue::String(value.to_string()),
9329 )),
9330 }
9331 }
9332 }
9333
9334 impl serde::ser::Serialize for ServiceCidr {
9335 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9336 where
9337 S: serde::Serializer,
9338 {
9339 match self {
9340 Self::Unspecified => serializer.serialize_i32(0),
9341 Self::Disabled => serializer.serialize_i32(1),
9342 Self::High26 => serializer.serialize_i32(2),
9343 Self::High27 => serializer.serialize_i32(3),
9344 Self::High28 => serializer.serialize_i32(4),
9345 Self::UnknownValue(u) => u.0.serialize(serializer),
9346 }
9347 }
9348 }
9349
9350 impl<'de> serde::de::Deserialize<'de> for ServiceCidr {
9351 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9352 where
9353 D: serde::Deserializer<'de>,
9354 {
9355 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceCidr>::new(
9356 ".google.cloud.baremetalsolution.v2.NetworkConfig.ServiceCidr",
9357 ))
9358 }
9359 }
9360}
9361
9362/// A resource budget.
9363#[derive(Clone, Default, PartialEq)]
9364#[non_exhaustive]
9365pub struct InstanceQuota {
9366 /// Output only. The name of the instance quota.
9367 pub name: std::string::String,
9368
9369 /// Instance type.
9370 /// Deprecated: use gcp_service.
9371 #[deprecated]
9372 pub instance_type: std::string::String,
9373
9374 /// The gcp service of the provisioning quota.
9375 pub gcp_service: std::string::String,
9376
9377 /// Location where the quota applies.
9378 pub location: std::string::String,
9379
9380 /// Number of machines than can be created for the given location and
9381 /// instance_type.
9382 pub available_machine_count: i32,
9383
9384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9385}
9386
9387impl InstanceQuota {
9388 pub fn new() -> Self {
9389 std::default::Default::default()
9390 }
9391
9392 /// Sets the value of [name][crate::model::InstanceQuota::name].
9393 ///
9394 /// # Example
9395 /// ```ignore,no_run
9396 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9397 /// let x = InstanceQuota::new().set_name("example");
9398 /// ```
9399 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9400 self.name = v.into();
9401 self
9402 }
9403
9404 /// Sets the value of [instance_type][crate::model::InstanceQuota::instance_type].
9405 ///
9406 /// # Example
9407 /// ```ignore,no_run
9408 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9409 /// let x = InstanceQuota::new().set_instance_type("example");
9410 /// ```
9411 #[deprecated]
9412 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9413 self.instance_type = v.into();
9414 self
9415 }
9416
9417 /// Sets the value of [gcp_service][crate::model::InstanceQuota::gcp_service].
9418 ///
9419 /// # Example
9420 /// ```ignore,no_run
9421 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9422 /// let x = InstanceQuota::new().set_gcp_service("example");
9423 /// ```
9424 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9425 self.gcp_service = v.into();
9426 self
9427 }
9428
9429 /// Sets the value of [location][crate::model::InstanceQuota::location].
9430 ///
9431 /// # Example
9432 /// ```ignore,no_run
9433 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9434 /// let x = InstanceQuota::new().set_location("example");
9435 /// ```
9436 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9437 self.location = v.into();
9438 self
9439 }
9440
9441 /// Sets the value of [available_machine_count][crate::model::InstanceQuota::available_machine_count].
9442 ///
9443 /// # Example
9444 /// ```ignore,no_run
9445 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9446 /// let x = InstanceQuota::new().set_available_machine_count(42);
9447 /// ```
9448 pub fn set_available_machine_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9449 self.available_machine_count = v.into();
9450 self
9451 }
9452}
9453
9454impl wkt::message::Message for InstanceQuota {
9455 fn typename() -> &'static str {
9456 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceQuota"
9457 }
9458}
9459
9460/// Request for GetProvisioningConfig.
9461#[derive(Clone, Default, PartialEq)]
9462#[non_exhaustive]
9463pub struct GetProvisioningConfigRequest {
9464 /// Required. Name of the ProvisioningConfig.
9465 pub name: std::string::String,
9466
9467 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9468}
9469
9470impl GetProvisioningConfigRequest {
9471 pub fn new() -> Self {
9472 std::default::Default::default()
9473 }
9474
9475 /// Sets the value of [name][crate::model::GetProvisioningConfigRequest::name].
9476 ///
9477 /// # Example
9478 /// ```ignore,no_run
9479 /// # use google_cloud_baremetalsolution_v2::model::GetProvisioningConfigRequest;
9480 /// let x = GetProvisioningConfigRequest::new().set_name("example");
9481 /// ```
9482 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9483 self.name = v.into();
9484 self
9485 }
9486}
9487
9488impl wkt::message::Message for GetProvisioningConfigRequest {
9489 fn typename() -> &'static str {
9490 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetProvisioningConfigRequest"
9491 }
9492}
9493
9494/// Request for CreateProvisioningConfig.
9495#[derive(Clone, Default, PartialEq)]
9496#[non_exhaustive]
9497pub struct CreateProvisioningConfigRequest {
9498 /// Required. The parent project and location containing the
9499 /// ProvisioningConfig.
9500 pub parent: std::string::String,
9501
9502 /// Required. The ProvisioningConfig to create.
9503 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9504
9505 /// Optional. Email provided to send a confirmation with provisioning config
9506 /// to.
9507 pub email: std::string::String,
9508
9509 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9510}
9511
9512impl CreateProvisioningConfigRequest {
9513 pub fn new() -> Self {
9514 std::default::Default::default()
9515 }
9516
9517 /// Sets the value of [parent][crate::model::CreateProvisioningConfigRequest::parent].
9518 ///
9519 /// # Example
9520 /// ```ignore,no_run
9521 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9522 /// let x = CreateProvisioningConfigRequest::new().set_parent("example");
9523 /// ```
9524 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9525 self.parent = v.into();
9526 self
9527 }
9528
9529 /// Sets the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9530 ///
9531 /// # Example
9532 /// ```ignore,no_run
9533 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9534 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9535 /// let x = CreateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9536 /// ```
9537 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9538 where
9539 T: std::convert::Into<crate::model::ProvisioningConfig>,
9540 {
9541 self.provisioning_config = std::option::Option::Some(v.into());
9542 self
9543 }
9544
9545 /// Sets or clears the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9546 ///
9547 /// # Example
9548 /// ```ignore,no_run
9549 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9550 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9551 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9552 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9553 /// ```
9554 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9555 where
9556 T: std::convert::Into<crate::model::ProvisioningConfig>,
9557 {
9558 self.provisioning_config = v.map(|x| x.into());
9559 self
9560 }
9561
9562 /// Sets the value of [email][crate::model::CreateProvisioningConfigRequest::email].
9563 ///
9564 /// # Example
9565 /// ```ignore,no_run
9566 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9567 /// let x = CreateProvisioningConfigRequest::new().set_email("example");
9568 /// ```
9569 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9570 self.email = v.into();
9571 self
9572 }
9573}
9574
9575impl wkt::message::Message for CreateProvisioningConfigRequest {
9576 fn typename() -> &'static str {
9577 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateProvisioningConfigRequest"
9578 }
9579}
9580
9581/// Message for updating a ProvisioningConfig.
9582#[derive(Clone, Default, PartialEq)]
9583#[non_exhaustive]
9584pub struct UpdateProvisioningConfigRequest {
9585 /// Required. The ProvisioningConfig to update.
9586 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9587
9588 /// Required. The list of fields to update.
9589 pub update_mask: std::option::Option<wkt::FieldMask>,
9590
9591 /// Optional. Email provided to send a confirmation with provisioning config
9592 /// to.
9593 pub email: std::string::String,
9594
9595 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9596}
9597
9598impl UpdateProvisioningConfigRequest {
9599 pub fn new() -> Self {
9600 std::default::Default::default()
9601 }
9602
9603 /// Sets the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9604 ///
9605 /// # Example
9606 /// ```ignore,no_run
9607 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9608 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9609 /// let x = UpdateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9610 /// ```
9611 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9612 where
9613 T: std::convert::Into<crate::model::ProvisioningConfig>,
9614 {
9615 self.provisioning_config = std::option::Option::Some(v.into());
9616 self
9617 }
9618
9619 /// Sets or clears the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9620 ///
9621 /// # Example
9622 /// ```ignore,no_run
9623 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9624 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9625 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9626 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9627 /// ```
9628 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9629 where
9630 T: std::convert::Into<crate::model::ProvisioningConfig>,
9631 {
9632 self.provisioning_config = v.map(|x| x.into());
9633 self
9634 }
9635
9636 /// Sets the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9637 ///
9638 /// # Example
9639 /// ```ignore,no_run
9640 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9641 /// use wkt::FieldMask;
9642 /// let x = UpdateProvisioningConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9643 /// ```
9644 pub fn set_update_mask<T>(mut self, v: T) -> Self
9645 where
9646 T: std::convert::Into<wkt::FieldMask>,
9647 {
9648 self.update_mask = std::option::Option::Some(v.into());
9649 self
9650 }
9651
9652 /// Sets or clears the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9653 ///
9654 /// # Example
9655 /// ```ignore,no_run
9656 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9657 /// use wkt::FieldMask;
9658 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9659 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9660 /// ```
9661 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9662 where
9663 T: std::convert::Into<wkt::FieldMask>,
9664 {
9665 self.update_mask = v.map(|x| x.into());
9666 self
9667 }
9668
9669 /// Sets the value of [email][crate::model::UpdateProvisioningConfigRequest::email].
9670 ///
9671 /// # Example
9672 /// ```ignore,no_run
9673 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9674 /// let x = UpdateProvisioningConfigRequest::new().set_email("example");
9675 /// ```
9676 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9677 self.email = v.into();
9678 self
9679 }
9680}
9681
9682impl wkt::message::Message for UpdateProvisioningConfigRequest {
9683 fn typename() -> &'static str {
9684 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateProvisioningConfigRequest"
9685 }
9686}
9687
9688/// An SSH key, used for authorizing with the interactive serial console feature.
9689#[derive(Clone, Default, PartialEq)]
9690#[non_exhaustive]
9691pub struct SSHKey {
9692 /// Output only. The name of this SSH key.
9693 /// Currently, the only valid value for the location is "global".
9694 pub name: std::string::String,
9695
9696 /// The public SSH key. This must be in OpenSSH .authorized_keys format.
9697 pub public_key: std::string::String,
9698
9699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9700}
9701
9702impl SSHKey {
9703 pub fn new() -> Self {
9704 std::default::Default::default()
9705 }
9706
9707 /// Sets the value of [name][crate::model::SSHKey::name].
9708 ///
9709 /// # Example
9710 /// ```ignore,no_run
9711 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9712 /// let x = SSHKey::new().set_name("example");
9713 /// ```
9714 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9715 self.name = v.into();
9716 self
9717 }
9718
9719 /// Sets the value of [public_key][crate::model::SSHKey::public_key].
9720 ///
9721 /// # Example
9722 /// ```ignore,no_run
9723 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9724 /// let x = SSHKey::new().set_public_key("example");
9725 /// ```
9726 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9727 self.public_key = v.into();
9728 self
9729 }
9730}
9731
9732impl wkt::message::Message for SSHKey {
9733 fn typename() -> &'static str {
9734 "type.googleapis.com/google.cloud.baremetalsolution.v2.SSHKey"
9735 }
9736}
9737
9738/// Message for listing the public SSH keys in a project.
9739#[derive(Clone, Default, PartialEq)]
9740#[non_exhaustive]
9741pub struct ListSSHKeysRequest {
9742 /// Required. The parent containing the SSH keys.
9743 /// Currently, the only valid value for the location is "global".
9744 pub parent: std::string::String,
9745
9746 /// The maximum number of items to return.
9747 pub page_size: i32,
9748
9749 /// The next_page_token value returned from a previous List request, if any.
9750 pub page_token: std::string::String,
9751
9752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9753}
9754
9755impl ListSSHKeysRequest {
9756 pub fn new() -> Self {
9757 std::default::Default::default()
9758 }
9759
9760 /// Sets the value of [parent][crate::model::ListSSHKeysRequest::parent].
9761 ///
9762 /// # Example
9763 /// ```ignore,no_run
9764 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9765 /// let x = ListSSHKeysRequest::new().set_parent("example");
9766 /// ```
9767 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9768 self.parent = v.into();
9769 self
9770 }
9771
9772 /// Sets the value of [page_size][crate::model::ListSSHKeysRequest::page_size].
9773 ///
9774 /// # Example
9775 /// ```ignore,no_run
9776 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9777 /// let x = ListSSHKeysRequest::new().set_page_size(42);
9778 /// ```
9779 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9780 self.page_size = v.into();
9781 self
9782 }
9783
9784 /// Sets the value of [page_token][crate::model::ListSSHKeysRequest::page_token].
9785 ///
9786 /// # Example
9787 /// ```ignore,no_run
9788 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9789 /// let x = ListSSHKeysRequest::new().set_page_token("example");
9790 /// ```
9791 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9792 self.page_token = v.into();
9793 self
9794 }
9795}
9796
9797impl wkt::message::Message for ListSSHKeysRequest {
9798 fn typename() -> &'static str {
9799 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysRequest"
9800 }
9801}
9802
9803/// Message for response of ListSSHKeys.
9804#[derive(Clone, Default, PartialEq)]
9805#[non_exhaustive]
9806pub struct ListSSHKeysResponse {
9807 /// The SSH keys registered in the project.
9808 pub ssh_keys: std::vec::Vec<crate::model::SSHKey>,
9809
9810 /// Token to retrieve the next page of results, or empty if there are no more
9811 /// results in the list.
9812 pub next_page_token: std::string::String,
9813
9814 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9815}
9816
9817impl ListSSHKeysResponse {
9818 pub fn new() -> Self {
9819 std::default::Default::default()
9820 }
9821
9822 /// Sets the value of [ssh_keys][crate::model::ListSSHKeysResponse::ssh_keys].
9823 ///
9824 /// # Example
9825 /// ```ignore,no_run
9826 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
9827 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9828 /// let x = ListSSHKeysResponse::new()
9829 /// .set_ssh_keys([
9830 /// SSHKey::default()/* use setters */,
9831 /// SSHKey::default()/* use (different) setters */,
9832 /// ]);
9833 /// ```
9834 pub fn set_ssh_keys<T, V>(mut self, v: T) -> Self
9835 where
9836 T: std::iter::IntoIterator<Item = V>,
9837 V: std::convert::Into<crate::model::SSHKey>,
9838 {
9839 use std::iter::Iterator;
9840 self.ssh_keys = v.into_iter().map(|i| i.into()).collect();
9841 self
9842 }
9843
9844 /// Sets the value of [next_page_token][crate::model::ListSSHKeysResponse::next_page_token].
9845 ///
9846 /// # Example
9847 /// ```ignore,no_run
9848 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
9849 /// let x = ListSSHKeysResponse::new().set_next_page_token("example");
9850 /// ```
9851 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9852 self.next_page_token = v.into();
9853 self
9854 }
9855}
9856
9857impl wkt::message::Message for ListSSHKeysResponse {
9858 fn typename() -> &'static str {
9859 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysResponse"
9860 }
9861}
9862
9863#[doc(hidden)]
9864impl google_cloud_gax::paginator::internal::PageableResponse for ListSSHKeysResponse {
9865 type PageItem = crate::model::SSHKey;
9866
9867 fn items(self) -> std::vec::Vec<Self::PageItem> {
9868 self.ssh_keys
9869 }
9870
9871 fn next_page_token(&self) -> std::string::String {
9872 use std::clone::Clone;
9873 self.next_page_token.clone()
9874 }
9875}
9876
9877/// Message for registering a public SSH key in a project.
9878#[derive(Clone, Default, PartialEq)]
9879#[non_exhaustive]
9880pub struct CreateSSHKeyRequest {
9881 /// Required. The parent containing the SSH keys.
9882 pub parent: std::string::String,
9883
9884 /// Required. The SSH key to register.
9885 pub ssh_key: std::option::Option<crate::model::SSHKey>,
9886
9887 /// Required. The ID to use for the key, which will become the final component
9888 /// of the key's resource name.
9889 ///
9890 /// This value must match the regex:
9891 /// [a-zA-Z0-9@.\-_]{1,64}
9892 pub ssh_key_id: std::string::String,
9893
9894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9895}
9896
9897impl CreateSSHKeyRequest {
9898 pub fn new() -> Self {
9899 std::default::Default::default()
9900 }
9901
9902 /// Sets the value of [parent][crate::model::CreateSSHKeyRequest::parent].
9903 ///
9904 /// # Example
9905 /// ```ignore,no_run
9906 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9907 /// let x = CreateSSHKeyRequest::new().set_parent("example");
9908 /// ```
9909 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9910 self.parent = v.into();
9911 self
9912 }
9913
9914 /// Sets the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
9915 ///
9916 /// # Example
9917 /// ```ignore,no_run
9918 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9919 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9920 /// let x = CreateSSHKeyRequest::new().set_ssh_key(SSHKey::default()/* use setters */);
9921 /// ```
9922 pub fn set_ssh_key<T>(mut self, v: T) -> Self
9923 where
9924 T: std::convert::Into<crate::model::SSHKey>,
9925 {
9926 self.ssh_key = std::option::Option::Some(v.into());
9927 self
9928 }
9929
9930 /// Sets or clears the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
9931 ///
9932 /// # Example
9933 /// ```ignore,no_run
9934 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9935 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9936 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(Some(SSHKey::default()/* use setters */));
9937 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(None::<SSHKey>);
9938 /// ```
9939 pub fn set_or_clear_ssh_key<T>(mut self, v: std::option::Option<T>) -> Self
9940 where
9941 T: std::convert::Into<crate::model::SSHKey>,
9942 {
9943 self.ssh_key = v.map(|x| x.into());
9944 self
9945 }
9946
9947 /// Sets the value of [ssh_key_id][crate::model::CreateSSHKeyRequest::ssh_key_id].
9948 ///
9949 /// # Example
9950 /// ```ignore,no_run
9951 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9952 /// let x = CreateSSHKeyRequest::new().set_ssh_key_id("example");
9953 /// ```
9954 pub fn set_ssh_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9955 self.ssh_key_id = v.into();
9956 self
9957 }
9958}
9959
9960impl wkt::message::Message for CreateSSHKeyRequest {
9961 fn typename() -> &'static str {
9962 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateSSHKeyRequest"
9963 }
9964}
9965
9966/// Message for deleting an SSH key from a project.
9967#[derive(Clone, Default, PartialEq)]
9968#[non_exhaustive]
9969pub struct DeleteSSHKeyRequest {
9970 /// Required. The name of the SSH key to delete.
9971 /// Currently, the only valid value for the location is "global".
9972 pub name: std::string::String,
9973
9974 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9975}
9976
9977impl DeleteSSHKeyRequest {
9978 pub fn new() -> Self {
9979 std::default::Default::default()
9980 }
9981
9982 /// Sets the value of [name][crate::model::DeleteSSHKeyRequest::name].
9983 ///
9984 /// # Example
9985 /// ```ignore,no_run
9986 /// # use google_cloud_baremetalsolution_v2::model::DeleteSSHKeyRequest;
9987 /// let x = DeleteSSHKeyRequest::new().set_name("example");
9988 /// ```
9989 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9990 self.name = v.into();
9991 self
9992 }
9993}
9994
9995impl wkt::message::Message for DeleteSSHKeyRequest {
9996 fn typename() -> &'static str {
9997 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteSSHKeyRequest"
9998 }
9999}
10000
10001/// A storage volume.
10002#[derive(Clone, Default, PartialEq)]
10003#[non_exhaustive]
10004pub struct Volume {
10005 /// Output only. The resource name of this `Volume`.
10006 /// Resource names are schemeless URIs that follow the conventions in
10007 /// <https://cloud.google.com/apis/design/resource_names>.
10008 /// Format:
10009 /// `projects/{project}/locations/{location}/volumes/{volume}`
10010 pub name: std::string::String,
10011
10012 /// An identifier for the `Volume`, generated by the backend.
10013 pub id: std::string::String,
10014
10015 /// The storage type for this volume.
10016 pub storage_type: crate::model::volume::StorageType,
10017
10018 /// The state of this storage volume.
10019 pub state: crate::model::volume::State,
10020
10021 /// The requested size of this storage volume, in GiB.
10022 pub requested_size_gib: i64,
10023
10024 /// Originally requested size, in GiB.
10025 pub originally_requested_size_gib: i64,
10026
10027 /// The current size of this storage volume, in GiB, including space reserved
10028 /// for snapshots. This size might be different than the requested size if the
10029 /// storage volume has been configured with auto grow or auto shrink.
10030 pub current_size_gib: i64,
10031
10032 /// Additional emergency size that was requested for this Volume, in GiB.
10033 /// current_size_gib includes this value.
10034 pub emergency_size_gib: i64,
10035
10036 /// Maximum size volume can be expanded to in case of evergency, in GiB.
10037 pub max_size_gib: i64,
10038
10039 /// The size, in GiB, that this storage volume has expanded as a result of an
10040 /// auto grow policy. In the absence of auto-grow, the value is 0.
10041 pub auto_grown_size_gib: i64,
10042
10043 /// The space remaining in the storage volume for new LUNs, in GiB, excluding
10044 /// space reserved for snapshots.
10045 pub remaining_space_gib: i64,
10046
10047 /// Details about snapshot space reservation and usage on the storage volume.
10048 pub snapshot_reservation_detail:
10049 std::option::Option<crate::model::volume::SnapshotReservationDetail>,
10050
10051 /// The behavior to use when snapshot reserved space is full.
10052 pub snapshot_auto_delete_behavior: crate::model::volume::SnapshotAutoDeleteBehavior,
10053
10054 /// Labels as key value pairs.
10055 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10056
10057 /// Whether snapshots are enabled.
10058 pub snapshot_enabled: bool,
10059
10060 /// Immutable. Pod name.
10061 pub pod: std::string::String,
10062
10063 /// Output only. Storage protocol for the Volume.
10064 pub protocol: crate::model::volume::Protocol,
10065
10066 /// Output only. Whether this volume is a boot volume. A boot volume is one
10067 /// which contains a boot LUN.
10068 pub boot_volume: bool,
10069
10070 /// Immutable. Performance tier of the Volume.
10071 /// Default is SHARED.
10072 pub performance_tier: crate::model::VolumePerformanceTier,
10073
10074 /// Input only. User-specified notes for new Volume.
10075 /// Used to provision Volumes that require manual intervention.
10076 pub notes: std::string::String,
10077
10078 /// The workload profile for the volume.
10079 pub workload_profile: crate::model::volume::WorkloadProfile,
10080
10081 /// Output only. Time after which volume will be fully deleted.
10082 /// It is filled only for volumes in COOLOFF state.
10083 pub expire_time: std::option::Option<wkt::Timestamp>,
10084
10085 /// Output only. Instances this Volume is attached to.
10086 /// This field is set only in Get requests.
10087 pub instances: std::vec::Vec<std::string::String>,
10088
10089 /// Output only. Is the Volume attached at at least one instance.
10090 /// This field is a lightweight counterpart of `instances` field.
10091 /// It is filled in List responses as well.
10092 pub attached: bool,
10093
10094 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10095}
10096
10097impl Volume {
10098 pub fn new() -> Self {
10099 std::default::Default::default()
10100 }
10101
10102 /// Sets the value of [name][crate::model::Volume::name].
10103 ///
10104 /// # Example
10105 /// ```ignore,no_run
10106 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10107 /// let x = Volume::new().set_name("example");
10108 /// ```
10109 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10110 self.name = v.into();
10111 self
10112 }
10113
10114 /// Sets the value of [id][crate::model::Volume::id].
10115 ///
10116 /// # Example
10117 /// ```ignore,no_run
10118 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10119 /// let x = Volume::new().set_id("example");
10120 /// ```
10121 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10122 self.id = v.into();
10123 self
10124 }
10125
10126 /// Sets the value of [storage_type][crate::model::Volume::storage_type].
10127 ///
10128 /// # Example
10129 /// ```ignore,no_run
10130 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10131 /// use google_cloud_baremetalsolution_v2::model::volume::StorageType;
10132 /// let x0 = Volume::new().set_storage_type(StorageType::Ssd);
10133 /// let x1 = Volume::new().set_storage_type(StorageType::Hdd);
10134 /// ```
10135 pub fn set_storage_type<T: std::convert::Into<crate::model::volume::StorageType>>(
10136 mut self,
10137 v: T,
10138 ) -> Self {
10139 self.storage_type = v.into();
10140 self
10141 }
10142
10143 /// Sets the value of [state][crate::model::Volume::state].
10144 ///
10145 /// # Example
10146 /// ```ignore,no_run
10147 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10148 /// use google_cloud_baremetalsolution_v2::model::volume::State;
10149 /// let x0 = Volume::new().set_state(State::Creating);
10150 /// let x1 = Volume::new().set_state(State::Ready);
10151 /// let x2 = Volume::new().set_state(State::Deleting);
10152 /// ```
10153 pub fn set_state<T: std::convert::Into<crate::model::volume::State>>(mut self, v: T) -> Self {
10154 self.state = v.into();
10155 self
10156 }
10157
10158 /// Sets the value of [requested_size_gib][crate::model::Volume::requested_size_gib].
10159 ///
10160 /// # Example
10161 /// ```ignore,no_run
10162 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10163 /// let x = Volume::new().set_requested_size_gib(42);
10164 /// ```
10165 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10166 self.requested_size_gib = v.into();
10167 self
10168 }
10169
10170 /// Sets the value of [originally_requested_size_gib][crate::model::Volume::originally_requested_size_gib].
10171 ///
10172 /// # Example
10173 /// ```ignore,no_run
10174 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10175 /// let x = Volume::new().set_originally_requested_size_gib(42);
10176 /// ```
10177 pub fn set_originally_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10178 self.originally_requested_size_gib = v.into();
10179 self
10180 }
10181
10182 /// Sets the value of [current_size_gib][crate::model::Volume::current_size_gib].
10183 ///
10184 /// # Example
10185 /// ```ignore,no_run
10186 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10187 /// let x = Volume::new().set_current_size_gib(42);
10188 /// ```
10189 pub fn set_current_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10190 self.current_size_gib = v.into();
10191 self
10192 }
10193
10194 /// Sets the value of [emergency_size_gib][crate::model::Volume::emergency_size_gib].
10195 ///
10196 /// # Example
10197 /// ```ignore,no_run
10198 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10199 /// let x = Volume::new().set_emergency_size_gib(42);
10200 /// ```
10201 pub fn set_emergency_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10202 self.emergency_size_gib = v.into();
10203 self
10204 }
10205
10206 /// Sets the value of [max_size_gib][crate::model::Volume::max_size_gib].
10207 ///
10208 /// # Example
10209 /// ```ignore,no_run
10210 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10211 /// let x = Volume::new().set_max_size_gib(42);
10212 /// ```
10213 pub fn set_max_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10214 self.max_size_gib = v.into();
10215 self
10216 }
10217
10218 /// Sets the value of [auto_grown_size_gib][crate::model::Volume::auto_grown_size_gib].
10219 ///
10220 /// # Example
10221 /// ```ignore,no_run
10222 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10223 /// let x = Volume::new().set_auto_grown_size_gib(42);
10224 /// ```
10225 pub fn set_auto_grown_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10226 self.auto_grown_size_gib = v.into();
10227 self
10228 }
10229
10230 /// Sets the value of [remaining_space_gib][crate::model::Volume::remaining_space_gib].
10231 ///
10232 /// # Example
10233 /// ```ignore,no_run
10234 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10235 /// let x = Volume::new().set_remaining_space_gib(42);
10236 /// ```
10237 pub fn set_remaining_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10238 self.remaining_space_gib = v.into();
10239 self
10240 }
10241
10242 /// Sets the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10243 ///
10244 /// # Example
10245 /// ```ignore,no_run
10246 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10247 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10248 /// let x = Volume::new().set_snapshot_reservation_detail(SnapshotReservationDetail::default()/* use setters */);
10249 /// ```
10250 pub fn set_snapshot_reservation_detail<T>(mut self, v: T) -> Self
10251 where
10252 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10253 {
10254 self.snapshot_reservation_detail = std::option::Option::Some(v.into());
10255 self
10256 }
10257
10258 /// Sets or clears the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10259 ///
10260 /// # Example
10261 /// ```ignore,no_run
10262 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10263 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10264 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(Some(SnapshotReservationDetail::default()/* use setters */));
10265 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(None::<SnapshotReservationDetail>);
10266 /// ```
10267 pub fn set_or_clear_snapshot_reservation_detail<T>(mut self, v: std::option::Option<T>) -> Self
10268 where
10269 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10270 {
10271 self.snapshot_reservation_detail = v.map(|x| x.into());
10272 self
10273 }
10274
10275 /// Sets the value of [snapshot_auto_delete_behavior][crate::model::Volume::snapshot_auto_delete_behavior].
10276 ///
10277 /// # Example
10278 /// ```ignore,no_run
10279 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10280 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotAutoDeleteBehavior;
10281 /// let x0 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::Disabled);
10282 /// let x1 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::OldestFirst);
10283 /// let x2 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::NewestFirst);
10284 /// ```
10285 pub fn set_snapshot_auto_delete_behavior<
10286 T: std::convert::Into<crate::model::volume::SnapshotAutoDeleteBehavior>,
10287 >(
10288 mut self,
10289 v: T,
10290 ) -> Self {
10291 self.snapshot_auto_delete_behavior = v.into();
10292 self
10293 }
10294
10295 /// Sets the value of [labels][crate::model::Volume::labels].
10296 ///
10297 /// # Example
10298 /// ```ignore,no_run
10299 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10300 /// let x = Volume::new().set_labels([
10301 /// ("key0", "abc"),
10302 /// ("key1", "xyz"),
10303 /// ]);
10304 /// ```
10305 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10306 where
10307 T: std::iter::IntoIterator<Item = (K, V)>,
10308 K: std::convert::Into<std::string::String>,
10309 V: std::convert::Into<std::string::String>,
10310 {
10311 use std::iter::Iterator;
10312 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10313 self
10314 }
10315
10316 /// Sets the value of [snapshot_enabled][crate::model::Volume::snapshot_enabled].
10317 ///
10318 /// # Example
10319 /// ```ignore,no_run
10320 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10321 /// let x = Volume::new().set_snapshot_enabled(true);
10322 /// ```
10323 pub fn set_snapshot_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10324 self.snapshot_enabled = v.into();
10325 self
10326 }
10327
10328 /// Sets the value of [pod][crate::model::Volume::pod].
10329 ///
10330 /// # Example
10331 /// ```ignore,no_run
10332 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10333 /// let x = Volume::new().set_pod("example");
10334 /// ```
10335 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10336 self.pod = v.into();
10337 self
10338 }
10339
10340 /// Sets the value of [protocol][crate::model::Volume::protocol].
10341 ///
10342 /// # Example
10343 /// ```ignore,no_run
10344 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10345 /// use google_cloud_baremetalsolution_v2::model::volume::Protocol;
10346 /// let x0 = Volume::new().set_protocol(Protocol::FibreChannel);
10347 /// let x1 = Volume::new().set_protocol(Protocol::Nfs);
10348 /// ```
10349 pub fn set_protocol<T: std::convert::Into<crate::model::volume::Protocol>>(
10350 mut self,
10351 v: T,
10352 ) -> Self {
10353 self.protocol = v.into();
10354 self
10355 }
10356
10357 /// Sets the value of [boot_volume][crate::model::Volume::boot_volume].
10358 ///
10359 /// # Example
10360 /// ```ignore,no_run
10361 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10362 /// let x = Volume::new().set_boot_volume(true);
10363 /// ```
10364 pub fn set_boot_volume<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10365 self.boot_volume = v.into();
10366 self
10367 }
10368
10369 /// Sets the value of [performance_tier][crate::model::Volume::performance_tier].
10370 ///
10371 /// # Example
10372 /// ```ignore,no_run
10373 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10374 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
10375 /// let x0 = Volume::new().set_performance_tier(VolumePerformanceTier::Shared);
10376 /// let x1 = Volume::new().set_performance_tier(VolumePerformanceTier::Assigned);
10377 /// let x2 = Volume::new().set_performance_tier(VolumePerformanceTier::Ht);
10378 /// ```
10379 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
10380 mut self,
10381 v: T,
10382 ) -> Self {
10383 self.performance_tier = v.into();
10384 self
10385 }
10386
10387 /// Sets the value of [notes][crate::model::Volume::notes].
10388 ///
10389 /// # Example
10390 /// ```ignore,no_run
10391 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10392 /// let x = Volume::new().set_notes("example");
10393 /// ```
10394 pub fn set_notes<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10395 self.notes = v.into();
10396 self
10397 }
10398
10399 /// Sets the value of [workload_profile][crate::model::Volume::workload_profile].
10400 ///
10401 /// # Example
10402 /// ```ignore,no_run
10403 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10404 /// use google_cloud_baremetalsolution_v2::model::volume::WorkloadProfile;
10405 /// let x0 = Volume::new().set_workload_profile(WorkloadProfile::Generic);
10406 /// let x1 = Volume::new().set_workload_profile(WorkloadProfile::Hana);
10407 /// ```
10408 pub fn set_workload_profile<T: std::convert::Into<crate::model::volume::WorkloadProfile>>(
10409 mut self,
10410 v: T,
10411 ) -> Self {
10412 self.workload_profile = v.into();
10413 self
10414 }
10415
10416 /// Sets the value of [expire_time][crate::model::Volume::expire_time].
10417 ///
10418 /// # Example
10419 /// ```ignore,no_run
10420 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10421 /// use wkt::Timestamp;
10422 /// let x = Volume::new().set_expire_time(Timestamp::default()/* use setters */);
10423 /// ```
10424 pub fn set_expire_time<T>(mut self, v: T) -> Self
10425 where
10426 T: std::convert::Into<wkt::Timestamp>,
10427 {
10428 self.expire_time = std::option::Option::Some(v.into());
10429 self
10430 }
10431
10432 /// Sets or clears the value of [expire_time][crate::model::Volume::expire_time].
10433 ///
10434 /// # Example
10435 /// ```ignore,no_run
10436 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10437 /// use wkt::Timestamp;
10438 /// let x = Volume::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10439 /// let x = Volume::new().set_or_clear_expire_time(None::<Timestamp>);
10440 /// ```
10441 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10442 where
10443 T: std::convert::Into<wkt::Timestamp>,
10444 {
10445 self.expire_time = v.map(|x| x.into());
10446 self
10447 }
10448
10449 /// Sets the value of [instances][crate::model::Volume::instances].
10450 ///
10451 /// # Example
10452 /// ```ignore,no_run
10453 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10454 /// let x = Volume::new().set_instances(["a", "b", "c"]);
10455 /// ```
10456 pub fn set_instances<T, V>(mut self, v: T) -> Self
10457 where
10458 T: std::iter::IntoIterator<Item = V>,
10459 V: std::convert::Into<std::string::String>,
10460 {
10461 use std::iter::Iterator;
10462 self.instances = v.into_iter().map(|i| i.into()).collect();
10463 self
10464 }
10465
10466 /// Sets the value of [attached][crate::model::Volume::attached].
10467 ///
10468 /// # Example
10469 /// ```ignore,no_run
10470 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10471 /// let x = Volume::new().set_attached(true);
10472 /// ```
10473 pub fn set_attached<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10474 self.attached = v.into();
10475 self
10476 }
10477}
10478
10479impl wkt::message::Message for Volume {
10480 fn typename() -> &'static str {
10481 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume"
10482 }
10483}
10484
10485/// Defines additional types related to [Volume].
10486pub mod volume {
10487 #[allow(unused_imports)]
10488 use super::*;
10489
10490 /// Details about snapshot space reservation and usage on the storage volume.
10491 #[derive(Clone, Default, PartialEq)]
10492 #[non_exhaustive]
10493 pub struct SnapshotReservationDetail {
10494 /// The space on this storage volume reserved for snapshots, shown in GiB.
10495 pub reserved_space_gib: i64,
10496
10497 /// The percent of snapshot space on this storage volume actually being used
10498 /// by the snapshot copies. This value might be higher than 100% if the
10499 /// snapshot copies have overflowed into the data portion of the storage
10500 /// volume.
10501 pub reserved_space_used_percent: i32,
10502
10503 /// The amount, in GiB, of available space in this storage volume's reserved
10504 /// snapshot space.
10505 pub reserved_space_remaining_gib: i64,
10506
10507 /// Percent of the total Volume size reserved for snapshot copies.
10508 /// Enabling snapshots requires reserving 20% or more of
10509 /// the storage volume space for snapshots. Maximum reserved space for
10510 /// snapshots is 40%.
10511 /// Setting this field will effectively set snapshot_enabled to true.
10512 pub reserved_space_percent: i32,
10513
10514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10515 }
10516
10517 impl SnapshotReservationDetail {
10518 pub fn new() -> Self {
10519 std::default::Default::default()
10520 }
10521
10522 /// Sets the value of [reserved_space_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_gib].
10523 ///
10524 /// # Example
10525 /// ```ignore,no_run
10526 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10527 /// let x = SnapshotReservationDetail::new().set_reserved_space_gib(42);
10528 /// ```
10529 pub fn set_reserved_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10530 self.reserved_space_gib = v.into();
10531 self
10532 }
10533
10534 /// Sets the value of [reserved_space_used_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_used_percent].
10535 ///
10536 /// # Example
10537 /// ```ignore,no_run
10538 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10539 /// let x = SnapshotReservationDetail::new().set_reserved_space_used_percent(42);
10540 /// ```
10541 pub fn set_reserved_space_used_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10542 self.reserved_space_used_percent = v.into();
10543 self
10544 }
10545
10546 /// Sets the value of [reserved_space_remaining_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_remaining_gib].
10547 ///
10548 /// # Example
10549 /// ```ignore,no_run
10550 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10551 /// let x = SnapshotReservationDetail::new().set_reserved_space_remaining_gib(42);
10552 /// ```
10553 pub fn set_reserved_space_remaining_gib<T: std::convert::Into<i64>>(
10554 mut self,
10555 v: T,
10556 ) -> Self {
10557 self.reserved_space_remaining_gib = v.into();
10558 self
10559 }
10560
10561 /// Sets the value of [reserved_space_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_percent].
10562 ///
10563 /// # Example
10564 /// ```ignore,no_run
10565 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10566 /// let x = SnapshotReservationDetail::new().set_reserved_space_percent(42);
10567 /// ```
10568 pub fn set_reserved_space_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10569 self.reserved_space_percent = v.into();
10570 self
10571 }
10572 }
10573
10574 impl wkt::message::Message for SnapshotReservationDetail {
10575 fn typename() -> &'static str {
10576 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume.SnapshotReservationDetail"
10577 }
10578 }
10579
10580 /// The storage type for a volume.
10581 ///
10582 /// # Working with unknown values
10583 ///
10584 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10585 /// additional enum variants at any time. Adding new variants is not considered
10586 /// a breaking change. Applications should write their code in anticipation of:
10587 ///
10588 /// - New values appearing in future releases of the client library, **and**
10589 /// - New values received dynamically, without application changes.
10590 ///
10591 /// Please consult the [Working with enums] section in the user guide for some
10592 /// guidelines.
10593 ///
10594 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10595 #[derive(Clone, Debug, PartialEq)]
10596 #[non_exhaustive]
10597 pub enum StorageType {
10598 /// The storage type for this volume is unknown.
10599 Unspecified,
10600 /// The storage type for this volume is SSD.
10601 Ssd,
10602 /// This storage type for this volume is HDD.
10603 Hdd,
10604 /// If set, the enum was initialized with an unknown value.
10605 ///
10606 /// Applications can examine the value using [StorageType::value] or
10607 /// [StorageType::name].
10608 UnknownValue(storage_type::UnknownValue),
10609 }
10610
10611 #[doc(hidden)]
10612 pub mod storage_type {
10613 #[allow(unused_imports)]
10614 use super::*;
10615 #[derive(Clone, Debug, PartialEq)]
10616 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10617 }
10618
10619 impl StorageType {
10620 /// Gets the enum value.
10621 ///
10622 /// Returns `None` if the enum contains an unknown value deserialized from
10623 /// the string representation of enums.
10624 pub fn value(&self) -> std::option::Option<i32> {
10625 match self {
10626 Self::Unspecified => std::option::Option::Some(0),
10627 Self::Ssd => std::option::Option::Some(1),
10628 Self::Hdd => std::option::Option::Some(2),
10629 Self::UnknownValue(u) => u.0.value(),
10630 }
10631 }
10632
10633 /// Gets the enum value as a string.
10634 ///
10635 /// Returns `None` if the enum contains an unknown value deserialized from
10636 /// the integer representation of enums.
10637 pub fn name(&self) -> std::option::Option<&str> {
10638 match self {
10639 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
10640 Self::Ssd => std::option::Option::Some("SSD"),
10641 Self::Hdd => std::option::Option::Some("HDD"),
10642 Self::UnknownValue(u) => u.0.name(),
10643 }
10644 }
10645 }
10646
10647 impl std::default::Default for StorageType {
10648 fn default() -> Self {
10649 use std::convert::From;
10650 Self::from(0)
10651 }
10652 }
10653
10654 impl std::fmt::Display for StorageType {
10655 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10656 wkt::internal::display_enum(f, self.name(), self.value())
10657 }
10658 }
10659
10660 impl std::convert::From<i32> for StorageType {
10661 fn from(value: i32) -> Self {
10662 match value {
10663 0 => Self::Unspecified,
10664 1 => Self::Ssd,
10665 2 => Self::Hdd,
10666 _ => Self::UnknownValue(storage_type::UnknownValue(
10667 wkt::internal::UnknownEnumValue::Integer(value),
10668 )),
10669 }
10670 }
10671 }
10672
10673 impl std::convert::From<&str> for StorageType {
10674 fn from(value: &str) -> Self {
10675 use std::string::ToString;
10676 match value {
10677 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
10678 "SSD" => Self::Ssd,
10679 "HDD" => Self::Hdd,
10680 _ => Self::UnknownValue(storage_type::UnknownValue(
10681 wkt::internal::UnknownEnumValue::String(value.to_string()),
10682 )),
10683 }
10684 }
10685 }
10686
10687 impl serde::ser::Serialize for StorageType {
10688 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10689 where
10690 S: serde::Serializer,
10691 {
10692 match self {
10693 Self::Unspecified => serializer.serialize_i32(0),
10694 Self::Ssd => serializer.serialize_i32(1),
10695 Self::Hdd => serializer.serialize_i32(2),
10696 Self::UnknownValue(u) => u.0.serialize(serializer),
10697 }
10698 }
10699 }
10700
10701 impl<'de> serde::de::Deserialize<'de> for StorageType {
10702 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10703 where
10704 D: serde::Deserializer<'de>,
10705 {
10706 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
10707 ".google.cloud.baremetalsolution.v2.Volume.StorageType",
10708 ))
10709 }
10710 }
10711
10712 /// The possible states for a storage volume.
10713 ///
10714 /// # Working with unknown values
10715 ///
10716 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10717 /// additional enum variants at any time. Adding new variants is not considered
10718 /// a breaking change. Applications should write their code in anticipation of:
10719 ///
10720 /// - New values appearing in future releases of the client library, **and**
10721 /// - New values received dynamically, without application changes.
10722 ///
10723 /// Please consult the [Working with enums] section in the user guide for some
10724 /// guidelines.
10725 ///
10726 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10727 #[derive(Clone, Debug, PartialEq)]
10728 #[non_exhaustive]
10729 pub enum State {
10730 /// The storage volume is in an unknown state.
10731 Unspecified,
10732 /// The storage volume is being created.
10733 Creating,
10734 /// The storage volume is ready for use.
10735 Ready,
10736 /// The storage volume has been requested to be deleted.
10737 Deleting,
10738 /// The storage volume is being updated.
10739 Updating,
10740 /// The storage volume is in cool off state. It will be deleted after
10741 /// `expire_time`.
10742 CoolOff,
10743 /// If set, the enum was initialized with an unknown value.
10744 ///
10745 /// Applications can examine the value using [State::value] or
10746 /// [State::name].
10747 UnknownValue(state::UnknownValue),
10748 }
10749
10750 #[doc(hidden)]
10751 pub mod state {
10752 #[allow(unused_imports)]
10753 use super::*;
10754 #[derive(Clone, Debug, PartialEq)]
10755 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10756 }
10757
10758 impl State {
10759 /// Gets the enum value.
10760 ///
10761 /// Returns `None` if the enum contains an unknown value deserialized from
10762 /// the string representation of enums.
10763 pub fn value(&self) -> std::option::Option<i32> {
10764 match self {
10765 Self::Unspecified => std::option::Option::Some(0),
10766 Self::Creating => std::option::Option::Some(1),
10767 Self::Ready => std::option::Option::Some(2),
10768 Self::Deleting => std::option::Option::Some(3),
10769 Self::Updating => std::option::Option::Some(4),
10770 Self::CoolOff => std::option::Option::Some(5),
10771 Self::UnknownValue(u) => u.0.value(),
10772 }
10773 }
10774
10775 /// Gets the enum value as a string.
10776 ///
10777 /// Returns `None` if the enum contains an unknown value deserialized from
10778 /// the integer representation of enums.
10779 pub fn name(&self) -> std::option::Option<&str> {
10780 match self {
10781 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10782 Self::Creating => std::option::Option::Some("CREATING"),
10783 Self::Ready => std::option::Option::Some("READY"),
10784 Self::Deleting => std::option::Option::Some("DELETING"),
10785 Self::Updating => std::option::Option::Some("UPDATING"),
10786 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
10787 Self::UnknownValue(u) => u.0.name(),
10788 }
10789 }
10790 }
10791
10792 impl std::default::Default for State {
10793 fn default() -> Self {
10794 use std::convert::From;
10795 Self::from(0)
10796 }
10797 }
10798
10799 impl std::fmt::Display for State {
10800 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10801 wkt::internal::display_enum(f, self.name(), self.value())
10802 }
10803 }
10804
10805 impl std::convert::From<i32> for State {
10806 fn from(value: i32) -> Self {
10807 match value {
10808 0 => Self::Unspecified,
10809 1 => Self::Creating,
10810 2 => Self::Ready,
10811 3 => Self::Deleting,
10812 4 => Self::Updating,
10813 5 => Self::CoolOff,
10814 _ => Self::UnknownValue(state::UnknownValue(
10815 wkt::internal::UnknownEnumValue::Integer(value),
10816 )),
10817 }
10818 }
10819 }
10820
10821 impl std::convert::From<&str> for State {
10822 fn from(value: &str) -> Self {
10823 use std::string::ToString;
10824 match value {
10825 "STATE_UNSPECIFIED" => Self::Unspecified,
10826 "CREATING" => Self::Creating,
10827 "READY" => Self::Ready,
10828 "DELETING" => Self::Deleting,
10829 "UPDATING" => Self::Updating,
10830 "COOL_OFF" => Self::CoolOff,
10831 _ => Self::UnknownValue(state::UnknownValue(
10832 wkt::internal::UnknownEnumValue::String(value.to_string()),
10833 )),
10834 }
10835 }
10836 }
10837
10838 impl serde::ser::Serialize for State {
10839 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10840 where
10841 S: serde::Serializer,
10842 {
10843 match self {
10844 Self::Unspecified => serializer.serialize_i32(0),
10845 Self::Creating => serializer.serialize_i32(1),
10846 Self::Ready => serializer.serialize_i32(2),
10847 Self::Deleting => serializer.serialize_i32(3),
10848 Self::Updating => serializer.serialize_i32(4),
10849 Self::CoolOff => serializer.serialize_i32(5),
10850 Self::UnknownValue(u) => u.0.serialize(serializer),
10851 }
10852 }
10853 }
10854
10855 impl<'de> serde::de::Deserialize<'de> for State {
10856 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10857 where
10858 D: serde::Deserializer<'de>,
10859 {
10860 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10861 ".google.cloud.baremetalsolution.v2.Volume.State",
10862 ))
10863 }
10864 }
10865
10866 /// The kinds of auto delete behavior to use when snapshot reserved space is
10867 /// full.
10868 ///
10869 /// # Working with unknown values
10870 ///
10871 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10872 /// additional enum variants at any time. Adding new variants is not considered
10873 /// a breaking change. Applications should write their code in anticipation of:
10874 ///
10875 /// - New values appearing in future releases of the client library, **and**
10876 /// - New values received dynamically, without application changes.
10877 ///
10878 /// Please consult the [Working with enums] section in the user guide for some
10879 /// guidelines.
10880 ///
10881 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10882 #[derive(Clone, Debug, PartialEq)]
10883 #[non_exhaustive]
10884 pub enum SnapshotAutoDeleteBehavior {
10885 /// The unspecified behavior.
10886 Unspecified,
10887 /// Don't delete any snapshots. This disables new snapshot creation, as
10888 /// long as the snapshot reserved space is full.
10889 Disabled,
10890 /// Delete the oldest snapshots first.
10891 OldestFirst,
10892 /// Delete the newest snapshots first.
10893 NewestFirst,
10894 /// If set, the enum was initialized with an unknown value.
10895 ///
10896 /// Applications can examine the value using [SnapshotAutoDeleteBehavior::value] or
10897 /// [SnapshotAutoDeleteBehavior::name].
10898 UnknownValue(snapshot_auto_delete_behavior::UnknownValue),
10899 }
10900
10901 #[doc(hidden)]
10902 pub mod snapshot_auto_delete_behavior {
10903 #[allow(unused_imports)]
10904 use super::*;
10905 #[derive(Clone, Debug, PartialEq)]
10906 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10907 }
10908
10909 impl SnapshotAutoDeleteBehavior {
10910 /// Gets the enum value.
10911 ///
10912 /// Returns `None` if the enum contains an unknown value deserialized from
10913 /// the string representation of enums.
10914 pub fn value(&self) -> std::option::Option<i32> {
10915 match self {
10916 Self::Unspecified => std::option::Option::Some(0),
10917 Self::Disabled => std::option::Option::Some(1),
10918 Self::OldestFirst => std::option::Option::Some(2),
10919 Self::NewestFirst => std::option::Option::Some(3),
10920 Self::UnknownValue(u) => u.0.value(),
10921 }
10922 }
10923
10924 /// Gets the enum value as a string.
10925 ///
10926 /// Returns `None` if the enum contains an unknown value deserialized from
10927 /// the integer representation of enums.
10928 pub fn name(&self) -> std::option::Option<&str> {
10929 match self {
10930 Self::Unspecified => {
10931 std::option::Option::Some("SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED")
10932 }
10933 Self::Disabled => std::option::Option::Some("DISABLED"),
10934 Self::OldestFirst => std::option::Option::Some("OLDEST_FIRST"),
10935 Self::NewestFirst => std::option::Option::Some("NEWEST_FIRST"),
10936 Self::UnknownValue(u) => u.0.name(),
10937 }
10938 }
10939 }
10940
10941 impl std::default::Default for SnapshotAutoDeleteBehavior {
10942 fn default() -> Self {
10943 use std::convert::From;
10944 Self::from(0)
10945 }
10946 }
10947
10948 impl std::fmt::Display for SnapshotAutoDeleteBehavior {
10949 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10950 wkt::internal::display_enum(f, self.name(), self.value())
10951 }
10952 }
10953
10954 impl std::convert::From<i32> for SnapshotAutoDeleteBehavior {
10955 fn from(value: i32) -> Self {
10956 match value {
10957 0 => Self::Unspecified,
10958 1 => Self::Disabled,
10959 2 => Self::OldestFirst,
10960 3 => Self::NewestFirst,
10961 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
10962 wkt::internal::UnknownEnumValue::Integer(value),
10963 )),
10964 }
10965 }
10966 }
10967
10968 impl std::convert::From<&str> for SnapshotAutoDeleteBehavior {
10969 fn from(value: &str) -> Self {
10970 use std::string::ToString;
10971 match value {
10972 "SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
10973 "DISABLED" => Self::Disabled,
10974 "OLDEST_FIRST" => Self::OldestFirst,
10975 "NEWEST_FIRST" => Self::NewestFirst,
10976 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
10977 wkt::internal::UnknownEnumValue::String(value.to_string()),
10978 )),
10979 }
10980 }
10981 }
10982
10983 impl serde::ser::Serialize for SnapshotAutoDeleteBehavior {
10984 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10985 where
10986 S: serde::Serializer,
10987 {
10988 match self {
10989 Self::Unspecified => serializer.serialize_i32(0),
10990 Self::Disabled => serializer.serialize_i32(1),
10991 Self::OldestFirst => serializer.serialize_i32(2),
10992 Self::NewestFirst => serializer.serialize_i32(3),
10993 Self::UnknownValue(u) => u.0.serialize(serializer),
10994 }
10995 }
10996 }
10997
10998 impl<'de> serde::de::Deserialize<'de> for SnapshotAutoDeleteBehavior {
10999 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11000 where
11001 D: serde::Deserializer<'de>,
11002 {
11003 deserializer.deserialize_any(
11004 wkt::internal::EnumVisitor::<SnapshotAutoDeleteBehavior>::new(
11005 ".google.cloud.baremetalsolution.v2.Volume.SnapshotAutoDeleteBehavior",
11006 ),
11007 )
11008 }
11009 }
11010
11011 /// Storage protocol.
11012 ///
11013 /// # Working with unknown values
11014 ///
11015 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11016 /// additional enum variants at any time. Adding new variants is not considered
11017 /// a breaking change. Applications should write their code in anticipation of:
11018 ///
11019 /// - New values appearing in future releases of the client library, **and**
11020 /// - New values received dynamically, without application changes.
11021 ///
11022 /// Please consult the [Working with enums] section in the user guide for some
11023 /// guidelines.
11024 ///
11025 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11026 #[derive(Clone, Debug, PartialEq)]
11027 #[non_exhaustive]
11028 pub enum Protocol {
11029 /// Value is not specified.
11030 Unspecified,
11031 /// Fibre Channel protocol.
11032 FibreChannel,
11033 /// NFS protocol means Volume is a NFS Share volume.
11034 /// Such volumes cannot be manipulated via Volumes API.
11035 Nfs,
11036 /// If set, the enum was initialized with an unknown value.
11037 ///
11038 /// Applications can examine the value using [Protocol::value] or
11039 /// [Protocol::name].
11040 UnknownValue(protocol::UnknownValue),
11041 }
11042
11043 #[doc(hidden)]
11044 pub mod protocol {
11045 #[allow(unused_imports)]
11046 use super::*;
11047 #[derive(Clone, Debug, PartialEq)]
11048 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11049 }
11050
11051 impl Protocol {
11052 /// Gets the enum value.
11053 ///
11054 /// Returns `None` if the enum contains an unknown value deserialized from
11055 /// the string representation of enums.
11056 pub fn value(&self) -> std::option::Option<i32> {
11057 match self {
11058 Self::Unspecified => std::option::Option::Some(0),
11059 Self::FibreChannel => std::option::Option::Some(1),
11060 Self::Nfs => std::option::Option::Some(2),
11061 Self::UnknownValue(u) => u.0.value(),
11062 }
11063 }
11064
11065 /// Gets the enum value as a string.
11066 ///
11067 /// Returns `None` if the enum contains an unknown value deserialized from
11068 /// the integer representation of enums.
11069 pub fn name(&self) -> std::option::Option<&str> {
11070 match self {
11071 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
11072 Self::FibreChannel => std::option::Option::Some("FIBRE_CHANNEL"),
11073 Self::Nfs => std::option::Option::Some("NFS"),
11074 Self::UnknownValue(u) => u.0.name(),
11075 }
11076 }
11077 }
11078
11079 impl std::default::Default for Protocol {
11080 fn default() -> Self {
11081 use std::convert::From;
11082 Self::from(0)
11083 }
11084 }
11085
11086 impl std::fmt::Display for Protocol {
11087 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11088 wkt::internal::display_enum(f, self.name(), self.value())
11089 }
11090 }
11091
11092 impl std::convert::From<i32> for Protocol {
11093 fn from(value: i32) -> Self {
11094 match value {
11095 0 => Self::Unspecified,
11096 1 => Self::FibreChannel,
11097 2 => Self::Nfs,
11098 _ => Self::UnknownValue(protocol::UnknownValue(
11099 wkt::internal::UnknownEnumValue::Integer(value),
11100 )),
11101 }
11102 }
11103 }
11104
11105 impl std::convert::From<&str> for Protocol {
11106 fn from(value: &str) -> Self {
11107 use std::string::ToString;
11108 match value {
11109 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
11110 "FIBRE_CHANNEL" => Self::FibreChannel,
11111 "NFS" => Self::Nfs,
11112 _ => Self::UnknownValue(protocol::UnknownValue(
11113 wkt::internal::UnknownEnumValue::String(value.to_string()),
11114 )),
11115 }
11116 }
11117 }
11118
11119 impl serde::ser::Serialize for Protocol {
11120 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11121 where
11122 S: serde::Serializer,
11123 {
11124 match self {
11125 Self::Unspecified => serializer.serialize_i32(0),
11126 Self::FibreChannel => serializer.serialize_i32(1),
11127 Self::Nfs => serializer.serialize_i32(2),
11128 Self::UnknownValue(u) => u.0.serialize(serializer),
11129 }
11130 }
11131 }
11132
11133 impl<'de> serde::de::Deserialize<'de> for Protocol {
11134 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11135 where
11136 D: serde::Deserializer<'de>,
11137 {
11138 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
11139 ".google.cloud.baremetalsolution.v2.Volume.Protocol",
11140 ))
11141 }
11142 }
11143
11144 /// The possible values for a workload profile.
11145 ///
11146 /// # Working with unknown values
11147 ///
11148 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11149 /// additional enum variants at any time. Adding new variants is not considered
11150 /// a breaking change. Applications should write their code in anticipation of:
11151 ///
11152 /// - New values appearing in future releases of the client library, **and**
11153 /// - New values received dynamically, without application changes.
11154 ///
11155 /// Please consult the [Working with enums] section in the user guide for some
11156 /// guidelines.
11157 ///
11158 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11159 #[derive(Clone, Debug, PartialEq)]
11160 #[non_exhaustive]
11161 pub enum WorkloadProfile {
11162 /// The workload profile is in an unknown state.
11163 Unspecified,
11164 /// The workload profile is generic.
11165 Generic,
11166 /// The workload profile is hana.
11167 Hana,
11168 /// If set, the enum was initialized with an unknown value.
11169 ///
11170 /// Applications can examine the value using [WorkloadProfile::value] or
11171 /// [WorkloadProfile::name].
11172 UnknownValue(workload_profile::UnknownValue),
11173 }
11174
11175 #[doc(hidden)]
11176 pub mod workload_profile {
11177 #[allow(unused_imports)]
11178 use super::*;
11179 #[derive(Clone, Debug, PartialEq)]
11180 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11181 }
11182
11183 impl WorkloadProfile {
11184 /// Gets the enum value.
11185 ///
11186 /// Returns `None` if the enum contains an unknown value deserialized from
11187 /// the string representation of enums.
11188 pub fn value(&self) -> std::option::Option<i32> {
11189 match self {
11190 Self::Unspecified => std::option::Option::Some(0),
11191 Self::Generic => std::option::Option::Some(1),
11192 Self::Hana => std::option::Option::Some(2),
11193 Self::UnknownValue(u) => u.0.value(),
11194 }
11195 }
11196
11197 /// Gets the enum value as a string.
11198 ///
11199 /// Returns `None` if the enum contains an unknown value deserialized from
11200 /// the integer representation of enums.
11201 pub fn name(&self) -> std::option::Option<&str> {
11202 match self {
11203 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
11204 Self::Generic => std::option::Option::Some("GENERIC"),
11205 Self::Hana => std::option::Option::Some("HANA"),
11206 Self::UnknownValue(u) => u.0.name(),
11207 }
11208 }
11209 }
11210
11211 impl std::default::Default for WorkloadProfile {
11212 fn default() -> Self {
11213 use std::convert::From;
11214 Self::from(0)
11215 }
11216 }
11217
11218 impl std::fmt::Display for WorkloadProfile {
11219 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11220 wkt::internal::display_enum(f, self.name(), self.value())
11221 }
11222 }
11223
11224 impl std::convert::From<i32> for WorkloadProfile {
11225 fn from(value: i32) -> Self {
11226 match value {
11227 0 => Self::Unspecified,
11228 1 => Self::Generic,
11229 2 => Self::Hana,
11230 _ => Self::UnknownValue(workload_profile::UnknownValue(
11231 wkt::internal::UnknownEnumValue::Integer(value),
11232 )),
11233 }
11234 }
11235 }
11236
11237 impl std::convert::From<&str> for WorkloadProfile {
11238 fn from(value: &str) -> Self {
11239 use std::string::ToString;
11240 match value {
11241 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
11242 "GENERIC" => Self::Generic,
11243 "HANA" => Self::Hana,
11244 _ => Self::UnknownValue(workload_profile::UnknownValue(
11245 wkt::internal::UnknownEnumValue::String(value.to_string()),
11246 )),
11247 }
11248 }
11249 }
11250
11251 impl serde::ser::Serialize for WorkloadProfile {
11252 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11253 where
11254 S: serde::Serializer,
11255 {
11256 match self {
11257 Self::Unspecified => serializer.serialize_i32(0),
11258 Self::Generic => serializer.serialize_i32(1),
11259 Self::Hana => serializer.serialize_i32(2),
11260 Self::UnknownValue(u) => u.0.serialize(serializer),
11261 }
11262 }
11263 }
11264
11265 impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
11266 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11267 where
11268 D: serde::Deserializer<'de>,
11269 {
11270 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
11271 ".google.cloud.baremetalsolution.v2.Volume.WorkloadProfile",
11272 ))
11273 }
11274 }
11275}
11276
11277/// Message for requesting storage volume information.
11278#[derive(Clone, Default, PartialEq)]
11279#[non_exhaustive]
11280pub struct GetVolumeRequest {
11281 /// Required. Name of the resource.
11282 pub name: std::string::String,
11283
11284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11285}
11286
11287impl GetVolumeRequest {
11288 pub fn new() -> Self {
11289 std::default::Default::default()
11290 }
11291
11292 /// Sets the value of [name][crate::model::GetVolumeRequest::name].
11293 ///
11294 /// # Example
11295 /// ```ignore,no_run
11296 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeRequest;
11297 /// let x = GetVolumeRequest::new().set_name("example");
11298 /// ```
11299 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11300 self.name = v.into();
11301 self
11302 }
11303}
11304
11305impl wkt::message::Message for GetVolumeRequest {
11306 fn typename() -> &'static str {
11307 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeRequest"
11308 }
11309}
11310
11311/// Message for requesting a list of storage volumes.
11312#[derive(Clone, Default, PartialEq)]
11313#[non_exhaustive]
11314pub struct ListVolumesRequest {
11315 /// Required. Parent value for ListVolumesRequest.
11316 pub parent: std::string::String,
11317
11318 /// Requested page size. The server might return fewer items than requested.
11319 /// If unspecified, server will pick an appropriate default.
11320 pub page_size: i32,
11321
11322 /// A token identifying a page of results from the server.
11323 pub page_token: std::string::String,
11324
11325 /// List filter.
11326 pub filter: std::string::String,
11327
11328 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11329}
11330
11331impl ListVolumesRequest {
11332 pub fn new() -> Self {
11333 std::default::Default::default()
11334 }
11335
11336 /// Sets the value of [parent][crate::model::ListVolumesRequest::parent].
11337 ///
11338 /// # Example
11339 /// ```ignore,no_run
11340 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11341 /// let x = ListVolumesRequest::new().set_parent("example");
11342 /// ```
11343 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11344 self.parent = v.into();
11345 self
11346 }
11347
11348 /// Sets the value of [page_size][crate::model::ListVolumesRequest::page_size].
11349 ///
11350 /// # Example
11351 /// ```ignore,no_run
11352 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11353 /// let x = ListVolumesRequest::new().set_page_size(42);
11354 /// ```
11355 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11356 self.page_size = v.into();
11357 self
11358 }
11359
11360 /// Sets the value of [page_token][crate::model::ListVolumesRequest::page_token].
11361 ///
11362 /// # Example
11363 /// ```ignore,no_run
11364 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11365 /// let x = ListVolumesRequest::new().set_page_token("example");
11366 /// ```
11367 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11368 self.page_token = v.into();
11369 self
11370 }
11371
11372 /// Sets the value of [filter][crate::model::ListVolumesRequest::filter].
11373 ///
11374 /// # Example
11375 /// ```ignore,no_run
11376 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11377 /// let x = ListVolumesRequest::new().set_filter("example");
11378 /// ```
11379 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11380 self.filter = v.into();
11381 self
11382 }
11383}
11384
11385impl wkt::message::Message for ListVolumesRequest {
11386 fn typename() -> &'static str {
11387 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesRequest"
11388 }
11389}
11390
11391/// Response message containing the list of storage volumes.
11392#[derive(Clone, Default, PartialEq)]
11393#[non_exhaustive]
11394pub struct ListVolumesResponse {
11395 /// The list of storage volumes.
11396 pub volumes: std::vec::Vec<crate::model::Volume>,
11397
11398 /// A token identifying a page of results from the server.
11399 pub next_page_token: std::string::String,
11400
11401 /// Locations that could not be reached.
11402 pub unreachable: std::vec::Vec<std::string::String>,
11403
11404 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11405}
11406
11407impl ListVolumesResponse {
11408 pub fn new() -> Self {
11409 std::default::Default::default()
11410 }
11411
11412 /// Sets the value of [volumes][crate::model::ListVolumesResponse::volumes].
11413 ///
11414 /// # Example
11415 /// ```ignore,no_run
11416 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11417 /// use google_cloud_baremetalsolution_v2::model::Volume;
11418 /// let x = ListVolumesResponse::new()
11419 /// .set_volumes([
11420 /// Volume::default()/* use setters */,
11421 /// Volume::default()/* use (different) setters */,
11422 /// ]);
11423 /// ```
11424 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11425 where
11426 T: std::iter::IntoIterator<Item = V>,
11427 V: std::convert::Into<crate::model::Volume>,
11428 {
11429 use std::iter::Iterator;
11430 self.volumes = v.into_iter().map(|i| i.into()).collect();
11431 self
11432 }
11433
11434 /// Sets the value of [next_page_token][crate::model::ListVolumesResponse::next_page_token].
11435 ///
11436 /// # Example
11437 /// ```ignore,no_run
11438 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11439 /// let x = ListVolumesResponse::new().set_next_page_token("example");
11440 /// ```
11441 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11442 self.next_page_token = v.into();
11443 self
11444 }
11445
11446 /// Sets the value of [unreachable][crate::model::ListVolumesResponse::unreachable].
11447 ///
11448 /// # Example
11449 /// ```ignore,no_run
11450 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11451 /// let x = ListVolumesResponse::new().set_unreachable(["a", "b", "c"]);
11452 /// ```
11453 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
11454 where
11455 T: std::iter::IntoIterator<Item = V>,
11456 V: std::convert::Into<std::string::String>,
11457 {
11458 use std::iter::Iterator;
11459 self.unreachable = v.into_iter().map(|i| i.into()).collect();
11460 self
11461 }
11462}
11463
11464impl wkt::message::Message for ListVolumesResponse {
11465 fn typename() -> &'static str {
11466 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesResponse"
11467 }
11468}
11469
11470#[doc(hidden)]
11471impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumesResponse {
11472 type PageItem = crate::model::Volume;
11473
11474 fn items(self) -> std::vec::Vec<Self::PageItem> {
11475 self.volumes
11476 }
11477
11478 fn next_page_token(&self) -> std::string::String {
11479 use std::clone::Clone;
11480 self.next_page_token.clone()
11481 }
11482}
11483
11484/// Message for updating a volume.
11485#[derive(Clone, Default, PartialEq)]
11486#[non_exhaustive]
11487pub struct UpdateVolumeRequest {
11488 /// Required. The volume to update.
11489 ///
11490 /// The `name` field is used to identify the volume to update.
11491 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11492 pub volume: std::option::Option<crate::model::Volume>,
11493
11494 /// The list of fields to update.
11495 /// The only currently supported fields are:
11496 /// 'labels'
11497 pub update_mask: std::option::Option<wkt::FieldMask>,
11498
11499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11500}
11501
11502impl UpdateVolumeRequest {
11503 pub fn new() -> Self {
11504 std::default::Default::default()
11505 }
11506
11507 /// Sets the value of [volume][crate::model::UpdateVolumeRequest::volume].
11508 ///
11509 /// # Example
11510 /// ```ignore,no_run
11511 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11512 /// use google_cloud_baremetalsolution_v2::model::Volume;
11513 /// let x = UpdateVolumeRequest::new().set_volume(Volume::default()/* use setters */);
11514 /// ```
11515 pub fn set_volume<T>(mut self, v: T) -> Self
11516 where
11517 T: std::convert::Into<crate::model::Volume>,
11518 {
11519 self.volume = std::option::Option::Some(v.into());
11520 self
11521 }
11522
11523 /// Sets or clears the value of [volume][crate::model::UpdateVolumeRequest::volume].
11524 ///
11525 /// # Example
11526 /// ```ignore,no_run
11527 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11528 /// use google_cloud_baremetalsolution_v2::model::Volume;
11529 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(Some(Volume::default()/* use setters */));
11530 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(None::<Volume>);
11531 /// ```
11532 pub fn set_or_clear_volume<T>(mut self, v: std::option::Option<T>) -> Self
11533 where
11534 T: std::convert::Into<crate::model::Volume>,
11535 {
11536 self.volume = v.map(|x| x.into());
11537 self
11538 }
11539
11540 /// Sets the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11541 ///
11542 /// # Example
11543 /// ```ignore,no_run
11544 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11545 /// use wkt::FieldMask;
11546 /// let x = UpdateVolumeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11547 /// ```
11548 pub fn set_update_mask<T>(mut self, v: T) -> Self
11549 where
11550 T: std::convert::Into<wkt::FieldMask>,
11551 {
11552 self.update_mask = std::option::Option::Some(v.into());
11553 self
11554 }
11555
11556 /// Sets or clears the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11557 ///
11558 /// # Example
11559 /// ```ignore,no_run
11560 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11561 /// use wkt::FieldMask;
11562 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11563 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11564 /// ```
11565 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11566 where
11567 T: std::convert::Into<wkt::FieldMask>,
11568 {
11569 self.update_mask = v.map(|x| x.into());
11570 self
11571 }
11572}
11573
11574impl wkt::message::Message for UpdateVolumeRequest {
11575 fn typename() -> &'static str {
11576 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateVolumeRequest"
11577 }
11578}
11579
11580/// Message requesting rename of a server.
11581#[derive(Clone, Default, PartialEq)]
11582#[non_exhaustive]
11583pub struct RenameVolumeRequest {
11584 /// Required. The `name` field is used to identify the volume.
11585 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11586 pub name: std::string::String,
11587
11588 /// Required. The new `id` of the volume.
11589 pub new_volume_id: std::string::String,
11590
11591 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11592}
11593
11594impl RenameVolumeRequest {
11595 pub fn new() -> Self {
11596 std::default::Default::default()
11597 }
11598
11599 /// Sets the value of [name][crate::model::RenameVolumeRequest::name].
11600 ///
11601 /// # Example
11602 /// ```ignore,no_run
11603 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11604 /// let x = RenameVolumeRequest::new().set_name("example");
11605 /// ```
11606 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11607 self.name = v.into();
11608 self
11609 }
11610
11611 /// Sets the value of [new_volume_id][crate::model::RenameVolumeRequest::new_volume_id].
11612 ///
11613 /// # Example
11614 /// ```ignore,no_run
11615 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11616 /// let x = RenameVolumeRequest::new().set_new_volume_id("example");
11617 /// ```
11618 pub fn set_new_volume_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11619 self.new_volume_id = v.into();
11620 self
11621 }
11622}
11623
11624impl wkt::message::Message for RenameVolumeRequest {
11625 fn typename() -> &'static str {
11626 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameVolumeRequest"
11627 }
11628}
11629
11630/// Request for skip volume cooloff and delete it.
11631#[derive(Clone, Default, PartialEq)]
11632#[non_exhaustive]
11633pub struct EvictVolumeRequest {
11634 /// Required. The name of the Volume.
11635 pub name: std::string::String,
11636
11637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11638}
11639
11640impl EvictVolumeRequest {
11641 pub fn new() -> Self {
11642 std::default::Default::default()
11643 }
11644
11645 /// Sets the value of [name][crate::model::EvictVolumeRequest::name].
11646 ///
11647 /// # Example
11648 /// ```ignore,no_run
11649 /// # use google_cloud_baremetalsolution_v2::model::EvictVolumeRequest;
11650 /// let x = EvictVolumeRequest::new().set_name("example");
11651 /// ```
11652 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11653 self.name = v.into();
11654 self
11655 }
11656}
11657
11658impl wkt::message::Message for EvictVolumeRequest {
11659 fn typename() -> &'static str {
11660 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictVolumeRequest"
11661 }
11662}
11663
11664/// Request for emergency resize Volume.
11665#[derive(Clone, Default, PartialEq)]
11666#[non_exhaustive]
11667pub struct ResizeVolumeRequest {
11668 /// Required. Volume to resize.
11669 pub volume: std::string::String,
11670
11671 /// New Volume size, in GiB.
11672 pub size_gib: i64,
11673
11674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11675}
11676
11677impl ResizeVolumeRequest {
11678 pub fn new() -> Self {
11679 std::default::Default::default()
11680 }
11681
11682 /// Sets the value of [volume][crate::model::ResizeVolumeRequest::volume].
11683 ///
11684 /// # Example
11685 /// ```ignore,no_run
11686 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11687 /// let x = ResizeVolumeRequest::new().set_volume("example");
11688 /// ```
11689 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11690 self.volume = v.into();
11691 self
11692 }
11693
11694 /// Sets the value of [size_gib][crate::model::ResizeVolumeRequest::size_gib].
11695 ///
11696 /// # Example
11697 /// ```ignore,no_run
11698 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11699 /// let x = ResizeVolumeRequest::new().set_size_gib(42);
11700 /// ```
11701 pub fn set_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11702 self.size_gib = v.into();
11703 self
11704 }
11705}
11706
11707impl wkt::message::Message for ResizeVolumeRequest {
11708 fn typename() -> &'static str {
11709 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResizeVolumeRequest"
11710 }
11711}
11712
11713/// A snapshot of a volume. Only boot volumes can have snapshots.
11714#[derive(Clone, Default, PartialEq)]
11715#[non_exhaustive]
11716pub struct VolumeSnapshot {
11717 /// The name of the snapshot.
11718 pub name: std::string::String,
11719
11720 /// Output only. An identifier for the snapshot, generated by the backend.
11721 pub id: std::string::String,
11722
11723 /// The description of the snapshot.
11724 pub description: std::string::String,
11725
11726 /// Output only. The creation time of the snapshot.
11727 pub create_time: std::option::Option<wkt::Timestamp>,
11728
11729 /// Output only. The name of the volume which this snapshot belongs to.
11730 pub storage_volume: std::string::String,
11731
11732 /// Output only. The type of the snapshot which indicates whether it was
11733 /// scheduled or manual/ad-hoc.
11734 pub r#type: crate::model::volume_snapshot::SnapshotType,
11735
11736 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11737}
11738
11739impl VolumeSnapshot {
11740 pub fn new() -> Self {
11741 std::default::Default::default()
11742 }
11743
11744 /// Sets the value of [name][crate::model::VolumeSnapshot::name].
11745 ///
11746 /// # Example
11747 /// ```ignore,no_run
11748 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11749 /// let x = VolumeSnapshot::new().set_name("example");
11750 /// ```
11751 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11752 self.name = v.into();
11753 self
11754 }
11755
11756 /// Sets the value of [id][crate::model::VolumeSnapshot::id].
11757 ///
11758 /// # Example
11759 /// ```ignore,no_run
11760 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11761 /// let x = VolumeSnapshot::new().set_id("example");
11762 /// ```
11763 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11764 self.id = v.into();
11765 self
11766 }
11767
11768 /// Sets the value of [description][crate::model::VolumeSnapshot::description].
11769 ///
11770 /// # Example
11771 /// ```ignore,no_run
11772 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11773 /// let x = VolumeSnapshot::new().set_description("example");
11774 /// ```
11775 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11776 self.description = v.into();
11777 self
11778 }
11779
11780 /// Sets the value of [create_time][crate::model::VolumeSnapshot::create_time].
11781 ///
11782 /// # Example
11783 /// ```ignore,no_run
11784 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11785 /// use wkt::Timestamp;
11786 /// let x = VolumeSnapshot::new().set_create_time(Timestamp::default()/* use setters */);
11787 /// ```
11788 pub fn set_create_time<T>(mut self, v: T) -> Self
11789 where
11790 T: std::convert::Into<wkt::Timestamp>,
11791 {
11792 self.create_time = std::option::Option::Some(v.into());
11793 self
11794 }
11795
11796 /// Sets or clears the value of [create_time][crate::model::VolumeSnapshot::create_time].
11797 ///
11798 /// # Example
11799 /// ```ignore,no_run
11800 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11801 /// use wkt::Timestamp;
11802 /// let x = VolumeSnapshot::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11803 /// let x = VolumeSnapshot::new().set_or_clear_create_time(None::<Timestamp>);
11804 /// ```
11805 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11806 where
11807 T: std::convert::Into<wkt::Timestamp>,
11808 {
11809 self.create_time = v.map(|x| x.into());
11810 self
11811 }
11812
11813 /// Sets the value of [storage_volume][crate::model::VolumeSnapshot::storage_volume].
11814 ///
11815 /// # Example
11816 /// ```ignore,no_run
11817 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11818 /// let x = VolumeSnapshot::new().set_storage_volume("example");
11819 /// ```
11820 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11821 self.storage_volume = v.into();
11822 self
11823 }
11824
11825 /// Sets the value of [r#type][crate::model::VolumeSnapshot::type].
11826 ///
11827 /// # Example
11828 /// ```ignore,no_run
11829 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11830 /// use google_cloud_baremetalsolution_v2::model::volume_snapshot::SnapshotType;
11831 /// let x0 = VolumeSnapshot::new().set_type(SnapshotType::AdHoc);
11832 /// let x1 = VolumeSnapshot::new().set_type(SnapshotType::Scheduled);
11833 /// ```
11834 pub fn set_type<T: std::convert::Into<crate::model::volume_snapshot::SnapshotType>>(
11835 mut self,
11836 v: T,
11837 ) -> Self {
11838 self.r#type = v.into();
11839 self
11840 }
11841}
11842
11843impl wkt::message::Message for VolumeSnapshot {
11844 fn typename() -> &'static str {
11845 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeSnapshot"
11846 }
11847}
11848
11849/// Defines additional types related to [VolumeSnapshot].
11850pub mod volume_snapshot {
11851 #[allow(unused_imports)]
11852 use super::*;
11853
11854 /// Represents the type of a snapshot.
11855 ///
11856 /// # Working with unknown values
11857 ///
11858 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11859 /// additional enum variants at any time. Adding new variants is not considered
11860 /// a breaking change. Applications should write their code in anticipation of:
11861 ///
11862 /// - New values appearing in future releases of the client library, **and**
11863 /// - New values received dynamically, without application changes.
11864 ///
11865 /// Please consult the [Working with enums] section in the user guide for some
11866 /// guidelines.
11867 ///
11868 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11869 #[derive(Clone, Debug, PartialEq)]
11870 #[non_exhaustive]
11871 pub enum SnapshotType {
11872 /// Type is not specified.
11873 Unspecified,
11874 /// Snapshot was taken manually by user.
11875 AdHoc,
11876 /// Snapshot was taken automatically as a part of a snapshot schedule.
11877 Scheduled,
11878 /// If set, the enum was initialized with an unknown value.
11879 ///
11880 /// Applications can examine the value using [SnapshotType::value] or
11881 /// [SnapshotType::name].
11882 UnknownValue(snapshot_type::UnknownValue),
11883 }
11884
11885 #[doc(hidden)]
11886 pub mod snapshot_type {
11887 #[allow(unused_imports)]
11888 use super::*;
11889 #[derive(Clone, Debug, PartialEq)]
11890 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11891 }
11892
11893 impl SnapshotType {
11894 /// Gets the enum value.
11895 ///
11896 /// Returns `None` if the enum contains an unknown value deserialized from
11897 /// the string representation of enums.
11898 pub fn value(&self) -> std::option::Option<i32> {
11899 match self {
11900 Self::Unspecified => std::option::Option::Some(0),
11901 Self::AdHoc => std::option::Option::Some(1),
11902 Self::Scheduled => std::option::Option::Some(2),
11903 Self::UnknownValue(u) => u.0.value(),
11904 }
11905 }
11906
11907 /// Gets the enum value as a string.
11908 ///
11909 /// Returns `None` if the enum contains an unknown value deserialized from
11910 /// the integer representation of enums.
11911 pub fn name(&self) -> std::option::Option<&str> {
11912 match self {
11913 Self::Unspecified => std::option::Option::Some("SNAPSHOT_TYPE_UNSPECIFIED"),
11914 Self::AdHoc => std::option::Option::Some("AD_HOC"),
11915 Self::Scheduled => std::option::Option::Some("SCHEDULED"),
11916 Self::UnknownValue(u) => u.0.name(),
11917 }
11918 }
11919 }
11920
11921 impl std::default::Default for SnapshotType {
11922 fn default() -> Self {
11923 use std::convert::From;
11924 Self::from(0)
11925 }
11926 }
11927
11928 impl std::fmt::Display for SnapshotType {
11929 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11930 wkt::internal::display_enum(f, self.name(), self.value())
11931 }
11932 }
11933
11934 impl std::convert::From<i32> for SnapshotType {
11935 fn from(value: i32) -> Self {
11936 match value {
11937 0 => Self::Unspecified,
11938 1 => Self::AdHoc,
11939 2 => Self::Scheduled,
11940 _ => Self::UnknownValue(snapshot_type::UnknownValue(
11941 wkt::internal::UnknownEnumValue::Integer(value),
11942 )),
11943 }
11944 }
11945 }
11946
11947 impl std::convert::From<&str> for SnapshotType {
11948 fn from(value: &str) -> Self {
11949 use std::string::ToString;
11950 match value {
11951 "SNAPSHOT_TYPE_UNSPECIFIED" => Self::Unspecified,
11952 "AD_HOC" => Self::AdHoc,
11953 "SCHEDULED" => Self::Scheduled,
11954 _ => Self::UnknownValue(snapshot_type::UnknownValue(
11955 wkt::internal::UnknownEnumValue::String(value.to_string()),
11956 )),
11957 }
11958 }
11959 }
11960
11961 impl serde::ser::Serialize for SnapshotType {
11962 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11963 where
11964 S: serde::Serializer,
11965 {
11966 match self {
11967 Self::Unspecified => serializer.serialize_i32(0),
11968 Self::AdHoc => serializer.serialize_i32(1),
11969 Self::Scheduled => serializer.serialize_i32(2),
11970 Self::UnknownValue(u) => u.0.serialize(serializer),
11971 }
11972 }
11973 }
11974
11975 impl<'de> serde::de::Deserialize<'de> for SnapshotType {
11976 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11977 where
11978 D: serde::Deserializer<'de>,
11979 {
11980 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotType>::new(
11981 ".google.cloud.baremetalsolution.v2.VolumeSnapshot.SnapshotType",
11982 ))
11983 }
11984 }
11985}
11986
11987/// Message for requesting volume snapshot information.
11988#[derive(Clone, Default, PartialEq)]
11989#[non_exhaustive]
11990pub struct GetVolumeSnapshotRequest {
11991 /// Required. The name of the snapshot.
11992 pub name: std::string::String,
11993
11994 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11995}
11996
11997impl GetVolumeSnapshotRequest {
11998 pub fn new() -> Self {
11999 std::default::Default::default()
12000 }
12001
12002 /// Sets the value of [name][crate::model::GetVolumeSnapshotRequest::name].
12003 ///
12004 /// # Example
12005 /// ```ignore,no_run
12006 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeSnapshotRequest;
12007 /// let x = GetVolumeSnapshotRequest::new().set_name("example");
12008 /// ```
12009 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12010 self.name = v.into();
12011 self
12012 }
12013}
12014
12015impl wkt::message::Message for GetVolumeSnapshotRequest {
12016 fn typename() -> &'static str {
12017 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeSnapshotRequest"
12018 }
12019}
12020
12021/// Message for requesting a list of volume snapshots.
12022#[derive(Clone, Default, PartialEq)]
12023#[non_exhaustive]
12024pub struct ListVolumeSnapshotsRequest {
12025 /// Required. Parent value for ListVolumesRequest.
12026 pub parent: std::string::String,
12027
12028 /// Requested page size. The server might return fewer items than requested.
12029 /// If unspecified, server will pick an appropriate default.
12030 pub page_size: i32,
12031
12032 /// A token identifying a page of results from the server.
12033 pub page_token: std::string::String,
12034
12035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12036}
12037
12038impl ListVolumeSnapshotsRequest {
12039 pub fn new() -> Self {
12040 std::default::Default::default()
12041 }
12042
12043 /// Sets the value of [parent][crate::model::ListVolumeSnapshotsRequest::parent].
12044 ///
12045 /// # Example
12046 /// ```ignore,no_run
12047 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12048 /// let x = ListVolumeSnapshotsRequest::new().set_parent("example");
12049 /// ```
12050 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12051 self.parent = v.into();
12052 self
12053 }
12054
12055 /// Sets the value of [page_size][crate::model::ListVolumeSnapshotsRequest::page_size].
12056 ///
12057 /// # Example
12058 /// ```ignore,no_run
12059 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12060 /// let x = ListVolumeSnapshotsRequest::new().set_page_size(42);
12061 /// ```
12062 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12063 self.page_size = v.into();
12064 self
12065 }
12066
12067 /// Sets the value of [page_token][crate::model::ListVolumeSnapshotsRequest::page_token].
12068 ///
12069 /// # Example
12070 /// ```ignore,no_run
12071 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12072 /// let x = ListVolumeSnapshotsRequest::new().set_page_token("example");
12073 /// ```
12074 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12075 self.page_token = v.into();
12076 self
12077 }
12078}
12079
12080impl wkt::message::Message for ListVolumeSnapshotsRequest {
12081 fn typename() -> &'static str {
12082 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsRequest"
12083 }
12084}
12085
12086/// Response message containing the list of volume snapshots.
12087#[derive(Clone, Default, PartialEq)]
12088#[non_exhaustive]
12089pub struct ListVolumeSnapshotsResponse {
12090 /// The list of snapshots.
12091 pub volume_snapshots: std::vec::Vec<crate::model::VolumeSnapshot>,
12092
12093 /// A token identifying a page of results from the server.
12094 pub next_page_token: std::string::String,
12095
12096 /// Locations that could not be reached.
12097 pub unreachable: std::vec::Vec<std::string::String>,
12098
12099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12100}
12101
12102impl ListVolumeSnapshotsResponse {
12103 pub fn new() -> Self {
12104 std::default::Default::default()
12105 }
12106
12107 /// Sets the value of [volume_snapshots][crate::model::ListVolumeSnapshotsResponse::volume_snapshots].
12108 ///
12109 /// # Example
12110 /// ```ignore,no_run
12111 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12112 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12113 /// let x = ListVolumeSnapshotsResponse::new()
12114 /// .set_volume_snapshots([
12115 /// VolumeSnapshot::default()/* use setters */,
12116 /// VolumeSnapshot::default()/* use (different) setters */,
12117 /// ]);
12118 /// ```
12119 pub fn set_volume_snapshots<T, V>(mut self, v: T) -> Self
12120 where
12121 T: std::iter::IntoIterator<Item = V>,
12122 V: std::convert::Into<crate::model::VolumeSnapshot>,
12123 {
12124 use std::iter::Iterator;
12125 self.volume_snapshots = v.into_iter().map(|i| i.into()).collect();
12126 self
12127 }
12128
12129 /// Sets the value of [next_page_token][crate::model::ListVolumeSnapshotsResponse::next_page_token].
12130 ///
12131 /// # Example
12132 /// ```ignore,no_run
12133 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12134 /// let x = ListVolumeSnapshotsResponse::new().set_next_page_token("example");
12135 /// ```
12136 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12137 self.next_page_token = v.into();
12138 self
12139 }
12140
12141 /// Sets the value of [unreachable][crate::model::ListVolumeSnapshotsResponse::unreachable].
12142 ///
12143 /// # Example
12144 /// ```ignore,no_run
12145 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12146 /// let x = ListVolumeSnapshotsResponse::new().set_unreachable(["a", "b", "c"]);
12147 /// ```
12148 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
12149 where
12150 T: std::iter::IntoIterator<Item = V>,
12151 V: std::convert::Into<std::string::String>,
12152 {
12153 use std::iter::Iterator;
12154 self.unreachable = v.into_iter().map(|i| i.into()).collect();
12155 self
12156 }
12157}
12158
12159impl wkt::message::Message for ListVolumeSnapshotsResponse {
12160 fn typename() -> &'static str {
12161 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsResponse"
12162 }
12163}
12164
12165#[doc(hidden)]
12166impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumeSnapshotsResponse {
12167 type PageItem = crate::model::VolumeSnapshot;
12168
12169 fn items(self) -> std::vec::Vec<Self::PageItem> {
12170 self.volume_snapshots
12171 }
12172
12173 fn next_page_token(&self) -> std::string::String {
12174 use std::clone::Clone;
12175 self.next_page_token.clone()
12176 }
12177}
12178
12179/// Message for deleting named Volume snapshot.
12180#[derive(Clone, Default, PartialEq)]
12181#[non_exhaustive]
12182pub struct DeleteVolumeSnapshotRequest {
12183 /// Required. The name of the snapshot to delete.
12184 pub name: std::string::String,
12185
12186 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12187}
12188
12189impl DeleteVolumeSnapshotRequest {
12190 pub fn new() -> Self {
12191 std::default::Default::default()
12192 }
12193
12194 /// Sets the value of [name][crate::model::DeleteVolumeSnapshotRequest::name].
12195 ///
12196 /// # Example
12197 /// ```ignore,no_run
12198 /// # use google_cloud_baremetalsolution_v2::model::DeleteVolumeSnapshotRequest;
12199 /// let x = DeleteVolumeSnapshotRequest::new().set_name("example");
12200 /// ```
12201 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12202 self.name = v.into();
12203 self
12204 }
12205}
12206
12207impl wkt::message::Message for DeleteVolumeSnapshotRequest {
12208 fn typename() -> &'static str {
12209 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteVolumeSnapshotRequest"
12210 }
12211}
12212
12213/// Message for creating a volume snapshot.
12214#[derive(Clone, Default, PartialEq)]
12215#[non_exhaustive]
12216pub struct CreateVolumeSnapshotRequest {
12217 /// Required. The volume to snapshot.
12218 pub parent: std::string::String,
12219
12220 /// Required. The snapshot to create.
12221 pub volume_snapshot: std::option::Option<crate::model::VolumeSnapshot>,
12222
12223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12224}
12225
12226impl CreateVolumeSnapshotRequest {
12227 pub fn new() -> Self {
12228 std::default::Default::default()
12229 }
12230
12231 /// Sets the value of [parent][crate::model::CreateVolumeSnapshotRequest::parent].
12232 ///
12233 /// # Example
12234 /// ```ignore,no_run
12235 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12236 /// let x = CreateVolumeSnapshotRequest::new().set_parent("example");
12237 /// ```
12238 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12239 self.parent = v.into();
12240 self
12241 }
12242
12243 /// Sets the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12244 ///
12245 /// # Example
12246 /// ```ignore,no_run
12247 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12248 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12249 /// let x = CreateVolumeSnapshotRequest::new().set_volume_snapshot(VolumeSnapshot::default()/* use setters */);
12250 /// ```
12251 pub fn set_volume_snapshot<T>(mut self, v: T) -> Self
12252 where
12253 T: std::convert::Into<crate::model::VolumeSnapshot>,
12254 {
12255 self.volume_snapshot = std::option::Option::Some(v.into());
12256 self
12257 }
12258
12259 /// Sets or clears the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12260 ///
12261 /// # Example
12262 /// ```ignore,no_run
12263 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12264 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12265 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(Some(VolumeSnapshot::default()/* use setters */));
12266 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(None::<VolumeSnapshot>);
12267 /// ```
12268 pub fn set_or_clear_volume_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
12269 where
12270 T: std::convert::Into<crate::model::VolumeSnapshot>,
12271 {
12272 self.volume_snapshot = v.map(|x| x.into());
12273 self
12274 }
12275}
12276
12277impl wkt::message::Message for CreateVolumeSnapshotRequest {
12278 fn typename() -> &'static str {
12279 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateVolumeSnapshotRequest"
12280 }
12281}
12282
12283/// Message for restoring a volume snapshot.
12284#[derive(Clone, Default, PartialEq)]
12285#[non_exhaustive]
12286pub struct RestoreVolumeSnapshotRequest {
12287 /// Required. Name of the snapshot which will be used to restore its parent
12288 /// volume.
12289 pub volume_snapshot: std::string::String,
12290
12291 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12292}
12293
12294impl RestoreVolumeSnapshotRequest {
12295 pub fn new() -> Self {
12296 std::default::Default::default()
12297 }
12298
12299 /// Sets the value of [volume_snapshot][crate::model::RestoreVolumeSnapshotRequest::volume_snapshot].
12300 ///
12301 /// # Example
12302 /// ```ignore,no_run
12303 /// # use google_cloud_baremetalsolution_v2::model::RestoreVolumeSnapshotRequest;
12304 /// let x = RestoreVolumeSnapshotRequest::new().set_volume_snapshot("example");
12305 /// ```
12306 pub fn set_volume_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12307 self.volume_snapshot = v.into();
12308 self
12309 }
12310}
12311
12312impl wkt::message::Message for RestoreVolumeSnapshotRequest {
12313 fn typename() -> &'static str {
12314 "type.googleapis.com/google.cloud.baremetalsolution.v2.RestoreVolumeSnapshotRequest"
12315 }
12316}
12317
12318/// Performance tier of the Volume.
12319///
12320/// # Working with unknown values
12321///
12322/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12323/// additional enum variants at any time. Adding new variants is not considered
12324/// a breaking change. Applications should write their code in anticipation of:
12325///
12326/// - New values appearing in future releases of the client library, **and**
12327/// - New values received dynamically, without application changes.
12328///
12329/// Please consult the [Working with enums] section in the user guide for some
12330/// guidelines.
12331///
12332/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12333#[derive(Clone, Debug, PartialEq)]
12334#[non_exhaustive]
12335pub enum VolumePerformanceTier {
12336 /// Value is not specified.
12337 Unspecified,
12338 /// Regular volumes, shared aggregates.
12339 Shared,
12340 /// Assigned aggregates.
12341 Assigned,
12342 /// High throughput aggregates.
12343 Ht,
12344 /// If set, the enum was initialized with an unknown value.
12345 ///
12346 /// Applications can examine the value using [VolumePerformanceTier::value] or
12347 /// [VolumePerformanceTier::name].
12348 UnknownValue(volume_performance_tier::UnknownValue),
12349}
12350
12351#[doc(hidden)]
12352pub mod volume_performance_tier {
12353 #[allow(unused_imports)]
12354 use super::*;
12355 #[derive(Clone, Debug, PartialEq)]
12356 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12357}
12358
12359impl VolumePerformanceTier {
12360 /// Gets the enum value.
12361 ///
12362 /// Returns `None` if the enum contains an unknown value deserialized from
12363 /// the string representation of enums.
12364 pub fn value(&self) -> std::option::Option<i32> {
12365 match self {
12366 Self::Unspecified => std::option::Option::Some(0),
12367 Self::Shared => std::option::Option::Some(1),
12368 Self::Assigned => std::option::Option::Some(2),
12369 Self::Ht => std::option::Option::Some(3),
12370 Self::UnknownValue(u) => u.0.value(),
12371 }
12372 }
12373
12374 /// Gets the enum value as a string.
12375 ///
12376 /// Returns `None` if the enum contains an unknown value deserialized from
12377 /// the integer representation of enums.
12378 pub fn name(&self) -> std::option::Option<&str> {
12379 match self {
12380 Self::Unspecified => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_UNSPECIFIED"),
12381 Self::Shared => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_SHARED"),
12382 Self::Assigned => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_ASSIGNED"),
12383 Self::Ht => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_HT"),
12384 Self::UnknownValue(u) => u.0.name(),
12385 }
12386 }
12387}
12388
12389impl std::default::Default for VolumePerformanceTier {
12390 fn default() -> Self {
12391 use std::convert::From;
12392 Self::from(0)
12393 }
12394}
12395
12396impl std::fmt::Display for VolumePerformanceTier {
12397 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12398 wkt::internal::display_enum(f, self.name(), self.value())
12399 }
12400}
12401
12402impl std::convert::From<i32> for VolumePerformanceTier {
12403 fn from(value: i32) -> Self {
12404 match value {
12405 0 => Self::Unspecified,
12406 1 => Self::Shared,
12407 2 => Self::Assigned,
12408 3 => Self::Ht,
12409 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12410 wkt::internal::UnknownEnumValue::Integer(value),
12411 )),
12412 }
12413 }
12414}
12415
12416impl std::convert::From<&str> for VolumePerformanceTier {
12417 fn from(value: &str) -> Self {
12418 use std::string::ToString;
12419 match value {
12420 "VOLUME_PERFORMANCE_TIER_UNSPECIFIED" => Self::Unspecified,
12421 "VOLUME_PERFORMANCE_TIER_SHARED" => Self::Shared,
12422 "VOLUME_PERFORMANCE_TIER_ASSIGNED" => Self::Assigned,
12423 "VOLUME_PERFORMANCE_TIER_HT" => Self::Ht,
12424 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12425 wkt::internal::UnknownEnumValue::String(value.to_string()),
12426 )),
12427 }
12428 }
12429}
12430
12431impl serde::ser::Serialize for VolumePerformanceTier {
12432 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12433 where
12434 S: serde::Serializer,
12435 {
12436 match self {
12437 Self::Unspecified => serializer.serialize_i32(0),
12438 Self::Shared => serializer.serialize_i32(1),
12439 Self::Assigned => serializer.serialize_i32(2),
12440 Self::Ht => serializer.serialize_i32(3),
12441 Self::UnknownValue(u) => u.0.serialize(serializer),
12442 }
12443 }
12444}
12445
12446impl<'de> serde::de::Deserialize<'de> for VolumePerformanceTier {
12447 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12448 where
12449 D: serde::Deserializer<'de>,
12450 {
12451 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumePerformanceTier>::new(
12452 ".google.cloud.baremetalsolution.v2.VolumePerformanceTier",
12453 ))
12454 }
12455}
12456
12457/// The possible values for a workload profile.
12458///
12459/// # Working with unknown values
12460///
12461/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12462/// additional enum variants at any time. Adding new variants is not considered
12463/// a breaking change. Applications should write their code in anticipation of:
12464///
12465/// - New values appearing in future releases of the client library, **and**
12466/// - New values received dynamically, without application changes.
12467///
12468/// Please consult the [Working with enums] section in the user guide for some
12469/// guidelines.
12470///
12471/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12472#[derive(Clone, Debug, PartialEq)]
12473#[non_exhaustive]
12474pub enum WorkloadProfile {
12475 /// The workload profile is in an unknown state.
12476 Unspecified,
12477 /// The workload profile is generic.
12478 Generic,
12479 /// The workload profile is hana.
12480 Hana,
12481 /// If set, the enum was initialized with an unknown value.
12482 ///
12483 /// Applications can examine the value using [WorkloadProfile::value] or
12484 /// [WorkloadProfile::name].
12485 UnknownValue(workload_profile::UnknownValue),
12486}
12487
12488#[doc(hidden)]
12489pub mod workload_profile {
12490 #[allow(unused_imports)]
12491 use super::*;
12492 #[derive(Clone, Debug, PartialEq)]
12493 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12494}
12495
12496impl WorkloadProfile {
12497 /// Gets the enum value.
12498 ///
12499 /// Returns `None` if the enum contains an unknown value deserialized from
12500 /// the string representation of enums.
12501 pub fn value(&self) -> std::option::Option<i32> {
12502 match self {
12503 Self::Unspecified => std::option::Option::Some(0),
12504 Self::Generic => std::option::Option::Some(1),
12505 Self::Hana => std::option::Option::Some(2),
12506 Self::UnknownValue(u) => u.0.value(),
12507 }
12508 }
12509
12510 /// Gets the enum value as a string.
12511 ///
12512 /// Returns `None` if the enum contains an unknown value deserialized from
12513 /// the integer representation of enums.
12514 pub fn name(&self) -> std::option::Option<&str> {
12515 match self {
12516 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
12517 Self::Generic => std::option::Option::Some("WORKLOAD_PROFILE_GENERIC"),
12518 Self::Hana => std::option::Option::Some("WORKLOAD_PROFILE_HANA"),
12519 Self::UnknownValue(u) => u.0.name(),
12520 }
12521 }
12522}
12523
12524impl std::default::Default for WorkloadProfile {
12525 fn default() -> Self {
12526 use std::convert::From;
12527 Self::from(0)
12528 }
12529}
12530
12531impl std::fmt::Display for WorkloadProfile {
12532 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12533 wkt::internal::display_enum(f, self.name(), self.value())
12534 }
12535}
12536
12537impl std::convert::From<i32> for WorkloadProfile {
12538 fn from(value: i32) -> Self {
12539 match value {
12540 0 => Self::Unspecified,
12541 1 => Self::Generic,
12542 2 => Self::Hana,
12543 _ => Self::UnknownValue(workload_profile::UnknownValue(
12544 wkt::internal::UnknownEnumValue::Integer(value),
12545 )),
12546 }
12547 }
12548}
12549
12550impl std::convert::From<&str> for WorkloadProfile {
12551 fn from(value: &str) -> Self {
12552 use std::string::ToString;
12553 match value {
12554 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
12555 "WORKLOAD_PROFILE_GENERIC" => Self::Generic,
12556 "WORKLOAD_PROFILE_HANA" => Self::Hana,
12557 _ => Self::UnknownValue(workload_profile::UnknownValue(
12558 wkt::internal::UnknownEnumValue::String(value.to_string()),
12559 )),
12560 }
12561 }
12562}
12563
12564impl serde::ser::Serialize for WorkloadProfile {
12565 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12566 where
12567 S: serde::Serializer,
12568 {
12569 match self {
12570 Self::Unspecified => serializer.serialize_i32(0),
12571 Self::Generic => serializer.serialize_i32(1),
12572 Self::Hana => serializer.serialize_i32(2),
12573 Self::UnknownValue(u) => u.0.serialize(serializer),
12574 }
12575 }
12576}
12577
12578impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
12579 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12580 where
12581 D: serde::Deserializer<'de>,
12582 {
12583 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
12584 ".google.cloud.baremetalsolution.v2.WorkloadProfile",
12585 ))
12586 }
12587}