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 serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// Represents the metadata from a long-running operation.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct OperationMetadata {
42 /// Output only. The time the operation was created.
43 pub create_time: std::option::Option<wkt::Timestamp>,
44
45 /// Output only. The time the operation finished running.
46 pub end_time: std::option::Option<wkt::Timestamp>,
47
48 /// Output only. Server-defined resource path for the target of the operation.
49 pub target: std::string::String,
50
51 /// Output only. Name of the action executed by the operation.
52 pub verb: std::string::String,
53
54 /// Output only. Human-readable status of the operation, if any.
55 pub status_message: std::string::String,
56
57 /// Output only. Identifies whether the user requested the cancellation
58 /// of the operation. Operations that have been successfully cancelled
59 /// have [Operation.error][] value with a
60 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
61 /// `Code.CANCELLED`.
62 ///
63 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
64 pub requested_cancellation: bool,
65
66 /// Output only. API version used with the operation.
67 pub api_version: std::string::String,
68
69 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
70}
71
72impl OperationMetadata {
73 pub fn new() -> Self {
74 std::default::Default::default()
75 }
76
77 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
78 ///
79 /// # Example
80 /// ```ignore,no_run
81 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
82 /// use wkt::Timestamp;
83 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
84 /// ```
85 pub fn set_create_time<T>(mut self, v: T) -> Self
86 where
87 T: std::convert::Into<wkt::Timestamp>,
88 {
89 self.create_time = std::option::Option::Some(v.into());
90 self
91 }
92
93 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
94 ///
95 /// # Example
96 /// ```ignore,no_run
97 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
98 /// use wkt::Timestamp;
99 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
100 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
101 /// ```
102 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
103 where
104 T: std::convert::Into<wkt::Timestamp>,
105 {
106 self.create_time = v.map(|x| x.into());
107 self
108 }
109
110 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
111 ///
112 /// # Example
113 /// ```ignore,no_run
114 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
115 /// use wkt::Timestamp;
116 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
117 /// ```
118 pub fn set_end_time<T>(mut self, v: T) -> Self
119 where
120 T: std::convert::Into<wkt::Timestamp>,
121 {
122 self.end_time = std::option::Option::Some(v.into());
123 self
124 }
125
126 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
127 ///
128 /// # Example
129 /// ```ignore,no_run
130 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
131 /// use wkt::Timestamp;
132 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
133 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
134 /// ```
135 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
136 where
137 T: std::convert::Into<wkt::Timestamp>,
138 {
139 self.end_time = v.map(|x| x.into());
140 self
141 }
142
143 /// Sets the value of [target][crate::model::OperationMetadata::target].
144 ///
145 /// # Example
146 /// ```ignore,no_run
147 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
148 /// let x = OperationMetadata::new().set_target("example");
149 /// ```
150 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
151 self.target = v.into();
152 self
153 }
154
155 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
156 ///
157 /// # Example
158 /// ```ignore,no_run
159 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
160 /// let x = OperationMetadata::new().set_verb("example");
161 /// ```
162 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
163 self.verb = v.into();
164 self
165 }
166
167 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
168 ///
169 /// # Example
170 /// ```ignore,no_run
171 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
172 /// let x = OperationMetadata::new().set_status_message("example");
173 /// ```
174 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
175 self.status_message = v.into();
176 self
177 }
178
179 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
180 ///
181 /// # Example
182 /// ```ignore,no_run
183 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
184 /// let x = OperationMetadata::new().set_requested_cancellation(true);
185 /// ```
186 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
187 self.requested_cancellation = v.into();
188 self
189 }
190
191 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
192 ///
193 /// # Example
194 /// ```ignore,no_run
195 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
196 /// let x = OperationMetadata::new().set_api_version("example");
197 /// ```
198 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
199 self.api_version = v.into();
200 self
201 }
202}
203
204impl wkt::message::Message for OperationMetadata {
205 fn typename() -> &'static str {
206 "type.googleapis.com/google.cloud.baremetalsolution.v2.OperationMetadata"
207 }
208}
209
210/// Response message from resetting a server.
211#[derive(Clone, Default, PartialEq)]
212#[non_exhaustive]
213pub struct ResetInstanceResponse {
214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
215}
216
217impl ResetInstanceResponse {
218 pub fn new() -> Self {
219 std::default::Default::default()
220 }
221}
222
223impl wkt::message::Message for ResetInstanceResponse {
224 fn typename() -> &'static str {
225 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceResponse"
226 }
227}
228
229/// A server.
230#[derive(Clone, Default, PartialEq)]
231#[non_exhaustive]
232pub struct Instance {
233 /// Immutable. The resource name of this `Instance`.
234 /// Resource names are schemeless URIs that follow the conventions in
235 /// <https://cloud.google.com/apis/design/resource_names>.
236 /// Format:
237 /// `projects/{project}/locations/{location}/instances/{instance}`
238 pub name: std::string::String,
239
240 /// Output only. An identifier for the `Instance`, generated by the backend.
241 pub id: std::string::String,
242
243 /// Output only. Create a time stamp.
244 pub create_time: std::option::Option<wkt::Timestamp>,
245
246 /// Output only. Update a time stamp.
247 pub update_time: std::option::Option<wkt::Timestamp>,
248
249 /// Immutable. The server type.
250 /// [Available server
251 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
252 pub machine_type: std::string::String,
253
254 /// Output only. The state of the server.
255 pub state: crate::model::instance::State,
256
257 /// True if you enable hyperthreading for the server, otherwise false.
258 /// The default value is false.
259 pub hyperthreading_enabled: bool,
260
261 /// Labels as key value pairs.
262 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
263
264 /// Immutable. List of LUNs associated with this server.
265 pub luns: std::vec::Vec<crate::model::Lun>,
266
267 /// Input only. List of Volumes to attach to this Instance on creation.
268 /// This field won't be populated in Get/List responses.
269 pub volumes: std::vec::Vec<crate::model::Volume>,
270
271 /// Output only. List of networks associated with this server.
272 pub networks: std::vec::Vec<crate::model::Network>,
273
274 /// Output only. True if the interactive serial console feature is enabled for
275 /// the instance, false otherwise. The default value is false.
276 pub interactive_serial_console_enabled: bool,
277
278 /// The OS image currently installed on the server.
279 pub os_image: std::string::String,
280
281 /// Immutable. Pod name.
282 /// Pod is an independent part of infrastructure.
283 /// Instance can be connected to the assets (networks, volumes) allocated
284 /// in the same pod only.
285 pub pod: std::string::String,
286
287 /// Instance network template name. For eg, bondaa-bondaa, bondab-nic, etc.
288 /// Generally, the template name follows the syntax of
289 /// "bond<bond_mode>" or "nic".
290 pub network_template: std::string::String,
291
292 /// List of logical interfaces for the instance. The number of logical
293 /// interfaces will be the same as number of hardware bond/nic on the chosen
294 /// network template. For the non-multivlan configurations (for eg, existing
295 /// servers) that use existing default network template (bondaa-bondaa), both
296 /// the Instance.networks field and the Instance.logical_interfaces fields will
297 /// be filled to ensure backward compatibility. For the others, only
298 /// Instance.logical_interfaces will be filled.
299 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
300
301 /// Output only. Text field about info for logging in.
302 pub login_info: std::string::String,
303
304 /// The workload profile for the instance.
305 pub workload_profile: crate::model::WorkloadProfile,
306
307 /// Output only. The firmware version for the instance.
308 pub firmware_version: std::string::String,
309
310 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
311}
312
313impl Instance {
314 pub fn new() -> Self {
315 std::default::Default::default()
316 }
317
318 /// Sets the value of [name][crate::model::Instance::name].
319 ///
320 /// # Example
321 /// ```ignore,no_run
322 /// # use google_cloud_baremetalsolution_v2::model::Instance;
323 /// let x = Instance::new().set_name("example");
324 /// ```
325 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
326 self.name = v.into();
327 self
328 }
329
330 /// Sets the value of [id][crate::model::Instance::id].
331 ///
332 /// # Example
333 /// ```ignore,no_run
334 /// # use google_cloud_baremetalsolution_v2::model::Instance;
335 /// let x = Instance::new().set_id("example");
336 /// ```
337 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
338 self.id = v.into();
339 self
340 }
341
342 /// Sets the value of [create_time][crate::model::Instance::create_time].
343 ///
344 /// # Example
345 /// ```ignore,no_run
346 /// # use google_cloud_baremetalsolution_v2::model::Instance;
347 /// use wkt::Timestamp;
348 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
349 /// ```
350 pub fn set_create_time<T>(mut self, v: T) -> Self
351 where
352 T: std::convert::Into<wkt::Timestamp>,
353 {
354 self.create_time = std::option::Option::Some(v.into());
355 self
356 }
357
358 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
359 ///
360 /// # Example
361 /// ```ignore,no_run
362 /// # use google_cloud_baremetalsolution_v2::model::Instance;
363 /// use wkt::Timestamp;
364 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
365 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
366 /// ```
367 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
368 where
369 T: std::convert::Into<wkt::Timestamp>,
370 {
371 self.create_time = v.map(|x| x.into());
372 self
373 }
374
375 /// Sets the value of [update_time][crate::model::Instance::update_time].
376 ///
377 /// # Example
378 /// ```ignore,no_run
379 /// # use google_cloud_baremetalsolution_v2::model::Instance;
380 /// use wkt::Timestamp;
381 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
382 /// ```
383 pub fn set_update_time<T>(mut self, v: T) -> Self
384 where
385 T: std::convert::Into<wkt::Timestamp>,
386 {
387 self.update_time = std::option::Option::Some(v.into());
388 self
389 }
390
391 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
392 ///
393 /// # Example
394 /// ```ignore,no_run
395 /// # use google_cloud_baremetalsolution_v2::model::Instance;
396 /// use wkt::Timestamp;
397 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
398 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
399 /// ```
400 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
401 where
402 T: std::convert::Into<wkt::Timestamp>,
403 {
404 self.update_time = v.map(|x| x.into());
405 self
406 }
407
408 /// Sets the value of [machine_type][crate::model::Instance::machine_type].
409 ///
410 /// # Example
411 /// ```ignore,no_run
412 /// # use google_cloud_baremetalsolution_v2::model::Instance;
413 /// let x = Instance::new().set_machine_type("example");
414 /// ```
415 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
416 self.machine_type = v.into();
417 self
418 }
419
420 /// Sets the value of [state][crate::model::Instance::state].
421 ///
422 /// # Example
423 /// ```ignore,no_run
424 /// # use google_cloud_baremetalsolution_v2::model::Instance;
425 /// use google_cloud_baremetalsolution_v2::model::instance::State;
426 /// let x0 = Instance::new().set_state(State::Provisioning);
427 /// let x1 = Instance::new().set_state(State::Running);
428 /// let x2 = Instance::new().set_state(State::Deleted);
429 /// ```
430 pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
431 self.state = v.into();
432 self
433 }
434
435 /// Sets the value of [hyperthreading_enabled][crate::model::Instance::hyperthreading_enabled].
436 ///
437 /// # Example
438 /// ```ignore,no_run
439 /// # use google_cloud_baremetalsolution_v2::model::Instance;
440 /// let x = Instance::new().set_hyperthreading_enabled(true);
441 /// ```
442 pub fn set_hyperthreading_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
443 self.hyperthreading_enabled = v.into();
444 self
445 }
446
447 /// Sets the value of [labels][crate::model::Instance::labels].
448 ///
449 /// # Example
450 /// ```ignore,no_run
451 /// # use google_cloud_baremetalsolution_v2::model::Instance;
452 /// let x = Instance::new().set_labels([
453 /// ("key0", "abc"),
454 /// ("key1", "xyz"),
455 /// ]);
456 /// ```
457 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
458 where
459 T: std::iter::IntoIterator<Item = (K, V)>,
460 K: std::convert::Into<std::string::String>,
461 V: std::convert::Into<std::string::String>,
462 {
463 use std::iter::Iterator;
464 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
465 self
466 }
467
468 /// Sets the value of [luns][crate::model::Instance::luns].
469 ///
470 /// # Example
471 /// ```ignore,no_run
472 /// # use google_cloud_baremetalsolution_v2::model::Instance;
473 /// use google_cloud_baremetalsolution_v2::model::Lun;
474 /// let x = Instance::new()
475 /// .set_luns([
476 /// Lun::default()/* use setters */,
477 /// Lun::default()/* use (different) setters */,
478 /// ]);
479 /// ```
480 pub fn set_luns<T, V>(mut self, v: T) -> Self
481 where
482 T: std::iter::IntoIterator<Item = V>,
483 V: std::convert::Into<crate::model::Lun>,
484 {
485 use std::iter::Iterator;
486 self.luns = v.into_iter().map(|i| i.into()).collect();
487 self
488 }
489
490 /// Sets the value of [volumes][crate::model::Instance::volumes].
491 ///
492 /// # Example
493 /// ```ignore,no_run
494 /// # use google_cloud_baremetalsolution_v2::model::Instance;
495 /// use google_cloud_baremetalsolution_v2::model::Volume;
496 /// let x = Instance::new()
497 /// .set_volumes([
498 /// Volume::default()/* use setters */,
499 /// Volume::default()/* use (different) setters */,
500 /// ]);
501 /// ```
502 pub fn set_volumes<T, V>(mut self, v: T) -> Self
503 where
504 T: std::iter::IntoIterator<Item = V>,
505 V: std::convert::Into<crate::model::Volume>,
506 {
507 use std::iter::Iterator;
508 self.volumes = v.into_iter().map(|i| i.into()).collect();
509 self
510 }
511
512 /// Sets the value of [networks][crate::model::Instance::networks].
513 ///
514 /// # Example
515 /// ```ignore,no_run
516 /// # use google_cloud_baremetalsolution_v2::model::Instance;
517 /// use google_cloud_baremetalsolution_v2::model::Network;
518 /// let x = Instance::new()
519 /// .set_networks([
520 /// Network::default()/* use setters */,
521 /// Network::default()/* use (different) setters */,
522 /// ]);
523 /// ```
524 pub fn set_networks<T, V>(mut self, v: T) -> Self
525 where
526 T: std::iter::IntoIterator<Item = V>,
527 V: std::convert::Into<crate::model::Network>,
528 {
529 use std::iter::Iterator;
530 self.networks = v.into_iter().map(|i| i.into()).collect();
531 self
532 }
533
534 /// Sets the value of [interactive_serial_console_enabled][crate::model::Instance::interactive_serial_console_enabled].
535 ///
536 /// # Example
537 /// ```ignore,no_run
538 /// # use google_cloud_baremetalsolution_v2::model::Instance;
539 /// let x = Instance::new().set_interactive_serial_console_enabled(true);
540 /// ```
541 pub fn set_interactive_serial_console_enabled<T: std::convert::Into<bool>>(
542 mut self,
543 v: T,
544 ) -> Self {
545 self.interactive_serial_console_enabled = v.into();
546 self
547 }
548
549 /// Sets the value of [os_image][crate::model::Instance::os_image].
550 ///
551 /// # Example
552 /// ```ignore,no_run
553 /// # use google_cloud_baremetalsolution_v2::model::Instance;
554 /// let x = Instance::new().set_os_image("example");
555 /// ```
556 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
557 self.os_image = v.into();
558 self
559 }
560
561 /// Sets the value of [pod][crate::model::Instance::pod].
562 ///
563 /// # Example
564 /// ```ignore,no_run
565 /// # use google_cloud_baremetalsolution_v2::model::Instance;
566 /// let x = Instance::new().set_pod("example");
567 /// ```
568 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
569 self.pod = v.into();
570 self
571 }
572
573 /// Sets the value of [network_template][crate::model::Instance::network_template].
574 ///
575 /// # Example
576 /// ```ignore,no_run
577 /// # use google_cloud_baremetalsolution_v2::model::Instance;
578 /// let x = Instance::new().set_network_template("example");
579 /// ```
580 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
581 mut self,
582 v: T,
583 ) -> Self {
584 self.network_template = v.into();
585 self
586 }
587
588 /// Sets the value of [logical_interfaces][crate::model::Instance::logical_interfaces].
589 ///
590 /// # Example
591 /// ```ignore,no_run
592 /// # use google_cloud_baremetalsolution_v2::model::Instance;
593 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
594 /// let x = Instance::new()
595 /// .set_logical_interfaces([
596 /// LogicalInterface::default()/* use setters */,
597 /// LogicalInterface::default()/* use (different) setters */,
598 /// ]);
599 /// ```
600 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
601 where
602 T: std::iter::IntoIterator<Item = V>,
603 V: std::convert::Into<crate::model::LogicalInterface>,
604 {
605 use std::iter::Iterator;
606 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
607 self
608 }
609
610 /// Sets the value of [login_info][crate::model::Instance::login_info].
611 ///
612 /// # Example
613 /// ```ignore,no_run
614 /// # use google_cloud_baremetalsolution_v2::model::Instance;
615 /// let x = Instance::new().set_login_info("example");
616 /// ```
617 pub fn set_login_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
618 self.login_info = v.into();
619 self
620 }
621
622 /// Sets the value of [workload_profile][crate::model::Instance::workload_profile].
623 ///
624 /// # Example
625 /// ```ignore,no_run
626 /// # use google_cloud_baremetalsolution_v2::model::Instance;
627 /// use google_cloud_baremetalsolution_v2::model::WorkloadProfile;
628 /// let x0 = Instance::new().set_workload_profile(WorkloadProfile::Generic);
629 /// let x1 = Instance::new().set_workload_profile(WorkloadProfile::Hana);
630 /// ```
631 pub fn set_workload_profile<T: std::convert::Into<crate::model::WorkloadProfile>>(
632 mut self,
633 v: T,
634 ) -> Self {
635 self.workload_profile = v.into();
636 self
637 }
638
639 /// Sets the value of [firmware_version][crate::model::Instance::firmware_version].
640 ///
641 /// # Example
642 /// ```ignore,no_run
643 /// # use google_cloud_baremetalsolution_v2::model::Instance;
644 /// let x = Instance::new().set_firmware_version("example");
645 /// ```
646 pub fn set_firmware_version<T: std::convert::Into<std::string::String>>(
647 mut self,
648 v: T,
649 ) -> Self {
650 self.firmware_version = v.into();
651 self
652 }
653}
654
655impl wkt::message::Message for Instance {
656 fn typename() -> &'static str {
657 "type.googleapis.com/google.cloud.baremetalsolution.v2.Instance"
658 }
659}
660
661/// Defines additional types related to [Instance].
662pub mod instance {
663 #[allow(unused_imports)]
664 use super::*;
665
666 /// The possible states for this server.
667 ///
668 /// # Working with unknown values
669 ///
670 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
671 /// additional enum variants at any time. Adding new variants is not considered
672 /// a breaking change. Applications should write their code in anticipation of:
673 ///
674 /// - New values appearing in future releases of the client library, **and**
675 /// - New values received dynamically, without application changes.
676 ///
677 /// Please consult the [Working with enums] section in the user guide for some
678 /// guidelines.
679 ///
680 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
681 #[derive(Clone, Debug, PartialEq)]
682 #[non_exhaustive]
683 pub enum State {
684 /// The server is in an unknown state.
685 Unspecified,
686 /// The server is being provisioned.
687 Provisioning,
688 /// The server is running.
689 Running,
690 /// The server has been deleted.
691 Deleted,
692 /// The server is being updated.
693 Updating,
694 /// The server is starting.
695 Starting,
696 /// The server is stopping.
697 Stopping,
698 /// The server is shutdown.
699 Shutdown,
700 /// If set, the enum was initialized with an unknown value.
701 ///
702 /// Applications can examine the value using [State::value] or
703 /// [State::name].
704 UnknownValue(state::UnknownValue),
705 }
706
707 #[doc(hidden)]
708 pub mod state {
709 #[allow(unused_imports)]
710 use super::*;
711 #[derive(Clone, Debug, PartialEq)]
712 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
713 }
714
715 impl State {
716 /// Gets the enum value.
717 ///
718 /// Returns `None` if the enum contains an unknown value deserialized from
719 /// the string representation of enums.
720 pub fn value(&self) -> std::option::Option<i32> {
721 match self {
722 Self::Unspecified => std::option::Option::Some(0),
723 Self::Provisioning => std::option::Option::Some(1),
724 Self::Running => std::option::Option::Some(2),
725 Self::Deleted => std::option::Option::Some(3),
726 Self::Updating => std::option::Option::Some(4),
727 Self::Starting => std::option::Option::Some(5),
728 Self::Stopping => std::option::Option::Some(6),
729 Self::Shutdown => std::option::Option::Some(7),
730 Self::UnknownValue(u) => u.0.value(),
731 }
732 }
733
734 /// Gets the enum value as a string.
735 ///
736 /// Returns `None` if the enum contains an unknown value deserialized from
737 /// the integer representation of enums.
738 pub fn name(&self) -> std::option::Option<&str> {
739 match self {
740 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
741 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
742 Self::Running => std::option::Option::Some("RUNNING"),
743 Self::Deleted => std::option::Option::Some("DELETED"),
744 Self::Updating => std::option::Option::Some("UPDATING"),
745 Self::Starting => std::option::Option::Some("STARTING"),
746 Self::Stopping => std::option::Option::Some("STOPPING"),
747 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
748 Self::UnknownValue(u) => u.0.name(),
749 }
750 }
751 }
752
753 impl std::default::Default for State {
754 fn default() -> Self {
755 use std::convert::From;
756 Self::from(0)
757 }
758 }
759
760 impl std::fmt::Display for State {
761 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
762 wkt::internal::display_enum(f, self.name(), self.value())
763 }
764 }
765
766 impl std::convert::From<i32> for State {
767 fn from(value: i32) -> Self {
768 match value {
769 0 => Self::Unspecified,
770 1 => Self::Provisioning,
771 2 => Self::Running,
772 3 => Self::Deleted,
773 4 => Self::Updating,
774 5 => Self::Starting,
775 6 => Self::Stopping,
776 7 => Self::Shutdown,
777 _ => Self::UnknownValue(state::UnknownValue(
778 wkt::internal::UnknownEnumValue::Integer(value),
779 )),
780 }
781 }
782 }
783
784 impl std::convert::From<&str> for State {
785 fn from(value: &str) -> Self {
786 use std::string::ToString;
787 match value {
788 "STATE_UNSPECIFIED" => Self::Unspecified,
789 "PROVISIONING" => Self::Provisioning,
790 "RUNNING" => Self::Running,
791 "DELETED" => Self::Deleted,
792 "UPDATING" => Self::Updating,
793 "STARTING" => Self::Starting,
794 "STOPPING" => Self::Stopping,
795 "SHUTDOWN" => Self::Shutdown,
796 _ => Self::UnknownValue(state::UnknownValue(
797 wkt::internal::UnknownEnumValue::String(value.to_string()),
798 )),
799 }
800 }
801 }
802
803 impl serde::ser::Serialize for State {
804 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
805 where
806 S: serde::Serializer,
807 {
808 match self {
809 Self::Unspecified => serializer.serialize_i32(0),
810 Self::Provisioning => serializer.serialize_i32(1),
811 Self::Running => serializer.serialize_i32(2),
812 Self::Deleted => serializer.serialize_i32(3),
813 Self::Updating => serializer.serialize_i32(4),
814 Self::Starting => serializer.serialize_i32(5),
815 Self::Stopping => serializer.serialize_i32(6),
816 Self::Shutdown => serializer.serialize_i32(7),
817 Self::UnknownValue(u) => u.0.serialize(serializer),
818 }
819 }
820 }
821
822 impl<'de> serde::de::Deserialize<'de> for State {
823 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
824 where
825 D: serde::Deserializer<'de>,
826 {
827 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
828 ".google.cloud.baremetalsolution.v2.Instance.State",
829 ))
830 }
831 }
832}
833
834/// Message for requesting server information.
835#[derive(Clone, Default, PartialEq)]
836#[non_exhaustive]
837pub struct GetInstanceRequest {
838 /// Required. Name of the resource.
839 pub name: std::string::String,
840
841 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
842}
843
844impl GetInstanceRequest {
845 pub fn new() -> Self {
846 std::default::Default::default()
847 }
848
849 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
850 ///
851 /// # Example
852 /// ```ignore,no_run
853 /// # use google_cloud_baremetalsolution_v2::model::GetInstanceRequest;
854 /// let x = GetInstanceRequest::new().set_name("example");
855 /// ```
856 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
857 self.name = v.into();
858 self
859 }
860}
861
862impl wkt::message::Message for GetInstanceRequest {
863 fn typename() -> &'static str {
864 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetInstanceRequest"
865 }
866}
867
868/// Message for requesting the list of servers.
869#[derive(Clone, Default, PartialEq)]
870#[non_exhaustive]
871pub struct ListInstancesRequest {
872 /// Required. Parent value for ListInstancesRequest.
873 pub parent: std::string::String,
874
875 /// Requested page size. Server may return fewer items than requested.
876 /// If unspecified, the server will pick an appropriate default.
877 pub page_size: i32,
878
879 /// A token identifying a page of results from the server.
880 pub page_token: std::string::String,
881
882 /// List filter.
883 pub filter: std::string::String,
884
885 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
886}
887
888impl ListInstancesRequest {
889 pub fn new() -> Self {
890 std::default::Default::default()
891 }
892
893 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
894 ///
895 /// # Example
896 /// ```ignore,no_run
897 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
898 /// let x = ListInstancesRequest::new().set_parent("example");
899 /// ```
900 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
901 self.parent = v.into();
902 self
903 }
904
905 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
906 ///
907 /// # Example
908 /// ```ignore,no_run
909 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
910 /// let x = ListInstancesRequest::new().set_page_size(42);
911 /// ```
912 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
913 self.page_size = v.into();
914 self
915 }
916
917 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
918 ///
919 /// # Example
920 /// ```ignore,no_run
921 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
922 /// let x = ListInstancesRequest::new().set_page_token("example");
923 /// ```
924 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
925 self.page_token = v.into();
926 self
927 }
928
929 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
930 ///
931 /// # Example
932 /// ```ignore,no_run
933 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
934 /// let x = ListInstancesRequest::new().set_filter("example");
935 /// ```
936 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
937 self.filter = v.into();
938 self
939 }
940}
941
942impl wkt::message::Message for ListInstancesRequest {
943 fn typename() -> &'static str {
944 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesRequest"
945 }
946}
947
948/// Response message for the list of servers.
949#[derive(Clone, Default, PartialEq)]
950#[non_exhaustive]
951pub struct ListInstancesResponse {
952 /// The list of servers.
953 pub instances: std::vec::Vec<crate::model::Instance>,
954
955 /// A token identifying a page of results from the server.
956 pub next_page_token: std::string::String,
957
958 /// Locations that could not be reached.
959 pub unreachable: std::vec::Vec<std::string::String>,
960
961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
962}
963
964impl ListInstancesResponse {
965 pub fn new() -> Self {
966 std::default::Default::default()
967 }
968
969 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
970 ///
971 /// # Example
972 /// ```ignore,no_run
973 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
974 /// use google_cloud_baremetalsolution_v2::model::Instance;
975 /// let x = ListInstancesResponse::new()
976 /// .set_instances([
977 /// Instance::default()/* use setters */,
978 /// Instance::default()/* use (different) setters */,
979 /// ]);
980 /// ```
981 pub fn set_instances<T, V>(mut self, v: T) -> Self
982 where
983 T: std::iter::IntoIterator<Item = V>,
984 V: std::convert::Into<crate::model::Instance>,
985 {
986 use std::iter::Iterator;
987 self.instances = v.into_iter().map(|i| i.into()).collect();
988 self
989 }
990
991 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
992 ///
993 /// # Example
994 /// ```ignore,no_run
995 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
996 /// let x = ListInstancesResponse::new().set_next_page_token("example");
997 /// ```
998 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
999 self.next_page_token = v.into();
1000 self
1001 }
1002
1003 /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
1004 ///
1005 /// # Example
1006 /// ```ignore,no_run
1007 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
1008 /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
1009 /// ```
1010 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1011 where
1012 T: std::iter::IntoIterator<Item = V>,
1013 V: std::convert::Into<std::string::String>,
1014 {
1015 use std::iter::Iterator;
1016 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1017 self
1018 }
1019}
1020
1021impl wkt::message::Message for ListInstancesResponse {
1022 fn typename() -> &'static str {
1023 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesResponse"
1024 }
1025}
1026
1027#[doc(hidden)]
1028impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
1029 type PageItem = crate::model::Instance;
1030
1031 fn items(self) -> std::vec::Vec<Self::PageItem> {
1032 self.instances
1033 }
1034
1035 fn next_page_token(&self) -> std::string::String {
1036 use std::clone::Clone;
1037 self.next_page_token.clone()
1038 }
1039}
1040
1041/// Message requesting to updating a server.
1042#[derive(Clone, Default, PartialEq)]
1043#[non_exhaustive]
1044pub struct UpdateInstanceRequest {
1045 /// Required. The server to update.
1046 ///
1047 /// The `name` field is used to identify the instance to update.
1048 /// Format: projects/{project}/locations/{location}/instances/{instance}
1049 pub instance: std::option::Option<crate::model::Instance>,
1050
1051 /// The list of fields to update.
1052 /// The currently supported fields are:
1053 /// `labels`
1054 /// `hyperthreading_enabled`
1055 /// `os_image`
1056 pub update_mask: std::option::Option<wkt::FieldMask>,
1057
1058 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1059}
1060
1061impl UpdateInstanceRequest {
1062 pub fn new() -> Self {
1063 std::default::Default::default()
1064 }
1065
1066 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
1067 ///
1068 /// # Example
1069 /// ```ignore,no_run
1070 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1071 /// use google_cloud_baremetalsolution_v2::model::Instance;
1072 /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
1073 /// ```
1074 pub fn set_instance<T>(mut self, v: T) -> Self
1075 where
1076 T: std::convert::Into<crate::model::Instance>,
1077 {
1078 self.instance = std::option::Option::Some(v.into());
1079 self
1080 }
1081
1082 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
1083 ///
1084 /// # Example
1085 /// ```ignore,no_run
1086 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1087 /// use google_cloud_baremetalsolution_v2::model::Instance;
1088 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
1089 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
1090 /// ```
1091 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1092 where
1093 T: std::convert::Into<crate::model::Instance>,
1094 {
1095 self.instance = v.map(|x| x.into());
1096 self
1097 }
1098
1099 /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1100 ///
1101 /// # Example
1102 /// ```ignore,no_run
1103 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1104 /// use wkt::FieldMask;
1105 /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1106 /// ```
1107 pub fn set_update_mask<T>(mut self, v: T) -> Self
1108 where
1109 T: std::convert::Into<wkt::FieldMask>,
1110 {
1111 self.update_mask = std::option::Option::Some(v.into());
1112 self
1113 }
1114
1115 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1116 ///
1117 /// # Example
1118 /// ```ignore,no_run
1119 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1120 /// use wkt::FieldMask;
1121 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1122 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1123 /// ```
1124 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1125 where
1126 T: std::convert::Into<wkt::FieldMask>,
1127 {
1128 self.update_mask = v.map(|x| x.into());
1129 self
1130 }
1131}
1132
1133impl wkt::message::Message for UpdateInstanceRequest {
1134 fn typename() -> &'static str {
1135 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateInstanceRequest"
1136 }
1137}
1138
1139/// Message requesting rename of a server.
1140#[derive(Clone, Default, PartialEq)]
1141#[non_exhaustive]
1142pub struct RenameInstanceRequest {
1143 /// Required. The `name` field is used to identify the instance.
1144 /// Format: projects/{project}/locations/{location}/instances/{instance}
1145 pub name: std::string::String,
1146
1147 /// Required. The new `id` of the instance.
1148 pub new_instance_id: std::string::String,
1149
1150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1151}
1152
1153impl RenameInstanceRequest {
1154 pub fn new() -> Self {
1155 std::default::Default::default()
1156 }
1157
1158 /// Sets the value of [name][crate::model::RenameInstanceRequest::name].
1159 ///
1160 /// # Example
1161 /// ```ignore,no_run
1162 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1163 /// let x = RenameInstanceRequest::new().set_name("example");
1164 /// ```
1165 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1166 self.name = v.into();
1167 self
1168 }
1169
1170 /// Sets the value of [new_instance_id][crate::model::RenameInstanceRequest::new_instance_id].
1171 ///
1172 /// # Example
1173 /// ```ignore,no_run
1174 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1175 /// let x = RenameInstanceRequest::new().set_new_instance_id("example");
1176 /// ```
1177 pub fn set_new_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1178 self.new_instance_id = v.into();
1179 self
1180 }
1181}
1182
1183impl wkt::message::Message for RenameInstanceRequest {
1184 fn typename() -> &'static str {
1185 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameInstanceRequest"
1186 }
1187}
1188
1189/// Message requesting to reset a server.
1190#[derive(Clone, Default, PartialEq)]
1191#[non_exhaustive]
1192pub struct ResetInstanceRequest {
1193 /// Required. Name of the resource.
1194 pub name: std::string::String,
1195
1196 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1197}
1198
1199impl ResetInstanceRequest {
1200 pub fn new() -> Self {
1201 std::default::Default::default()
1202 }
1203
1204 /// Sets the value of [name][crate::model::ResetInstanceRequest::name].
1205 ///
1206 /// # Example
1207 /// ```ignore,no_run
1208 /// # use google_cloud_baremetalsolution_v2::model::ResetInstanceRequest;
1209 /// let x = ResetInstanceRequest::new().set_name("example");
1210 /// ```
1211 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1212 self.name = v.into();
1213 self
1214 }
1215}
1216
1217impl wkt::message::Message for ResetInstanceRequest {
1218 fn typename() -> &'static str {
1219 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceRequest"
1220 }
1221}
1222
1223/// Message requesting to start a server.
1224#[derive(Clone, Default, PartialEq)]
1225#[non_exhaustive]
1226pub struct StartInstanceRequest {
1227 /// Required. Name of the resource.
1228 pub name: std::string::String,
1229
1230 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1231}
1232
1233impl StartInstanceRequest {
1234 pub fn new() -> Self {
1235 std::default::Default::default()
1236 }
1237
1238 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
1239 ///
1240 /// # Example
1241 /// ```ignore,no_run
1242 /// # use google_cloud_baremetalsolution_v2::model::StartInstanceRequest;
1243 /// let x = StartInstanceRequest::new().set_name("example");
1244 /// ```
1245 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1246 self.name = v.into();
1247 self
1248 }
1249}
1250
1251impl wkt::message::Message for StartInstanceRequest {
1252 fn typename() -> &'static str {
1253 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceRequest"
1254 }
1255}
1256
1257/// Response message from starting a server.
1258#[derive(Clone, Default, PartialEq)]
1259#[non_exhaustive]
1260pub struct StartInstanceResponse {
1261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1262}
1263
1264impl StartInstanceResponse {
1265 pub fn new() -> Self {
1266 std::default::Default::default()
1267 }
1268}
1269
1270impl wkt::message::Message for StartInstanceResponse {
1271 fn typename() -> &'static str {
1272 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceResponse"
1273 }
1274}
1275
1276/// Message requesting to stop a server.
1277#[derive(Clone, Default, PartialEq)]
1278#[non_exhaustive]
1279pub struct StopInstanceRequest {
1280 /// Required. Name of the resource.
1281 pub name: std::string::String,
1282
1283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1284}
1285
1286impl StopInstanceRequest {
1287 pub fn new() -> Self {
1288 std::default::Default::default()
1289 }
1290
1291 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
1292 ///
1293 /// # Example
1294 /// ```ignore,no_run
1295 /// # use google_cloud_baremetalsolution_v2::model::StopInstanceRequest;
1296 /// let x = StopInstanceRequest::new().set_name("example");
1297 /// ```
1298 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1299 self.name = v.into();
1300 self
1301 }
1302}
1303
1304impl wkt::message::Message for StopInstanceRequest {
1305 fn typename() -> &'static str {
1306 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceRequest"
1307 }
1308}
1309
1310/// Response message from stopping a server.
1311#[derive(Clone, Default, PartialEq)]
1312#[non_exhaustive]
1313pub struct StopInstanceResponse {
1314 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1315}
1316
1317impl StopInstanceResponse {
1318 pub fn new() -> Self {
1319 std::default::Default::default()
1320 }
1321}
1322
1323impl wkt::message::Message for StopInstanceResponse {
1324 fn typename() -> &'static str {
1325 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceResponse"
1326 }
1327}
1328
1329/// Message for enabling the interactive serial console on an instance.
1330#[derive(Clone, Default, PartialEq)]
1331#[non_exhaustive]
1332pub struct EnableInteractiveSerialConsoleRequest {
1333 /// Required. Name of the resource.
1334 pub name: std::string::String,
1335
1336 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1337}
1338
1339impl EnableInteractiveSerialConsoleRequest {
1340 pub fn new() -> Self {
1341 std::default::Default::default()
1342 }
1343
1344 /// Sets the value of [name][crate::model::EnableInteractiveSerialConsoleRequest::name].
1345 ///
1346 /// # Example
1347 /// ```ignore,no_run
1348 /// # use google_cloud_baremetalsolution_v2::model::EnableInteractiveSerialConsoleRequest;
1349 /// let x = EnableInteractiveSerialConsoleRequest::new().set_name("example");
1350 /// ```
1351 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1352 self.name = v.into();
1353 self
1354 }
1355}
1356
1357impl wkt::message::Message for EnableInteractiveSerialConsoleRequest {
1358 fn typename() -> &'static str {
1359 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleRequest"
1360 }
1361}
1362
1363/// Message for response of EnableInteractiveSerialConsole.
1364#[derive(Clone, Default, PartialEq)]
1365#[non_exhaustive]
1366pub struct EnableInteractiveSerialConsoleResponse {
1367 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1368}
1369
1370impl EnableInteractiveSerialConsoleResponse {
1371 pub fn new() -> Self {
1372 std::default::Default::default()
1373 }
1374}
1375
1376impl wkt::message::Message for EnableInteractiveSerialConsoleResponse {
1377 fn typename() -> &'static str {
1378 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleResponse"
1379 }
1380}
1381
1382/// Message for disabling the interactive serial console on an instance.
1383#[derive(Clone, Default, PartialEq)]
1384#[non_exhaustive]
1385pub struct DisableInteractiveSerialConsoleRequest {
1386 /// Required. Name of the resource.
1387 pub name: std::string::String,
1388
1389 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1390}
1391
1392impl DisableInteractiveSerialConsoleRequest {
1393 pub fn new() -> Self {
1394 std::default::Default::default()
1395 }
1396
1397 /// Sets the value of [name][crate::model::DisableInteractiveSerialConsoleRequest::name].
1398 ///
1399 /// # Example
1400 /// ```ignore,no_run
1401 /// # use google_cloud_baremetalsolution_v2::model::DisableInteractiveSerialConsoleRequest;
1402 /// let x = DisableInteractiveSerialConsoleRequest::new().set_name("example");
1403 /// ```
1404 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1405 self.name = v.into();
1406 self
1407 }
1408}
1409
1410impl wkt::message::Message for DisableInteractiveSerialConsoleRequest {
1411 fn typename() -> &'static str {
1412 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleRequest"
1413 }
1414}
1415
1416/// Message for response of DisableInteractiveSerialConsole.
1417#[derive(Clone, Default, PartialEq)]
1418#[non_exhaustive]
1419pub struct DisableInteractiveSerialConsoleResponse {
1420 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1421}
1422
1423impl DisableInteractiveSerialConsoleResponse {
1424 pub fn new() -> Self {
1425 std::default::Default::default()
1426 }
1427}
1428
1429impl wkt::message::Message for DisableInteractiveSerialConsoleResponse {
1430 fn typename() -> &'static str {
1431 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleResponse"
1432 }
1433}
1434
1435/// Message for detach specific LUN from an Instance.
1436#[derive(Clone, Default, PartialEq)]
1437#[non_exhaustive]
1438pub struct DetachLunRequest {
1439 /// Required. Name of the instance.
1440 pub instance: std::string::String,
1441
1442 /// Required. Name of the Lun to detach.
1443 pub lun: std::string::String,
1444
1445 /// If true, performs lun unmapping without instance reboot.
1446 pub skip_reboot: bool,
1447
1448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1449}
1450
1451impl DetachLunRequest {
1452 pub fn new() -> Self {
1453 std::default::Default::default()
1454 }
1455
1456 /// Sets the value of [instance][crate::model::DetachLunRequest::instance].
1457 ///
1458 /// # Example
1459 /// ```ignore,no_run
1460 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1461 /// let x = DetachLunRequest::new().set_instance("example");
1462 /// ```
1463 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1464 self.instance = v.into();
1465 self
1466 }
1467
1468 /// Sets the value of [lun][crate::model::DetachLunRequest::lun].
1469 ///
1470 /// # Example
1471 /// ```ignore,no_run
1472 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1473 /// let x = DetachLunRequest::new().set_lun("example");
1474 /// ```
1475 pub fn set_lun<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1476 self.lun = v.into();
1477 self
1478 }
1479
1480 /// Sets the value of [skip_reboot][crate::model::DetachLunRequest::skip_reboot].
1481 ///
1482 /// # Example
1483 /// ```ignore,no_run
1484 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1485 /// let x = DetachLunRequest::new().set_skip_reboot(true);
1486 /// ```
1487 pub fn set_skip_reboot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1488 self.skip_reboot = v.into();
1489 self
1490 }
1491}
1492
1493impl wkt::message::Message for DetachLunRequest {
1494 fn typename() -> &'static str {
1495 "type.googleapis.com/google.cloud.baremetalsolution.v2.DetachLunRequest"
1496 }
1497}
1498
1499/// Network template.
1500#[derive(Clone, Default, PartialEq)]
1501#[non_exhaustive]
1502pub struct ServerNetworkTemplate {
1503 /// Output only. Template's unique name. The full resource name follows the
1504 /// pattern:
1505 /// `projects/{project}/locations/{location}/serverNetworkTemplate/{server_network_template}`
1506 /// Generally, the {server_network_template} follows the syntax of
1507 /// "bond<interface_type_index><bond_mode>" or "nic<interface_type_index>".
1508 pub name: std::string::String,
1509
1510 /// Instance types this template is applicable to.
1511 pub applicable_instance_types: std::vec::Vec<std::string::String>,
1512
1513 /// Logical interfaces.
1514 pub logical_interfaces: std::vec::Vec<crate::model::server_network_template::LogicalInterface>,
1515
1516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1517}
1518
1519impl ServerNetworkTemplate {
1520 pub fn new() -> Self {
1521 std::default::Default::default()
1522 }
1523
1524 /// Sets the value of [name][crate::model::ServerNetworkTemplate::name].
1525 ///
1526 /// # Example
1527 /// ```ignore,no_run
1528 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1529 /// let x = ServerNetworkTemplate::new().set_name("example");
1530 /// ```
1531 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1532 self.name = v.into();
1533 self
1534 }
1535
1536 /// Sets the value of [applicable_instance_types][crate::model::ServerNetworkTemplate::applicable_instance_types].
1537 ///
1538 /// # Example
1539 /// ```ignore,no_run
1540 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1541 /// let x = ServerNetworkTemplate::new().set_applicable_instance_types(["a", "b", "c"]);
1542 /// ```
1543 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
1544 where
1545 T: std::iter::IntoIterator<Item = V>,
1546 V: std::convert::Into<std::string::String>,
1547 {
1548 use std::iter::Iterator;
1549 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
1550 self
1551 }
1552
1553 /// Sets the value of [logical_interfaces][crate::model::ServerNetworkTemplate::logical_interfaces].
1554 ///
1555 /// # Example
1556 /// ```ignore,no_run
1557 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1558 /// use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1559 /// let x = ServerNetworkTemplate::new()
1560 /// .set_logical_interfaces([
1561 /// LogicalInterface::default()/* use setters */,
1562 /// LogicalInterface::default()/* use (different) setters */,
1563 /// ]);
1564 /// ```
1565 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
1566 where
1567 T: std::iter::IntoIterator<Item = V>,
1568 V: std::convert::Into<crate::model::server_network_template::LogicalInterface>,
1569 {
1570 use std::iter::Iterator;
1571 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
1572 self
1573 }
1574}
1575
1576impl wkt::message::Message for ServerNetworkTemplate {
1577 fn typename() -> &'static str {
1578 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate"
1579 }
1580}
1581
1582/// Defines additional types related to [ServerNetworkTemplate].
1583pub mod server_network_template {
1584 #[allow(unused_imports)]
1585 use super::*;
1586
1587 /// Logical interface.
1588 #[derive(Clone, Default, PartialEq)]
1589 #[non_exhaustive]
1590 pub struct LogicalInterface {
1591 /// Interface name.
1592 /// This is not a globally unique identifier.
1593 /// Name is unique only inside the ServerNetworkTemplate. This is of syntax
1594 /// \<bond\><interface_type_index><bond_mode> or \<nic\><interface_type_index>
1595 /// and forms part of the network template name.
1596 pub name: std::string::String,
1597
1598 /// Interface type.
1599 pub r#type: crate::model::server_network_template::logical_interface::InterfaceType,
1600
1601 /// If true, interface must have network connected.
1602 pub required: bool,
1603
1604 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1605 }
1606
1607 impl LogicalInterface {
1608 pub fn new() -> Self {
1609 std::default::Default::default()
1610 }
1611
1612 /// Sets the value of [name][crate::model::server_network_template::LogicalInterface::name].
1613 ///
1614 /// # Example
1615 /// ```ignore,no_run
1616 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1617 /// let x = LogicalInterface::new().set_name("example");
1618 /// ```
1619 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1620 self.name = v.into();
1621 self
1622 }
1623
1624 /// Sets the value of [r#type][crate::model::server_network_template::LogicalInterface::type].
1625 ///
1626 /// # Example
1627 /// ```ignore,no_run
1628 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1629 /// use google_cloud_baremetalsolution_v2::model::server_network_template::logical_interface::InterfaceType;
1630 /// let x0 = LogicalInterface::new().set_type(InterfaceType::Bond);
1631 /// let x1 = LogicalInterface::new().set_type(InterfaceType::Nic);
1632 /// ```
1633 pub fn set_type<
1634 T: std::convert::Into<
1635 crate::model::server_network_template::logical_interface::InterfaceType,
1636 >,
1637 >(
1638 mut self,
1639 v: T,
1640 ) -> Self {
1641 self.r#type = v.into();
1642 self
1643 }
1644
1645 /// Sets the value of [required][crate::model::server_network_template::LogicalInterface::required].
1646 ///
1647 /// # Example
1648 /// ```ignore,no_run
1649 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1650 /// let x = LogicalInterface::new().set_required(true);
1651 /// ```
1652 pub fn set_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1653 self.required = v.into();
1654 self
1655 }
1656 }
1657
1658 impl wkt::message::Message for LogicalInterface {
1659 fn typename() -> &'static str {
1660 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface"
1661 }
1662 }
1663
1664 /// Defines additional types related to [LogicalInterface].
1665 pub mod logical_interface {
1666 #[allow(unused_imports)]
1667 use super::*;
1668
1669 /// Interface type.
1670 ///
1671 /// # Working with unknown values
1672 ///
1673 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1674 /// additional enum variants at any time. Adding new variants is not considered
1675 /// a breaking change. Applications should write their code in anticipation of:
1676 ///
1677 /// - New values appearing in future releases of the client library, **and**
1678 /// - New values received dynamically, without application changes.
1679 ///
1680 /// Please consult the [Working with enums] section in the user guide for some
1681 /// guidelines.
1682 ///
1683 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1684 #[derive(Clone, Debug, PartialEq)]
1685 #[non_exhaustive]
1686 pub enum InterfaceType {
1687 /// Unspecified value.
1688 Unspecified,
1689 /// Bond interface type.
1690 Bond,
1691 /// NIC interface type.
1692 Nic,
1693 /// If set, the enum was initialized with an unknown value.
1694 ///
1695 /// Applications can examine the value using [InterfaceType::value] or
1696 /// [InterfaceType::name].
1697 UnknownValue(interface_type::UnknownValue),
1698 }
1699
1700 #[doc(hidden)]
1701 pub mod interface_type {
1702 #[allow(unused_imports)]
1703 use super::*;
1704 #[derive(Clone, Debug, PartialEq)]
1705 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1706 }
1707
1708 impl InterfaceType {
1709 /// Gets the enum value.
1710 ///
1711 /// Returns `None` if the enum contains an unknown value deserialized from
1712 /// the string representation of enums.
1713 pub fn value(&self) -> std::option::Option<i32> {
1714 match self {
1715 Self::Unspecified => std::option::Option::Some(0),
1716 Self::Bond => std::option::Option::Some(1),
1717 Self::Nic => std::option::Option::Some(2),
1718 Self::UnknownValue(u) => u.0.value(),
1719 }
1720 }
1721
1722 /// Gets the enum value as a string.
1723 ///
1724 /// Returns `None` if the enum contains an unknown value deserialized from
1725 /// the integer representation of enums.
1726 pub fn name(&self) -> std::option::Option<&str> {
1727 match self {
1728 Self::Unspecified => std::option::Option::Some("INTERFACE_TYPE_UNSPECIFIED"),
1729 Self::Bond => std::option::Option::Some("BOND"),
1730 Self::Nic => std::option::Option::Some("NIC"),
1731 Self::UnknownValue(u) => u.0.name(),
1732 }
1733 }
1734 }
1735
1736 impl std::default::Default for InterfaceType {
1737 fn default() -> Self {
1738 use std::convert::From;
1739 Self::from(0)
1740 }
1741 }
1742
1743 impl std::fmt::Display for InterfaceType {
1744 fn fmt(
1745 &self,
1746 f: &mut std::fmt::Formatter<'_>,
1747 ) -> std::result::Result<(), std::fmt::Error> {
1748 wkt::internal::display_enum(f, self.name(), self.value())
1749 }
1750 }
1751
1752 impl std::convert::From<i32> for InterfaceType {
1753 fn from(value: i32) -> Self {
1754 match value {
1755 0 => Self::Unspecified,
1756 1 => Self::Bond,
1757 2 => Self::Nic,
1758 _ => Self::UnknownValue(interface_type::UnknownValue(
1759 wkt::internal::UnknownEnumValue::Integer(value),
1760 )),
1761 }
1762 }
1763 }
1764
1765 impl std::convert::From<&str> for InterfaceType {
1766 fn from(value: &str) -> Self {
1767 use std::string::ToString;
1768 match value {
1769 "INTERFACE_TYPE_UNSPECIFIED" => Self::Unspecified,
1770 "BOND" => Self::Bond,
1771 "NIC" => Self::Nic,
1772 _ => Self::UnknownValue(interface_type::UnknownValue(
1773 wkt::internal::UnknownEnumValue::String(value.to_string()),
1774 )),
1775 }
1776 }
1777 }
1778
1779 impl serde::ser::Serialize for InterfaceType {
1780 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1781 where
1782 S: serde::Serializer,
1783 {
1784 match self {
1785 Self::Unspecified => serializer.serialize_i32(0),
1786 Self::Bond => serializer.serialize_i32(1),
1787 Self::Nic => serializer.serialize_i32(2),
1788 Self::UnknownValue(u) => u.0.serialize(serializer),
1789 }
1790 }
1791 }
1792
1793 impl<'de> serde::de::Deserialize<'de> for InterfaceType {
1794 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1795 where
1796 D: serde::Deserializer<'de>,
1797 {
1798 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InterfaceType>::new(
1799 ".google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface.InterfaceType"))
1800 }
1801 }
1802 }
1803}
1804
1805/// A storage volume logical unit number (LUN).
1806#[derive(Clone, Default, PartialEq)]
1807#[non_exhaustive]
1808pub struct Lun {
1809 /// Output only. The name of the LUN.
1810 pub name: std::string::String,
1811
1812 /// An identifier for the LUN, generated by the backend.
1813 pub id: std::string::String,
1814
1815 /// The state of this storage volume.
1816 pub state: crate::model::lun::State,
1817
1818 /// The size of this LUN, in gigabytes.
1819 pub size_gb: i64,
1820
1821 /// The LUN multiprotocol type ensures the characteristics of the LUN are
1822 /// optimized for each operating system.
1823 pub multiprotocol_type: crate::model::lun::MultiprotocolType,
1824
1825 /// Display the storage volume for this LUN.
1826 pub storage_volume: std::string::String,
1827
1828 /// Display if this LUN can be shared between multiple physical servers.
1829 pub shareable: bool,
1830
1831 /// Display if this LUN is a boot LUN.
1832 pub boot_lun: bool,
1833
1834 /// The storage type for this LUN.
1835 pub storage_type: crate::model::lun::StorageType,
1836
1837 /// The WWID for this LUN.
1838 pub wwid: std::string::String,
1839
1840 /// Output only. Time after which LUN will be fully deleted.
1841 /// It is filled only for LUNs in COOL_OFF state.
1842 pub expire_time: std::option::Option<wkt::Timestamp>,
1843
1844 /// Output only. Instances this Lun is attached to.
1845 pub instances: std::vec::Vec<std::string::String>,
1846
1847 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1848}
1849
1850impl Lun {
1851 pub fn new() -> Self {
1852 std::default::Default::default()
1853 }
1854
1855 /// Sets the value of [name][crate::model::Lun::name].
1856 ///
1857 /// # Example
1858 /// ```ignore,no_run
1859 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1860 /// let x = Lun::new().set_name("example");
1861 /// ```
1862 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1863 self.name = v.into();
1864 self
1865 }
1866
1867 /// Sets the value of [id][crate::model::Lun::id].
1868 ///
1869 /// # Example
1870 /// ```ignore,no_run
1871 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1872 /// let x = Lun::new().set_id("example");
1873 /// ```
1874 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1875 self.id = v.into();
1876 self
1877 }
1878
1879 /// Sets the value of [state][crate::model::Lun::state].
1880 ///
1881 /// # Example
1882 /// ```ignore,no_run
1883 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1884 /// use google_cloud_baremetalsolution_v2::model::lun::State;
1885 /// let x0 = Lun::new().set_state(State::Creating);
1886 /// let x1 = Lun::new().set_state(State::Updating);
1887 /// let x2 = Lun::new().set_state(State::Ready);
1888 /// ```
1889 pub fn set_state<T: std::convert::Into<crate::model::lun::State>>(mut self, v: T) -> Self {
1890 self.state = v.into();
1891 self
1892 }
1893
1894 /// Sets the value of [size_gb][crate::model::Lun::size_gb].
1895 ///
1896 /// # Example
1897 /// ```ignore,no_run
1898 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1899 /// let x = Lun::new().set_size_gb(42);
1900 /// ```
1901 pub fn set_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1902 self.size_gb = v.into();
1903 self
1904 }
1905
1906 /// Sets the value of [multiprotocol_type][crate::model::Lun::multiprotocol_type].
1907 ///
1908 /// # Example
1909 /// ```ignore,no_run
1910 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1911 /// use google_cloud_baremetalsolution_v2::model::lun::MultiprotocolType;
1912 /// let x0 = Lun::new().set_multiprotocol_type(MultiprotocolType::Linux);
1913 /// ```
1914 pub fn set_multiprotocol_type<T: std::convert::Into<crate::model::lun::MultiprotocolType>>(
1915 mut self,
1916 v: T,
1917 ) -> Self {
1918 self.multiprotocol_type = v.into();
1919 self
1920 }
1921
1922 /// Sets the value of [storage_volume][crate::model::Lun::storage_volume].
1923 ///
1924 /// # Example
1925 /// ```ignore,no_run
1926 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1927 /// let x = Lun::new().set_storage_volume("example");
1928 /// ```
1929 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1930 self.storage_volume = v.into();
1931 self
1932 }
1933
1934 /// Sets the value of [shareable][crate::model::Lun::shareable].
1935 ///
1936 /// # Example
1937 /// ```ignore,no_run
1938 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1939 /// let x = Lun::new().set_shareable(true);
1940 /// ```
1941 pub fn set_shareable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1942 self.shareable = v.into();
1943 self
1944 }
1945
1946 /// Sets the value of [boot_lun][crate::model::Lun::boot_lun].
1947 ///
1948 /// # Example
1949 /// ```ignore,no_run
1950 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1951 /// let x = Lun::new().set_boot_lun(true);
1952 /// ```
1953 pub fn set_boot_lun<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1954 self.boot_lun = v.into();
1955 self
1956 }
1957
1958 /// Sets the value of [storage_type][crate::model::Lun::storage_type].
1959 ///
1960 /// # Example
1961 /// ```ignore,no_run
1962 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1963 /// use google_cloud_baremetalsolution_v2::model::lun::StorageType;
1964 /// let x0 = Lun::new().set_storage_type(StorageType::Ssd);
1965 /// let x1 = Lun::new().set_storage_type(StorageType::Hdd);
1966 /// ```
1967 pub fn set_storage_type<T: std::convert::Into<crate::model::lun::StorageType>>(
1968 mut self,
1969 v: T,
1970 ) -> Self {
1971 self.storage_type = v.into();
1972 self
1973 }
1974
1975 /// Sets the value of [wwid][crate::model::Lun::wwid].
1976 ///
1977 /// # Example
1978 /// ```ignore,no_run
1979 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1980 /// let x = Lun::new().set_wwid("example");
1981 /// ```
1982 pub fn set_wwid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1983 self.wwid = v.into();
1984 self
1985 }
1986
1987 /// Sets the value of [expire_time][crate::model::Lun::expire_time].
1988 ///
1989 /// # Example
1990 /// ```ignore,no_run
1991 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1992 /// use wkt::Timestamp;
1993 /// let x = Lun::new().set_expire_time(Timestamp::default()/* use setters */);
1994 /// ```
1995 pub fn set_expire_time<T>(mut self, v: T) -> Self
1996 where
1997 T: std::convert::Into<wkt::Timestamp>,
1998 {
1999 self.expire_time = std::option::Option::Some(v.into());
2000 self
2001 }
2002
2003 /// Sets or clears the value of [expire_time][crate::model::Lun::expire_time].
2004 ///
2005 /// # Example
2006 /// ```ignore,no_run
2007 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2008 /// use wkt::Timestamp;
2009 /// let x = Lun::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2010 /// let x = Lun::new().set_or_clear_expire_time(None::<Timestamp>);
2011 /// ```
2012 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2013 where
2014 T: std::convert::Into<wkt::Timestamp>,
2015 {
2016 self.expire_time = v.map(|x| x.into());
2017 self
2018 }
2019
2020 /// Sets the value of [instances][crate::model::Lun::instances].
2021 ///
2022 /// # Example
2023 /// ```ignore,no_run
2024 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2025 /// let x = Lun::new().set_instances(["a", "b", "c"]);
2026 /// ```
2027 pub fn set_instances<T, V>(mut self, v: T) -> Self
2028 where
2029 T: std::iter::IntoIterator<Item = V>,
2030 V: std::convert::Into<std::string::String>,
2031 {
2032 use std::iter::Iterator;
2033 self.instances = v.into_iter().map(|i| i.into()).collect();
2034 self
2035 }
2036}
2037
2038impl wkt::message::Message for Lun {
2039 fn typename() -> &'static str {
2040 "type.googleapis.com/google.cloud.baremetalsolution.v2.Lun"
2041 }
2042}
2043
2044/// Defines additional types related to [Lun].
2045pub mod lun {
2046 #[allow(unused_imports)]
2047 use super::*;
2048
2049 /// The possible states for the LUN.
2050 ///
2051 /// # Working with unknown values
2052 ///
2053 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2054 /// additional enum variants at any time. Adding new variants is not considered
2055 /// a breaking change. Applications should write their code in anticipation of:
2056 ///
2057 /// - New values appearing in future releases of the client library, **and**
2058 /// - New values received dynamically, without application changes.
2059 ///
2060 /// Please consult the [Working with enums] section in the user guide for some
2061 /// guidelines.
2062 ///
2063 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2064 #[derive(Clone, Debug, PartialEq)]
2065 #[non_exhaustive]
2066 pub enum State {
2067 /// The LUN is in an unknown state.
2068 Unspecified,
2069 /// The LUN is being created.
2070 Creating,
2071 /// The LUN is being updated.
2072 Updating,
2073 /// The LUN is ready for use.
2074 Ready,
2075 /// The LUN has been requested to be deleted.
2076 Deleting,
2077 /// The LUN is in cool off state. It will be deleted after `expire_time`.
2078 CoolOff,
2079 /// If set, the enum was initialized with an unknown value.
2080 ///
2081 /// Applications can examine the value using [State::value] or
2082 /// [State::name].
2083 UnknownValue(state::UnknownValue),
2084 }
2085
2086 #[doc(hidden)]
2087 pub mod state {
2088 #[allow(unused_imports)]
2089 use super::*;
2090 #[derive(Clone, Debug, PartialEq)]
2091 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2092 }
2093
2094 impl State {
2095 /// Gets the enum value.
2096 ///
2097 /// Returns `None` if the enum contains an unknown value deserialized from
2098 /// the string representation of enums.
2099 pub fn value(&self) -> std::option::Option<i32> {
2100 match self {
2101 Self::Unspecified => std::option::Option::Some(0),
2102 Self::Creating => std::option::Option::Some(1),
2103 Self::Updating => std::option::Option::Some(2),
2104 Self::Ready => std::option::Option::Some(3),
2105 Self::Deleting => std::option::Option::Some(4),
2106 Self::CoolOff => std::option::Option::Some(5),
2107 Self::UnknownValue(u) => u.0.value(),
2108 }
2109 }
2110
2111 /// Gets the enum value as a string.
2112 ///
2113 /// Returns `None` if the enum contains an unknown value deserialized from
2114 /// the integer representation of enums.
2115 pub fn name(&self) -> std::option::Option<&str> {
2116 match self {
2117 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2118 Self::Creating => std::option::Option::Some("CREATING"),
2119 Self::Updating => std::option::Option::Some("UPDATING"),
2120 Self::Ready => std::option::Option::Some("READY"),
2121 Self::Deleting => std::option::Option::Some("DELETING"),
2122 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
2123 Self::UnknownValue(u) => u.0.name(),
2124 }
2125 }
2126 }
2127
2128 impl std::default::Default for State {
2129 fn default() -> Self {
2130 use std::convert::From;
2131 Self::from(0)
2132 }
2133 }
2134
2135 impl std::fmt::Display for State {
2136 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2137 wkt::internal::display_enum(f, self.name(), self.value())
2138 }
2139 }
2140
2141 impl std::convert::From<i32> for State {
2142 fn from(value: i32) -> Self {
2143 match value {
2144 0 => Self::Unspecified,
2145 1 => Self::Creating,
2146 2 => Self::Updating,
2147 3 => Self::Ready,
2148 4 => Self::Deleting,
2149 5 => Self::CoolOff,
2150 _ => Self::UnknownValue(state::UnknownValue(
2151 wkt::internal::UnknownEnumValue::Integer(value),
2152 )),
2153 }
2154 }
2155 }
2156
2157 impl std::convert::From<&str> for State {
2158 fn from(value: &str) -> Self {
2159 use std::string::ToString;
2160 match value {
2161 "STATE_UNSPECIFIED" => Self::Unspecified,
2162 "CREATING" => Self::Creating,
2163 "UPDATING" => Self::Updating,
2164 "READY" => Self::Ready,
2165 "DELETING" => Self::Deleting,
2166 "COOL_OFF" => Self::CoolOff,
2167 _ => Self::UnknownValue(state::UnknownValue(
2168 wkt::internal::UnknownEnumValue::String(value.to_string()),
2169 )),
2170 }
2171 }
2172 }
2173
2174 impl serde::ser::Serialize for State {
2175 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2176 where
2177 S: serde::Serializer,
2178 {
2179 match self {
2180 Self::Unspecified => serializer.serialize_i32(0),
2181 Self::Creating => serializer.serialize_i32(1),
2182 Self::Updating => serializer.serialize_i32(2),
2183 Self::Ready => serializer.serialize_i32(3),
2184 Self::Deleting => serializer.serialize_i32(4),
2185 Self::CoolOff => serializer.serialize_i32(5),
2186 Self::UnknownValue(u) => u.0.serialize(serializer),
2187 }
2188 }
2189 }
2190
2191 impl<'de> serde::de::Deserialize<'de> for State {
2192 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2193 where
2194 D: serde::Deserializer<'de>,
2195 {
2196 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2197 ".google.cloud.baremetalsolution.v2.Lun.State",
2198 ))
2199 }
2200 }
2201
2202 /// Display the operating systems present for the LUN multiprotocol type.
2203 ///
2204 /// # Working with unknown values
2205 ///
2206 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2207 /// additional enum variants at any time. Adding new variants is not considered
2208 /// a breaking change. Applications should write their code in anticipation of:
2209 ///
2210 /// - New values appearing in future releases of the client library, **and**
2211 /// - New values received dynamically, without application changes.
2212 ///
2213 /// Please consult the [Working with enums] section in the user guide for some
2214 /// guidelines.
2215 ///
2216 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2217 #[derive(Clone, Debug, PartialEq)]
2218 #[non_exhaustive]
2219 pub enum MultiprotocolType {
2220 /// Server has no OS specified.
2221 Unspecified,
2222 /// Server with Linux OS.
2223 Linux,
2224 /// If set, the enum was initialized with an unknown value.
2225 ///
2226 /// Applications can examine the value using [MultiprotocolType::value] or
2227 /// [MultiprotocolType::name].
2228 UnknownValue(multiprotocol_type::UnknownValue),
2229 }
2230
2231 #[doc(hidden)]
2232 pub mod multiprotocol_type {
2233 #[allow(unused_imports)]
2234 use super::*;
2235 #[derive(Clone, Debug, PartialEq)]
2236 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2237 }
2238
2239 impl MultiprotocolType {
2240 /// Gets the enum value.
2241 ///
2242 /// Returns `None` if the enum contains an unknown value deserialized from
2243 /// the string representation of enums.
2244 pub fn value(&self) -> std::option::Option<i32> {
2245 match self {
2246 Self::Unspecified => std::option::Option::Some(0),
2247 Self::Linux => std::option::Option::Some(1),
2248 Self::UnknownValue(u) => u.0.value(),
2249 }
2250 }
2251
2252 /// Gets the enum value as a string.
2253 ///
2254 /// Returns `None` if the enum contains an unknown value deserialized from
2255 /// the integer representation of enums.
2256 pub fn name(&self) -> std::option::Option<&str> {
2257 match self {
2258 Self::Unspecified => std::option::Option::Some("MULTIPROTOCOL_TYPE_UNSPECIFIED"),
2259 Self::Linux => std::option::Option::Some("LINUX"),
2260 Self::UnknownValue(u) => u.0.name(),
2261 }
2262 }
2263 }
2264
2265 impl std::default::Default for MultiprotocolType {
2266 fn default() -> Self {
2267 use std::convert::From;
2268 Self::from(0)
2269 }
2270 }
2271
2272 impl std::fmt::Display for MultiprotocolType {
2273 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2274 wkt::internal::display_enum(f, self.name(), self.value())
2275 }
2276 }
2277
2278 impl std::convert::From<i32> for MultiprotocolType {
2279 fn from(value: i32) -> Self {
2280 match value {
2281 0 => Self::Unspecified,
2282 1 => Self::Linux,
2283 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2284 wkt::internal::UnknownEnumValue::Integer(value),
2285 )),
2286 }
2287 }
2288 }
2289
2290 impl std::convert::From<&str> for MultiprotocolType {
2291 fn from(value: &str) -> Self {
2292 use std::string::ToString;
2293 match value {
2294 "MULTIPROTOCOL_TYPE_UNSPECIFIED" => Self::Unspecified,
2295 "LINUX" => Self::Linux,
2296 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2297 wkt::internal::UnknownEnumValue::String(value.to_string()),
2298 )),
2299 }
2300 }
2301 }
2302
2303 impl serde::ser::Serialize for MultiprotocolType {
2304 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2305 where
2306 S: serde::Serializer,
2307 {
2308 match self {
2309 Self::Unspecified => serializer.serialize_i32(0),
2310 Self::Linux => serializer.serialize_i32(1),
2311 Self::UnknownValue(u) => u.0.serialize(serializer),
2312 }
2313 }
2314 }
2315
2316 impl<'de> serde::de::Deserialize<'de> for MultiprotocolType {
2317 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2318 where
2319 D: serde::Deserializer<'de>,
2320 {
2321 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MultiprotocolType>::new(
2322 ".google.cloud.baremetalsolution.v2.Lun.MultiprotocolType",
2323 ))
2324 }
2325 }
2326
2327 /// The storage types for a LUN.
2328 ///
2329 /// # Working with unknown values
2330 ///
2331 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2332 /// additional enum variants at any time. Adding new variants is not considered
2333 /// a breaking change. Applications should write their code in anticipation of:
2334 ///
2335 /// - New values appearing in future releases of the client library, **and**
2336 /// - New values received dynamically, without application changes.
2337 ///
2338 /// Please consult the [Working with enums] section in the user guide for some
2339 /// guidelines.
2340 ///
2341 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2342 #[derive(Clone, Debug, PartialEq)]
2343 #[non_exhaustive]
2344 pub enum StorageType {
2345 /// The storage type for this LUN is unknown.
2346 Unspecified,
2347 /// This storage type for this LUN is SSD.
2348 Ssd,
2349 /// This storage type for this LUN is HDD.
2350 Hdd,
2351 /// If set, the enum was initialized with an unknown value.
2352 ///
2353 /// Applications can examine the value using [StorageType::value] or
2354 /// [StorageType::name].
2355 UnknownValue(storage_type::UnknownValue),
2356 }
2357
2358 #[doc(hidden)]
2359 pub mod storage_type {
2360 #[allow(unused_imports)]
2361 use super::*;
2362 #[derive(Clone, Debug, PartialEq)]
2363 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2364 }
2365
2366 impl StorageType {
2367 /// Gets the enum value.
2368 ///
2369 /// Returns `None` if the enum contains an unknown value deserialized from
2370 /// the string representation of enums.
2371 pub fn value(&self) -> std::option::Option<i32> {
2372 match self {
2373 Self::Unspecified => std::option::Option::Some(0),
2374 Self::Ssd => std::option::Option::Some(1),
2375 Self::Hdd => std::option::Option::Some(2),
2376 Self::UnknownValue(u) => u.0.value(),
2377 }
2378 }
2379
2380 /// Gets the enum value as a string.
2381 ///
2382 /// Returns `None` if the enum contains an unknown value deserialized from
2383 /// the integer representation of enums.
2384 pub fn name(&self) -> std::option::Option<&str> {
2385 match self {
2386 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
2387 Self::Ssd => std::option::Option::Some("SSD"),
2388 Self::Hdd => std::option::Option::Some("HDD"),
2389 Self::UnknownValue(u) => u.0.name(),
2390 }
2391 }
2392 }
2393
2394 impl std::default::Default for StorageType {
2395 fn default() -> Self {
2396 use std::convert::From;
2397 Self::from(0)
2398 }
2399 }
2400
2401 impl std::fmt::Display for StorageType {
2402 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2403 wkt::internal::display_enum(f, self.name(), self.value())
2404 }
2405 }
2406
2407 impl std::convert::From<i32> for StorageType {
2408 fn from(value: i32) -> Self {
2409 match value {
2410 0 => Self::Unspecified,
2411 1 => Self::Ssd,
2412 2 => Self::Hdd,
2413 _ => Self::UnknownValue(storage_type::UnknownValue(
2414 wkt::internal::UnknownEnumValue::Integer(value),
2415 )),
2416 }
2417 }
2418 }
2419
2420 impl std::convert::From<&str> for StorageType {
2421 fn from(value: &str) -> Self {
2422 use std::string::ToString;
2423 match value {
2424 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
2425 "SSD" => Self::Ssd,
2426 "HDD" => Self::Hdd,
2427 _ => Self::UnknownValue(storage_type::UnknownValue(
2428 wkt::internal::UnknownEnumValue::String(value.to_string()),
2429 )),
2430 }
2431 }
2432 }
2433
2434 impl serde::ser::Serialize for StorageType {
2435 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2436 where
2437 S: serde::Serializer,
2438 {
2439 match self {
2440 Self::Unspecified => serializer.serialize_i32(0),
2441 Self::Ssd => serializer.serialize_i32(1),
2442 Self::Hdd => serializer.serialize_i32(2),
2443 Self::UnknownValue(u) => u.0.serialize(serializer),
2444 }
2445 }
2446 }
2447
2448 impl<'de> serde::de::Deserialize<'de> for StorageType {
2449 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2450 where
2451 D: serde::Deserializer<'de>,
2452 {
2453 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
2454 ".google.cloud.baremetalsolution.v2.Lun.StorageType",
2455 ))
2456 }
2457 }
2458}
2459
2460/// Message for requesting storage lun information.
2461#[derive(Clone, Default, PartialEq)]
2462#[non_exhaustive]
2463pub struct GetLunRequest {
2464 /// Required. Name of the resource.
2465 pub name: std::string::String,
2466
2467 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2468}
2469
2470impl GetLunRequest {
2471 pub fn new() -> Self {
2472 std::default::Default::default()
2473 }
2474
2475 /// Sets the value of [name][crate::model::GetLunRequest::name].
2476 ///
2477 /// # Example
2478 /// ```ignore,no_run
2479 /// # use google_cloud_baremetalsolution_v2::model::GetLunRequest;
2480 /// let x = GetLunRequest::new().set_name("example");
2481 /// ```
2482 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2483 self.name = v.into();
2484 self
2485 }
2486}
2487
2488impl wkt::message::Message for GetLunRequest {
2489 fn typename() -> &'static str {
2490 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetLunRequest"
2491 }
2492}
2493
2494/// Message for requesting a list of storage volume luns.
2495#[derive(Clone, Default, PartialEq)]
2496#[non_exhaustive]
2497pub struct ListLunsRequest {
2498 /// Required. Parent value for ListLunsRequest.
2499 pub parent: std::string::String,
2500
2501 /// Requested page size. The server might return fewer items than requested.
2502 /// If unspecified, server will pick an appropriate default.
2503 pub page_size: i32,
2504
2505 /// A token identifying a page of results from the server.
2506 pub page_token: std::string::String,
2507
2508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2509}
2510
2511impl ListLunsRequest {
2512 pub fn new() -> Self {
2513 std::default::Default::default()
2514 }
2515
2516 /// Sets the value of [parent][crate::model::ListLunsRequest::parent].
2517 ///
2518 /// # Example
2519 /// ```ignore,no_run
2520 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2521 /// let x = ListLunsRequest::new().set_parent("example");
2522 /// ```
2523 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2524 self.parent = v.into();
2525 self
2526 }
2527
2528 /// Sets the value of [page_size][crate::model::ListLunsRequest::page_size].
2529 ///
2530 /// # Example
2531 /// ```ignore,no_run
2532 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2533 /// let x = ListLunsRequest::new().set_page_size(42);
2534 /// ```
2535 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2536 self.page_size = v.into();
2537 self
2538 }
2539
2540 /// Sets the value of [page_token][crate::model::ListLunsRequest::page_token].
2541 ///
2542 /// # Example
2543 /// ```ignore,no_run
2544 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2545 /// let x = ListLunsRequest::new().set_page_token("example");
2546 /// ```
2547 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2548 self.page_token = v.into();
2549 self
2550 }
2551}
2552
2553impl wkt::message::Message for ListLunsRequest {
2554 fn typename() -> &'static str {
2555 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsRequest"
2556 }
2557}
2558
2559/// Response message containing the list of storage volume luns.
2560#[derive(Clone, Default, PartialEq)]
2561#[non_exhaustive]
2562pub struct ListLunsResponse {
2563 /// The list of luns.
2564 pub luns: std::vec::Vec<crate::model::Lun>,
2565
2566 /// A token identifying a page of results from the server.
2567 pub next_page_token: std::string::String,
2568
2569 /// Locations that could not be reached.
2570 pub unreachable: std::vec::Vec<std::string::String>,
2571
2572 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2573}
2574
2575impl ListLunsResponse {
2576 pub fn new() -> Self {
2577 std::default::Default::default()
2578 }
2579
2580 /// Sets the value of [luns][crate::model::ListLunsResponse::luns].
2581 ///
2582 /// # Example
2583 /// ```ignore,no_run
2584 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2585 /// use google_cloud_baremetalsolution_v2::model::Lun;
2586 /// let x = ListLunsResponse::new()
2587 /// .set_luns([
2588 /// Lun::default()/* use setters */,
2589 /// Lun::default()/* use (different) setters */,
2590 /// ]);
2591 /// ```
2592 pub fn set_luns<T, V>(mut self, v: T) -> Self
2593 where
2594 T: std::iter::IntoIterator<Item = V>,
2595 V: std::convert::Into<crate::model::Lun>,
2596 {
2597 use std::iter::Iterator;
2598 self.luns = v.into_iter().map(|i| i.into()).collect();
2599 self
2600 }
2601
2602 /// Sets the value of [next_page_token][crate::model::ListLunsResponse::next_page_token].
2603 ///
2604 /// # Example
2605 /// ```ignore,no_run
2606 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2607 /// let x = ListLunsResponse::new().set_next_page_token("example");
2608 /// ```
2609 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2610 self.next_page_token = v.into();
2611 self
2612 }
2613
2614 /// Sets the value of [unreachable][crate::model::ListLunsResponse::unreachable].
2615 ///
2616 /// # Example
2617 /// ```ignore,no_run
2618 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2619 /// let x = ListLunsResponse::new().set_unreachable(["a", "b", "c"]);
2620 /// ```
2621 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2622 where
2623 T: std::iter::IntoIterator<Item = V>,
2624 V: std::convert::Into<std::string::String>,
2625 {
2626 use std::iter::Iterator;
2627 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2628 self
2629 }
2630}
2631
2632impl wkt::message::Message for ListLunsResponse {
2633 fn typename() -> &'static str {
2634 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsResponse"
2635 }
2636}
2637
2638#[doc(hidden)]
2639impl google_cloud_gax::paginator::internal::PageableResponse for ListLunsResponse {
2640 type PageItem = crate::model::Lun;
2641
2642 fn items(self) -> std::vec::Vec<Self::PageItem> {
2643 self.luns
2644 }
2645
2646 fn next_page_token(&self) -> std::string::String {
2647 use std::clone::Clone;
2648 self.next_page_token.clone()
2649 }
2650}
2651
2652/// Request for skip lun cooloff and delete it.
2653#[derive(Clone, Default, PartialEq)]
2654#[non_exhaustive]
2655pub struct EvictLunRequest {
2656 /// Required. The name of the lun.
2657 pub name: std::string::String,
2658
2659 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2660}
2661
2662impl EvictLunRequest {
2663 pub fn new() -> Self {
2664 std::default::Default::default()
2665 }
2666
2667 /// Sets the value of [name][crate::model::EvictLunRequest::name].
2668 ///
2669 /// # Example
2670 /// ```ignore,no_run
2671 /// # use google_cloud_baremetalsolution_v2::model::EvictLunRequest;
2672 /// let x = EvictLunRequest::new().set_name("example");
2673 /// ```
2674 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2675 self.name = v.into();
2676 self
2677 }
2678}
2679
2680impl wkt::message::Message for EvictLunRequest {
2681 fn typename() -> &'static str {
2682 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictLunRequest"
2683 }
2684}
2685
2686/// A Network.
2687#[derive(Clone, Default, PartialEq)]
2688#[non_exhaustive]
2689pub struct Network {
2690 /// Output only. The resource name of this `Network`.
2691 /// Resource names are schemeless URIs that follow the conventions in
2692 /// <https://cloud.google.com/apis/design/resource_names>.
2693 /// Format:
2694 /// `projects/{project}/locations/{location}/networks/{network}`
2695 pub name: std::string::String,
2696
2697 /// An identifier for the `Network`, generated by the backend.
2698 pub id: std::string::String,
2699
2700 /// The type of this network.
2701 pub r#type: crate::model::network::Type,
2702
2703 /// IP address configured.
2704 pub ip_address: std::string::String,
2705
2706 /// List of physical interfaces.
2707 pub mac_address: std::vec::Vec<std::string::String>,
2708
2709 /// The Network state.
2710 pub state: crate::model::network::State,
2711
2712 /// The vlan id of the Network.
2713 pub vlan_id: std::string::String,
2714
2715 /// The cidr of the Network.
2716 pub cidr: std::string::String,
2717
2718 /// The vrf for the Network.
2719 pub vrf: std::option::Option<crate::model::Vrf>,
2720
2721 /// Labels as key value pairs.
2722 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2723
2724 /// IP range for reserved for services (e.g. NFS).
2725 pub services_cidr: std::string::String,
2726
2727 /// List of IP address reservations in this network.
2728 /// When updating this field, an error will be generated if a reservation
2729 /// conflicts with an IP address already allocated to a physical server.
2730 pub reservations: std::vec::Vec<crate::model::NetworkAddressReservation>,
2731
2732 /// Output only. Pod name.
2733 pub pod: std::string::String,
2734
2735 /// Input only. List of mount points to attach the network to.
2736 pub mount_points: std::vec::Vec<crate::model::NetworkMountPoint>,
2737
2738 /// Whether network uses standard frames or jumbo ones.
2739 pub jumbo_frames_enabled: bool,
2740
2741 /// Output only. Gateway ip address.
2742 pub gateway_ip: std::string::String,
2743
2744 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2745}
2746
2747impl Network {
2748 pub fn new() -> Self {
2749 std::default::Default::default()
2750 }
2751
2752 /// Sets the value of [name][crate::model::Network::name].
2753 ///
2754 /// # Example
2755 /// ```ignore,no_run
2756 /// # use google_cloud_baremetalsolution_v2::model::Network;
2757 /// let x = Network::new().set_name("example");
2758 /// ```
2759 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2760 self.name = v.into();
2761 self
2762 }
2763
2764 /// Sets the value of [id][crate::model::Network::id].
2765 ///
2766 /// # Example
2767 /// ```ignore,no_run
2768 /// # use google_cloud_baremetalsolution_v2::model::Network;
2769 /// let x = Network::new().set_id("example");
2770 /// ```
2771 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2772 self.id = v.into();
2773 self
2774 }
2775
2776 /// Sets the value of [r#type][crate::model::Network::type].
2777 ///
2778 /// # Example
2779 /// ```ignore,no_run
2780 /// # use google_cloud_baremetalsolution_v2::model::Network;
2781 /// use google_cloud_baremetalsolution_v2::model::network::Type;
2782 /// let x0 = Network::new().set_type(Type::Client);
2783 /// let x1 = Network::new().set_type(Type::Private);
2784 /// ```
2785 pub fn set_type<T: std::convert::Into<crate::model::network::Type>>(mut self, v: T) -> Self {
2786 self.r#type = v.into();
2787 self
2788 }
2789
2790 /// Sets the value of [ip_address][crate::model::Network::ip_address].
2791 ///
2792 /// # Example
2793 /// ```ignore,no_run
2794 /// # use google_cloud_baremetalsolution_v2::model::Network;
2795 /// let x = Network::new().set_ip_address("example");
2796 /// ```
2797 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2798 self.ip_address = v.into();
2799 self
2800 }
2801
2802 /// Sets the value of [mac_address][crate::model::Network::mac_address].
2803 ///
2804 /// # Example
2805 /// ```ignore,no_run
2806 /// # use google_cloud_baremetalsolution_v2::model::Network;
2807 /// let x = Network::new().set_mac_address(["a", "b", "c"]);
2808 /// ```
2809 pub fn set_mac_address<T, V>(mut self, v: T) -> Self
2810 where
2811 T: std::iter::IntoIterator<Item = V>,
2812 V: std::convert::Into<std::string::String>,
2813 {
2814 use std::iter::Iterator;
2815 self.mac_address = v.into_iter().map(|i| i.into()).collect();
2816 self
2817 }
2818
2819 /// Sets the value of [state][crate::model::Network::state].
2820 ///
2821 /// # Example
2822 /// ```ignore,no_run
2823 /// # use google_cloud_baremetalsolution_v2::model::Network;
2824 /// use google_cloud_baremetalsolution_v2::model::network::State;
2825 /// let x0 = Network::new().set_state(State::Provisioning);
2826 /// let x1 = Network::new().set_state(State::Provisioned);
2827 /// let x2 = Network::new().set_state(State::Deprovisioning);
2828 /// ```
2829 pub fn set_state<T: std::convert::Into<crate::model::network::State>>(mut self, v: T) -> Self {
2830 self.state = v.into();
2831 self
2832 }
2833
2834 /// Sets the value of [vlan_id][crate::model::Network::vlan_id].
2835 ///
2836 /// # Example
2837 /// ```ignore,no_run
2838 /// # use google_cloud_baremetalsolution_v2::model::Network;
2839 /// let x = Network::new().set_vlan_id("example");
2840 /// ```
2841 pub fn set_vlan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2842 self.vlan_id = v.into();
2843 self
2844 }
2845
2846 /// Sets the value of [cidr][crate::model::Network::cidr].
2847 ///
2848 /// # Example
2849 /// ```ignore,no_run
2850 /// # use google_cloud_baremetalsolution_v2::model::Network;
2851 /// let x = Network::new().set_cidr("example");
2852 /// ```
2853 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2854 self.cidr = v.into();
2855 self
2856 }
2857
2858 /// Sets the value of [vrf][crate::model::Network::vrf].
2859 ///
2860 /// # Example
2861 /// ```ignore,no_run
2862 /// # use google_cloud_baremetalsolution_v2::model::Network;
2863 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2864 /// let x = Network::new().set_vrf(Vrf::default()/* use setters */);
2865 /// ```
2866 pub fn set_vrf<T>(mut self, v: T) -> Self
2867 where
2868 T: std::convert::Into<crate::model::Vrf>,
2869 {
2870 self.vrf = std::option::Option::Some(v.into());
2871 self
2872 }
2873
2874 /// Sets or clears the value of [vrf][crate::model::Network::vrf].
2875 ///
2876 /// # Example
2877 /// ```ignore,no_run
2878 /// # use google_cloud_baremetalsolution_v2::model::Network;
2879 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2880 /// let x = Network::new().set_or_clear_vrf(Some(Vrf::default()/* use setters */));
2881 /// let x = Network::new().set_or_clear_vrf(None::<Vrf>);
2882 /// ```
2883 pub fn set_or_clear_vrf<T>(mut self, v: std::option::Option<T>) -> Self
2884 where
2885 T: std::convert::Into<crate::model::Vrf>,
2886 {
2887 self.vrf = v.map(|x| x.into());
2888 self
2889 }
2890
2891 /// Sets the value of [labels][crate::model::Network::labels].
2892 ///
2893 /// # Example
2894 /// ```ignore,no_run
2895 /// # use google_cloud_baremetalsolution_v2::model::Network;
2896 /// let x = Network::new().set_labels([
2897 /// ("key0", "abc"),
2898 /// ("key1", "xyz"),
2899 /// ]);
2900 /// ```
2901 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2902 where
2903 T: std::iter::IntoIterator<Item = (K, V)>,
2904 K: std::convert::Into<std::string::String>,
2905 V: std::convert::Into<std::string::String>,
2906 {
2907 use std::iter::Iterator;
2908 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2909 self
2910 }
2911
2912 /// Sets the value of [services_cidr][crate::model::Network::services_cidr].
2913 ///
2914 /// # Example
2915 /// ```ignore,no_run
2916 /// # use google_cloud_baremetalsolution_v2::model::Network;
2917 /// let x = Network::new().set_services_cidr("example");
2918 /// ```
2919 pub fn set_services_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2920 self.services_cidr = v.into();
2921 self
2922 }
2923
2924 /// Sets the value of [reservations][crate::model::Network::reservations].
2925 ///
2926 /// # Example
2927 /// ```ignore,no_run
2928 /// # use google_cloud_baremetalsolution_v2::model::Network;
2929 /// use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
2930 /// let x = Network::new()
2931 /// .set_reservations([
2932 /// NetworkAddressReservation::default()/* use setters */,
2933 /// NetworkAddressReservation::default()/* use (different) setters */,
2934 /// ]);
2935 /// ```
2936 pub fn set_reservations<T, V>(mut self, v: T) -> Self
2937 where
2938 T: std::iter::IntoIterator<Item = V>,
2939 V: std::convert::Into<crate::model::NetworkAddressReservation>,
2940 {
2941 use std::iter::Iterator;
2942 self.reservations = v.into_iter().map(|i| i.into()).collect();
2943 self
2944 }
2945
2946 /// Sets the value of [pod][crate::model::Network::pod].
2947 ///
2948 /// # Example
2949 /// ```ignore,no_run
2950 /// # use google_cloud_baremetalsolution_v2::model::Network;
2951 /// let x = Network::new().set_pod("example");
2952 /// ```
2953 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2954 self.pod = v.into();
2955 self
2956 }
2957
2958 /// Sets the value of [mount_points][crate::model::Network::mount_points].
2959 ///
2960 /// # Example
2961 /// ```ignore,no_run
2962 /// # use google_cloud_baremetalsolution_v2::model::Network;
2963 /// use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
2964 /// let x = Network::new()
2965 /// .set_mount_points([
2966 /// NetworkMountPoint::default()/* use setters */,
2967 /// NetworkMountPoint::default()/* use (different) setters */,
2968 /// ]);
2969 /// ```
2970 pub fn set_mount_points<T, V>(mut self, v: T) -> Self
2971 where
2972 T: std::iter::IntoIterator<Item = V>,
2973 V: std::convert::Into<crate::model::NetworkMountPoint>,
2974 {
2975 use std::iter::Iterator;
2976 self.mount_points = v.into_iter().map(|i| i.into()).collect();
2977 self
2978 }
2979
2980 /// Sets the value of [jumbo_frames_enabled][crate::model::Network::jumbo_frames_enabled].
2981 ///
2982 /// # Example
2983 /// ```ignore,no_run
2984 /// # use google_cloud_baremetalsolution_v2::model::Network;
2985 /// let x = Network::new().set_jumbo_frames_enabled(true);
2986 /// ```
2987 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2988 self.jumbo_frames_enabled = v.into();
2989 self
2990 }
2991
2992 /// Sets the value of [gateway_ip][crate::model::Network::gateway_ip].
2993 ///
2994 /// # Example
2995 /// ```ignore,no_run
2996 /// # use google_cloud_baremetalsolution_v2::model::Network;
2997 /// let x = Network::new().set_gateway_ip("example");
2998 /// ```
2999 pub fn set_gateway_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3000 self.gateway_ip = v.into();
3001 self
3002 }
3003}
3004
3005impl wkt::message::Message for Network {
3006 fn typename() -> &'static str {
3007 "type.googleapis.com/google.cloud.baremetalsolution.v2.Network"
3008 }
3009}
3010
3011/// Defines additional types related to [Network].
3012pub mod network {
3013 #[allow(unused_imports)]
3014 use super::*;
3015
3016 /// Network type.
3017 ///
3018 /// # Working with unknown values
3019 ///
3020 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3021 /// additional enum variants at any time. Adding new variants is not considered
3022 /// a breaking change. Applications should write their code in anticipation of:
3023 ///
3024 /// - New values appearing in future releases of the client library, **and**
3025 /// - New values received dynamically, without application changes.
3026 ///
3027 /// Please consult the [Working with enums] section in the user guide for some
3028 /// guidelines.
3029 ///
3030 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3031 #[derive(Clone, Debug, PartialEq)]
3032 #[non_exhaustive]
3033 pub enum Type {
3034 /// Unspecified value.
3035 Unspecified,
3036 /// Client network, a network peered to a Google Cloud VPC.
3037 Client,
3038 /// Private network, a network local to the Bare Metal Solution environment.
3039 Private,
3040 /// If set, the enum was initialized with an unknown value.
3041 ///
3042 /// Applications can examine the value using [Type::value] or
3043 /// [Type::name].
3044 UnknownValue(r#type::UnknownValue),
3045 }
3046
3047 #[doc(hidden)]
3048 pub mod r#type {
3049 #[allow(unused_imports)]
3050 use super::*;
3051 #[derive(Clone, Debug, PartialEq)]
3052 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3053 }
3054
3055 impl Type {
3056 /// Gets the enum value.
3057 ///
3058 /// Returns `None` if the enum contains an unknown value deserialized from
3059 /// the string representation of enums.
3060 pub fn value(&self) -> std::option::Option<i32> {
3061 match self {
3062 Self::Unspecified => std::option::Option::Some(0),
3063 Self::Client => std::option::Option::Some(1),
3064 Self::Private => std::option::Option::Some(2),
3065 Self::UnknownValue(u) => u.0.value(),
3066 }
3067 }
3068
3069 /// Gets the enum value as a string.
3070 ///
3071 /// Returns `None` if the enum contains an unknown value deserialized from
3072 /// the integer representation of enums.
3073 pub fn name(&self) -> std::option::Option<&str> {
3074 match self {
3075 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
3076 Self::Client => std::option::Option::Some("CLIENT"),
3077 Self::Private => std::option::Option::Some("PRIVATE"),
3078 Self::UnknownValue(u) => u.0.name(),
3079 }
3080 }
3081 }
3082
3083 impl std::default::Default for Type {
3084 fn default() -> Self {
3085 use std::convert::From;
3086 Self::from(0)
3087 }
3088 }
3089
3090 impl std::fmt::Display for Type {
3091 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3092 wkt::internal::display_enum(f, self.name(), self.value())
3093 }
3094 }
3095
3096 impl std::convert::From<i32> for Type {
3097 fn from(value: i32) -> Self {
3098 match value {
3099 0 => Self::Unspecified,
3100 1 => Self::Client,
3101 2 => Self::Private,
3102 _ => Self::UnknownValue(r#type::UnknownValue(
3103 wkt::internal::UnknownEnumValue::Integer(value),
3104 )),
3105 }
3106 }
3107 }
3108
3109 impl std::convert::From<&str> for Type {
3110 fn from(value: &str) -> Self {
3111 use std::string::ToString;
3112 match value {
3113 "TYPE_UNSPECIFIED" => Self::Unspecified,
3114 "CLIENT" => Self::Client,
3115 "PRIVATE" => Self::Private,
3116 _ => Self::UnknownValue(r#type::UnknownValue(
3117 wkt::internal::UnknownEnumValue::String(value.to_string()),
3118 )),
3119 }
3120 }
3121 }
3122
3123 impl serde::ser::Serialize for Type {
3124 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3125 where
3126 S: serde::Serializer,
3127 {
3128 match self {
3129 Self::Unspecified => serializer.serialize_i32(0),
3130 Self::Client => serializer.serialize_i32(1),
3131 Self::Private => serializer.serialize_i32(2),
3132 Self::UnknownValue(u) => u.0.serialize(serializer),
3133 }
3134 }
3135 }
3136
3137 impl<'de> serde::de::Deserialize<'de> for Type {
3138 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3139 where
3140 D: serde::Deserializer<'de>,
3141 {
3142 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
3143 ".google.cloud.baremetalsolution.v2.Network.Type",
3144 ))
3145 }
3146 }
3147
3148 /// The possible states for this Network.
3149 ///
3150 /// # Working with unknown values
3151 ///
3152 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3153 /// additional enum variants at any time. Adding new variants is not considered
3154 /// a breaking change. Applications should write their code in anticipation of:
3155 ///
3156 /// - New values appearing in future releases of the client library, **and**
3157 /// - New values received dynamically, without application changes.
3158 ///
3159 /// Please consult the [Working with enums] section in the user guide for some
3160 /// guidelines.
3161 ///
3162 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3163 #[derive(Clone, Debug, PartialEq)]
3164 #[non_exhaustive]
3165 pub enum State {
3166 /// The Network is in an unknown state.
3167 Unspecified,
3168 /// The Network is provisioning.
3169 Provisioning,
3170 /// The Network has been provisioned.
3171 Provisioned,
3172 /// The Network is being deprovisioned.
3173 Deprovisioning,
3174 /// The Network is being updated.
3175 Updating,
3176 /// If set, the enum was initialized with an unknown value.
3177 ///
3178 /// Applications can examine the value using [State::value] or
3179 /// [State::name].
3180 UnknownValue(state::UnknownValue),
3181 }
3182
3183 #[doc(hidden)]
3184 pub mod state {
3185 #[allow(unused_imports)]
3186 use super::*;
3187 #[derive(Clone, Debug, PartialEq)]
3188 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3189 }
3190
3191 impl State {
3192 /// Gets the enum value.
3193 ///
3194 /// Returns `None` if the enum contains an unknown value deserialized from
3195 /// the string representation of enums.
3196 pub fn value(&self) -> std::option::Option<i32> {
3197 match self {
3198 Self::Unspecified => std::option::Option::Some(0),
3199 Self::Provisioning => std::option::Option::Some(1),
3200 Self::Provisioned => std::option::Option::Some(2),
3201 Self::Deprovisioning => std::option::Option::Some(3),
3202 Self::Updating => std::option::Option::Some(4),
3203 Self::UnknownValue(u) => u.0.value(),
3204 }
3205 }
3206
3207 /// Gets the enum value as a string.
3208 ///
3209 /// Returns `None` if the enum contains an unknown value deserialized from
3210 /// the integer representation of enums.
3211 pub fn name(&self) -> std::option::Option<&str> {
3212 match self {
3213 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3214 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3215 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3216 Self::Deprovisioning => std::option::Option::Some("DEPROVISIONING"),
3217 Self::Updating => std::option::Option::Some("UPDATING"),
3218 Self::UnknownValue(u) => u.0.name(),
3219 }
3220 }
3221 }
3222
3223 impl std::default::Default for State {
3224 fn default() -> Self {
3225 use std::convert::From;
3226 Self::from(0)
3227 }
3228 }
3229
3230 impl std::fmt::Display for State {
3231 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3232 wkt::internal::display_enum(f, self.name(), self.value())
3233 }
3234 }
3235
3236 impl std::convert::From<i32> for State {
3237 fn from(value: i32) -> Self {
3238 match value {
3239 0 => Self::Unspecified,
3240 1 => Self::Provisioning,
3241 2 => Self::Provisioned,
3242 3 => Self::Deprovisioning,
3243 4 => Self::Updating,
3244 _ => Self::UnknownValue(state::UnknownValue(
3245 wkt::internal::UnknownEnumValue::Integer(value),
3246 )),
3247 }
3248 }
3249 }
3250
3251 impl std::convert::From<&str> for State {
3252 fn from(value: &str) -> Self {
3253 use std::string::ToString;
3254 match value {
3255 "STATE_UNSPECIFIED" => Self::Unspecified,
3256 "PROVISIONING" => Self::Provisioning,
3257 "PROVISIONED" => Self::Provisioned,
3258 "DEPROVISIONING" => Self::Deprovisioning,
3259 "UPDATING" => Self::Updating,
3260 _ => Self::UnknownValue(state::UnknownValue(
3261 wkt::internal::UnknownEnumValue::String(value.to_string()),
3262 )),
3263 }
3264 }
3265 }
3266
3267 impl serde::ser::Serialize for State {
3268 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3269 where
3270 S: serde::Serializer,
3271 {
3272 match self {
3273 Self::Unspecified => serializer.serialize_i32(0),
3274 Self::Provisioning => serializer.serialize_i32(1),
3275 Self::Provisioned => serializer.serialize_i32(2),
3276 Self::Deprovisioning => serializer.serialize_i32(3),
3277 Self::Updating => serializer.serialize_i32(4),
3278 Self::UnknownValue(u) => u.0.serialize(serializer),
3279 }
3280 }
3281 }
3282
3283 impl<'de> serde::de::Deserialize<'de> for State {
3284 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3285 where
3286 D: serde::Deserializer<'de>,
3287 {
3288 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3289 ".google.cloud.baremetalsolution.v2.Network.State",
3290 ))
3291 }
3292 }
3293}
3294
3295/// A reservation of one or more addresses in a network.
3296#[derive(Clone, Default, PartialEq)]
3297#[non_exhaustive]
3298pub struct NetworkAddressReservation {
3299 /// The first address of this reservation block.
3300 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3301 pub start_address: std::string::String,
3302
3303 /// The last address of this reservation block, inclusive. I.e., for cases when
3304 /// reservations are only single addresses, end_address and start_address will
3305 /// be the same.
3306 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3307 pub end_address: std::string::String,
3308
3309 /// A note about this reservation, intended for human consumption.
3310 pub note: std::string::String,
3311
3312 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3313}
3314
3315impl NetworkAddressReservation {
3316 pub fn new() -> Self {
3317 std::default::Default::default()
3318 }
3319
3320 /// Sets the value of [start_address][crate::model::NetworkAddressReservation::start_address].
3321 ///
3322 /// # Example
3323 /// ```ignore,no_run
3324 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3325 /// let x = NetworkAddressReservation::new().set_start_address("example");
3326 /// ```
3327 pub fn set_start_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3328 self.start_address = v.into();
3329 self
3330 }
3331
3332 /// Sets the value of [end_address][crate::model::NetworkAddressReservation::end_address].
3333 ///
3334 /// # Example
3335 /// ```ignore,no_run
3336 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3337 /// let x = NetworkAddressReservation::new().set_end_address("example");
3338 /// ```
3339 pub fn set_end_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3340 self.end_address = v.into();
3341 self
3342 }
3343
3344 /// Sets the value of [note][crate::model::NetworkAddressReservation::note].
3345 ///
3346 /// # Example
3347 /// ```ignore,no_run
3348 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3349 /// let x = NetworkAddressReservation::new().set_note("example");
3350 /// ```
3351 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3352 self.note = v.into();
3353 self
3354 }
3355}
3356
3357impl wkt::message::Message for NetworkAddressReservation {
3358 fn typename() -> &'static str {
3359 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkAddressReservation"
3360 }
3361}
3362
3363/// A network VRF.
3364#[derive(Clone, Default, PartialEq)]
3365#[non_exhaustive]
3366pub struct Vrf {
3367 /// The name of the VRF.
3368 pub name: std::string::String,
3369
3370 /// The possible state of VRF.
3371 pub state: crate::model::vrf::State,
3372
3373 /// The QOS policy applied to this VRF.
3374 /// The value is only meaningful when all the vlan attachments have the same
3375 /// QoS. This field should not be used for new integrations, use vlan
3376 /// attachment level qos instead. The field is left for backward-compatibility.
3377 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3378
3379 /// The list of VLAN attachments for the VRF.
3380 pub vlan_attachments: std::vec::Vec<crate::model::vrf::VlanAttachment>,
3381
3382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3383}
3384
3385impl Vrf {
3386 pub fn new() -> Self {
3387 std::default::Default::default()
3388 }
3389
3390 /// Sets the value of [name][crate::model::Vrf::name].
3391 ///
3392 /// # Example
3393 /// ```ignore,no_run
3394 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3395 /// let x = Vrf::new().set_name("example");
3396 /// ```
3397 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3398 self.name = v.into();
3399 self
3400 }
3401
3402 /// Sets the value of [state][crate::model::Vrf::state].
3403 ///
3404 /// # Example
3405 /// ```ignore,no_run
3406 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3407 /// use google_cloud_baremetalsolution_v2::model::vrf::State;
3408 /// let x0 = Vrf::new().set_state(State::Provisioning);
3409 /// let x1 = Vrf::new().set_state(State::Provisioned);
3410 /// ```
3411 pub fn set_state<T: std::convert::Into<crate::model::vrf::State>>(mut self, v: T) -> Self {
3412 self.state = v.into();
3413 self
3414 }
3415
3416 /// Sets the value of [qos_policy][crate::model::Vrf::qos_policy].
3417 ///
3418 /// # Example
3419 /// ```ignore,no_run
3420 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3421 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3422 /// let x = Vrf::new().set_qos_policy(QosPolicy::default()/* use setters */);
3423 /// ```
3424 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3425 where
3426 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3427 {
3428 self.qos_policy = std::option::Option::Some(v.into());
3429 self
3430 }
3431
3432 /// Sets or clears the value of [qos_policy][crate::model::Vrf::qos_policy].
3433 ///
3434 /// # Example
3435 /// ```ignore,no_run
3436 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3437 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3438 /// let x = Vrf::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3439 /// let x = Vrf::new().set_or_clear_qos_policy(None::<QosPolicy>);
3440 /// ```
3441 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3442 where
3443 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3444 {
3445 self.qos_policy = v.map(|x| x.into());
3446 self
3447 }
3448
3449 /// Sets the value of [vlan_attachments][crate::model::Vrf::vlan_attachments].
3450 ///
3451 /// # Example
3452 /// ```ignore,no_run
3453 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3454 /// use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3455 /// let x = Vrf::new()
3456 /// .set_vlan_attachments([
3457 /// VlanAttachment::default()/* use setters */,
3458 /// VlanAttachment::default()/* use (different) setters */,
3459 /// ]);
3460 /// ```
3461 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
3462 where
3463 T: std::iter::IntoIterator<Item = V>,
3464 V: std::convert::Into<crate::model::vrf::VlanAttachment>,
3465 {
3466 use std::iter::Iterator;
3467 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
3468 self
3469 }
3470}
3471
3472impl wkt::message::Message for Vrf {
3473 fn typename() -> &'static str {
3474 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF"
3475 }
3476}
3477
3478/// Defines additional types related to [Vrf].
3479pub mod vrf {
3480 #[allow(unused_imports)]
3481 use super::*;
3482
3483 /// QOS policy parameters.
3484 #[derive(Clone, Default, PartialEq)]
3485 #[non_exhaustive]
3486 pub struct QosPolicy {
3487 /// The bandwidth permitted by the QOS policy, in gbps.
3488 pub bandwidth_gbps: f64,
3489
3490 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3491 }
3492
3493 impl QosPolicy {
3494 pub fn new() -> Self {
3495 std::default::Default::default()
3496 }
3497
3498 /// Sets the value of [bandwidth_gbps][crate::model::vrf::QosPolicy::bandwidth_gbps].
3499 ///
3500 /// # Example
3501 /// ```ignore,no_run
3502 /// # use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3503 /// let x = QosPolicy::new().set_bandwidth_gbps(42.0);
3504 /// ```
3505 pub fn set_bandwidth_gbps<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3506 self.bandwidth_gbps = v.into();
3507 self
3508 }
3509 }
3510
3511 impl wkt::message::Message for QosPolicy {
3512 fn typename() -> &'static str {
3513 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.QosPolicy"
3514 }
3515 }
3516
3517 /// VLAN attachment details.
3518 #[derive(Clone, Default, PartialEq)]
3519 #[non_exhaustive]
3520 pub struct VlanAttachment {
3521 /// The peer vlan ID of the attachment.
3522 pub peer_vlan_id: i64,
3523
3524 /// The peer IP of the attachment.
3525 pub peer_ip: std::string::String,
3526
3527 /// The router IP of the attachment.
3528 pub router_ip: std::string::String,
3529
3530 /// Input only. Pairing key.
3531 pub pairing_key: std::string::String,
3532
3533 /// The QOS policy applied to this VLAN attachment.
3534 /// This value should be preferred to using qos at vrf level.
3535 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3536
3537 /// Immutable. The identifier of the attachment within vrf.
3538 pub id: std::string::String,
3539
3540 /// Optional. The name of the vlan attachment within vrf. This is of the form
3541 /// projects/{project_number}/regions/{region}/interconnectAttachments/{interconnect_attachment}
3542 pub interconnect_attachment: std::string::String,
3543
3544 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3545 }
3546
3547 impl VlanAttachment {
3548 pub fn new() -> Self {
3549 std::default::Default::default()
3550 }
3551
3552 /// Sets the value of [peer_vlan_id][crate::model::vrf::VlanAttachment::peer_vlan_id].
3553 ///
3554 /// # Example
3555 /// ```ignore,no_run
3556 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3557 /// let x = VlanAttachment::new().set_peer_vlan_id(42);
3558 /// ```
3559 pub fn set_peer_vlan_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3560 self.peer_vlan_id = v.into();
3561 self
3562 }
3563
3564 /// Sets the value of [peer_ip][crate::model::vrf::VlanAttachment::peer_ip].
3565 ///
3566 /// # Example
3567 /// ```ignore,no_run
3568 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3569 /// let x = VlanAttachment::new().set_peer_ip("example");
3570 /// ```
3571 pub fn set_peer_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3572 self.peer_ip = v.into();
3573 self
3574 }
3575
3576 /// Sets the value of [router_ip][crate::model::vrf::VlanAttachment::router_ip].
3577 ///
3578 /// # Example
3579 /// ```ignore,no_run
3580 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3581 /// let x = VlanAttachment::new().set_router_ip("example");
3582 /// ```
3583 pub fn set_router_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3584 self.router_ip = v.into();
3585 self
3586 }
3587
3588 /// Sets the value of [pairing_key][crate::model::vrf::VlanAttachment::pairing_key].
3589 ///
3590 /// # Example
3591 /// ```ignore,no_run
3592 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3593 /// let x = VlanAttachment::new().set_pairing_key("example");
3594 /// ```
3595 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3596 self.pairing_key = v.into();
3597 self
3598 }
3599
3600 /// Sets the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3601 ///
3602 /// # Example
3603 /// ```ignore,no_run
3604 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3605 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3606 /// let x = VlanAttachment::new().set_qos_policy(QosPolicy::default()/* use setters */);
3607 /// ```
3608 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3609 where
3610 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3611 {
3612 self.qos_policy = std::option::Option::Some(v.into());
3613 self
3614 }
3615
3616 /// Sets or clears the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3617 ///
3618 /// # Example
3619 /// ```ignore,no_run
3620 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3621 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3622 /// let x = VlanAttachment::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3623 /// let x = VlanAttachment::new().set_or_clear_qos_policy(None::<QosPolicy>);
3624 /// ```
3625 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3626 where
3627 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3628 {
3629 self.qos_policy = v.map(|x| x.into());
3630 self
3631 }
3632
3633 /// Sets the value of [id][crate::model::vrf::VlanAttachment::id].
3634 ///
3635 /// # Example
3636 /// ```ignore,no_run
3637 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3638 /// let x = VlanAttachment::new().set_id("example");
3639 /// ```
3640 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3641 self.id = v.into();
3642 self
3643 }
3644
3645 /// Sets the value of [interconnect_attachment][crate::model::vrf::VlanAttachment::interconnect_attachment].
3646 ///
3647 /// # Example
3648 /// ```ignore,no_run
3649 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3650 /// let x = VlanAttachment::new().set_interconnect_attachment("example");
3651 /// ```
3652 pub fn set_interconnect_attachment<T: std::convert::Into<std::string::String>>(
3653 mut self,
3654 v: T,
3655 ) -> Self {
3656 self.interconnect_attachment = v.into();
3657 self
3658 }
3659 }
3660
3661 impl wkt::message::Message for VlanAttachment {
3662 fn typename() -> &'static str {
3663 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.VlanAttachment"
3664 }
3665 }
3666
3667 /// The possible states for this VRF.
3668 ///
3669 /// # Working with unknown values
3670 ///
3671 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3672 /// additional enum variants at any time. Adding new variants is not considered
3673 /// a breaking change. Applications should write their code in anticipation of:
3674 ///
3675 /// - New values appearing in future releases of the client library, **and**
3676 /// - New values received dynamically, without application changes.
3677 ///
3678 /// Please consult the [Working with enums] section in the user guide for some
3679 /// guidelines.
3680 ///
3681 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3682 #[derive(Clone, Debug, PartialEq)]
3683 #[non_exhaustive]
3684 pub enum State {
3685 /// The unspecified state.
3686 Unspecified,
3687 /// The vrf is provisioning.
3688 Provisioning,
3689 /// The vrf is provisioned.
3690 Provisioned,
3691 /// If set, the enum was initialized with an unknown value.
3692 ///
3693 /// Applications can examine the value using [State::value] or
3694 /// [State::name].
3695 UnknownValue(state::UnknownValue),
3696 }
3697
3698 #[doc(hidden)]
3699 pub mod state {
3700 #[allow(unused_imports)]
3701 use super::*;
3702 #[derive(Clone, Debug, PartialEq)]
3703 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3704 }
3705
3706 impl State {
3707 /// Gets the enum value.
3708 ///
3709 /// Returns `None` if the enum contains an unknown value deserialized from
3710 /// the string representation of enums.
3711 pub fn value(&self) -> std::option::Option<i32> {
3712 match self {
3713 Self::Unspecified => std::option::Option::Some(0),
3714 Self::Provisioning => std::option::Option::Some(1),
3715 Self::Provisioned => std::option::Option::Some(2),
3716 Self::UnknownValue(u) => u.0.value(),
3717 }
3718 }
3719
3720 /// Gets the enum value as a string.
3721 ///
3722 /// Returns `None` if the enum contains an unknown value deserialized from
3723 /// the integer representation of enums.
3724 pub fn name(&self) -> std::option::Option<&str> {
3725 match self {
3726 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3727 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3728 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3729 Self::UnknownValue(u) => u.0.name(),
3730 }
3731 }
3732 }
3733
3734 impl std::default::Default for State {
3735 fn default() -> Self {
3736 use std::convert::From;
3737 Self::from(0)
3738 }
3739 }
3740
3741 impl std::fmt::Display for State {
3742 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3743 wkt::internal::display_enum(f, self.name(), self.value())
3744 }
3745 }
3746
3747 impl std::convert::From<i32> for State {
3748 fn from(value: i32) -> Self {
3749 match value {
3750 0 => Self::Unspecified,
3751 1 => Self::Provisioning,
3752 2 => Self::Provisioned,
3753 _ => Self::UnknownValue(state::UnknownValue(
3754 wkt::internal::UnknownEnumValue::Integer(value),
3755 )),
3756 }
3757 }
3758 }
3759
3760 impl std::convert::From<&str> for State {
3761 fn from(value: &str) -> Self {
3762 use std::string::ToString;
3763 match value {
3764 "STATE_UNSPECIFIED" => Self::Unspecified,
3765 "PROVISIONING" => Self::Provisioning,
3766 "PROVISIONED" => Self::Provisioned,
3767 _ => Self::UnknownValue(state::UnknownValue(
3768 wkt::internal::UnknownEnumValue::String(value.to_string()),
3769 )),
3770 }
3771 }
3772 }
3773
3774 impl serde::ser::Serialize for State {
3775 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3776 where
3777 S: serde::Serializer,
3778 {
3779 match self {
3780 Self::Unspecified => serializer.serialize_i32(0),
3781 Self::Provisioning => serializer.serialize_i32(1),
3782 Self::Provisioned => serializer.serialize_i32(2),
3783 Self::UnknownValue(u) => u.0.serialize(serializer),
3784 }
3785 }
3786 }
3787
3788 impl<'de> serde::de::Deserialize<'de> for State {
3789 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3790 where
3791 D: serde::Deserializer<'de>,
3792 {
3793 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3794 ".google.cloud.baremetalsolution.v2.VRF.State",
3795 ))
3796 }
3797 }
3798}
3799
3800/// Each logical interface represents a logical abstraction of the underlying
3801/// physical interface (for eg. bond, nic) of the instance. Each logical
3802/// interface can effectively map to multiple network-IP pairs and still be
3803/// mapped to one underlying physical interface.
3804#[derive(Clone, Default, PartialEq)]
3805#[non_exhaustive]
3806pub struct LogicalInterface {
3807 /// List of logical network interfaces within a logical interface.
3808 pub logical_network_interfaces:
3809 std::vec::Vec<crate::model::logical_interface::LogicalNetworkInterface>,
3810
3811 /// Interface name. This is of syntax \<bond\><bond_mode> or \<nic\> and
3812 /// forms part of the network template name.
3813 pub name: std::string::String,
3814
3815 /// The index of the logical interface mapping to the index of the hardware
3816 /// bond or nic on the chosen network template. This field is deprecated.
3817 #[deprecated]
3818 pub interface_index: i32,
3819
3820 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3821}
3822
3823impl LogicalInterface {
3824 pub fn new() -> Self {
3825 std::default::Default::default()
3826 }
3827
3828 /// Sets the value of [logical_network_interfaces][crate::model::LogicalInterface::logical_network_interfaces].
3829 ///
3830 /// # Example
3831 /// ```ignore,no_run
3832 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3833 /// use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3834 /// let x = LogicalInterface::new()
3835 /// .set_logical_network_interfaces([
3836 /// LogicalNetworkInterface::default()/* use setters */,
3837 /// LogicalNetworkInterface::default()/* use (different) setters */,
3838 /// ]);
3839 /// ```
3840 pub fn set_logical_network_interfaces<T, V>(mut self, v: T) -> Self
3841 where
3842 T: std::iter::IntoIterator<Item = V>,
3843 V: std::convert::Into<crate::model::logical_interface::LogicalNetworkInterface>,
3844 {
3845 use std::iter::Iterator;
3846 self.logical_network_interfaces = v.into_iter().map(|i| i.into()).collect();
3847 self
3848 }
3849
3850 /// Sets the value of [name][crate::model::LogicalInterface::name].
3851 ///
3852 /// # Example
3853 /// ```ignore,no_run
3854 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3855 /// let x = LogicalInterface::new().set_name("example");
3856 /// ```
3857 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3858 self.name = v.into();
3859 self
3860 }
3861
3862 /// Sets the value of [interface_index][crate::model::LogicalInterface::interface_index].
3863 ///
3864 /// # Example
3865 /// ```ignore,no_run
3866 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3867 /// let x = LogicalInterface::new().set_interface_index(42);
3868 /// ```
3869 #[deprecated]
3870 pub fn set_interface_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3871 self.interface_index = v.into();
3872 self
3873 }
3874}
3875
3876impl wkt::message::Message for LogicalInterface {
3877 fn typename() -> &'static str {
3878 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface"
3879 }
3880}
3881
3882/// Defines additional types related to [LogicalInterface].
3883pub mod logical_interface {
3884 #[allow(unused_imports)]
3885 use super::*;
3886
3887 /// Each logical network interface is effectively a network and IP pair.
3888 #[derive(Clone, Default, PartialEq)]
3889 #[non_exhaustive]
3890 pub struct LogicalNetworkInterface {
3891 /// Name of the network
3892 pub network: std::string::String,
3893
3894 /// IP address in the network
3895 pub ip_address: std::string::String,
3896
3897 /// Whether this interface is the default gateway for the instance. Only
3898 /// one interface can be the default gateway for the instance.
3899 pub default_gateway: bool,
3900
3901 /// Type of network.
3902 pub network_type: crate::model::network::Type,
3903
3904 /// An identifier for the `Network`, generated by the backend.
3905 pub id: std::string::String,
3906
3907 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3908 }
3909
3910 impl LogicalNetworkInterface {
3911 pub fn new() -> Self {
3912 std::default::Default::default()
3913 }
3914
3915 /// Sets the value of [network][crate::model::logical_interface::LogicalNetworkInterface::network].
3916 ///
3917 /// # Example
3918 /// ```ignore,no_run
3919 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3920 /// let x = LogicalNetworkInterface::new().set_network("example");
3921 /// ```
3922 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3923 self.network = v.into();
3924 self
3925 }
3926
3927 /// Sets the value of [ip_address][crate::model::logical_interface::LogicalNetworkInterface::ip_address].
3928 ///
3929 /// # Example
3930 /// ```ignore,no_run
3931 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3932 /// let x = LogicalNetworkInterface::new().set_ip_address("example");
3933 /// ```
3934 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3935 self.ip_address = v.into();
3936 self
3937 }
3938
3939 /// Sets the value of [default_gateway][crate::model::logical_interface::LogicalNetworkInterface::default_gateway].
3940 ///
3941 /// # Example
3942 /// ```ignore,no_run
3943 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3944 /// let x = LogicalNetworkInterface::new().set_default_gateway(true);
3945 /// ```
3946 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3947 self.default_gateway = v.into();
3948 self
3949 }
3950
3951 /// Sets the value of [network_type][crate::model::logical_interface::LogicalNetworkInterface::network_type].
3952 ///
3953 /// # Example
3954 /// ```ignore,no_run
3955 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3956 /// use google_cloud_baremetalsolution_v2::model::network::Type;
3957 /// let x0 = LogicalNetworkInterface::new().set_network_type(Type::Client);
3958 /// let x1 = LogicalNetworkInterface::new().set_network_type(Type::Private);
3959 /// ```
3960 pub fn set_network_type<T: std::convert::Into<crate::model::network::Type>>(
3961 mut self,
3962 v: T,
3963 ) -> Self {
3964 self.network_type = v.into();
3965 self
3966 }
3967
3968 /// Sets the value of [id][crate::model::logical_interface::LogicalNetworkInterface::id].
3969 ///
3970 /// # Example
3971 /// ```ignore,no_run
3972 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3973 /// let x = LogicalNetworkInterface::new().set_id("example");
3974 /// ```
3975 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3976 self.id = v.into();
3977 self
3978 }
3979 }
3980
3981 impl wkt::message::Message for LogicalNetworkInterface {
3982 fn typename() -> &'static str {
3983 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface.LogicalNetworkInterface"
3984 }
3985 }
3986}
3987
3988/// Message for requesting network information.
3989#[derive(Clone, Default, PartialEq)]
3990#[non_exhaustive]
3991pub struct GetNetworkRequest {
3992 /// Required. Name of the resource.
3993 pub name: std::string::String,
3994
3995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3996}
3997
3998impl GetNetworkRequest {
3999 pub fn new() -> Self {
4000 std::default::Default::default()
4001 }
4002
4003 /// Sets the value of [name][crate::model::GetNetworkRequest::name].
4004 ///
4005 /// # Example
4006 /// ```ignore,no_run
4007 /// # use google_cloud_baremetalsolution_v2::model::GetNetworkRequest;
4008 /// let x = GetNetworkRequest::new().set_name("example");
4009 /// ```
4010 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4011 self.name = v.into();
4012 self
4013 }
4014}
4015
4016impl wkt::message::Message for GetNetworkRequest {
4017 fn typename() -> &'static str {
4018 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNetworkRequest"
4019 }
4020}
4021
4022/// Message for requesting a list of networks.
4023#[derive(Clone, Default, PartialEq)]
4024#[non_exhaustive]
4025pub struct ListNetworksRequest {
4026 /// Required. Parent value for ListNetworksRequest.
4027 pub parent: std::string::String,
4028
4029 /// Requested page size. The server might return fewer items than requested.
4030 /// If unspecified, server will pick an appropriate default.
4031 pub page_size: i32,
4032
4033 /// A token identifying a page of results from the server.
4034 pub page_token: std::string::String,
4035
4036 /// List filter.
4037 pub filter: std::string::String,
4038
4039 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4040}
4041
4042impl ListNetworksRequest {
4043 pub fn new() -> Self {
4044 std::default::Default::default()
4045 }
4046
4047 /// Sets the value of [parent][crate::model::ListNetworksRequest::parent].
4048 ///
4049 /// # Example
4050 /// ```ignore,no_run
4051 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4052 /// let x = ListNetworksRequest::new().set_parent("example");
4053 /// ```
4054 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4055 self.parent = v.into();
4056 self
4057 }
4058
4059 /// Sets the value of [page_size][crate::model::ListNetworksRequest::page_size].
4060 ///
4061 /// # Example
4062 /// ```ignore,no_run
4063 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4064 /// let x = ListNetworksRequest::new().set_page_size(42);
4065 /// ```
4066 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4067 self.page_size = v.into();
4068 self
4069 }
4070
4071 /// Sets the value of [page_token][crate::model::ListNetworksRequest::page_token].
4072 ///
4073 /// # Example
4074 /// ```ignore,no_run
4075 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4076 /// let x = ListNetworksRequest::new().set_page_token("example");
4077 /// ```
4078 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4079 self.page_token = v.into();
4080 self
4081 }
4082
4083 /// Sets the value of [filter][crate::model::ListNetworksRequest::filter].
4084 ///
4085 /// # Example
4086 /// ```ignore,no_run
4087 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4088 /// let x = ListNetworksRequest::new().set_filter("example");
4089 /// ```
4090 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4091 self.filter = v.into();
4092 self
4093 }
4094}
4095
4096impl wkt::message::Message for ListNetworksRequest {
4097 fn typename() -> &'static str {
4098 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksRequest"
4099 }
4100}
4101
4102/// Response message containing the list of networks.
4103#[derive(Clone, Default, PartialEq)]
4104#[non_exhaustive]
4105pub struct ListNetworksResponse {
4106 /// The list of networks.
4107 pub networks: std::vec::Vec<crate::model::Network>,
4108
4109 /// A token identifying a page of results from the server.
4110 pub next_page_token: std::string::String,
4111
4112 /// Locations that could not be reached.
4113 pub unreachable: std::vec::Vec<std::string::String>,
4114
4115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4116}
4117
4118impl ListNetworksResponse {
4119 pub fn new() -> Self {
4120 std::default::Default::default()
4121 }
4122
4123 /// Sets the value of [networks][crate::model::ListNetworksResponse::networks].
4124 ///
4125 /// # Example
4126 /// ```ignore,no_run
4127 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4128 /// use google_cloud_baremetalsolution_v2::model::Network;
4129 /// let x = ListNetworksResponse::new()
4130 /// .set_networks([
4131 /// Network::default()/* use setters */,
4132 /// Network::default()/* use (different) setters */,
4133 /// ]);
4134 /// ```
4135 pub fn set_networks<T, V>(mut self, v: T) -> Self
4136 where
4137 T: std::iter::IntoIterator<Item = V>,
4138 V: std::convert::Into<crate::model::Network>,
4139 {
4140 use std::iter::Iterator;
4141 self.networks = v.into_iter().map(|i| i.into()).collect();
4142 self
4143 }
4144
4145 /// Sets the value of [next_page_token][crate::model::ListNetworksResponse::next_page_token].
4146 ///
4147 /// # Example
4148 /// ```ignore,no_run
4149 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4150 /// let x = ListNetworksResponse::new().set_next_page_token("example");
4151 /// ```
4152 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4153 self.next_page_token = v.into();
4154 self
4155 }
4156
4157 /// Sets the value of [unreachable][crate::model::ListNetworksResponse::unreachable].
4158 ///
4159 /// # Example
4160 /// ```ignore,no_run
4161 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4162 /// let x = ListNetworksResponse::new().set_unreachable(["a", "b", "c"]);
4163 /// ```
4164 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4165 where
4166 T: std::iter::IntoIterator<Item = V>,
4167 V: std::convert::Into<std::string::String>,
4168 {
4169 use std::iter::Iterator;
4170 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4171 self
4172 }
4173}
4174
4175impl wkt::message::Message for ListNetworksResponse {
4176 fn typename() -> &'static str {
4177 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksResponse"
4178 }
4179}
4180
4181#[doc(hidden)]
4182impl google_cloud_gax::paginator::internal::PageableResponse for ListNetworksResponse {
4183 type PageItem = crate::model::Network;
4184
4185 fn items(self) -> std::vec::Vec<Self::PageItem> {
4186 self.networks
4187 }
4188
4189 fn next_page_token(&self) -> std::string::String {
4190 use std::clone::Clone;
4191 self.next_page_token.clone()
4192 }
4193}
4194
4195/// Message requesting to updating a network.
4196#[derive(Clone, Default, PartialEq)]
4197#[non_exhaustive]
4198pub struct UpdateNetworkRequest {
4199 /// Required. The network to update.
4200 ///
4201 /// The `name` field is used to identify the instance to update.
4202 /// Format: projects/{project}/locations/{location}/networks/{network}
4203 pub network: std::option::Option<crate::model::Network>,
4204
4205 /// The list of fields to update.
4206 /// The only currently supported fields are:
4207 /// `labels`, `reservations`, `vrf.vlan_attachments`
4208 pub update_mask: std::option::Option<wkt::FieldMask>,
4209
4210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4211}
4212
4213impl UpdateNetworkRequest {
4214 pub fn new() -> Self {
4215 std::default::Default::default()
4216 }
4217
4218 /// Sets the value of [network][crate::model::UpdateNetworkRequest::network].
4219 ///
4220 /// # Example
4221 /// ```ignore,no_run
4222 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4223 /// use google_cloud_baremetalsolution_v2::model::Network;
4224 /// let x = UpdateNetworkRequest::new().set_network(Network::default()/* use setters */);
4225 /// ```
4226 pub fn set_network<T>(mut self, v: T) -> Self
4227 where
4228 T: std::convert::Into<crate::model::Network>,
4229 {
4230 self.network = std::option::Option::Some(v.into());
4231 self
4232 }
4233
4234 /// Sets or clears the value of [network][crate::model::UpdateNetworkRequest::network].
4235 ///
4236 /// # Example
4237 /// ```ignore,no_run
4238 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4239 /// use google_cloud_baremetalsolution_v2::model::Network;
4240 /// let x = UpdateNetworkRequest::new().set_or_clear_network(Some(Network::default()/* use setters */));
4241 /// let x = UpdateNetworkRequest::new().set_or_clear_network(None::<Network>);
4242 /// ```
4243 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4244 where
4245 T: std::convert::Into<crate::model::Network>,
4246 {
4247 self.network = v.map(|x| x.into());
4248 self
4249 }
4250
4251 /// Sets the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4252 ///
4253 /// # Example
4254 /// ```ignore,no_run
4255 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4256 /// use wkt::FieldMask;
4257 /// let x = UpdateNetworkRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4258 /// ```
4259 pub fn set_update_mask<T>(mut self, v: T) -> Self
4260 where
4261 T: std::convert::Into<wkt::FieldMask>,
4262 {
4263 self.update_mask = std::option::Option::Some(v.into());
4264 self
4265 }
4266
4267 /// Sets or clears the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4268 ///
4269 /// # Example
4270 /// ```ignore,no_run
4271 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4272 /// use wkt::FieldMask;
4273 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4274 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4275 /// ```
4276 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4277 where
4278 T: std::convert::Into<wkt::FieldMask>,
4279 {
4280 self.update_mask = v.map(|x| x.into());
4281 self
4282 }
4283}
4284
4285impl wkt::message::Message for UpdateNetworkRequest {
4286 fn typename() -> &'static str {
4287 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNetworkRequest"
4288 }
4289}
4290
4291/// Network with all used IP addresses.
4292#[derive(Clone, Default, PartialEq)]
4293#[non_exhaustive]
4294pub struct NetworkUsage {
4295 /// Network.
4296 pub network: std::option::Option<crate::model::Network>,
4297
4298 /// All used IP addresses in this network.
4299 pub used_ips: std::vec::Vec<std::string::String>,
4300
4301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4302}
4303
4304impl NetworkUsage {
4305 pub fn new() -> Self {
4306 std::default::Default::default()
4307 }
4308
4309 /// Sets the value of [network][crate::model::NetworkUsage::network].
4310 ///
4311 /// # Example
4312 /// ```ignore,no_run
4313 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4314 /// use google_cloud_baremetalsolution_v2::model::Network;
4315 /// let x = NetworkUsage::new().set_network(Network::default()/* use setters */);
4316 /// ```
4317 pub fn set_network<T>(mut self, v: T) -> Self
4318 where
4319 T: std::convert::Into<crate::model::Network>,
4320 {
4321 self.network = std::option::Option::Some(v.into());
4322 self
4323 }
4324
4325 /// Sets or clears the value of [network][crate::model::NetworkUsage::network].
4326 ///
4327 /// # Example
4328 /// ```ignore,no_run
4329 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4330 /// use google_cloud_baremetalsolution_v2::model::Network;
4331 /// let x = NetworkUsage::new().set_or_clear_network(Some(Network::default()/* use setters */));
4332 /// let x = NetworkUsage::new().set_or_clear_network(None::<Network>);
4333 /// ```
4334 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4335 where
4336 T: std::convert::Into<crate::model::Network>,
4337 {
4338 self.network = v.map(|x| x.into());
4339 self
4340 }
4341
4342 /// Sets the value of [used_ips][crate::model::NetworkUsage::used_ips].
4343 ///
4344 /// # Example
4345 /// ```ignore,no_run
4346 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4347 /// let x = NetworkUsage::new().set_used_ips(["a", "b", "c"]);
4348 /// ```
4349 pub fn set_used_ips<T, V>(mut self, v: T) -> Self
4350 where
4351 T: std::iter::IntoIterator<Item = V>,
4352 V: std::convert::Into<std::string::String>,
4353 {
4354 use std::iter::Iterator;
4355 self.used_ips = v.into_iter().map(|i| i.into()).collect();
4356 self
4357 }
4358}
4359
4360impl wkt::message::Message for NetworkUsage {
4361 fn typename() -> &'static str {
4362 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkUsage"
4363 }
4364}
4365
4366/// Request to get networks with IPs.
4367#[derive(Clone, Default, PartialEq)]
4368#[non_exhaustive]
4369pub struct ListNetworkUsageRequest {
4370 /// Required. Parent value (project and location).
4371 pub location: std::string::String,
4372
4373 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4374}
4375
4376impl ListNetworkUsageRequest {
4377 pub fn new() -> Self {
4378 std::default::Default::default()
4379 }
4380
4381 /// Sets the value of [location][crate::model::ListNetworkUsageRequest::location].
4382 ///
4383 /// # Example
4384 /// ```ignore,no_run
4385 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageRequest;
4386 /// let x = ListNetworkUsageRequest::new().set_location("example");
4387 /// ```
4388 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4389 self.location = v.into();
4390 self
4391 }
4392}
4393
4394impl wkt::message::Message for ListNetworkUsageRequest {
4395 fn typename() -> &'static str {
4396 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageRequest"
4397 }
4398}
4399
4400/// Response with Networks with IPs
4401#[derive(Clone, Default, PartialEq)]
4402#[non_exhaustive]
4403pub struct ListNetworkUsageResponse {
4404 /// Networks with IPs.
4405 pub networks: std::vec::Vec<crate::model::NetworkUsage>,
4406
4407 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4408}
4409
4410impl ListNetworkUsageResponse {
4411 pub fn new() -> Self {
4412 std::default::Default::default()
4413 }
4414
4415 /// Sets the value of [networks][crate::model::ListNetworkUsageResponse::networks].
4416 ///
4417 /// # Example
4418 /// ```ignore,no_run
4419 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageResponse;
4420 /// use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4421 /// let x = ListNetworkUsageResponse::new()
4422 /// .set_networks([
4423 /// NetworkUsage::default()/* use setters */,
4424 /// NetworkUsage::default()/* use (different) setters */,
4425 /// ]);
4426 /// ```
4427 pub fn set_networks<T, V>(mut self, v: T) -> Self
4428 where
4429 T: std::iter::IntoIterator<Item = V>,
4430 V: std::convert::Into<crate::model::NetworkUsage>,
4431 {
4432 use std::iter::Iterator;
4433 self.networks = v.into_iter().map(|i| i.into()).collect();
4434 self
4435 }
4436}
4437
4438impl wkt::message::Message for ListNetworkUsageResponse {
4439 fn typename() -> &'static str {
4440 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageResponse"
4441 }
4442}
4443
4444/// Mount point for a network.
4445#[derive(Clone, Default, PartialEq)]
4446#[non_exhaustive]
4447pub struct NetworkMountPoint {
4448 /// Instance to attach network to.
4449 pub instance: std::string::String,
4450
4451 /// Logical interface to detach from.
4452 pub logical_interface: std::string::String,
4453
4454 /// Network should be a default gateway.
4455 pub default_gateway: bool,
4456
4457 /// Ip address of the server.
4458 pub ip_address: std::string::String,
4459
4460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4461}
4462
4463impl NetworkMountPoint {
4464 pub fn new() -> Self {
4465 std::default::Default::default()
4466 }
4467
4468 /// Sets the value of [instance][crate::model::NetworkMountPoint::instance].
4469 ///
4470 /// # Example
4471 /// ```ignore,no_run
4472 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4473 /// let x = NetworkMountPoint::new().set_instance("example");
4474 /// ```
4475 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4476 self.instance = v.into();
4477 self
4478 }
4479
4480 /// Sets the value of [logical_interface][crate::model::NetworkMountPoint::logical_interface].
4481 ///
4482 /// # Example
4483 /// ```ignore,no_run
4484 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4485 /// let x = NetworkMountPoint::new().set_logical_interface("example");
4486 /// ```
4487 pub fn set_logical_interface<T: std::convert::Into<std::string::String>>(
4488 mut self,
4489 v: T,
4490 ) -> Self {
4491 self.logical_interface = v.into();
4492 self
4493 }
4494
4495 /// Sets the value of [default_gateway][crate::model::NetworkMountPoint::default_gateway].
4496 ///
4497 /// # Example
4498 /// ```ignore,no_run
4499 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4500 /// let x = NetworkMountPoint::new().set_default_gateway(true);
4501 /// ```
4502 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4503 self.default_gateway = v.into();
4504 self
4505 }
4506
4507 /// Sets the value of [ip_address][crate::model::NetworkMountPoint::ip_address].
4508 ///
4509 /// # Example
4510 /// ```ignore,no_run
4511 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4512 /// let x = NetworkMountPoint::new().set_ip_address("example");
4513 /// ```
4514 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4515 self.ip_address = v.into();
4516 self
4517 }
4518}
4519
4520impl wkt::message::Message for NetworkMountPoint {
4521 fn typename() -> &'static str {
4522 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkMountPoint"
4523 }
4524}
4525
4526/// Message requesting rename of a server.
4527#[derive(Clone, Default, PartialEq)]
4528#[non_exhaustive]
4529pub struct RenameNetworkRequest {
4530 /// Required. The `name` field is used to identify the network.
4531 /// Format: projects/{project}/locations/{location}/networks/{network}
4532 pub name: std::string::String,
4533
4534 /// Required. The new `id` of the network.
4535 pub new_network_id: std::string::String,
4536
4537 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4538}
4539
4540impl RenameNetworkRequest {
4541 pub fn new() -> Self {
4542 std::default::Default::default()
4543 }
4544
4545 /// Sets the value of [name][crate::model::RenameNetworkRequest::name].
4546 ///
4547 /// # Example
4548 /// ```ignore,no_run
4549 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4550 /// let x = RenameNetworkRequest::new().set_name("example");
4551 /// ```
4552 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4553 self.name = v.into();
4554 self
4555 }
4556
4557 /// Sets the value of [new_network_id][crate::model::RenameNetworkRequest::new_network_id].
4558 ///
4559 /// # Example
4560 /// ```ignore,no_run
4561 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4562 /// let x = RenameNetworkRequest::new().set_new_network_id("example");
4563 /// ```
4564 pub fn set_new_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4565 self.new_network_id = v.into();
4566 self
4567 }
4568}
4569
4570impl wkt::message::Message for RenameNetworkRequest {
4571 fn typename() -> &'static str {
4572 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNetworkRequest"
4573 }
4574}
4575
4576/// An NFS share.
4577#[derive(Clone, Default, PartialEq)]
4578#[non_exhaustive]
4579pub struct NfsShare {
4580 /// Immutable. The name of the NFS share.
4581 pub name: std::string::String,
4582
4583 /// Output only. An identifier for the NFS share, generated by the backend.
4584 /// This field will be deprecated in the future, use `id` instead.
4585 pub nfs_share_id: std::string::String,
4586
4587 /// Output only. An identifier for the NFS share, generated by the backend.
4588 /// This is the same value as nfs_share_id and will replace it in the future.
4589 pub id: std::string::String,
4590
4591 /// Output only. The state of the NFS share.
4592 pub state: crate::model::nfs_share::State,
4593
4594 /// Output only. The underlying volume of the share. Created automatically
4595 /// during provisioning.
4596 pub volume: std::string::String,
4597
4598 /// List of allowed access points.
4599 pub allowed_clients: std::vec::Vec<crate::model::nfs_share::AllowedClient>,
4600
4601 /// Labels as key value pairs.
4602 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4603
4604 /// The requested size, in GiB.
4605 pub requested_size_gib: i64,
4606
4607 /// Immutable. The storage type of the underlying volume.
4608 pub storage_type: crate::model::nfs_share::StorageType,
4609
4610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4611}
4612
4613impl NfsShare {
4614 pub fn new() -> Self {
4615 std::default::Default::default()
4616 }
4617
4618 /// Sets the value of [name][crate::model::NfsShare::name].
4619 ///
4620 /// # Example
4621 /// ```ignore,no_run
4622 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4623 /// let x = NfsShare::new().set_name("example");
4624 /// ```
4625 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4626 self.name = v.into();
4627 self
4628 }
4629
4630 /// Sets the value of [nfs_share_id][crate::model::NfsShare::nfs_share_id].
4631 ///
4632 /// # Example
4633 /// ```ignore,no_run
4634 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4635 /// let x = NfsShare::new().set_nfs_share_id("example");
4636 /// ```
4637 pub fn set_nfs_share_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4638 self.nfs_share_id = v.into();
4639 self
4640 }
4641
4642 /// Sets the value of [id][crate::model::NfsShare::id].
4643 ///
4644 /// # Example
4645 /// ```ignore,no_run
4646 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4647 /// let x = NfsShare::new().set_id("example");
4648 /// ```
4649 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4650 self.id = v.into();
4651 self
4652 }
4653
4654 /// Sets the value of [state][crate::model::NfsShare::state].
4655 ///
4656 /// # Example
4657 /// ```ignore,no_run
4658 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4659 /// use google_cloud_baremetalsolution_v2::model::nfs_share::State;
4660 /// let x0 = NfsShare::new().set_state(State::Provisioned);
4661 /// let x1 = NfsShare::new().set_state(State::Creating);
4662 /// let x2 = NfsShare::new().set_state(State::Updating);
4663 /// ```
4664 pub fn set_state<T: std::convert::Into<crate::model::nfs_share::State>>(
4665 mut self,
4666 v: T,
4667 ) -> Self {
4668 self.state = v.into();
4669 self
4670 }
4671
4672 /// Sets the value of [volume][crate::model::NfsShare::volume].
4673 ///
4674 /// # Example
4675 /// ```ignore,no_run
4676 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4677 /// let x = NfsShare::new().set_volume("example");
4678 /// ```
4679 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4680 self.volume = v.into();
4681 self
4682 }
4683
4684 /// Sets the value of [allowed_clients][crate::model::NfsShare::allowed_clients].
4685 ///
4686 /// # Example
4687 /// ```ignore,no_run
4688 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4689 /// use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4690 /// let x = NfsShare::new()
4691 /// .set_allowed_clients([
4692 /// AllowedClient::default()/* use setters */,
4693 /// AllowedClient::default()/* use (different) setters */,
4694 /// ]);
4695 /// ```
4696 pub fn set_allowed_clients<T, V>(mut self, v: T) -> Self
4697 where
4698 T: std::iter::IntoIterator<Item = V>,
4699 V: std::convert::Into<crate::model::nfs_share::AllowedClient>,
4700 {
4701 use std::iter::Iterator;
4702 self.allowed_clients = v.into_iter().map(|i| i.into()).collect();
4703 self
4704 }
4705
4706 /// Sets the value of [labels][crate::model::NfsShare::labels].
4707 ///
4708 /// # Example
4709 /// ```ignore,no_run
4710 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4711 /// let x = NfsShare::new().set_labels([
4712 /// ("key0", "abc"),
4713 /// ("key1", "xyz"),
4714 /// ]);
4715 /// ```
4716 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4717 where
4718 T: std::iter::IntoIterator<Item = (K, V)>,
4719 K: std::convert::Into<std::string::String>,
4720 V: std::convert::Into<std::string::String>,
4721 {
4722 use std::iter::Iterator;
4723 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4724 self
4725 }
4726
4727 /// Sets the value of [requested_size_gib][crate::model::NfsShare::requested_size_gib].
4728 ///
4729 /// # Example
4730 /// ```ignore,no_run
4731 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4732 /// let x = NfsShare::new().set_requested_size_gib(42);
4733 /// ```
4734 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4735 self.requested_size_gib = v.into();
4736 self
4737 }
4738
4739 /// Sets the value of [storage_type][crate::model::NfsShare::storage_type].
4740 ///
4741 /// # Example
4742 /// ```ignore,no_run
4743 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4744 /// use google_cloud_baremetalsolution_v2::model::nfs_share::StorageType;
4745 /// let x0 = NfsShare::new().set_storage_type(StorageType::Ssd);
4746 /// let x1 = NfsShare::new().set_storage_type(StorageType::Hdd);
4747 /// ```
4748 pub fn set_storage_type<T: std::convert::Into<crate::model::nfs_share::StorageType>>(
4749 mut self,
4750 v: T,
4751 ) -> Self {
4752 self.storage_type = v.into();
4753 self
4754 }
4755}
4756
4757impl wkt::message::Message for NfsShare {
4758 fn typename() -> &'static str {
4759 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare"
4760 }
4761}
4762
4763/// Defines additional types related to [NfsShare].
4764pub mod nfs_share {
4765 #[allow(unused_imports)]
4766 use super::*;
4767
4768 /// Represents an 'access point' for the share.
4769 #[derive(Clone, Default, PartialEq)]
4770 #[non_exhaustive]
4771 pub struct AllowedClient {
4772 /// The network the access point sits on.
4773 pub network: std::string::String,
4774
4775 /// Output only. The IP address of the share on this network. Assigned
4776 /// automatically during provisioning based on the network's services_cidr.
4777 pub share_ip: std::string::String,
4778
4779 /// The subnet of IP addresses permitted to access the share.
4780 pub allowed_clients_cidr: std::string::String,
4781
4782 /// Mount permissions.
4783 pub mount_permissions: crate::model::nfs_share::MountPermissions,
4784
4785 /// Allow dev flag. Which controls whether to allow creation of devices.
4786 pub allow_dev: bool,
4787
4788 /// Allow the setuid flag.
4789 pub allow_suid: bool,
4790
4791 /// Disable root squashing, which is a feature of NFS.
4792 /// Root squash is a special mapping of the remote superuser (root) identity
4793 /// when using identity authentication.
4794 pub no_root_squash: bool,
4795
4796 /// Output only. The path to access NFS, in format shareIP:/InstanceID
4797 /// InstanceID is the generated ID instead of customer provided name.
4798 /// example like "10.0.0.0:/g123456789-nfs001"
4799 pub nfs_path: std::string::String,
4800
4801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4802 }
4803
4804 impl AllowedClient {
4805 pub fn new() -> Self {
4806 std::default::Default::default()
4807 }
4808
4809 /// Sets the value of [network][crate::model::nfs_share::AllowedClient::network].
4810 ///
4811 /// # Example
4812 /// ```ignore,no_run
4813 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4814 /// let x = AllowedClient::new().set_network("example");
4815 /// ```
4816 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4817 self.network = v.into();
4818 self
4819 }
4820
4821 /// Sets the value of [share_ip][crate::model::nfs_share::AllowedClient::share_ip].
4822 ///
4823 /// # Example
4824 /// ```ignore,no_run
4825 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4826 /// let x = AllowedClient::new().set_share_ip("example");
4827 /// ```
4828 pub fn set_share_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4829 self.share_ip = v.into();
4830 self
4831 }
4832
4833 /// Sets the value of [allowed_clients_cidr][crate::model::nfs_share::AllowedClient::allowed_clients_cidr].
4834 ///
4835 /// # Example
4836 /// ```ignore,no_run
4837 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4838 /// let x = AllowedClient::new().set_allowed_clients_cidr("example");
4839 /// ```
4840 pub fn set_allowed_clients_cidr<T: std::convert::Into<std::string::String>>(
4841 mut self,
4842 v: T,
4843 ) -> Self {
4844 self.allowed_clients_cidr = v.into();
4845 self
4846 }
4847
4848 /// Sets the value of [mount_permissions][crate::model::nfs_share::AllowedClient::mount_permissions].
4849 ///
4850 /// # Example
4851 /// ```ignore,no_run
4852 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4853 /// use google_cloud_baremetalsolution_v2::model::nfs_share::MountPermissions;
4854 /// let x0 = AllowedClient::new().set_mount_permissions(MountPermissions::Read);
4855 /// let x1 = AllowedClient::new().set_mount_permissions(MountPermissions::ReadWrite);
4856 /// ```
4857 pub fn set_mount_permissions<
4858 T: std::convert::Into<crate::model::nfs_share::MountPermissions>,
4859 >(
4860 mut self,
4861 v: T,
4862 ) -> Self {
4863 self.mount_permissions = v.into();
4864 self
4865 }
4866
4867 /// Sets the value of [allow_dev][crate::model::nfs_share::AllowedClient::allow_dev].
4868 ///
4869 /// # Example
4870 /// ```ignore,no_run
4871 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4872 /// let x = AllowedClient::new().set_allow_dev(true);
4873 /// ```
4874 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4875 self.allow_dev = v.into();
4876 self
4877 }
4878
4879 /// Sets the value of [allow_suid][crate::model::nfs_share::AllowedClient::allow_suid].
4880 ///
4881 /// # Example
4882 /// ```ignore,no_run
4883 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4884 /// let x = AllowedClient::new().set_allow_suid(true);
4885 /// ```
4886 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4887 self.allow_suid = v.into();
4888 self
4889 }
4890
4891 /// Sets the value of [no_root_squash][crate::model::nfs_share::AllowedClient::no_root_squash].
4892 ///
4893 /// # Example
4894 /// ```ignore,no_run
4895 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4896 /// let x = AllowedClient::new().set_no_root_squash(true);
4897 /// ```
4898 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4899 self.no_root_squash = v.into();
4900 self
4901 }
4902
4903 /// Sets the value of [nfs_path][crate::model::nfs_share::AllowedClient::nfs_path].
4904 ///
4905 /// # Example
4906 /// ```ignore,no_run
4907 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4908 /// let x = AllowedClient::new().set_nfs_path("example");
4909 /// ```
4910 pub fn set_nfs_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4911 self.nfs_path = v.into();
4912 self
4913 }
4914 }
4915
4916 impl wkt::message::Message for AllowedClient {
4917 fn typename() -> &'static str {
4918 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare.AllowedClient"
4919 }
4920 }
4921
4922 /// The possible states for this NFS share.
4923 ///
4924 /// # Working with unknown values
4925 ///
4926 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4927 /// additional enum variants at any time. Adding new variants is not considered
4928 /// a breaking change. Applications should write their code in anticipation of:
4929 ///
4930 /// - New values appearing in future releases of the client library, **and**
4931 /// - New values received dynamically, without application changes.
4932 ///
4933 /// Please consult the [Working with enums] section in the user guide for some
4934 /// guidelines.
4935 ///
4936 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4937 #[derive(Clone, Debug, PartialEq)]
4938 #[non_exhaustive]
4939 pub enum State {
4940 /// The share is in an unknown state.
4941 Unspecified,
4942 /// The share has been provisioned.
4943 Provisioned,
4944 /// The NFS Share is being created.
4945 Creating,
4946 /// The NFS Share is being updated.
4947 Updating,
4948 /// The NFS Share has been requested to be deleted.
4949 Deleting,
4950 /// If set, the enum was initialized with an unknown value.
4951 ///
4952 /// Applications can examine the value using [State::value] or
4953 /// [State::name].
4954 UnknownValue(state::UnknownValue),
4955 }
4956
4957 #[doc(hidden)]
4958 pub mod state {
4959 #[allow(unused_imports)]
4960 use super::*;
4961 #[derive(Clone, Debug, PartialEq)]
4962 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4963 }
4964
4965 impl State {
4966 /// Gets the enum value.
4967 ///
4968 /// Returns `None` if the enum contains an unknown value deserialized from
4969 /// the string representation of enums.
4970 pub fn value(&self) -> std::option::Option<i32> {
4971 match self {
4972 Self::Unspecified => std::option::Option::Some(0),
4973 Self::Provisioned => std::option::Option::Some(1),
4974 Self::Creating => std::option::Option::Some(2),
4975 Self::Updating => std::option::Option::Some(3),
4976 Self::Deleting => std::option::Option::Some(4),
4977 Self::UnknownValue(u) => u.0.value(),
4978 }
4979 }
4980
4981 /// Gets the enum value as a string.
4982 ///
4983 /// Returns `None` if the enum contains an unknown value deserialized from
4984 /// the integer representation of enums.
4985 pub fn name(&self) -> std::option::Option<&str> {
4986 match self {
4987 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4988 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
4989 Self::Creating => std::option::Option::Some("CREATING"),
4990 Self::Updating => std::option::Option::Some("UPDATING"),
4991 Self::Deleting => std::option::Option::Some("DELETING"),
4992 Self::UnknownValue(u) => u.0.name(),
4993 }
4994 }
4995 }
4996
4997 impl std::default::Default for State {
4998 fn default() -> Self {
4999 use std::convert::From;
5000 Self::from(0)
5001 }
5002 }
5003
5004 impl std::fmt::Display for State {
5005 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5006 wkt::internal::display_enum(f, self.name(), self.value())
5007 }
5008 }
5009
5010 impl std::convert::From<i32> for State {
5011 fn from(value: i32) -> Self {
5012 match value {
5013 0 => Self::Unspecified,
5014 1 => Self::Provisioned,
5015 2 => Self::Creating,
5016 3 => Self::Updating,
5017 4 => Self::Deleting,
5018 _ => Self::UnknownValue(state::UnknownValue(
5019 wkt::internal::UnknownEnumValue::Integer(value),
5020 )),
5021 }
5022 }
5023 }
5024
5025 impl std::convert::From<&str> for State {
5026 fn from(value: &str) -> Self {
5027 use std::string::ToString;
5028 match value {
5029 "STATE_UNSPECIFIED" => Self::Unspecified,
5030 "PROVISIONED" => Self::Provisioned,
5031 "CREATING" => Self::Creating,
5032 "UPDATING" => Self::Updating,
5033 "DELETING" => Self::Deleting,
5034 _ => Self::UnknownValue(state::UnknownValue(
5035 wkt::internal::UnknownEnumValue::String(value.to_string()),
5036 )),
5037 }
5038 }
5039 }
5040
5041 impl serde::ser::Serialize for State {
5042 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5043 where
5044 S: serde::Serializer,
5045 {
5046 match self {
5047 Self::Unspecified => serializer.serialize_i32(0),
5048 Self::Provisioned => serializer.serialize_i32(1),
5049 Self::Creating => serializer.serialize_i32(2),
5050 Self::Updating => serializer.serialize_i32(3),
5051 Self::Deleting => serializer.serialize_i32(4),
5052 Self::UnknownValue(u) => u.0.serialize(serializer),
5053 }
5054 }
5055 }
5056
5057 impl<'de> serde::de::Deserialize<'de> for State {
5058 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5059 where
5060 D: serde::Deserializer<'de>,
5061 {
5062 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5063 ".google.cloud.baremetalsolution.v2.NfsShare.State",
5064 ))
5065 }
5066 }
5067
5068 /// The possible mount permissions.
5069 ///
5070 /// # Working with unknown values
5071 ///
5072 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5073 /// additional enum variants at any time. Adding new variants is not considered
5074 /// a breaking change. Applications should write their code in anticipation of:
5075 ///
5076 /// - New values appearing in future releases of the client library, **and**
5077 /// - New values received dynamically, without application changes.
5078 ///
5079 /// Please consult the [Working with enums] section in the user guide for some
5080 /// guidelines.
5081 ///
5082 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5083 #[derive(Clone, Debug, PartialEq)]
5084 #[non_exhaustive]
5085 pub enum MountPermissions {
5086 /// Permissions were not specified.
5087 Unspecified,
5088 /// NFS share can be mount with read-only permissions.
5089 Read,
5090 /// NFS share can be mount with read-write permissions.
5091 ReadWrite,
5092 /// If set, the enum was initialized with an unknown value.
5093 ///
5094 /// Applications can examine the value using [MountPermissions::value] or
5095 /// [MountPermissions::name].
5096 UnknownValue(mount_permissions::UnknownValue),
5097 }
5098
5099 #[doc(hidden)]
5100 pub mod mount_permissions {
5101 #[allow(unused_imports)]
5102 use super::*;
5103 #[derive(Clone, Debug, PartialEq)]
5104 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5105 }
5106
5107 impl MountPermissions {
5108 /// Gets the enum value.
5109 ///
5110 /// Returns `None` if the enum contains an unknown value deserialized from
5111 /// the string representation of enums.
5112 pub fn value(&self) -> std::option::Option<i32> {
5113 match self {
5114 Self::Unspecified => std::option::Option::Some(0),
5115 Self::Read => std::option::Option::Some(1),
5116 Self::ReadWrite => std::option::Option::Some(2),
5117 Self::UnknownValue(u) => u.0.value(),
5118 }
5119 }
5120
5121 /// Gets the enum value as a string.
5122 ///
5123 /// Returns `None` if the enum contains an unknown value deserialized from
5124 /// the integer representation of enums.
5125 pub fn name(&self) -> std::option::Option<&str> {
5126 match self {
5127 Self::Unspecified => std::option::Option::Some("MOUNT_PERMISSIONS_UNSPECIFIED"),
5128 Self::Read => std::option::Option::Some("READ"),
5129 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
5130 Self::UnknownValue(u) => u.0.name(),
5131 }
5132 }
5133 }
5134
5135 impl std::default::Default for MountPermissions {
5136 fn default() -> Self {
5137 use std::convert::From;
5138 Self::from(0)
5139 }
5140 }
5141
5142 impl std::fmt::Display for MountPermissions {
5143 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5144 wkt::internal::display_enum(f, self.name(), self.value())
5145 }
5146 }
5147
5148 impl std::convert::From<i32> for MountPermissions {
5149 fn from(value: i32) -> Self {
5150 match value {
5151 0 => Self::Unspecified,
5152 1 => Self::Read,
5153 2 => Self::ReadWrite,
5154 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5155 wkt::internal::UnknownEnumValue::Integer(value),
5156 )),
5157 }
5158 }
5159 }
5160
5161 impl std::convert::From<&str> for MountPermissions {
5162 fn from(value: &str) -> Self {
5163 use std::string::ToString;
5164 match value {
5165 "MOUNT_PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
5166 "READ" => Self::Read,
5167 "READ_WRITE" => Self::ReadWrite,
5168 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5169 wkt::internal::UnknownEnumValue::String(value.to_string()),
5170 )),
5171 }
5172 }
5173 }
5174
5175 impl serde::ser::Serialize for MountPermissions {
5176 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5177 where
5178 S: serde::Serializer,
5179 {
5180 match self {
5181 Self::Unspecified => serializer.serialize_i32(0),
5182 Self::Read => serializer.serialize_i32(1),
5183 Self::ReadWrite => serializer.serialize_i32(2),
5184 Self::UnknownValue(u) => u.0.serialize(serializer),
5185 }
5186 }
5187 }
5188
5189 impl<'de> serde::de::Deserialize<'de> for MountPermissions {
5190 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5191 where
5192 D: serde::Deserializer<'de>,
5193 {
5194 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MountPermissions>::new(
5195 ".google.cloud.baremetalsolution.v2.NfsShare.MountPermissions",
5196 ))
5197 }
5198 }
5199
5200 /// The storage type for a volume.
5201 ///
5202 /// # Working with unknown values
5203 ///
5204 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5205 /// additional enum variants at any time. Adding new variants is not considered
5206 /// a breaking change. Applications should write their code in anticipation of:
5207 ///
5208 /// - New values appearing in future releases of the client library, **and**
5209 /// - New values received dynamically, without application changes.
5210 ///
5211 /// Please consult the [Working with enums] section in the user guide for some
5212 /// guidelines.
5213 ///
5214 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5215 #[derive(Clone, Debug, PartialEq)]
5216 #[non_exhaustive]
5217 pub enum StorageType {
5218 /// The storage type for this volume is unknown.
5219 Unspecified,
5220 /// The storage type for this volume is SSD.
5221 Ssd,
5222 /// This storage type for this volume is HDD.
5223 Hdd,
5224 /// If set, the enum was initialized with an unknown value.
5225 ///
5226 /// Applications can examine the value using [StorageType::value] or
5227 /// [StorageType::name].
5228 UnknownValue(storage_type::UnknownValue),
5229 }
5230
5231 #[doc(hidden)]
5232 pub mod storage_type {
5233 #[allow(unused_imports)]
5234 use super::*;
5235 #[derive(Clone, Debug, PartialEq)]
5236 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5237 }
5238
5239 impl StorageType {
5240 /// Gets the enum value.
5241 ///
5242 /// Returns `None` if the enum contains an unknown value deserialized from
5243 /// the string representation of enums.
5244 pub fn value(&self) -> std::option::Option<i32> {
5245 match self {
5246 Self::Unspecified => std::option::Option::Some(0),
5247 Self::Ssd => std::option::Option::Some(1),
5248 Self::Hdd => std::option::Option::Some(2),
5249 Self::UnknownValue(u) => u.0.value(),
5250 }
5251 }
5252
5253 /// Gets the enum value as a string.
5254 ///
5255 /// Returns `None` if the enum contains an unknown value deserialized from
5256 /// the integer representation of enums.
5257 pub fn name(&self) -> std::option::Option<&str> {
5258 match self {
5259 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
5260 Self::Ssd => std::option::Option::Some("SSD"),
5261 Self::Hdd => std::option::Option::Some("HDD"),
5262 Self::UnknownValue(u) => u.0.name(),
5263 }
5264 }
5265 }
5266
5267 impl std::default::Default for StorageType {
5268 fn default() -> Self {
5269 use std::convert::From;
5270 Self::from(0)
5271 }
5272 }
5273
5274 impl std::fmt::Display for StorageType {
5275 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5276 wkt::internal::display_enum(f, self.name(), self.value())
5277 }
5278 }
5279
5280 impl std::convert::From<i32> for StorageType {
5281 fn from(value: i32) -> Self {
5282 match value {
5283 0 => Self::Unspecified,
5284 1 => Self::Ssd,
5285 2 => Self::Hdd,
5286 _ => Self::UnknownValue(storage_type::UnknownValue(
5287 wkt::internal::UnknownEnumValue::Integer(value),
5288 )),
5289 }
5290 }
5291 }
5292
5293 impl std::convert::From<&str> for StorageType {
5294 fn from(value: &str) -> Self {
5295 use std::string::ToString;
5296 match value {
5297 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
5298 "SSD" => Self::Ssd,
5299 "HDD" => Self::Hdd,
5300 _ => Self::UnknownValue(storage_type::UnknownValue(
5301 wkt::internal::UnknownEnumValue::String(value.to_string()),
5302 )),
5303 }
5304 }
5305 }
5306
5307 impl serde::ser::Serialize for StorageType {
5308 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5309 where
5310 S: serde::Serializer,
5311 {
5312 match self {
5313 Self::Unspecified => serializer.serialize_i32(0),
5314 Self::Ssd => serializer.serialize_i32(1),
5315 Self::Hdd => serializer.serialize_i32(2),
5316 Self::UnknownValue(u) => u.0.serialize(serializer),
5317 }
5318 }
5319 }
5320
5321 impl<'de> serde::de::Deserialize<'de> for StorageType {
5322 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5323 where
5324 D: serde::Deserializer<'de>,
5325 {
5326 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
5327 ".google.cloud.baremetalsolution.v2.NfsShare.StorageType",
5328 ))
5329 }
5330 }
5331}
5332
5333/// Message for requesting NFS share information.
5334#[derive(Clone, Default, PartialEq)]
5335#[non_exhaustive]
5336pub struct GetNfsShareRequest {
5337 /// Required. Name of the resource.
5338 pub name: std::string::String,
5339
5340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5341}
5342
5343impl GetNfsShareRequest {
5344 pub fn new() -> Self {
5345 std::default::Default::default()
5346 }
5347
5348 /// Sets the value of [name][crate::model::GetNfsShareRequest::name].
5349 ///
5350 /// # Example
5351 /// ```ignore,no_run
5352 /// # use google_cloud_baremetalsolution_v2::model::GetNfsShareRequest;
5353 /// let x = GetNfsShareRequest::new().set_name("example");
5354 /// ```
5355 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5356 self.name = v.into();
5357 self
5358 }
5359}
5360
5361impl wkt::message::Message for GetNfsShareRequest {
5362 fn typename() -> &'static str {
5363 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNfsShareRequest"
5364 }
5365}
5366
5367/// Message for requesting a list of NFS shares.
5368#[derive(Clone, Default, PartialEq)]
5369#[non_exhaustive]
5370pub struct ListNfsSharesRequest {
5371 /// Required. Parent value for ListNfsSharesRequest.
5372 pub parent: std::string::String,
5373
5374 /// Requested page size. The server might return fewer items than requested.
5375 /// If unspecified, server will pick an appropriate default.
5376 pub page_size: i32,
5377
5378 /// A token identifying a page of results from the server.
5379 pub page_token: std::string::String,
5380
5381 /// List filter.
5382 pub filter: std::string::String,
5383
5384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5385}
5386
5387impl ListNfsSharesRequest {
5388 pub fn new() -> Self {
5389 std::default::Default::default()
5390 }
5391
5392 /// Sets the value of [parent][crate::model::ListNfsSharesRequest::parent].
5393 ///
5394 /// # Example
5395 /// ```ignore,no_run
5396 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5397 /// let x = ListNfsSharesRequest::new().set_parent("example");
5398 /// ```
5399 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5400 self.parent = v.into();
5401 self
5402 }
5403
5404 /// Sets the value of [page_size][crate::model::ListNfsSharesRequest::page_size].
5405 ///
5406 /// # Example
5407 /// ```ignore,no_run
5408 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5409 /// let x = ListNfsSharesRequest::new().set_page_size(42);
5410 /// ```
5411 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5412 self.page_size = v.into();
5413 self
5414 }
5415
5416 /// Sets the value of [page_token][crate::model::ListNfsSharesRequest::page_token].
5417 ///
5418 /// # Example
5419 /// ```ignore,no_run
5420 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5421 /// let x = ListNfsSharesRequest::new().set_page_token("example");
5422 /// ```
5423 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5424 self.page_token = v.into();
5425 self
5426 }
5427
5428 /// Sets the value of [filter][crate::model::ListNfsSharesRequest::filter].
5429 ///
5430 /// # Example
5431 /// ```ignore,no_run
5432 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5433 /// let x = ListNfsSharesRequest::new().set_filter("example");
5434 /// ```
5435 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5436 self.filter = v.into();
5437 self
5438 }
5439}
5440
5441impl wkt::message::Message for ListNfsSharesRequest {
5442 fn typename() -> &'static str {
5443 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesRequest"
5444 }
5445}
5446
5447/// Response message containing the list of NFS shares.
5448#[derive(Clone, Default, PartialEq)]
5449#[non_exhaustive]
5450pub struct ListNfsSharesResponse {
5451 /// The list of NFS shares.
5452 pub nfs_shares: std::vec::Vec<crate::model::NfsShare>,
5453
5454 /// A token identifying a page of results from the server.
5455 pub next_page_token: std::string::String,
5456
5457 /// Locations that could not be reached.
5458 pub unreachable: std::vec::Vec<std::string::String>,
5459
5460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5461}
5462
5463impl ListNfsSharesResponse {
5464 pub fn new() -> Self {
5465 std::default::Default::default()
5466 }
5467
5468 /// Sets the value of [nfs_shares][crate::model::ListNfsSharesResponse::nfs_shares].
5469 ///
5470 /// # Example
5471 /// ```ignore,no_run
5472 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5473 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5474 /// let x = ListNfsSharesResponse::new()
5475 /// .set_nfs_shares([
5476 /// NfsShare::default()/* use setters */,
5477 /// NfsShare::default()/* use (different) setters */,
5478 /// ]);
5479 /// ```
5480 pub fn set_nfs_shares<T, V>(mut self, v: T) -> Self
5481 where
5482 T: std::iter::IntoIterator<Item = V>,
5483 V: std::convert::Into<crate::model::NfsShare>,
5484 {
5485 use std::iter::Iterator;
5486 self.nfs_shares = v.into_iter().map(|i| i.into()).collect();
5487 self
5488 }
5489
5490 /// Sets the value of [next_page_token][crate::model::ListNfsSharesResponse::next_page_token].
5491 ///
5492 /// # Example
5493 /// ```ignore,no_run
5494 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5495 /// let x = ListNfsSharesResponse::new().set_next_page_token("example");
5496 /// ```
5497 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5498 self.next_page_token = v.into();
5499 self
5500 }
5501
5502 /// Sets the value of [unreachable][crate::model::ListNfsSharesResponse::unreachable].
5503 ///
5504 /// # Example
5505 /// ```ignore,no_run
5506 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5507 /// let x = ListNfsSharesResponse::new().set_unreachable(["a", "b", "c"]);
5508 /// ```
5509 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5510 where
5511 T: std::iter::IntoIterator<Item = V>,
5512 V: std::convert::Into<std::string::String>,
5513 {
5514 use std::iter::Iterator;
5515 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5516 self
5517 }
5518}
5519
5520impl wkt::message::Message for ListNfsSharesResponse {
5521 fn typename() -> &'static str {
5522 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesResponse"
5523 }
5524}
5525
5526#[doc(hidden)]
5527impl google_cloud_gax::paginator::internal::PageableResponse for ListNfsSharesResponse {
5528 type PageItem = crate::model::NfsShare;
5529
5530 fn items(self) -> std::vec::Vec<Self::PageItem> {
5531 self.nfs_shares
5532 }
5533
5534 fn next_page_token(&self) -> std::string::String {
5535 use std::clone::Clone;
5536 self.next_page_token.clone()
5537 }
5538}
5539
5540/// Message requesting to updating an NFS share.
5541#[derive(Clone, Default, PartialEq)]
5542#[non_exhaustive]
5543pub struct UpdateNfsShareRequest {
5544 /// Required. The NFS share to update.
5545 ///
5546 /// The `name` field is used to identify the NFS share to update.
5547 /// Format: projects/{project}/locations/{location}/nfsShares/{nfs_share}
5548 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5549
5550 /// The list of fields to update.
5551 /// The only currently supported fields are:
5552 /// `labels`
5553 /// `allowed_clients`
5554 pub update_mask: std::option::Option<wkt::FieldMask>,
5555
5556 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5557}
5558
5559impl UpdateNfsShareRequest {
5560 pub fn new() -> Self {
5561 std::default::Default::default()
5562 }
5563
5564 /// Sets the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5565 ///
5566 /// # Example
5567 /// ```ignore,no_run
5568 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5569 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5570 /// let x = UpdateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5571 /// ```
5572 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5573 where
5574 T: std::convert::Into<crate::model::NfsShare>,
5575 {
5576 self.nfs_share = std::option::Option::Some(v.into());
5577 self
5578 }
5579
5580 /// Sets or clears the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5581 ///
5582 /// # Example
5583 /// ```ignore,no_run
5584 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5585 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5586 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5587 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5588 /// ```
5589 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5590 where
5591 T: std::convert::Into<crate::model::NfsShare>,
5592 {
5593 self.nfs_share = v.map(|x| x.into());
5594 self
5595 }
5596
5597 /// Sets the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5598 ///
5599 /// # Example
5600 /// ```ignore,no_run
5601 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5602 /// use wkt::FieldMask;
5603 /// let x = UpdateNfsShareRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5604 /// ```
5605 pub fn set_update_mask<T>(mut self, v: T) -> Self
5606 where
5607 T: std::convert::Into<wkt::FieldMask>,
5608 {
5609 self.update_mask = std::option::Option::Some(v.into());
5610 self
5611 }
5612
5613 /// Sets or clears the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5614 ///
5615 /// # Example
5616 /// ```ignore,no_run
5617 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5618 /// use wkt::FieldMask;
5619 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5620 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5621 /// ```
5622 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5623 where
5624 T: std::convert::Into<wkt::FieldMask>,
5625 {
5626 self.update_mask = v.map(|x| x.into());
5627 self
5628 }
5629}
5630
5631impl wkt::message::Message for UpdateNfsShareRequest {
5632 fn typename() -> &'static str {
5633 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNfsShareRequest"
5634 }
5635}
5636
5637/// Message requesting rename of a server.
5638#[derive(Clone, Default, PartialEq)]
5639#[non_exhaustive]
5640pub struct RenameNfsShareRequest {
5641 /// Required. The `name` field is used to identify the nfsshare.
5642 /// Format: projects/{project}/locations/{location}/nfsshares/{nfsshare}
5643 pub name: std::string::String,
5644
5645 /// Required. The new `id` of the nfsshare.
5646 pub new_nfsshare_id: std::string::String,
5647
5648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5649}
5650
5651impl RenameNfsShareRequest {
5652 pub fn new() -> Self {
5653 std::default::Default::default()
5654 }
5655
5656 /// Sets the value of [name][crate::model::RenameNfsShareRequest::name].
5657 ///
5658 /// # Example
5659 /// ```ignore,no_run
5660 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5661 /// let x = RenameNfsShareRequest::new().set_name("example");
5662 /// ```
5663 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5664 self.name = v.into();
5665 self
5666 }
5667
5668 /// Sets the value of [new_nfsshare_id][crate::model::RenameNfsShareRequest::new_nfsshare_id].
5669 ///
5670 /// # Example
5671 /// ```ignore,no_run
5672 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5673 /// let x = RenameNfsShareRequest::new().set_new_nfsshare_id("example");
5674 /// ```
5675 pub fn set_new_nfsshare_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5676 self.new_nfsshare_id = v.into();
5677 self
5678 }
5679}
5680
5681impl wkt::message::Message for RenameNfsShareRequest {
5682 fn typename() -> &'static str {
5683 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNfsShareRequest"
5684 }
5685}
5686
5687/// Message for creating an NFS share.
5688#[derive(Clone, Default, PartialEq)]
5689#[non_exhaustive]
5690pub struct CreateNfsShareRequest {
5691 /// Required. The parent project and location.
5692 pub parent: std::string::String,
5693
5694 /// Required. The NfsShare to create.
5695 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5696
5697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5698}
5699
5700impl CreateNfsShareRequest {
5701 pub fn new() -> Self {
5702 std::default::Default::default()
5703 }
5704
5705 /// Sets the value of [parent][crate::model::CreateNfsShareRequest::parent].
5706 ///
5707 /// # Example
5708 /// ```ignore,no_run
5709 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5710 /// let x = CreateNfsShareRequest::new().set_parent("example");
5711 /// ```
5712 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5713 self.parent = v.into();
5714 self
5715 }
5716
5717 /// Sets the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5718 ///
5719 /// # Example
5720 /// ```ignore,no_run
5721 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5722 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5723 /// let x = CreateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5724 /// ```
5725 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5726 where
5727 T: std::convert::Into<crate::model::NfsShare>,
5728 {
5729 self.nfs_share = std::option::Option::Some(v.into());
5730 self
5731 }
5732
5733 /// Sets or clears the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5734 ///
5735 /// # Example
5736 /// ```ignore,no_run
5737 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5738 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5739 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5740 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5741 /// ```
5742 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5743 where
5744 T: std::convert::Into<crate::model::NfsShare>,
5745 {
5746 self.nfs_share = v.map(|x| x.into());
5747 self
5748 }
5749}
5750
5751impl wkt::message::Message for CreateNfsShareRequest {
5752 fn typename() -> &'static str {
5753 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateNfsShareRequest"
5754 }
5755}
5756
5757/// Message for deleting an NFS share.
5758#[derive(Clone, Default, PartialEq)]
5759#[non_exhaustive]
5760pub struct DeleteNfsShareRequest {
5761 /// Required. The name of the NFS share to delete.
5762 pub name: std::string::String,
5763
5764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5765}
5766
5767impl DeleteNfsShareRequest {
5768 pub fn new() -> Self {
5769 std::default::Default::default()
5770 }
5771
5772 /// Sets the value of [name][crate::model::DeleteNfsShareRequest::name].
5773 ///
5774 /// # Example
5775 /// ```ignore,no_run
5776 /// # use google_cloud_baremetalsolution_v2::model::DeleteNfsShareRequest;
5777 /// let x = DeleteNfsShareRequest::new().set_name("example");
5778 /// ```
5779 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5780 self.name = v.into();
5781 self
5782 }
5783}
5784
5785impl wkt::message::Message for DeleteNfsShareRequest {
5786 fn typename() -> &'static str {
5787 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteNfsShareRequest"
5788 }
5789}
5790
5791/// Operation System image.
5792#[derive(Clone, Default, PartialEq)]
5793#[non_exhaustive]
5794pub struct OSImage {
5795 /// Output only. OS Image's unique name.
5796 pub name: std::string::String,
5797
5798 /// OS Image code.
5799 pub code: std::string::String,
5800
5801 /// OS Image description.
5802 pub description: std::string::String,
5803
5804 /// Instance types this image is applicable to.
5805 /// [Available
5806 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
5807 pub applicable_instance_types: std::vec::Vec<std::string::String>,
5808
5809 /// Network templates that can be used with this OS Image.
5810 pub supported_network_templates: std::vec::Vec<std::string::String>,
5811
5812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5813}
5814
5815impl OSImage {
5816 pub fn new() -> Self {
5817 std::default::Default::default()
5818 }
5819
5820 /// Sets the value of [name][crate::model::OSImage::name].
5821 ///
5822 /// # Example
5823 /// ```ignore,no_run
5824 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5825 /// let x = OSImage::new().set_name("example");
5826 /// ```
5827 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5828 self.name = v.into();
5829 self
5830 }
5831
5832 /// Sets the value of [code][crate::model::OSImage::code].
5833 ///
5834 /// # Example
5835 /// ```ignore,no_run
5836 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5837 /// let x = OSImage::new().set_code("example");
5838 /// ```
5839 pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5840 self.code = v.into();
5841 self
5842 }
5843
5844 /// Sets the value of [description][crate::model::OSImage::description].
5845 ///
5846 /// # Example
5847 /// ```ignore,no_run
5848 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5849 /// let x = OSImage::new().set_description("example");
5850 /// ```
5851 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5852 self.description = v.into();
5853 self
5854 }
5855
5856 /// Sets the value of [applicable_instance_types][crate::model::OSImage::applicable_instance_types].
5857 ///
5858 /// # Example
5859 /// ```ignore,no_run
5860 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5861 /// let x = OSImage::new().set_applicable_instance_types(["a", "b", "c"]);
5862 /// ```
5863 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
5864 where
5865 T: std::iter::IntoIterator<Item = V>,
5866 V: std::convert::Into<std::string::String>,
5867 {
5868 use std::iter::Iterator;
5869 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
5870 self
5871 }
5872
5873 /// Sets the value of [supported_network_templates][crate::model::OSImage::supported_network_templates].
5874 ///
5875 /// # Example
5876 /// ```ignore,no_run
5877 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5878 /// let x = OSImage::new().set_supported_network_templates(["a", "b", "c"]);
5879 /// ```
5880 pub fn set_supported_network_templates<T, V>(mut self, v: T) -> Self
5881 where
5882 T: std::iter::IntoIterator<Item = V>,
5883 V: std::convert::Into<std::string::String>,
5884 {
5885 use std::iter::Iterator;
5886 self.supported_network_templates = v.into_iter().map(|i| i.into()).collect();
5887 self
5888 }
5889}
5890
5891impl wkt::message::Message for OSImage {
5892 fn typename() -> &'static str {
5893 "type.googleapis.com/google.cloud.baremetalsolution.v2.OSImage"
5894 }
5895}
5896
5897/// Request for getting all available OS images.
5898#[derive(Clone, Default, PartialEq)]
5899#[non_exhaustive]
5900pub struct ListOSImagesRequest {
5901 /// Required. Parent value for ListProvisioningQuotasRequest.
5902 pub parent: std::string::String,
5903
5904 /// Requested page size. The server might return fewer items than requested.
5905 /// If unspecified, server will pick an appropriate default.
5906 /// Notice that page_size field is not supported and won't be respected in
5907 /// the API request for now, will be updated when pagination is supported.
5908 pub page_size: i32,
5909
5910 /// A token identifying a page of results from the server.
5911 pub page_token: std::string::String,
5912
5913 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5914}
5915
5916impl ListOSImagesRequest {
5917 pub fn new() -> Self {
5918 std::default::Default::default()
5919 }
5920
5921 /// Sets the value of [parent][crate::model::ListOSImagesRequest::parent].
5922 ///
5923 /// # Example
5924 /// ```ignore,no_run
5925 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5926 /// let x = ListOSImagesRequest::new().set_parent("example");
5927 /// ```
5928 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5929 self.parent = v.into();
5930 self
5931 }
5932
5933 /// Sets the value of [page_size][crate::model::ListOSImagesRequest::page_size].
5934 ///
5935 /// # Example
5936 /// ```ignore,no_run
5937 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5938 /// let x = ListOSImagesRequest::new().set_page_size(42);
5939 /// ```
5940 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5941 self.page_size = v.into();
5942 self
5943 }
5944
5945 /// Sets the value of [page_token][crate::model::ListOSImagesRequest::page_token].
5946 ///
5947 /// # Example
5948 /// ```ignore,no_run
5949 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5950 /// let x = ListOSImagesRequest::new().set_page_token("example");
5951 /// ```
5952 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5953 self.page_token = v.into();
5954 self
5955 }
5956}
5957
5958impl wkt::message::Message for ListOSImagesRequest {
5959 fn typename() -> &'static str {
5960 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesRequest"
5961 }
5962}
5963
5964/// Request for getting all available OS images.
5965#[derive(Clone, Default, PartialEq)]
5966#[non_exhaustive]
5967pub struct ListOSImagesResponse {
5968 /// The OS images available.
5969 pub os_images: std::vec::Vec<crate::model::OSImage>,
5970
5971 /// Token to retrieve the next page of results, or empty if there are no more
5972 /// results in the list.
5973 pub next_page_token: std::string::String,
5974
5975 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5976}
5977
5978impl ListOSImagesResponse {
5979 pub fn new() -> Self {
5980 std::default::Default::default()
5981 }
5982
5983 /// Sets the value of [os_images][crate::model::ListOSImagesResponse::os_images].
5984 ///
5985 /// # Example
5986 /// ```ignore,no_run
5987 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
5988 /// use google_cloud_baremetalsolution_v2::model::OSImage;
5989 /// let x = ListOSImagesResponse::new()
5990 /// .set_os_images([
5991 /// OSImage::default()/* use setters */,
5992 /// OSImage::default()/* use (different) setters */,
5993 /// ]);
5994 /// ```
5995 pub fn set_os_images<T, V>(mut self, v: T) -> Self
5996 where
5997 T: std::iter::IntoIterator<Item = V>,
5998 V: std::convert::Into<crate::model::OSImage>,
5999 {
6000 use std::iter::Iterator;
6001 self.os_images = v.into_iter().map(|i| i.into()).collect();
6002 self
6003 }
6004
6005 /// Sets the value of [next_page_token][crate::model::ListOSImagesResponse::next_page_token].
6006 ///
6007 /// # Example
6008 /// ```ignore,no_run
6009 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
6010 /// let x = ListOSImagesResponse::new().set_next_page_token("example");
6011 /// ```
6012 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6013 self.next_page_token = v.into();
6014 self
6015 }
6016}
6017
6018impl wkt::message::Message for ListOSImagesResponse {
6019 fn typename() -> &'static str {
6020 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesResponse"
6021 }
6022}
6023
6024#[doc(hidden)]
6025impl google_cloud_gax::paginator::internal::PageableResponse for ListOSImagesResponse {
6026 type PageItem = crate::model::OSImage;
6027
6028 fn items(self) -> std::vec::Vec<Self::PageItem> {
6029 self.os_images
6030 }
6031
6032 fn next_page_token(&self) -> std::string::String {
6033 use std::clone::Clone;
6034 self.next_page_token.clone()
6035 }
6036}
6037
6038/// A provisioning configuration.
6039#[derive(Clone, Default, PartialEq)]
6040#[non_exhaustive]
6041pub struct ProvisioningConfig {
6042 /// Output only. The system-generated name of the provisioning config. This
6043 /// follows the UUID format.
6044 pub name: std::string::String,
6045
6046 /// Instances to be created.
6047 pub instances: std::vec::Vec<crate::model::InstanceConfig>,
6048
6049 /// Networks to be created.
6050 pub networks: std::vec::Vec<crate::model::NetworkConfig>,
6051
6052 /// Volumes to be created.
6053 pub volumes: std::vec::Vec<crate::model::VolumeConfig>,
6054
6055 /// A generated ticket id to track provisioning request.
6056 pub ticket_id: std::string::String,
6057
6058 /// A service account to enable customers to access instance credentials upon
6059 /// handover.
6060 pub handover_service_account: std::string::String,
6061
6062 /// Email provided to send a confirmation with provisioning config to.
6063 /// Deprecated in favour of email field in request messages.
6064 #[deprecated]
6065 pub email: std::string::String,
6066
6067 /// Output only. State of ProvisioningConfig.
6068 pub state: crate::model::provisioning_config::State,
6069
6070 /// Optional. Location name of this ProvisioningConfig.
6071 /// It is optional only for Intake UI transition period.
6072 pub location: std::string::String,
6073
6074 /// Output only. Last update timestamp.
6075 pub update_time: std::option::Option<wkt::Timestamp>,
6076
6077 /// Output only. URI to Cloud Console UI view of this provisioning config.
6078 pub cloud_console_uri: std::string::String,
6079
6080 /// If true, VPC SC is enabled for the cluster.
6081 pub vpc_sc_enabled: bool,
6082
6083 /// Optional status messages associated with the FAILED state.
6084 pub status_message: std::string::String,
6085
6086 /// Optional. The user-defined identifier of the provisioning config.
6087 pub custom_id: std::string::String,
6088
6089 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6090}
6091
6092impl ProvisioningConfig {
6093 pub fn new() -> Self {
6094 std::default::Default::default()
6095 }
6096
6097 /// Sets the value of [name][crate::model::ProvisioningConfig::name].
6098 ///
6099 /// # Example
6100 /// ```ignore,no_run
6101 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6102 /// let x = ProvisioningConfig::new().set_name("example");
6103 /// ```
6104 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6105 self.name = v.into();
6106 self
6107 }
6108
6109 /// Sets the value of [instances][crate::model::ProvisioningConfig::instances].
6110 ///
6111 /// # Example
6112 /// ```ignore,no_run
6113 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6114 /// use google_cloud_baremetalsolution_v2::model::InstanceConfig;
6115 /// let x = ProvisioningConfig::new()
6116 /// .set_instances([
6117 /// InstanceConfig::default()/* use setters */,
6118 /// InstanceConfig::default()/* use (different) setters */,
6119 /// ]);
6120 /// ```
6121 pub fn set_instances<T, V>(mut self, v: T) -> Self
6122 where
6123 T: std::iter::IntoIterator<Item = V>,
6124 V: std::convert::Into<crate::model::InstanceConfig>,
6125 {
6126 use std::iter::Iterator;
6127 self.instances = v.into_iter().map(|i| i.into()).collect();
6128 self
6129 }
6130
6131 /// Sets the value of [networks][crate::model::ProvisioningConfig::networks].
6132 ///
6133 /// # Example
6134 /// ```ignore,no_run
6135 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6136 /// use google_cloud_baremetalsolution_v2::model::NetworkConfig;
6137 /// let x = ProvisioningConfig::new()
6138 /// .set_networks([
6139 /// NetworkConfig::default()/* use setters */,
6140 /// NetworkConfig::default()/* use (different) setters */,
6141 /// ]);
6142 /// ```
6143 pub fn set_networks<T, V>(mut self, v: T) -> Self
6144 where
6145 T: std::iter::IntoIterator<Item = V>,
6146 V: std::convert::Into<crate::model::NetworkConfig>,
6147 {
6148 use std::iter::Iterator;
6149 self.networks = v.into_iter().map(|i| i.into()).collect();
6150 self
6151 }
6152
6153 /// Sets the value of [volumes][crate::model::ProvisioningConfig::volumes].
6154 ///
6155 /// # Example
6156 /// ```ignore,no_run
6157 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6158 /// use google_cloud_baremetalsolution_v2::model::VolumeConfig;
6159 /// let x = ProvisioningConfig::new()
6160 /// .set_volumes([
6161 /// VolumeConfig::default()/* use setters */,
6162 /// VolumeConfig::default()/* use (different) setters */,
6163 /// ]);
6164 /// ```
6165 pub fn set_volumes<T, V>(mut self, v: T) -> Self
6166 where
6167 T: std::iter::IntoIterator<Item = V>,
6168 V: std::convert::Into<crate::model::VolumeConfig>,
6169 {
6170 use std::iter::Iterator;
6171 self.volumes = v.into_iter().map(|i| i.into()).collect();
6172 self
6173 }
6174
6175 /// Sets the value of [ticket_id][crate::model::ProvisioningConfig::ticket_id].
6176 ///
6177 /// # Example
6178 /// ```ignore,no_run
6179 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6180 /// let x = ProvisioningConfig::new().set_ticket_id("example");
6181 /// ```
6182 pub fn set_ticket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6183 self.ticket_id = v.into();
6184 self
6185 }
6186
6187 /// Sets the value of [handover_service_account][crate::model::ProvisioningConfig::handover_service_account].
6188 ///
6189 /// # Example
6190 /// ```ignore,no_run
6191 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6192 /// let x = ProvisioningConfig::new().set_handover_service_account("example");
6193 /// ```
6194 pub fn set_handover_service_account<T: std::convert::Into<std::string::String>>(
6195 mut self,
6196 v: T,
6197 ) -> Self {
6198 self.handover_service_account = v.into();
6199 self
6200 }
6201
6202 /// Sets the value of [email][crate::model::ProvisioningConfig::email].
6203 ///
6204 /// # Example
6205 /// ```ignore,no_run
6206 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6207 /// let x = ProvisioningConfig::new().set_email("example");
6208 /// ```
6209 #[deprecated]
6210 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6211 self.email = v.into();
6212 self
6213 }
6214
6215 /// Sets the value of [state][crate::model::ProvisioningConfig::state].
6216 ///
6217 /// # Example
6218 /// ```ignore,no_run
6219 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6220 /// use google_cloud_baremetalsolution_v2::model::provisioning_config::State;
6221 /// let x0 = ProvisioningConfig::new().set_state(State::Draft);
6222 /// let x1 = ProvisioningConfig::new().set_state(State::Submitted);
6223 /// let x2 = ProvisioningConfig::new().set_state(State::Provisioning);
6224 /// ```
6225 pub fn set_state<T: std::convert::Into<crate::model::provisioning_config::State>>(
6226 mut self,
6227 v: T,
6228 ) -> Self {
6229 self.state = v.into();
6230 self
6231 }
6232
6233 /// Sets the value of [location][crate::model::ProvisioningConfig::location].
6234 ///
6235 /// # Example
6236 /// ```ignore,no_run
6237 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6238 /// let x = ProvisioningConfig::new().set_location("example");
6239 /// ```
6240 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6241 self.location = v.into();
6242 self
6243 }
6244
6245 /// Sets the value of [update_time][crate::model::ProvisioningConfig::update_time].
6246 ///
6247 /// # Example
6248 /// ```ignore,no_run
6249 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6250 /// use wkt::Timestamp;
6251 /// let x = ProvisioningConfig::new().set_update_time(Timestamp::default()/* use setters */);
6252 /// ```
6253 pub fn set_update_time<T>(mut self, v: T) -> Self
6254 where
6255 T: std::convert::Into<wkt::Timestamp>,
6256 {
6257 self.update_time = std::option::Option::Some(v.into());
6258 self
6259 }
6260
6261 /// Sets or clears the value of [update_time][crate::model::ProvisioningConfig::update_time].
6262 ///
6263 /// # Example
6264 /// ```ignore,no_run
6265 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6266 /// use wkt::Timestamp;
6267 /// let x = ProvisioningConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6268 /// let x = ProvisioningConfig::new().set_or_clear_update_time(None::<Timestamp>);
6269 /// ```
6270 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6271 where
6272 T: std::convert::Into<wkt::Timestamp>,
6273 {
6274 self.update_time = v.map(|x| x.into());
6275 self
6276 }
6277
6278 /// Sets the value of [cloud_console_uri][crate::model::ProvisioningConfig::cloud_console_uri].
6279 ///
6280 /// # Example
6281 /// ```ignore,no_run
6282 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6283 /// let x = ProvisioningConfig::new().set_cloud_console_uri("example");
6284 /// ```
6285 pub fn set_cloud_console_uri<T: std::convert::Into<std::string::String>>(
6286 mut self,
6287 v: T,
6288 ) -> Self {
6289 self.cloud_console_uri = v.into();
6290 self
6291 }
6292
6293 /// Sets the value of [vpc_sc_enabled][crate::model::ProvisioningConfig::vpc_sc_enabled].
6294 ///
6295 /// # Example
6296 /// ```ignore,no_run
6297 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6298 /// let x = ProvisioningConfig::new().set_vpc_sc_enabled(true);
6299 /// ```
6300 pub fn set_vpc_sc_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6301 self.vpc_sc_enabled = v.into();
6302 self
6303 }
6304
6305 /// Sets the value of [status_message][crate::model::ProvisioningConfig::status_message].
6306 ///
6307 /// # Example
6308 /// ```ignore,no_run
6309 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6310 /// let x = ProvisioningConfig::new().set_status_message("example");
6311 /// ```
6312 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6313 self.status_message = v.into();
6314 self
6315 }
6316
6317 /// Sets the value of [custom_id][crate::model::ProvisioningConfig::custom_id].
6318 ///
6319 /// # Example
6320 /// ```ignore,no_run
6321 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6322 /// let x = ProvisioningConfig::new().set_custom_id("example");
6323 /// ```
6324 pub fn set_custom_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6325 self.custom_id = v.into();
6326 self
6327 }
6328}
6329
6330impl wkt::message::Message for ProvisioningConfig {
6331 fn typename() -> &'static str {
6332 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningConfig"
6333 }
6334}
6335
6336/// Defines additional types related to [ProvisioningConfig].
6337pub mod provisioning_config {
6338 #[allow(unused_imports)]
6339 use super::*;
6340
6341 /// The possible states for this ProvisioningConfig.
6342 ///
6343 /// # Working with unknown values
6344 ///
6345 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6346 /// additional enum variants at any time. Adding new variants is not considered
6347 /// a breaking change. Applications should write their code in anticipation of:
6348 ///
6349 /// - New values appearing in future releases of the client library, **and**
6350 /// - New values received dynamically, without application changes.
6351 ///
6352 /// Please consult the [Working with enums] section in the user guide for some
6353 /// guidelines.
6354 ///
6355 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6356 #[derive(Clone, Debug, PartialEq)]
6357 #[non_exhaustive]
6358 pub enum State {
6359 /// State wasn't specified.
6360 Unspecified,
6361 /// ProvisioningConfig is a draft and can be freely modified.
6362 Draft,
6363 /// ProvisioningConfig was already submitted and cannot be modified.
6364 Submitted,
6365 /// ProvisioningConfig was in the provisioning state. Initially this state
6366 /// comes from the work order table in big query when SNOW is used. Later
6367 /// this field can be set by the work order API.
6368 Provisioning,
6369 /// ProvisioningConfig was provisioned, meaning the resources exist.
6370 Provisioned,
6371 /// ProvisioningConfig was validated. A validation tool will be run to
6372 /// set this state.
6373 Validated,
6374 /// ProvisioningConfig was canceled.
6375 Cancelled,
6376 /// The request is submitted for provisioning, with error return.
6377 Failed,
6378 /// If set, the enum was initialized with an unknown value.
6379 ///
6380 /// Applications can examine the value using [State::value] or
6381 /// [State::name].
6382 UnknownValue(state::UnknownValue),
6383 }
6384
6385 #[doc(hidden)]
6386 pub mod state {
6387 #[allow(unused_imports)]
6388 use super::*;
6389 #[derive(Clone, Debug, PartialEq)]
6390 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6391 }
6392
6393 impl State {
6394 /// Gets the enum value.
6395 ///
6396 /// Returns `None` if the enum contains an unknown value deserialized from
6397 /// the string representation of enums.
6398 pub fn value(&self) -> std::option::Option<i32> {
6399 match self {
6400 Self::Unspecified => std::option::Option::Some(0),
6401 Self::Draft => std::option::Option::Some(1),
6402 Self::Submitted => std::option::Option::Some(2),
6403 Self::Provisioning => std::option::Option::Some(3),
6404 Self::Provisioned => std::option::Option::Some(4),
6405 Self::Validated => std::option::Option::Some(5),
6406 Self::Cancelled => std::option::Option::Some(6),
6407 Self::Failed => std::option::Option::Some(7),
6408 Self::UnknownValue(u) => u.0.value(),
6409 }
6410 }
6411
6412 /// Gets the enum value as a string.
6413 ///
6414 /// Returns `None` if the enum contains an unknown value deserialized from
6415 /// the integer representation of enums.
6416 pub fn name(&self) -> std::option::Option<&str> {
6417 match self {
6418 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6419 Self::Draft => std::option::Option::Some("DRAFT"),
6420 Self::Submitted => std::option::Option::Some("SUBMITTED"),
6421 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
6422 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
6423 Self::Validated => std::option::Option::Some("VALIDATED"),
6424 Self::Cancelled => std::option::Option::Some("CANCELLED"),
6425 Self::Failed => std::option::Option::Some("FAILED"),
6426 Self::UnknownValue(u) => u.0.name(),
6427 }
6428 }
6429 }
6430
6431 impl std::default::Default for State {
6432 fn default() -> Self {
6433 use std::convert::From;
6434 Self::from(0)
6435 }
6436 }
6437
6438 impl std::fmt::Display for State {
6439 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6440 wkt::internal::display_enum(f, self.name(), self.value())
6441 }
6442 }
6443
6444 impl std::convert::From<i32> for State {
6445 fn from(value: i32) -> Self {
6446 match value {
6447 0 => Self::Unspecified,
6448 1 => Self::Draft,
6449 2 => Self::Submitted,
6450 3 => Self::Provisioning,
6451 4 => Self::Provisioned,
6452 5 => Self::Validated,
6453 6 => Self::Cancelled,
6454 7 => Self::Failed,
6455 _ => Self::UnknownValue(state::UnknownValue(
6456 wkt::internal::UnknownEnumValue::Integer(value),
6457 )),
6458 }
6459 }
6460 }
6461
6462 impl std::convert::From<&str> for State {
6463 fn from(value: &str) -> Self {
6464 use std::string::ToString;
6465 match value {
6466 "STATE_UNSPECIFIED" => Self::Unspecified,
6467 "DRAFT" => Self::Draft,
6468 "SUBMITTED" => Self::Submitted,
6469 "PROVISIONING" => Self::Provisioning,
6470 "PROVISIONED" => Self::Provisioned,
6471 "VALIDATED" => Self::Validated,
6472 "CANCELLED" => Self::Cancelled,
6473 "FAILED" => Self::Failed,
6474 _ => Self::UnknownValue(state::UnknownValue(
6475 wkt::internal::UnknownEnumValue::String(value.to_string()),
6476 )),
6477 }
6478 }
6479 }
6480
6481 impl serde::ser::Serialize for State {
6482 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6483 where
6484 S: serde::Serializer,
6485 {
6486 match self {
6487 Self::Unspecified => serializer.serialize_i32(0),
6488 Self::Draft => serializer.serialize_i32(1),
6489 Self::Submitted => serializer.serialize_i32(2),
6490 Self::Provisioning => serializer.serialize_i32(3),
6491 Self::Provisioned => serializer.serialize_i32(4),
6492 Self::Validated => serializer.serialize_i32(5),
6493 Self::Cancelled => serializer.serialize_i32(6),
6494 Self::Failed => serializer.serialize_i32(7),
6495 Self::UnknownValue(u) => u.0.serialize(serializer),
6496 }
6497 }
6498 }
6499
6500 impl<'de> serde::de::Deserialize<'de> for State {
6501 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6502 where
6503 D: serde::Deserializer<'de>,
6504 {
6505 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6506 ".google.cloud.baremetalsolution.v2.ProvisioningConfig.State",
6507 ))
6508 }
6509 }
6510}
6511
6512/// Request for SubmitProvisioningConfig.
6513#[derive(Clone, Default, PartialEq)]
6514#[non_exhaustive]
6515pub struct SubmitProvisioningConfigRequest {
6516 /// Required. The parent project and location containing the
6517 /// ProvisioningConfig.
6518 pub parent: std::string::String,
6519
6520 /// Required. The ProvisioningConfig to create.
6521 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6522
6523 /// Optional. Email provided to send a confirmation with provisioning config
6524 /// to.
6525 pub email: std::string::String,
6526
6527 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6528}
6529
6530impl SubmitProvisioningConfigRequest {
6531 pub fn new() -> Self {
6532 std::default::Default::default()
6533 }
6534
6535 /// Sets the value of [parent][crate::model::SubmitProvisioningConfigRequest::parent].
6536 ///
6537 /// # Example
6538 /// ```ignore,no_run
6539 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6540 /// let x = SubmitProvisioningConfigRequest::new().set_parent("example");
6541 /// ```
6542 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6543 self.parent = v.into();
6544 self
6545 }
6546
6547 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6548 ///
6549 /// # Example
6550 /// ```ignore,no_run
6551 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6552 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6553 /// let x = SubmitProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6554 /// ```
6555 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6556 where
6557 T: std::convert::Into<crate::model::ProvisioningConfig>,
6558 {
6559 self.provisioning_config = std::option::Option::Some(v.into());
6560 self
6561 }
6562
6563 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6564 ///
6565 /// # Example
6566 /// ```ignore,no_run
6567 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6568 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6569 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6570 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6571 /// ```
6572 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6573 where
6574 T: std::convert::Into<crate::model::ProvisioningConfig>,
6575 {
6576 self.provisioning_config = v.map(|x| x.into());
6577 self
6578 }
6579
6580 /// Sets the value of [email][crate::model::SubmitProvisioningConfigRequest::email].
6581 ///
6582 /// # Example
6583 /// ```ignore,no_run
6584 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6585 /// let x = SubmitProvisioningConfigRequest::new().set_email("example");
6586 /// ```
6587 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6588 self.email = v.into();
6589 self
6590 }
6591}
6592
6593impl wkt::message::Message for SubmitProvisioningConfigRequest {
6594 fn typename() -> &'static str {
6595 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigRequest"
6596 }
6597}
6598
6599/// Response for SubmitProvisioningConfig.
6600#[derive(Clone, Default, PartialEq)]
6601#[non_exhaustive]
6602pub struct SubmitProvisioningConfigResponse {
6603 /// The submitted provisioning config.
6604 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6605
6606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6607}
6608
6609impl SubmitProvisioningConfigResponse {
6610 pub fn new() -> Self {
6611 std::default::Default::default()
6612 }
6613
6614 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6615 ///
6616 /// # Example
6617 /// ```ignore,no_run
6618 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6619 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6620 /// let x = SubmitProvisioningConfigResponse::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6621 /// ```
6622 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6623 where
6624 T: std::convert::Into<crate::model::ProvisioningConfig>,
6625 {
6626 self.provisioning_config = std::option::Option::Some(v.into());
6627 self
6628 }
6629
6630 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6631 ///
6632 /// # Example
6633 /// ```ignore,no_run
6634 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6635 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6636 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6637 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6638 /// ```
6639 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6640 where
6641 T: std::convert::Into<crate::model::ProvisioningConfig>,
6642 {
6643 self.provisioning_config = v.map(|x| x.into());
6644 self
6645 }
6646}
6647
6648impl wkt::message::Message for SubmitProvisioningConfigResponse {
6649 fn typename() -> &'static str {
6650 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigResponse"
6651 }
6652}
6653
6654/// A provisioning quota for a given project.
6655#[derive(Clone, Default, PartialEq)]
6656#[non_exhaustive]
6657pub struct ProvisioningQuota {
6658 /// Output only. The name of the provisioning quota.
6659 pub name: std::string::String,
6660
6661 /// The asset type of this provisioning quota.
6662 pub asset_type: crate::model::provisioning_quota::AssetType,
6663
6664 /// The gcp service of the provisioning quota.
6665 pub gcp_service: std::string::String,
6666
6667 /// The specific location of the provisioining quota.
6668 pub location: std::string::String,
6669
6670 /// The available count of the provisioning quota.
6671 pub available_count: i32,
6672
6673 /// The quota of one asset type.
6674 pub quota: std::option::Option<crate::model::provisioning_quota::Quota>,
6675
6676 /// Available quantity based on asset type.
6677 pub availability: std::option::Option<crate::model::provisioning_quota::Availability>,
6678
6679 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6680}
6681
6682impl ProvisioningQuota {
6683 pub fn new() -> Self {
6684 std::default::Default::default()
6685 }
6686
6687 /// Sets the value of [name][crate::model::ProvisioningQuota::name].
6688 ///
6689 /// # Example
6690 /// ```ignore,no_run
6691 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6692 /// let x = ProvisioningQuota::new().set_name("example");
6693 /// ```
6694 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6695 self.name = v.into();
6696 self
6697 }
6698
6699 /// Sets the value of [asset_type][crate::model::ProvisioningQuota::asset_type].
6700 ///
6701 /// # Example
6702 /// ```ignore,no_run
6703 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6704 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::AssetType;
6705 /// let x0 = ProvisioningQuota::new().set_asset_type(AssetType::Server);
6706 /// let x1 = ProvisioningQuota::new().set_asset_type(AssetType::Storage);
6707 /// let x2 = ProvisioningQuota::new().set_asset_type(AssetType::Network);
6708 /// ```
6709 pub fn set_asset_type<T: std::convert::Into<crate::model::provisioning_quota::AssetType>>(
6710 mut self,
6711 v: T,
6712 ) -> Self {
6713 self.asset_type = v.into();
6714 self
6715 }
6716
6717 /// Sets the value of [gcp_service][crate::model::ProvisioningQuota::gcp_service].
6718 ///
6719 /// # Example
6720 /// ```ignore,no_run
6721 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6722 /// let x = ProvisioningQuota::new().set_gcp_service("example");
6723 /// ```
6724 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6725 self.gcp_service = v.into();
6726 self
6727 }
6728
6729 /// Sets the value of [location][crate::model::ProvisioningQuota::location].
6730 ///
6731 /// # Example
6732 /// ```ignore,no_run
6733 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6734 /// let x = ProvisioningQuota::new().set_location("example");
6735 /// ```
6736 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6737 self.location = v.into();
6738 self
6739 }
6740
6741 /// Sets the value of [available_count][crate::model::ProvisioningQuota::available_count].
6742 ///
6743 /// # Example
6744 /// ```ignore,no_run
6745 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6746 /// let x = ProvisioningQuota::new().set_available_count(42);
6747 /// ```
6748 pub fn set_available_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6749 self.available_count = v.into();
6750 self
6751 }
6752
6753 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota].
6754 ///
6755 /// Note that all the setters affecting `quota` are mutually
6756 /// exclusive.
6757 ///
6758 /// # Example
6759 /// ```ignore,no_run
6760 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6761 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6762 /// let x = ProvisioningQuota::new().set_quota(Some(
6763 /// google_cloud_baremetalsolution_v2::model::provisioning_quota::Quota::InstanceQuota(InstanceQuota::default().into())));
6764 /// ```
6765 pub fn set_quota<
6766 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Quota>>,
6767 >(
6768 mut self,
6769 v: T,
6770 ) -> Self {
6771 self.quota = v.into();
6772 self
6773 }
6774
6775 /// The value of [quota][crate::model::ProvisioningQuota::quota]
6776 /// if it holds a `InstanceQuota`, `None` if the field is not set or
6777 /// holds a different branch.
6778 pub fn instance_quota(
6779 &self,
6780 ) -> std::option::Option<&std::boxed::Box<crate::model::InstanceQuota>> {
6781 #[allow(unreachable_patterns)]
6782 self.quota.as_ref().and_then(|v| match v {
6783 crate::model::provisioning_quota::Quota::InstanceQuota(v) => {
6784 std::option::Option::Some(v)
6785 }
6786 _ => std::option::Option::None,
6787 })
6788 }
6789
6790 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota]
6791 /// to hold a `InstanceQuota`.
6792 ///
6793 /// Note that all the setters affecting `quota` are
6794 /// mutually exclusive.
6795 ///
6796 /// # Example
6797 /// ```ignore,no_run
6798 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6799 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6800 /// let x = ProvisioningQuota::new().set_instance_quota(InstanceQuota::default()/* use setters */);
6801 /// assert!(x.instance_quota().is_some());
6802 /// ```
6803 pub fn set_instance_quota<
6804 T: std::convert::Into<std::boxed::Box<crate::model::InstanceQuota>>,
6805 >(
6806 mut self,
6807 v: T,
6808 ) -> Self {
6809 self.quota = std::option::Option::Some(
6810 crate::model::provisioning_quota::Quota::InstanceQuota(v.into()),
6811 );
6812 self
6813 }
6814
6815 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability].
6816 ///
6817 /// Note that all the setters affecting `availability` are mutually
6818 /// exclusive.
6819 ///
6820 /// # Example
6821 /// ```ignore,no_run
6822 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6823 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::Availability;
6824 /// let x = ProvisioningQuota::new().set_availability(Some(Availability::ServerCount(42)));
6825 /// ```
6826 pub fn set_availability<
6827 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Availability>>,
6828 >(
6829 mut self,
6830 v: T,
6831 ) -> Self {
6832 self.availability = v.into();
6833 self
6834 }
6835
6836 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6837 /// if it holds a `ServerCount`, `None` if the field is not set or
6838 /// holds a different branch.
6839 pub fn server_count(&self) -> std::option::Option<&i64> {
6840 #[allow(unreachable_patterns)]
6841 self.availability.as_ref().and_then(|v| match v {
6842 crate::model::provisioning_quota::Availability::ServerCount(v) => {
6843 std::option::Option::Some(v)
6844 }
6845 _ => std::option::Option::None,
6846 })
6847 }
6848
6849 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6850 /// to hold a `ServerCount`.
6851 ///
6852 /// Note that all the setters affecting `availability` are
6853 /// mutually exclusive.
6854 ///
6855 /// # Example
6856 /// ```ignore,no_run
6857 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6858 /// let x = ProvisioningQuota::new().set_server_count(42);
6859 /// assert!(x.server_count().is_some());
6860 /// assert!(x.network_bandwidth().is_none());
6861 /// assert!(x.storage_gib().is_none());
6862 /// ```
6863 pub fn set_server_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6864 self.availability = std::option::Option::Some(
6865 crate::model::provisioning_quota::Availability::ServerCount(v.into()),
6866 );
6867 self
6868 }
6869
6870 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6871 /// if it holds a `NetworkBandwidth`, `None` if the field is not set or
6872 /// holds a different branch.
6873 pub fn network_bandwidth(&self) -> std::option::Option<&i64> {
6874 #[allow(unreachable_patterns)]
6875 self.availability.as_ref().and_then(|v| match v {
6876 crate::model::provisioning_quota::Availability::NetworkBandwidth(v) => {
6877 std::option::Option::Some(v)
6878 }
6879 _ => std::option::Option::None,
6880 })
6881 }
6882
6883 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6884 /// to hold a `NetworkBandwidth`.
6885 ///
6886 /// Note that all the setters affecting `availability` are
6887 /// mutually exclusive.
6888 ///
6889 /// # Example
6890 /// ```ignore,no_run
6891 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6892 /// let x = ProvisioningQuota::new().set_network_bandwidth(42);
6893 /// assert!(x.network_bandwidth().is_some());
6894 /// assert!(x.server_count().is_none());
6895 /// assert!(x.storage_gib().is_none());
6896 /// ```
6897 pub fn set_network_bandwidth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6898 self.availability = std::option::Option::Some(
6899 crate::model::provisioning_quota::Availability::NetworkBandwidth(v.into()),
6900 );
6901 self
6902 }
6903
6904 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6905 /// if it holds a `StorageGib`, `None` if the field is not set or
6906 /// holds a different branch.
6907 pub fn storage_gib(&self) -> std::option::Option<&i64> {
6908 #[allow(unreachable_patterns)]
6909 self.availability.as_ref().and_then(|v| match v {
6910 crate::model::provisioning_quota::Availability::StorageGib(v) => {
6911 std::option::Option::Some(v)
6912 }
6913 _ => std::option::Option::None,
6914 })
6915 }
6916
6917 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6918 /// to hold a `StorageGib`.
6919 ///
6920 /// Note that all the setters affecting `availability` are
6921 /// mutually exclusive.
6922 ///
6923 /// # Example
6924 /// ```ignore,no_run
6925 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6926 /// let x = ProvisioningQuota::new().set_storage_gib(42);
6927 /// assert!(x.storage_gib().is_some());
6928 /// assert!(x.server_count().is_none());
6929 /// assert!(x.network_bandwidth().is_none());
6930 /// ```
6931 pub fn set_storage_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6932 self.availability = std::option::Option::Some(
6933 crate::model::provisioning_quota::Availability::StorageGib(v.into()),
6934 );
6935 self
6936 }
6937}
6938
6939impl wkt::message::Message for ProvisioningQuota {
6940 fn typename() -> &'static str {
6941 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningQuota"
6942 }
6943}
6944
6945/// Defines additional types related to [ProvisioningQuota].
6946pub mod provisioning_quota {
6947 #[allow(unused_imports)]
6948 use super::*;
6949
6950 /// The available asset types for intake.
6951 ///
6952 /// # Working with unknown values
6953 ///
6954 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6955 /// additional enum variants at any time. Adding new variants is not considered
6956 /// a breaking change. Applications should write their code in anticipation of:
6957 ///
6958 /// - New values appearing in future releases of the client library, **and**
6959 /// - New values received dynamically, without application changes.
6960 ///
6961 /// Please consult the [Working with enums] section in the user guide for some
6962 /// guidelines.
6963 ///
6964 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6965 #[derive(Clone, Debug, PartialEq)]
6966 #[non_exhaustive]
6967 pub enum AssetType {
6968 /// The unspecified type.
6969 Unspecified,
6970 /// The server asset type.
6971 Server,
6972 /// The storage asset type.
6973 Storage,
6974 /// The network asset type.
6975 Network,
6976 /// If set, the enum was initialized with an unknown value.
6977 ///
6978 /// Applications can examine the value using [AssetType::value] or
6979 /// [AssetType::name].
6980 UnknownValue(asset_type::UnknownValue),
6981 }
6982
6983 #[doc(hidden)]
6984 pub mod asset_type {
6985 #[allow(unused_imports)]
6986 use super::*;
6987 #[derive(Clone, Debug, PartialEq)]
6988 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6989 }
6990
6991 impl AssetType {
6992 /// Gets the enum value.
6993 ///
6994 /// Returns `None` if the enum contains an unknown value deserialized from
6995 /// the string representation of enums.
6996 pub fn value(&self) -> std::option::Option<i32> {
6997 match self {
6998 Self::Unspecified => std::option::Option::Some(0),
6999 Self::Server => std::option::Option::Some(1),
7000 Self::Storage => std::option::Option::Some(2),
7001 Self::Network => std::option::Option::Some(3),
7002 Self::UnknownValue(u) => u.0.value(),
7003 }
7004 }
7005
7006 /// Gets the enum value as a string.
7007 ///
7008 /// Returns `None` if the enum contains an unknown value deserialized from
7009 /// the integer representation of enums.
7010 pub fn name(&self) -> std::option::Option<&str> {
7011 match self {
7012 Self::Unspecified => std::option::Option::Some("ASSET_TYPE_UNSPECIFIED"),
7013 Self::Server => std::option::Option::Some("ASSET_TYPE_SERVER"),
7014 Self::Storage => std::option::Option::Some("ASSET_TYPE_STORAGE"),
7015 Self::Network => std::option::Option::Some("ASSET_TYPE_NETWORK"),
7016 Self::UnknownValue(u) => u.0.name(),
7017 }
7018 }
7019 }
7020
7021 impl std::default::Default for AssetType {
7022 fn default() -> Self {
7023 use std::convert::From;
7024 Self::from(0)
7025 }
7026 }
7027
7028 impl std::fmt::Display for AssetType {
7029 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7030 wkt::internal::display_enum(f, self.name(), self.value())
7031 }
7032 }
7033
7034 impl std::convert::From<i32> for AssetType {
7035 fn from(value: i32) -> Self {
7036 match value {
7037 0 => Self::Unspecified,
7038 1 => Self::Server,
7039 2 => Self::Storage,
7040 3 => Self::Network,
7041 _ => Self::UnknownValue(asset_type::UnknownValue(
7042 wkt::internal::UnknownEnumValue::Integer(value),
7043 )),
7044 }
7045 }
7046 }
7047
7048 impl std::convert::From<&str> for AssetType {
7049 fn from(value: &str) -> Self {
7050 use std::string::ToString;
7051 match value {
7052 "ASSET_TYPE_UNSPECIFIED" => Self::Unspecified,
7053 "ASSET_TYPE_SERVER" => Self::Server,
7054 "ASSET_TYPE_STORAGE" => Self::Storage,
7055 "ASSET_TYPE_NETWORK" => Self::Network,
7056 _ => Self::UnknownValue(asset_type::UnknownValue(
7057 wkt::internal::UnknownEnumValue::String(value.to_string()),
7058 )),
7059 }
7060 }
7061 }
7062
7063 impl serde::ser::Serialize for AssetType {
7064 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7065 where
7066 S: serde::Serializer,
7067 {
7068 match self {
7069 Self::Unspecified => serializer.serialize_i32(0),
7070 Self::Server => serializer.serialize_i32(1),
7071 Self::Storage => serializer.serialize_i32(2),
7072 Self::Network => serializer.serialize_i32(3),
7073 Self::UnknownValue(u) => u.0.serialize(serializer),
7074 }
7075 }
7076 }
7077
7078 impl<'de> serde::de::Deserialize<'de> for AssetType {
7079 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7080 where
7081 D: serde::Deserializer<'de>,
7082 {
7083 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AssetType>::new(
7084 ".google.cloud.baremetalsolution.v2.ProvisioningQuota.AssetType",
7085 ))
7086 }
7087 }
7088
7089 /// The quota of one asset type.
7090 #[derive(Clone, Debug, PartialEq)]
7091 #[non_exhaustive]
7092 pub enum Quota {
7093 /// Instance quota.
7094 InstanceQuota(std::boxed::Box<crate::model::InstanceQuota>),
7095 }
7096
7097 /// Available quantity based on asset type.
7098 #[derive(Clone, Debug, PartialEq)]
7099 #[non_exhaustive]
7100 pub enum Availability {
7101 /// Server count.
7102 ServerCount(i64),
7103 /// Network bandwidth, Gbps
7104 NetworkBandwidth(i64),
7105 /// Storage size (GB).
7106 StorageGib(i64),
7107 }
7108}
7109
7110/// Message for requesting the list of provisioning quotas.
7111#[derive(Clone, Default, PartialEq)]
7112#[non_exhaustive]
7113pub struct ListProvisioningQuotasRequest {
7114 /// Required. Parent value for ListProvisioningQuotasRequest.
7115 pub parent: std::string::String,
7116
7117 /// Requested page size. The server might return fewer items than requested.
7118 /// If unspecified, server will pick an appropriate default.
7119 /// Notice that page_size field is not supported and won't be respected in
7120 /// the API request for now, will be updated when pagination is supported.
7121 pub page_size: i32,
7122
7123 /// A token identifying a page of results from the server.
7124 pub page_token: std::string::String,
7125
7126 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7127}
7128
7129impl ListProvisioningQuotasRequest {
7130 pub fn new() -> Self {
7131 std::default::Default::default()
7132 }
7133
7134 /// Sets the value of [parent][crate::model::ListProvisioningQuotasRequest::parent].
7135 ///
7136 /// # Example
7137 /// ```ignore,no_run
7138 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7139 /// let x = ListProvisioningQuotasRequest::new().set_parent("example");
7140 /// ```
7141 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7142 self.parent = v.into();
7143 self
7144 }
7145
7146 /// Sets the value of [page_size][crate::model::ListProvisioningQuotasRequest::page_size].
7147 ///
7148 /// # Example
7149 /// ```ignore,no_run
7150 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7151 /// let x = ListProvisioningQuotasRequest::new().set_page_size(42);
7152 /// ```
7153 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7154 self.page_size = v.into();
7155 self
7156 }
7157
7158 /// Sets the value of [page_token][crate::model::ListProvisioningQuotasRequest::page_token].
7159 ///
7160 /// # Example
7161 /// ```ignore,no_run
7162 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7163 /// let x = ListProvisioningQuotasRequest::new().set_page_token("example");
7164 /// ```
7165 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7166 self.page_token = v.into();
7167 self
7168 }
7169}
7170
7171impl wkt::message::Message for ListProvisioningQuotasRequest {
7172 fn typename() -> &'static str {
7173 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasRequest"
7174 }
7175}
7176
7177/// Response message for the list of provisioning quotas.
7178#[derive(Clone, Default, PartialEq)]
7179#[non_exhaustive]
7180pub struct ListProvisioningQuotasResponse {
7181 /// The provisioning quotas registered in this project.
7182 pub provisioning_quotas: std::vec::Vec<crate::model::ProvisioningQuota>,
7183
7184 /// Token to retrieve the next page of results, or empty if there are no more
7185 /// results in the list.
7186 pub next_page_token: std::string::String,
7187
7188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7189}
7190
7191impl ListProvisioningQuotasResponse {
7192 pub fn new() -> Self {
7193 std::default::Default::default()
7194 }
7195
7196 /// Sets the value of [provisioning_quotas][crate::model::ListProvisioningQuotasResponse::provisioning_quotas].
7197 ///
7198 /// # Example
7199 /// ```ignore,no_run
7200 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7201 /// use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7202 /// let x = ListProvisioningQuotasResponse::new()
7203 /// .set_provisioning_quotas([
7204 /// ProvisioningQuota::default()/* use setters */,
7205 /// ProvisioningQuota::default()/* use (different) setters */,
7206 /// ]);
7207 /// ```
7208 pub fn set_provisioning_quotas<T, V>(mut self, v: T) -> Self
7209 where
7210 T: std::iter::IntoIterator<Item = V>,
7211 V: std::convert::Into<crate::model::ProvisioningQuota>,
7212 {
7213 use std::iter::Iterator;
7214 self.provisioning_quotas = v.into_iter().map(|i| i.into()).collect();
7215 self
7216 }
7217
7218 /// Sets the value of [next_page_token][crate::model::ListProvisioningQuotasResponse::next_page_token].
7219 ///
7220 /// # Example
7221 /// ```ignore,no_run
7222 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7223 /// let x = ListProvisioningQuotasResponse::new().set_next_page_token("example");
7224 /// ```
7225 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7226 self.next_page_token = v.into();
7227 self
7228 }
7229}
7230
7231impl wkt::message::Message for ListProvisioningQuotasResponse {
7232 fn typename() -> &'static str {
7233 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasResponse"
7234 }
7235}
7236
7237#[doc(hidden)]
7238impl google_cloud_gax::paginator::internal::PageableResponse for ListProvisioningQuotasResponse {
7239 type PageItem = crate::model::ProvisioningQuota;
7240
7241 fn items(self) -> std::vec::Vec<Self::PageItem> {
7242 self.provisioning_quotas
7243 }
7244
7245 fn next_page_token(&self) -> std::string::String {
7246 use std::clone::Clone;
7247 self.next_page_token.clone()
7248 }
7249}
7250
7251/// Configuration parameters for a new instance.
7252#[derive(Clone, Default, PartialEq)]
7253#[non_exhaustive]
7254pub struct InstanceConfig {
7255 /// Output only. The name of the instance config.
7256 pub name: std::string::String,
7257
7258 /// A transient unique identifier to idenfity an instance within an
7259 /// ProvisioningConfig request.
7260 pub id: std::string::String,
7261
7262 /// Instance type.
7263 /// [Available
7264 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7265 pub instance_type: std::string::String,
7266
7267 /// Whether the instance should be provisioned with Hyperthreading enabled.
7268 pub hyperthreading: bool,
7269
7270 /// OS image to initialize the instance.
7271 /// [Available
7272 /// images](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7273 pub os_image: std::string::String,
7274
7275 /// Client network address. Filled if InstanceConfig.multivlan_config is false.
7276 #[deprecated]
7277 pub client_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7278
7279 /// Private network address, if any. Filled if InstanceConfig.multivlan_config
7280 /// is false.
7281 #[deprecated]
7282 pub private_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7283
7284 /// User note field, it can be used by customers to add additional information
7285 /// for the BMS Ops team .
7286 pub user_note: std::string::String,
7287
7288 /// If true networks can be from different projects of the same vendor account.
7289 pub account_networks_enabled: bool,
7290
7291 /// The type of network configuration on the instance.
7292 pub network_config: crate::model::instance_config::NetworkConfig,
7293
7294 /// Server network template name. Filled if InstanceConfig.multivlan_config is
7295 /// true.
7296 pub network_template: std::string::String,
7297
7298 /// List of logical interfaces for the instance. The number of logical
7299 /// interfaces will be the same as number of hardware bond/nic on the chosen
7300 /// network template. Filled if InstanceConfig.multivlan_config is true.
7301 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
7302
7303 /// List of names of ssh keys used to provision the instance.
7304 pub ssh_key_names: std::vec::Vec<std::string::String>,
7305
7306 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7307}
7308
7309impl InstanceConfig {
7310 pub fn new() -> Self {
7311 std::default::Default::default()
7312 }
7313
7314 /// Sets the value of [name][crate::model::InstanceConfig::name].
7315 ///
7316 /// # Example
7317 /// ```ignore,no_run
7318 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7319 /// let x = InstanceConfig::new().set_name("example");
7320 /// ```
7321 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7322 self.name = v.into();
7323 self
7324 }
7325
7326 /// Sets the value of [id][crate::model::InstanceConfig::id].
7327 ///
7328 /// # Example
7329 /// ```ignore,no_run
7330 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7331 /// let x = InstanceConfig::new().set_id("example");
7332 /// ```
7333 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7334 self.id = v.into();
7335 self
7336 }
7337
7338 /// Sets the value of [instance_type][crate::model::InstanceConfig::instance_type].
7339 ///
7340 /// # Example
7341 /// ```ignore,no_run
7342 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7343 /// let x = InstanceConfig::new().set_instance_type("example");
7344 /// ```
7345 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7346 self.instance_type = v.into();
7347 self
7348 }
7349
7350 /// Sets the value of [hyperthreading][crate::model::InstanceConfig::hyperthreading].
7351 ///
7352 /// # Example
7353 /// ```ignore,no_run
7354 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7355 /// let x = InstanceConfig::new().set_hyperthreading(true);
7356 /// ```
7357 pub fn set_hyperthreading<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7358 self.hyperthreading = v.into();
7359 self
7360 }
7361
7362 /// Sets the value of [os_image][crate::model::InstanceConfig::os_image].
7363 ///
7364 /// # Example
7365 /// ```ignore,no_run
7366 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7367 /// let x = InstanceConfig::new().set_os_image("example");
7368 /// ```
7369 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7370 self.os_image = v.into();
7371 self
7372 }
7373
7374 /// Sets the value of [client_network][crate::model::InstanceConfig::client_network].
7375 ///
7376 /// # Example
7377 /// ```ignore,no_run
7378 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7379 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7380 /// let x = InstanceConfig::new().set_client_network(NetworkAddress::default()/* use setters */);
7381 /// ```
7382 #[deprecated]
7383 pub fn set_client_network<T>(mut self, v: T) -> Self
7384 where
7385 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7386 {
7387 self.client_network = std::option::Option::Some(v.into());
7388 self
7389 }
7390
7391 /// Sets or clears the value of [client_network][crate::model::InstanceConfig::client_network].
7392 ///
7393 /// # Example
7394 /// ```ignore,no_run
7395 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7396 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7397 /// let x = InstanceConfig::new().set_or_clear_client_network(Some(NetworkAddress::default()/* use setters */));
7398 /// let x = InstanceConfig::new().set_or_clear_client_network(None::<NetworkAddress>);
7399 /// ```
7400 #[deprecated]
7401 pub fn set_or_clear_client_network<T>(mut self, v: std::option::Option<T>) -> Self
7402 where
7403 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7404 {
7405 self.client_network = v.map(|x| x.into());
7406 self
7407 }
7408
7409 /// Sets the value of [private_network][crate::model::InstanceConfig::private_network].
7410 ///
7411 /// # Example
7412 /// ```ignore,no_run
7413 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7414 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7415 /// let x = InstanceConfig::new().set_private_network(NetworkAddress::default()/* use setters */);
7416 /// ```
7417 #[deprecated]
7418 pub fn set_private_network<T>(mut self, v: T) -> Self
7419 where
7420 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7421 {
7422 self.private_network = std::option::Option::Some(v.into());
7423 self
7424 }
7425
7426 /// Sets or clears the value of [private_network][crate::model::InstanceConfig::private_network].
7427 ///
7428 /// # Example
7429 /// ```ignore,no_run
7430 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7431 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7432 /// let x = InstanceConfig::new().set_or_clear_private_network(Some(NetworkAddress::default()/* use setters */));
7433 /// let x = InstanceConfig::new().set_or_clear_private_network(None::<NetworkAddress>);
7434 /// ```
7435 #[deprecated]
7436 pub fn set_or_clear_private_network<T>(mut self, v: std::option::Option<T>) -> Self
7437 where
7438 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7439 {
7440 self.private_network = v.map(|x| x.into());
7441 self
7442 }
7443
7444 /// Sets the value of [user_note][crate::model::InstanceConfig::user_note].
7445 ///
7446 /// # Example
7447 /// ```ignore,no_run
7448 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7449 /// let x = InstanceConfig::new().set_user_note("example");
7450 /// ```
7451 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7452 self.user_note = v.into();
7453 self
7454 }
7455
7456 /// Sets the value of [account_networks_enabled][crate::model::InstanceConfig::account_networks_enabled].
7457 ///
7458 /// # Example
7459 /// ```ignore,no_run
7460 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7461 /// let x = InstanceConfig::new().set_account_networks_enabled(true);
7462 /// ```
7463 pub fn set_account_networks_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7464 self.account_networks_enabled = v.into();
7465 self
7466 }
7467
7468 /// Sets the value of [network_config][crate::model::InstanceConfig::network_config].
7469 ///
7470 /// # Example
7471 /// ```ignore,no_run
7472 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7473 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkConfig;
7474 /// let x0 = InstanceConfig::new().set_network_config(NetworkConfig::SingleVlan);
7475 /// let x1 = InstanceConfig::new().set_network_config(NetworkConfig::MultiVlan);
7476 /// ```
7477 pub fn set_network_config<
7478 T: std::convert::Into<crate::model::instance_config::NetworkConfig>,
7479 >(
7480 mut self,
7481 v: T,
7482 ) -> Self {
7483 self.network_config = v.into();
7484 self
7485 }
7486
7487 /// Sets the value of [network_template][crate::model::InstanceConfig::network_template].
7488 ///
7489 /// # Example
7490 /// ```ignore,no_run
7491 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7492 /// let x = InstanceConfig::new().set_network_template("example");
7493 /// ```
7494 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
7495 mut self,
7496 v: T,
7497 ) -> Self {
7498 self.network_template = v.into();
7499 self
7500 }
7501
7502 /// Sets the value of [logical_interfaces][crate::model::InstanceConfig::logical_interfaces].
7503 ///
7504 /// # Example
7505 /// ```ignore,no_run
7506 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7507 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
7508 /// let x = InstanceConfig::new()
7509 /// .set_logical_interfaces([
7510 /// LogicalInterface::default()/* use setters */,
7511 /// LogicalInterface::default()/* use (different) setters */,
7512 /// ]);
7513 /// ```
7514 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
7515 where
7516 T: std::iter::IntoIterator<Item = V>,
7517 V: std::convert::Into<crate::model::LogicalInterface>,
7518 {
7519 use std::iter::Iterator;
7520 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
7521 self
7522 }
7523
7524 /// Sets the value of [ssh_key_names][crate::model::InstanceConfig::ssh_key_names].
7525 ///
7526 /// # Example
7527 /// ```ignore,no_run
7528 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7529 /// let x = InstanceConfig::new().set_ssh_key_names(["a", "b", "c"]);
7530 /// ```
7531 pub fn set_ssh_key_names<T, V>(mut self, v: T) -> Self
7532 where
7533 T: std::iter::IntoIterator<Item = V>,
7534 V: std::convert::Into<std::string::String>,
7535 {
7536 use std::iter::Iterator;
7537 self.ssh_key_names = v.into_iter().map(|i| i.into()).collect();
7538 self
7539 }
7540}
7541
7542impl wkt::message::Message for InstanceConfig {
7543 fn typename() -> &'static str {
7544 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig"
7545 }
7546}
7547
7548/// Defines additional types related to [InstanceConfig].
7549pub mod instance_config {
7550 #[allow(unused_imports)]
7551 use super::*;
7552
7553 /// A network.
7554 #[derive(Clone, Default, PartialEq)]
7555 #[non_exhaustive]
7556 pub struct NetworkAddress {
7557 /// Id of the network to use, within the same ProvisioningConfig request.
7558 pub network_id: std::string::String,
7559
7560 /// IPv4 address to be assigned to the server.
7561 pub address: std::string::String,
7562
7563 /// Name of the existing network to use.
7564 pub existing_network_id: std::string::String,
7565
7566 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7567 }
7568
7569 impl NetworkAddress {
7570 pub fn new() -> Self {
7571 std::default::Default::default()
7572 }
7573
7574 /// Sets the value of [network_id][crate::model::instance_config::NetworkAddress::network_id].
7575 ///
7576 /// # Example
7577 /// ```ignore,no_run
7578 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7579 /// let x = NetworkAddress::new().set_network_id("example");
7580 /// ```
7581 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7582 self.network_id = v.into();
7583 self
7584 }
7585
7586 /// Sets the value of [address][crate::model::instance_config::NetworkAddress::address].
7587 ///
7588 /// # Example
7589 /// ```ignore,no_run
7590 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7591 /// let x = NetworkAddress::new().set_address("example");
7592 /// ```
7593 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7594 self.address = v.into();
7595 self
7596 }
7597
7598 /// Sets the value of [existing_network_id][crate::model::instance_config::NetworkAddress::existing_network_id].
7599 ///
7600 /// # Example
7601 /// ```ignore,no_run
7602 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7603 /// let x = NetworkAddress::new().set_existing_network_id("example");
7604 /// ```
7605 pub fn set_existing_network_id<T: std::convert::Into<std::string::String>>(
7606 mut self,
7607 v: T,
7608 ) -> Self {
7609 self.existing_network_id = v.into();
7610 self
7611 }
7612 }
7613
7614 impl wkt::message::Message for NetworkAddress {
7615 fn typename() -> &'static str {
7616 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig.NetworkAddress"
7617 }
7618 }
7619
7620 /// The network configuration of the instance.
7621 ///
7622 /// # Working with unknown values
7623 ///
7624 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7625 /// additional enum variants at any time. Adding new variants is not considered
7626 /// a breaking change. Applications should write their code in anticipation of:
7627 ///
7628 /// - New values appearing in future releases of the client library, **and**
7629 /// - New values received dynamically, without application changes.
7630 ///
7631 /// Please consult the [Working with enums] section in the user guide for some
7632 /// guidelines.
7633 ///
7634 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7635 #[derive(Clone, Debug, PartialEq)]
7636 #[non_exhaustive]
7637 pub enum NetworkConfig {
7638 /// The unspecified network configuration.
7639 NetworkconfigUnspecified,
7640 /// Instance part of single client network and single private network.
7641 SingleVlan,
7642 /// Instance part of multiple (or single) client networks and private
7643 /// networks.
7644 MultiVlan,
7645 /// If set, the enum was initialized with an unknown value.
7646 ///
7647 /// Applications can examine the value using [NetworkConfig::value] or
7648 /// [NetworkConfig::name].
7649 UnknownValue(network_config::UnknownValue),
7650 }
7651
7652 #[doc(hidden)]
7653 pub mod network_config {
7654 #[allow(unused_imports)]
7655 use super::*;
7656 #[derive(Clone, Debug, PartialEq)]
7657 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7658 }
7659
7660 impl NetworkConfig {
7661 /// Gets the enum value.
7662 ///
7663 /// Returns `None` if the enum contains an unknown value deserialized from
7664 /// the string representation of enums.
7665 pub fn value(&self) -> std::option::Option<i32> {
7666 match self {
7667 Self::NetworkconfigUnspecified => std::option::Option::Some(0),
7668 Self::SingleVlan => std::option::Option::Some(1),
7669 Self::MultiVlan => std::option::Option::Some(2),
7670 Self::UnknownValue(u) => u.0.value(),
7671 }
7672 }
7673
7674 /// Gets the enum value as a string.
7675 ///
7676 /// Returns `None` if the enum contains an unknown value deserialized from
7677 /// the integer representation of enums.
7678 pub fn name(&self) -> std::option::Option<&str> {
7679 match self {
7680 Self::NetworkconfigUnspecified => {
7681 std::option::Option::Some("NETWORKCONFIG_UNSPECIFIED")
7682 }
7683 Self::SingleVlan => std::option::Option::Some("SINGLE_VLAN"),
7684 Self::MultiVlan => std::option::Option::Some("MULTI_VLAN"),
7685 Self::UnknownValue(u) => u.0.name(),
7686 }
7687 }
7688 }
7689
7690 impl std::default::Default for NetworkConfig {
7691 fn default() -> Self {
7692 use std::convert::From;
7693 Self::from(0)
7694 }
7695 }
7696
7697 impl std::fmt::Display for NetworkConfig {
7698 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7699 wkt::internal::display_enum(f, self.name(), self.value())
7700 }
7701 }
7702
7703 impl std::convert::From<i32> for NetworkConfig {
7704 fn from(value: i32) -> Self {
7705 match value {
7706 0 => Self::NetworkconfigUnspecified,
7707 1 => Self::SingleVlan,
7708 2 => Self::MultiVlan,
7709 _ => Self::UnknownValue(network_config::UnknownValue(
7710 wkt::internal::UnknownEnumValue::Integer(value),
7711 )),
7712 }
7713 }
7714 }
7715
7716 impl std::convert::From<&str> for NetworkConfig {
7717 fn from(value: &str) -> Self {
7718 use std::string::ToString;
7719 match value {
7720 "NETWORKCONFIG_UNSPECIFIED" => Self::NetworkconfigUnspecified,
7721 "SINGLE_VLAN" => Self::SingleVlan,
7722 "MULTI_VLAN" => Self::MultiVlan,
7723 _ => Self::UnknownValue(network_config::UnknownValue(
7724 wkt::internal::UnknownEnumValue::String(value.to_string()),
7725 )),
7726 }
7727 }
7728 }
7729
7730 impl serde::ser::Serialize for NetworkConfig {
7731 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7732 where
7733 S: serde::Serializer,
7734 {
7735 match self {
7736 Self::NetworkconfigUnspecified => serializer.serialize_i32(0),
7737 Self::SingleVlan => serializer.serialize_i32(1),
7738 Self::MultiVlan => serializer.serialize_i32(2),
7739 Self::UnknownValue(u) => u.0.serialize(serializer),
7740 }
7741 }
7742 }
7743
7744 impl<'de> serde::de::Deserialize<'de> for NetworkConfig {
7745 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7746 where
7747 D: serde::Deserializer<'de>,
7748 {
7749 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NetworkConfig>::new(
7750 ".google.cloud.baremetalsolution.v2.InstanceConfig.NetworkConfig",
7751 ))
7752 }
7753 }
7754}
7755
7756/// Configuration parameters for a new volume.
7757#[derive(Clone, Default, PartialEq)]
7758#[non_exhaustive]
7759pub struct VolumeConfig {
7760 /// Output only. The name of the volume config.
7761 pub name: std::string::String,
7762
7763 /// A transient unique identifier to identify a volume within an
7764 /// ProvisioningConfig request.
7765 pub id: std::string::String,
7766
7767 /// Whether snapshots should be enabled.
7768 pub snapshots_enabled: bool,
7769
7770 /// The type of this Volume.
7771 pub r#type: crate::model::volume_config::Type,
7772
7773 /// Volume protocol.
7774 pub protocol: crate::model::volume_config::Protocol,
7775
7776 /// The requested size of this volume, in GB.
7777 pub size_gb: i32,
7778
7779 /// LUN ranges to be configured. Set only when protocol is PROTOCOL_FC.
7780 pub lun_ranges: std::vec::Vec<crate::model::volume_config::LunRange>,
7781
7782 /// Machine ids connected to this volume. Set only when protocol is
7783 /// PROTOCOL_FC.
7784 pub machine_ids: std::vec::Vec<std::string::String>,
7785
7786 /// NFS exports. Set only when protocol is PROTOCOL_NFS.
7787 pub nfs_exports: std::vec::Vec<crate::model::volume_config::NfsExport>,
7788
7789 /// User note field, it can be used by customers to add additional information
7790 /// for the BMS Ops team .
7791 pub user_note: std::string::String,
7792
7793 /// The GCP service of the storage volume. Available gcp_service are in
7794 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
7795 pub gcp_service: std::string::String,
7796
7797 /// Performance tier of the Volume.
7798 /// Default is SHARED.
7799 pub performance_tier: crate::model::VolumePerformanceTier,
7800
7801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7802}
7803
7804impl VolumeConfig {
7805 pub fn new() -> Self {
7806 std::default::Default::default()
7807 }
7808
7809 /// Sets the value of [name][crate::model::VolumeConfig::name].
7810 ///
7811 /// # Example
7812 /// ```ignore,no_run
7813 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7814 /// let x = VolumeConfig::new().set_name("example");
7815 /// ```
7816 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7817 self.name = v.into();
7818 self
7819 }
7820
7821 /// Sets the value of [id][crate::model::VolumeConfig::id].
7822 ///
7823 /// # Example
7824 /// ```ignore,no_run
7825 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7826 /// let x = VolumeConfig::new().set_id("example");
7827 /// ```
7828 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7829 self.id = v.into();
7830 self
7831 }
7832
7833 /// Sets the value of [snapshots_enabled][crate::model::VolumeConfig::snapshots_enabled].
7834 ///
7835 /// # Example
7836 /// ```ignore,no_run
7837 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7838 /// let x = VolumeConfig::new().set_snapshots_enabled(true);
7839 /// ```
7840 pub fn set_snapshots_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7841 self.snapshots_enabled = v.into();
7842 self
7843 }
7844
7845 /// Sets the value of [r#type][crate::model::VolumeConfig::type].
7846 ///
7847 /// # Example
7848 /// ```ignore,no_run
7849 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7850 /// use google_cloud_baremetalsolution_v2::model::volume_config::Type;
7851 /// let x0 = VolumeConfig::new().set_type(Type::Flash);
7852 /// let x1 = VolumeConfig::new().set_type(Type::Disk);
7853 /// ```
7854 pub fn set_type<T: std::convert::Into<crate::model::volume_config::Type>>(
7855 mut self,
7856 v: T,
7857 ) -> Self {
7858 self.r#type = v.into();
7859 self
7860 }
7861
7862 /// Sets the value of [protocol][crate::model::VolumeConfig::protocol].
7863 ///
7864 /// # Example
7865 /// ```ignore,no_run
7866 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7867 /// use google_cloud_baremetalsolution_v2::model::volume_config::Protocol;
7868 /// let x0 = VolumeConfig::new().set_protocol(Protocol::Fc);
7869 /// let x1 = VolumeConfig::new().set_protocol(Protocol::Nfs);
7870 /// ```
7871 pub fn set_protocol<T: std::convert::Into<crate::model::volume_config::Protocol>>(
7872 mut self,
7873 v: T,
7874 ) -> Self {
7875 self.protocol = v.into();
7876 self
7877 }
7878
7879 /// Sets the value of [size_gb][crate::model::VolumeConfig::size_gb].
7880 ///
7881 /// # Example
7882 /// ```ignore,no_run
7883 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7884 /// let x = VolumeConfig::new().set_size_gb(42);
7885 /// ```
7886 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7887 self.size_gb = v.into();
7888 self
7889 }
7890
7891 /// Sets the value of [lun_ranges][crate::model::VolumeConfig::lun_ranges].
7892 ///
7893 /// # Example
7894 /// ```ignore,no_run
7895 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7896 /// use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
7897 /// let x = VolumeConfig::new()
7898 /// .set_lun_ranges([
7899 /// LunRange::default()/* use setters */,
7900 /// LunRange::default()/* use (different) setters */,
7901 /// ]);
7902 /// ```
7903 pub fn set_lun_ranges<T, V>(mut self, v: T) -> Self
7904 where
7905 T: std::iter::IntoIterator<Item = V>,
7906 V: std::convert::Into<crate::model::volume_config::LunRange>,
7907 {
7908 use std::iter::Iterator;
7909 self.lun_ranges = v.into_iter().map(|i| i.into()).collect();
7910 self
7911 }
7912
7913 /// Sets the value of [machine_ids][crate::model::VolumeConfig::machine_ids].
7914 ///
7915 /// # Example
7916 /// ```ignore,no_run
7917 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7918 /// let x = VolumeConfig::new().set_machine_ids(["a", "b", "c"]);
7919 /// ```
7920 pub fn set_machine_ids<T, V>(mut self, v: T) -> Self
7921 where
7922 T: std::iter::IntoIterator<Item = V>,
7923 V: std::convert::Into<std::string::String>,
7924 {
7925 use std::iter::Iterator;
7926 self.machine_ids = v.into_iter().map(|i| i.into()).collect();
7927 self
7928 }
7929
7930 /// Sets the value of [nfs_exports][crate::model::VolumeConfig::nfs_exports].
7931 ///
7932 /// # Example
7933 /// ```ignore,no_run
7934 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7935 /// use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
7936 /// let x = VolumeConfig::new()
7937 /// .set_nfs_exports([
7938 /// NfsExport::default()/* use setters */,
7939 /// NfsExport::default()/* use (different) setters */,
7940 /// ]);
7941 /// ```
7942 pub fn set_nfs_exports<T, V>(mut self, v: T) -> Self
7943 where
7944 T: std::iter::IntoIterator<Item = V>,
7945 V: std::convert::Into<crate::model::volume_config::NfsExport>,
7946 {
7947 use std::iter::Iterator;
7948 self.nfs_exports = v.into_iter().map(|i| i.into()).collect();
7949 self
7950 }
7951
7952 /// Sets the value of [user_note][crate::model::VolumeConfig::user_note].
7953 ///
7954 /// # Example
7955 /// ```ignore,no_run
7956 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7957 /// let x = VolumeConfig::new().set_user_note("example");
7958 /// ```
7959 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7960 self.user_note = v.into();
7961 self
7962 }
7963
7964 /// Sets the value of [gcp_service][crate::model::VolumeConfig::gcp_service].
7965 ///
7966 /// # Example
7967 /// ```ignore,no_run
7968 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7969 /// let x = VolumeConfig::new().set_gcp_service("example");
7970 /// ```
7971 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7972 self.gcp_service = v.into();
7973 self
7974 }
7975
7976 /// Sets the value of [performance_tier][crate::model::VolumeConfig::performance_tier].
7977 ///
7978 /// # Example
7979 /// ```ignore,no_run
7980 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7981 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
7982 /// let x0 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Shared);
7983 /// let x1 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Assigned);
7984 /// let x2 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Ht);
7985 /// ```
7986 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
7987 mut self,
7988 v: T,
7989 ) -> Self {
7990 self.performance_tier = v.into();
7991 self
7992 }
7993}
7994
7995impl wkt::message::Message for VolumeConfig {
7996 fn typename() -> &'static str {
7997 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig"
7998 }
7999}
8000
8001/// Defines additional types related to [VolumeConfig].
8002pub mod volume_config {
8003 #[allow(unused_imports)]
8004 use super::*;
8005
8006 /// A LUN(Logical Unit Number) range.
8007 #[derive(Clone, Default, PartialEq)]
8008 #[non_exhaustive]
8009 pub struct LunRange {
8010 /// Number of LUNs to create.
8011 pub quantity: i32,
8012
8013 /// The requested size of each LUN, in GB.
8014 pub size_gb: i32,
8015
8016 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8017 }
8018
8019 impl LunRange {
8020 pub fn new() -> Self {
8021 std::default::Default::default()
8022 }
8023
8024 /// Sets the value of [quantity][crate::model::volume_config::LunRange::quantity].
8025 ///
8026 /// # Example
8027 /// ```ignore,no_run
8028 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8029 /// let x = LunRange::new().set_quantity(42);
8030 /// ```
8031 pub fn set_quantity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8032 self.quantity = v.into();
8033 self
8034 }
8035
8036 /// Sets the value of [size_gb][crate::model::volume_config::LunRange::size_gb].
8037 ///
8038 /// # Example
8039 /// ```ignore,no_run
8040 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8041 /// let x = LunRange::new().set_size_gb(42);
8042 /// ```
8043 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8044 self.size_gb = v.into();
8045 self
8046 }
8047 }
8048
8049 impl wkt::message::Message for LunRange {
8050 fn typename() -> &'static str {
8051 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.LunRange"
8052 }
8053 }
8054
8055 /// A NFS export entry.
8056 #[derive(Clone, Default, PartialEq)]
8057 #[non_exhaustive]
8058 pub struct NfsExport {
8059 /// Network to use to publish the export.
8060 pub network_id: std::string::String,
8061
8062 /// Export permissions.
8063 pub permissions: crate::model::volume_config::nfs_export::Permissions,
8064
8065 /// Disable root squashing, which is a feature of NFS.
8066 /// Root squash is a special mapping of the remote superuser (root) identity
8067 /// when using identity authentication.
8068 pub no_root_squash: bool,
8069
8070 /// Allow the setuid flag.
8071 pub allow_suid: bool,
8072
8073 /// Allow dev flag in NfsShare AllowedClientsRequest.
8074 pub allow_dev: bool,
8075
8076 /// A client object.
8077 pub client: std::option::Option<crate::model::volume_config::nfs_export::Client>,
8078
8079 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8080 }
8081
8082 impl NfsExport {
8083 pub fn new() -> Self {
8084 std::default::Default::default()
8085 }
8086
8087 /// Sets the value of [network_id][crate::model::volume_config::NfsExport::network_id].
8088 ///
8089 /// # Example
8090 /// ```ignore,no_run
8091 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8092 /// let x = NfsExport::new().set_network_id("example");
8093 /// ```
8094 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8095 self.network_id = v.into();
8096 self
8097 }
8098
8099 /// Sets the value of [permissions][crate::model::volume_config::NfsExport::permissions].
8100 ///
8101 /// # Example
8102 /// ```ignore,no_run
8103 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8104 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Permissions;
8105 /// let x0 = NfsExport::new().set_permissions(Permissions::ReadOnly);
8106 /// let x1 = NfsExport::new().set_permissions(Permissions::ReadWrite);
8107 /// ```
8108 pub fn set_permissions<
8109 T: std::convert::Into<crate::model::volume_config::nfs_export::Permissions>,
8110 >(
8111 mut self,
8112 v: T,
8113 ) -> Self {
8114 self.permissions = v.into();
8115 self
8116 }
8117
8118 /// Sets the value of [no_root_squash][crate::model::volume_config::NfsExport::no_root_squash].
8119 ///
8120 /// # Example
8121 /// ```ignore,no_run
8122 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8123 /// let x = NfsExport::new().set_no_root_squash(true);
8124 /// ```
8125 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8126 self.no_root_squash = v.into();
8127 self
8128 }
8129
8130 /// Sets the value of [allow_suid][crate::model::volume_config::NfsExport::allow_suid].
8131 ///
8132 /// # Example
8133 /// ```ignore,no_run
8134 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8135 /// let x = NfsExport::new().set_allow_suid(true);
8136 /// ```
8137 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8138 self.allow_suid = v.into();
8139 self
8140 }
8141
8142 /// Sets the value of [allow_dev][crate::model::volume_config::NfsExport::allow_dev].
8143 ///
8144 /// # Example
8145 /// ```ignore,no_run
8146 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8147 /// let x = NfsExport::new().set_allow_dev(true);
8148 /// ```
8149 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8150 self.allow_dev = v.into();
8151 self
8152 }
8153
8154 /// Sets the value of [client][crate::model::volume_config::NfsExport::client].
8155 ///
8156 /// Note that all the setters affecting `client` are mutually
8157 /// exclusive.
8158 ///
8159 /// # Example
8160 /// ```ignore,no_run
8161 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8162 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Client;
8163 /// let x = NfsExport::new().set_client(Some(Client::MachineId("example".to_string())));
8164 /// ```
8165 pub fn set_client<
8166 T: std::convert::Into<
8167 std::option::Option<crate::model::volume_config::nfs_export::Client>,
8168 >,
8169 >(
8170 mut self,
8171 v: T,
8172 ) -> Self {
8173 self.client = v.into();
8174 self
8175 }
8176
8177 /// The value of [client][crate::model::volume_config::NfsExport::client]
8178 /// if it holds a `MachineId`, `None` if the field is not set or
8179 /// holds a different branch.
8180 pub fn machine_id(&self) -> std::option::Option<&std::string::String> {
8181 #[allow(unreachable_patterns)]
8182 self.client.as_ref().and_then(|v| match v {
8183 crate::model::volume_config::nfs_export::Client::MachineId(v) => {
8184 std::option::Option::Some(v)
8185 }
8186 _ => std::option::Option::None,
8187 })
8188 }
8189
8190 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8191 /// to hold a `MachineId`.
8192 ///
8193 /// Note that all the setters affecting `client` are
8194 /// mutually exclusive.
8195 ///
8196 /// # Example
8197 /// ```ignore,no_run
8198 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8199 /// let x = NfsExport::new().set_machine_id("example");
8200 /// assert!(x.machine_id().is_some());
8201 /// assert!(x.cidr().is_none());
8202 /// ```
8203 pub fn set_machine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8204 self.client = std::option::Option::Some(
8205 crate::model::volume_config::nfs_export::Client::MachineId(v.into()),
8206 );
8207 self
8208 }
8209
8210 /// The value of [client][crate::model::volume_config::NfsExport::client]
8211 /// if it holds a `Cidr`, `None` if the field is not set or
8212 /// holds a different branch.
8213 pub fn cidr(&self) -> std::option::Option<&std::string::String> {
8214 #[allow(unreachable_patterns)]
8215 self.client.as_ref().and_then(|v| match v {
8216 crate::model::volume_config::nfs_export::Client::Cidr(v) => {
8217 std::option::Option::Some(v)
8218 }
8219 _ => std::option::Option::None,
8220 })
8221 }
8222
8223 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8224 /// to hold a `Cidr`.
8225 ///
8226 /// Note that all the setters affecting `client` are
8227 /// mutually exclusive.
8228 ///
8229 /// # Example
8230 /// ```ignore,no_run
8231 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8232 /// let x = NfsExport::new().set_cidr("example");
8233 /// assert!(x.cidr().is_some());
8234 /// assert!(x.machine_id().is_none());
8235 /// ```
8236 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8237 self.client = std::option::Option::Some(
8238 crate::model::volume_config::nfs_export::Client::Cidr(v.into()),
8239 );
8240 self
8241 }
8242 }
8243
8244 impl wkt::message::Message for NfsExport {
8245 fn typename() -> &'static str {
8246 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport"
8247 }
8248 }
8249
8250 /// Defines additional types related to [NfsExport].
8251 pub mod nfs_export {
8252 #[allow(unused_imports)]
8253 use super::*;
8254
8255 /// Permissions that can granted for an export.
8256 ///
8257 /// # Working with unknown values
8258 ///
8259 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8260 /// additional enum variants at any time. Adding new variants is not considered
8261 /// a breaking change. Applications should write their code in anticipation of:
8262 ///
8263 /// - New values appearing in future releases of the client library, **and**
8264 /// - New values received dynamically, without application changes.
8265 ///
8266 /// Please consult the [Working with enums] section in the user guide for some
8267 /// guidelines.
8268 ///
8269 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8270 #[derive(Clone, Debug, PartialEq)]
8271 #[non_exhaustive]
8272 pub enum Permissions {
8273 /// Unspecified value.
8274 Unspecified,
8275 /// Read-only permission.
8276 ReadOnly,
8277 /// Read-write permission.
8278 ReadWrite,
8279 /// If set, the enum was initialized with an unknown value.
8280 ///
8281 /// Applications can examine the value using [Permissions::value] or
8282 /// [Permissions::name].
8283 UnknownValue(permissions::UnknownValue),
8284 }
8285
8286 #[doc(hidden)]
8287 pub mod permissions {
8288 #[allow(unused_imports)]
8289 use super::*;
8290 #[derive(Clone, Debug, PartialEq)]
8291 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8292 }
8293
8294 impl Permissions {
8295 /// Gets the enum value.
8296 ///
8297 /// Returns `None` if the enum contains an unknown value deserialized from
8298 /// the string representation of enums.
8299 pub fn value(&self) -> std::option::Option<i32> {
8300 match self {
8301 Self::Unspecified => std::option::Option::Some(0),
8302 Self::ReadOnly => std::option::Option::Some(1),
8303 Self::ReadWrite => std::option::Option::Some(2),
8304 Self::UnknownValue(u) => u.0.value(),
8305 }
8306 }
8307
8308 /// Gets the enum value as a string.
8309 ///
8310 /// Returns `None` if the enum contains an unknown value deserialized from
8311 /// the integer representation of enums.
8312 pub fn name(&self) -> std::option::Option<&str> {
8313 match self {
8314 Self::Unspecified => std::option::Option::Some("PERMISSIONS_UNSPECIFIED"),
8315 Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
8316 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
8317 Self::UnknownValue(u) => u.0.name(),
8318 }
8319 }
8320 }
8321
8322 impl std::default::Default for Permissions {
8323 fn default() -> Self {
8324 use std::convert::From;
8325 Self::from(0)
8326 }
8327 }
8328
8329 impl std::fmt::Display for Permissions {
8330 fn fmt(
8331 &self,
8332 f: &mut std::fmt::Formatter<'_>,
8333 ) -> std::result::Result<(), std::fmt::Error> {
8334 wkt::internal::display_enum(f, self.name(), self.value())
8335 }
8336 }
8337
8338 impl std::convert::From<i32> for Permissions {
8339 fn from(value: i32) -> Self {
8340 match value {
8341 0 => Self::Unspecified,
8342 1 => Self::ReadOnly,
8343 2 => Self::ReadWrite,
8344 _ => Self::UnknownValue(permissions::UnknownValue(
8345 wkt::internal::UnknownEnumValue::Integer(value),
8346 )),
8347 }
8348 }
8349 }
8350
8351 impl std::convert::From<&str> for Permissions {
8352 fn from(value: &str) -> Self {
8353 use std::string::ToString;
8354 match value {
8355 "PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
8356 "READ_ONLY" => Self::ReadOnly,
8357 "READ_WRITE" => Self::ReadWrite,
8358 _ => Self::UnknownValue(permissions::UnknownValue(
8359 wkt::internal::UnknownEnumValue::String(value.to_string()),
8360 )),
8361 }
8362 }
8363 }
8364
8365 impl serde::ser::Serialize for Permissions {
8366 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8367 where
8368 S: serde::Serializer,
8369 {
8370 match self {
8371 Self::Unspecified => serializer.serialize_i32(0),
8372 Self::ReadOnly => serializer.serialize_i32(1),
8373 Self::ReadWrite => serializer.serialize_i32(2),
8374 Self::UnknownValue(u) => u.0.serialize(serializer),
8375 }
8376 }
8377 }
8378
8379 impl<'de> serde::de::Deserialize<'de> for Permissions {
8380 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8381 where
8382 D: serde::Deserializer<'de>,
8383 {
8384 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Permissions>::new(
8385 ".google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport.Permissions",
8386 ))
8387 }
8388 }
8389
8390 /// A client object.
8391 #[derive(Clone, Debug, PartialEq)]
8392 #[non_exhaustive]
8393 pub enum Client {
8394 /// Either a single machine, identified by an ID, or a comma-separated
8395 /// list of machine IDs.
8396 MachineId(std::string::String),
8397 /// A CIDR range.
8398 Cidr(std::string::String),
8399 }
8400 }
8401
8402 /// The types of Volumes.
8403 ///
8404 /// # Working with unknown values
8405 ///
8406 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8407 /// additional enum variants at any time. Adding new variants is not considered
8408 /// a breaking change. Applications should write their code in anticipation of:
8409 ///
8410 /// - New values appearing in future releases of the client library, **and**
8411 /// - New values received dynamically, without application changes.
8412 ///
8413 /// Please consult the [Working with enums] section in the user guide for some
8414 /// guidelines.
8415 ///
8416 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8417 #[derive(Clone, Debug, PartialEq)]
8418 #[non_exhaustive]
8419 pub enum Type {
8420 /// The unspecified type.
8421 Unspecified,
8422 /// This Volume is on flash.
8423 Flash,
8424 /// This Volume is on disk.
8425 Disk,
8426 /// If set, the enum was initialized with an unknown value.
8427 ///
8428 /// Applications can examine the value using [Type::value] or
8429 /// [Type::name].
8430 UnknownValue(r#type::UnknownValue),
8431 }
8432
8433 #[doc(hidden)]
8434 pub mod r#type {
8435 #[allow(unused_imports)]
8436 use super::*;
8437 #[derive(Clone, Debug, PartialEq)]
8438 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8439 }
8440
8441 impl Type {
8442 /// Gets the enum value.
8443 ///
8444 /// Returns `None` if the enum contains an unknown value deserialized from
8445 /// the string representation of enums.
8446 pub fn value(&self) -> std::option::Option<i32> {
8447 match self {
8448 Self::Unspecified => std::option::Option::Some(0),
8449 Self::Flash => std::option::Option::Some(1),
8450 Self::Disk => std::option::Option::Some(2),
8451 Self::UnknownValue(u) => u.0.value(),
8452 }
8453 }
8454
8455 /// Gets the enum value as a string.
8456 ///
8457 /// Returns `None` if the enum contains an unknown value deserialized from
8458 /// the integer representation of enums.
8459 pub fn name(&self) -> std::option::Option<&str> {
8460 match self {
8461 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8462 Self::Flash => std::option::Option::Some("FLASH"),
8463 Self::Disk => std::option::Option::Some("DISK"),
8464 Self::UnknownValue(u) => u.0.name(),
8465 }
8466 }
8467 }
8468
8469 impl std::default::Default for Type {
8470 fn default() -> Self {
8471 use std::convert::From;
8472 Self::from(0)
8473 }
8474 }
8475
8476 impl std::fmt::Display for Type {
8477 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8478 wkt::internal::display_enum(f, self.name(), self.value())
8479 }
8480 }
8481
8482 impl std::convert::From<i32> for Type {
8483 fn from(value: i32) -> Self {
8484 match value {
8485 0 => Self::Unspecified,
8486 1 => Self::Flash,
8487 2 => Self::Disk,
8488 _ => Self::UnknownValue(r#type::UnknownValue(
8489 wkt::internal::UnknownEnumValue::Integer(value),
8490 )),
8491 }
8492 }
8493 }
8494
8495 impl std::convert::From<&str> for Type {
8496 fn from(value: &str) -> Self {
8497 use std::string::ToString;
8498 match value {
8499 "TYPE_UNSPECIFIED" => Self::Unspecified,
8500 "FLASH" => Self::Flash,
8501 "DISK" => Self::Disk,
8502 _ => Self::UnknownValue(r#type::UnknownValue(
8503 wkt::internal::UnknownEnumValue::String(value.to_string()),
8504 )),
8505 }
8506 }
8507 }
8508
8509 impl serde::ser::Serialize for Type {
8510 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8511 where
8512 S: serde::Serializer,
8513 {
8514 match self {
8515 Self::Unspecified => serializer.serialize_i32(0),
8516 Self::Flash => serializer.serialize_i32(1),
8517 Self::Disk => serializer.serialize_i32(2),
8518 Self::UnknownValue(u) => u.0.serialize(serializer),
8519 }
8520 }
8521 }
8522
8523 impl<'de> serde::de::Deserialize<'de> for Type {
8524 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8525 where
8526 D: serde::Deserializer<'de>,
8527 {
8528 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
8529 ".google.cloud.baremetalsolution.v2.VolumeConfig.Type",
8530 ))
8531 }
8532 }
8533
8534 /// The protocol used to access the volume.
8535 ///
8536 /// # Working with unknown values
8537 ///
8538 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8539 /// additional enum variants at any time. Adding new variants is not considered
8540 /// a breaking change. Applications should write their code in anticipation of:
8541 ///
8542 /// - New values appearing in future releases of the client library, **and**
8543 /// - New values received dynamically, without application changes.
8544 ///
8545 /// Please consult the [Working with enums] section in the user guide for some
8546 /// guidelines.
8547 ///
8548 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8549 #[derive(Clone, Debug, PartialEq)]
8550 #[non_exhaustive]
8551 pub enum Protocol {
8552 /// Unspecified value.
8553 Unspecified,
8554 /// Fibre channel.
8555 Fc,
8556 /// Network file system.
8557 Nfs,
8558 /// If set, the enum was initialized with an unknown value.
8559 ///
8560 /// Applications can examine the value using [Protocol::value] or
8561 /// [Protocol::name].
8562 UnknownValue(protocol::UnknownValue),
8563 }
8564
8565 #[doc(hidden)]
8566 pub mod protocol {
8567 #[allow(unused_imports)]
8568 use super::*;
8569 #[derive(Clone, Debug, PartialEq)]
8570 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8571 }
8572
8573 impl Protocol {
8574 /// Gets the enum value.
8575 ///
8576 /// Returns `None` if the enum contains an unknown value deserialized from
8577 /// the string representation of enums.
8578 pub fn value(&self) -> std::option::Option<i32> {
8579 match self {
8580 Self::Unspecified => std::option::Option::Some(0),
8581 Self::Fc => std::option::Option::Some(1),
8582 Self::Nfs => std::option::Option::Some(2),
8583 Self::UnknownValue(u) => u.0.value(),
8584 }
8585 }
8586
8587 /// Gets the enum value as a string.
8588 ///
8589 /// Returns `None` if the enum contains an unknown value deserialized from
8590 /// the integer representation of enums.
8591 pub fn name(&self) -> std::option::Option<&str> {
8592 match self {
8593 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
8594 Self::Fc => std::option::Option::Some("PROTOCOL_FC"),
8595 Self::Nfs => std::option::Option::Some("PROTOCOL_NFS"),
8596 Self::UnknownValue(u) => u.0.name(),
8597 }
8598 }
8599 }
8600
8601 impl std::default::Default for Protocol {
8602 fn default() -> Self {
8603 use std::convert::From;
8604 Self::from(0)
8605 }
8606 }
8607
8608 impl std::fmt::Display for Protocol {
8609 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8610 wkt::internal::display_enum(f, self.name(), self.value())
8611 }
8612 }
8613
8614 impl std::convert::From<i32> for Protocol {
8615 fn from(value: i32) -> Self {
8616 match value {
8617 0 => Self::Unspecified,
8618 1 => Self::Fc,
8619 2 => Self::Nfs,
8620 _ => Self::UnknownValue(protocol::UnknownValue(
8621 wkt::internal::UnknownEnumValue::Integer(value),
8622 )),
8623 }
8624 }
8625 }
8626
8627 impl std::convert::From<&str> for Protocol {
8628 fn from(value: &str) -> Self {
8629 use std::string::ToString;
8630 match value {
8631 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
8632 "PROTOCOL_FC" => Self::Fc,
8633 "PROTOCOL_NFS" => Self::Nfs,
8634 _ => Self::UnknownValue(protocol::UnknownValue(
8635 wkt::internal::UnknownEnumValue::String(value.to_string()),
8636 )),
8637 }
8638 }
8639 }
8640
8641 impl serde::ser::Serialize for Protocol {
8642 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8643 where
8644 S: serde::Serializer,
8645 {
8646 match self {
8647 Self::Unspecified => serializer.serialize_i32(0),
8648 Self::Fc => serializer.serialize_i32(1),
8649 Self::Nfs => serializer.serialize_i32(2),
8650 Self::UnknownValue(u) => u.0.serialize(serializer),
8651 }
8652 }
8653 }
8654
8655 impl<'de> serde::de::Deserialize<'de> for Protocol {
8656 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8657 where
8658 D: serde::Deserializer<'de>,
8659 {
8660 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
8661 ".google.cloud.baremetalsolution.v2.VolumeConfig.Protocol",
8662 ))
8663 }
8664 }
8665}
8666
8667/// Configuration parameters for a new network.
8668#[derive(Clone, Default, PartialEq)]
8669#[non_exhaustive]
8670pub struct NetworkConfig {
8671 /// Output only. The name of the network config.
8672 pub name: std::string::String,
8673
8674 /// A transient unique identifier to identify a volume within an
8675 /// ProvisioningConfig request.
8676 pub id: std::string::String,
8677
8678 /// The type of this network, either Client or Private.
8679 pub r#type: crate::model::network_config::Type,
8680
8681 /// Interconnect bandwidth. Set only when type is CLIENT.
8682 pub bandwidth: crate::model::network_config::Bandwidth,
8683
8684 /// List of VLAN attachments. As of now there are always 2 attachments, but it
8685 /// is going to change in the future (multi vlan).
8686 pub vlan_attachments: std::vec::Vec<crate::model::network_config::IntakeVlanAttachment>,
8687
8688 /// CIDR range of the network.
8689 pub cidr: std::string::String,
8690
8691 /// Service CIDR, if any.
8692 pub service_cidr: crate::model::network_config::ServiceCidr,
8693
8694 /// User note field, it can be used by customers to add additional information
8695 /// for the BMS Ops team .
8696 pub user_note: std::string::String,
8697
8698 /// The GCP service of the network. Available gcp_service are in
8699 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
8700 pub gcp_service: std::string::String,
8701
8702 /// Whether the VLAN attachment pair is located in the same project.
8703 pub vlan_same_project: bool,
8704
8705 /// The JumboFramesEnabled option for customer to set.
8706 pub jumbo_frames_enabled: bool,
8707
8708 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8709}
8710
8711impl NetworkConfig {
8712 pub fn new() -> Self {
8713 std::default::Default::default()
8714 }
8715
8716 /// Sets the value of [name][crate::model::NetworkConfig::name].
8717 ///
8718 /// # Example
8719 /// ```ignore,no_run
8720 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8721 /// let x = NetworkConfig::new().set_name("example");
8722 /// ```
8723 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8724 self.name = v.into();
8725 self
8726 }
8727
8728 /// Sets the value of [id][crate::model::NetworkConfig::id].
8729 ///
8730 /// # Example
8731 /// ```ignore,no_run
8732 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8733 /// let x = NetworkConfig::new().set_id("example");
8734 /// ```
8735 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8736 self.id = v.into();
8737 self
8738 }
8739
8740 /// Sets the value of [r#type][crate::model::NetworkConfig::type].
8741 ///
8742 /// # Example
8743 /// ```ignore,no_run
8744 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8745 /// use google_cloud_baremetalsolution_v2::model::network_config::Type;
8746 /// let x0 = NetworkConfig::new().set_type(Type::Client);
8747 /// let x1 = NetworkConfig::new().set_type(Type::Private);
8748 /// ```
8749 pub fn set_type<T: std::convert::Into<crate::model::network_config::Type>>(
8750 mut self,
8751 v: T,
8752 ) -> Self {
8753 self.r#type = v.into();
8754 self
8755 }
8756
8757 /// Sets the value of [bandwidth][crate::model::NetworkConfig::bandwidth].
8758 ///
8759 /// # Example
8760 /// ```ignore,no_run
8761 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8762 /// use google_cloud_baremetalsolution_v2::model::network_config::Bandwidth;
8763 /// let x0 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw1Gbps);
8764 /// let x1 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw2Gbps);
8765 /// let x2 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw5Gbps);
8766 /// ```
8767 pub fn set_bandwidth<T: std::convert::Into<crate::model::network_config::Bandwidth>>(
8768 mut self,
8769 v: T,
8770 ) -> Self {
8771 self.bandwidth = v.into();
8772 self
8773 }
8774
8775 /// Sets the value of [vlan_attachments][crate::model::NetworkConfig::vlan_attachments].
8776 ///
8777 /// # Example
8778 /// ```ignore,no_run
8779 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8780 /// use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8781 /// let x = NetworkConfig::new()
8782 /// .set_vlan_attachments([
8783 /// IntakeVlanAttachment::default()/* use setters */,
8784 /// IntakeVlanAttachment::default()/* use (different) setters */,
8785 /// ]);
8786 /// ```
8787 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
8788 where
8789 T: std::iter::IntoIterator<Item = V>,
8790 V: std::convert::Into<crate::model::network_config::IntakeVlanAttachment>,
8791 {
8792 use std::iter::Iterator;
8793 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
8794 self
8795 }
8796
8797 /// Sets the value of [cidr][crate::model::NetworkConfig::cidr].
8798 ///
8799 /// # Example
8800 /// ```ignore,no_run
8801 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8802 /// let x = NetworkConfig::new().set_cidr("example");
8803 /// ```
8804 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8805 self.cidr = v.into();
8806 self
8807 }
8808
8809 /// Sets the value of [service_cidr][crate::model::NetworkConfig::service_cidr].
8810 ///
8811 /// # Example
8812 /// ```ignore,no_run
8813 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8814 /// use google_cloud_baremetalsolution_v2::model::network_config::ServiceCidr;
8815 /// let x0 = NetworkConfig::new().set_service_cidr(ServiceCidr::Disabled);
8816 /// let x1 = NetworkConfig::new().set_service_cidr(ServiceCidr::High26);
8817 /// let x2 = NetworkConfig::new().set_service_cidr(ServiceCidr::High27);
8818 /// ```
8819 pub fn set_service_cidr<T: std::convert::Into<crate::model::network_config::ServiceCidr>>(
8820 mut self,
8821 v: T,
8822 ) -> Self {
8823 self.service_cidr = v.into();
8824 self
8825 }
8826
8827 /// Sets the value of [user_note][crate::model::NetworkConfig::user_note].
8828 ///
8829 /// # Example
8830 /// ```ignore,no_run
8831 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8832 /// let x = NetworkConfig::new().set_user_note("example");
8833 /// ```
8834 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8835 self.user_note = v.into();
8836 self
8837 }
8838
8839 /// Sets the value of [gcp_service][crate::model::NetworkConfig::gcp_service].
8840 ///
8841 /// # Example
8842 /// ```ignore,no_run
8843 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8844 /// let x = NetworkConfig::new().set_gcp_service("example");
8845 /// ```
8846 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8847 self.gcp_service = v.into();
8848 self
8849 }
8850
8851 /// Sets the value of [vlan_same_project][crate::model::NetworkConfig::vlan_same_project].
8852 ///
8853 /// # Example
8854 /// ```ignore,no_run
8855 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8856 /// let x = NetworkConfig::new().set_vlan_same_project(true);
8857 /// ```
8858 pub fn set_vlan_same_project<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8859 self.vlan_same_project = v.into();
8860 self
8861 }
8862
8863 /// Sets the value of [jumbo_frames_enabled][crate::model::NetworkConfig::jumbo_frames_enabled].
8864 ///
8865 /// # Example
8866 /// ```ignore,no_run
8867 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8868 /// let x = NetworkConfig::new().set_jumbo_frames_enabled(true);
8869 /// ```
8870 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8871 self.jumbo_frames_enabled = v.into();
8872 self
8873 }
8874}
8875
8876impl wkt::message::Message for NetworkConfig {
8877 fn typename() -> &'static str {
8878 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig"
8879 }
8880}
8881
8882/// Defines additional types related to [NetworkConfig].
8883pub mod network_config {
8884 #[allow(unused_imports)]
8885 use super::*;
8886
8887 /// A GCP vlan attachment.
8888 #[derive(Clone, Default, PartialEq)]
8889 #[non_exhaustive]
8890 pub struct IntakeVlanAttachment {
8891 /// Identifier of the VLAN attachment.
8892 pub id: std::string::String,
8893
8894 /// Attachment pairing key.
8895 pub pairing_key: std::string::String,
8896
8897 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8898 }
8899
8900 impl IntakeVlanAttachment {
8901 pub fn new() -> Self {
8902 std::default::Default::default()
8903 }
8904
8905 /// Sets the value of [id][crate::model::network_config::IntakeVlanAttachment::id].
8906 ///
8907 /// # Example
8908 /// ```ignore,no_run
8909 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8910 /// let x = IntakeVlanAttachment::new().set_id("example");
8911 /// ```
8912 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8913 self.id = v.into();
8914 self
8915 }
8916
8917 /// Sets the value of [pairing_key][crate::model::network_config::IntakeVlanAttachment::pairing_key].
8918 ///
8919 /// # Example
8920 /// ```ignore,no_run
8921 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8922 /// let x = IntakeVlanAttachment::new().set_pairing_key("example");
8923 /// ```
8924 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8925 self.pairing_key = v.into();
8926 self
8927 }
8928 }
8929
8930 impl wkt::message::Message for IntakeVlanAttachment {
8931 fn typename() -> &'static str {
8932 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig.IntakeVlanAttachment"
8933 }
8934 }
8935
8936 /// Network type.
8937 ///
8938 /// # Working with unknown values
8939 ///
8940 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8941 /// additional enum variants at any time. Adding new variants is not considered
8942 /// a breaking change. Applications should write their code in anticipation of:
8943 ///
8944 /// - New values appearing in future releases of the client library, **and**
8945 /// - New values received dynamically, without application changes.
8946 ///
8947 /// Please consult the [Working with enums] section in the user guide for some
8948 /// guidelines.
8949 ///
8950 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8951 #[derive(Clone, Debug, PartialEq)]
8952 #[non_exhaustive]
8953 pub enum Type {
8954 /// Unspecified value.
8955 Unspecified,
8956 /// Client network, that is a network peered to a GCP VPC.
8957 Client,
8958 /// Private network, that is a network local to the BMS POD.
8959 Private,
8960 /// If set, the enum was initialized with an unknown value.
8961 ///
8962 /// Applications can examine the value using [Type::value] or
8963 /// [Type::name].
8964 UnknownValue(r#type::UnknownValue),
8965 }
8966
8967 #[doc(hidden)]
8968 pub mod r#type {
8969 #[allow(unused_imports)]
8970 use super::*;
8971 #[derive(Clone, Debug, PartialEq)]
8972 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8973 }
8974
8975 impl Type {
8976 /// Gets the enum value.
8977 ///
8978 /// Returns `None` if the enum contains an unknown value deserialized from
8979 /// the string representation of enums.
8980 pub fn value(&self) -> std::option::Option<i32> {
8981 match self {
8982 Self::Unspecified => std::option::Option::Some(0),
8983 Self::Client => std::option::Option::Some(1),
8984 Self::Private => std::option::Option::Some(2),
8985 Self::UnknownValue(u) => u.0.value(),
8986 }
8987 }
8988
8989 /// Gets the enum value as a string.
8990 ///
8991 /// Returns `None` if the enum contains an unknown value deserialized from
8992 /// the integer representation of enums.
8993 pub fn name(&self) -> std::option::Option<&str> {
8994 match self {
8995 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8996 Self::Client => std::option::Option::Some("CLIENT"),
8997 Self::Private => std::option::Option::Some("PRIVATE"),
8998 Self::UnknownValue(u) => u.0.name(),
8999 }
9000 }
9001 }
9002
9003 impl std::default::Default for Type {
9004 fn default() -> Self {
9005 use std::convert::From;
9006 Self::from(0)
9007 }
9008 }
9009
9010 impl std::fmt::Display for Type {
9011 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9012 wkt::internal::display_enum(f, self.name(), self.value())
9013 }
9014 }
9015
9016 impl std::convert::From<i32> for Type {
9017 fn from(value: i32) -> Self {
9018 match value {
9019 0 => Self::Unspecified,
9020 1 => Self::Client,
9021 2 => Self::Private,
9022 _ => Self::UnknownValue(r#type::UnknownValue(
9023 wkt::internal::UnknownEnumValue::Integer(value),
9024 )),
9025 }
9026 }
9027 }
9028
9029 impl std::convert::From<&str> for Type {
9030 fn from(value: &str) -> Self {
9031 use std::string::ToString;
9032 match value {
9033 "TYPE_UNSPECIFIED" => Self::Unspecified,
9034 "CLIENT" => Self::Client,
9035 "PRIVATE" => Self::Private,
9036 _ => Self::UnknownValue(r#type::UnknownValue(
9037 wkt::internal::UnknownEnumValue::String(value.to_string()),
9038 )),
9039 }
9040 }
9041 }
9042
9043 impl serde::ser::Serialize for Type {
9044 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9045 where
9046 S: serde::Serializer,
9047 {
9048 match self {
9049 Self::Unspecified => serializer.serialize_i32(0),
9050 Self::Client => serializer.serialize_i32(1),
9051 Self::Private => serializer.serialize_i32(2),
9052 Self::UnknownValue(u) => u.0.serialize(serializer),
9053 }
9054 }
9055 }
9056
9057 impl<'de> serde::de::Deserialize<'de> for Type {
9058 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9059 where
9060 D: serde::Deserializer<'de>,
9061 {
9062 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
9063 ".google.cloud.baremetalsolution.v2.NetworkConfig.Type",
9064 ))
9065 }
9066 }
9067
9068 /// Interconnect bandwidth.
9069 ///
9070 /// # Working with unknown values
9071 ///
9072 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9073 /// additional enum variants at any time. Adding new variants is not considered
9074 /// a breaking change. Applications should write their code in anticipation of:
9075 ///
9076 /// - New values appearing in future releases of the client library, **and**
9077 /// - New values received dynamically, without application changes.
9078 ///
9079 /// Please consult the [Working with enums] section in the user guide for some
9080 /// guidelines.
9081 ///
9082 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9083 #[derive(Clone, Debug, PartialEq)]
9084 #[non_exhaustive]
9085 pub enum Bandwidth {
9086 /// Unspecified value.
9087 Unspecified,
9088 /// 1 Gbps.
9089 Bw1Gbps,
9090 /// 2 Gbps.
9091 Bw2Gbps,
9092 /// 5 Gbps.
9093 Bw5Gbps,
9094 /// 10 Gbps.
9095 Bw10Gbps,
9096 /// If set, the enum was initialized with an unknown value.
9097 ///
9098 /// Applications can examine the value using [Bandwidth::value] or
9099 /// [Bandwidth::name].
9100 UnknownValue(bandwidth::UnknownValue),
9101 }
9102
9103 #[doc(hidden)]
9104 pub mod bandwidth {
9105 #[allow(unused_imports)]
9106 use super::*;
9107 #[derive(Clone, Debug, PartialEq)]
9108 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9109 }
9110
9111 impl Bandwidth {
9112 /// Gets the enum value.
9113 ///
9114 /// Returns `None` if the enum contains an unknown value deserialized from
9115 /// the string representation of enums.
9116 pub fn value(&self) -> std::option::Option<i32> {
9117 match self {
9118 Self::Unspecified => std::option::Option::Some(0),
9119 Self::Bw1Gbps => std::option::Option::Some(1),
9120 Self::Bw2Gbps => std::option::Option::Some(2),
9121 Self::Bw5Gbps => std::option::Option::Some(3),
9122 Self::Bw10Gbps => std::option::Option::Some(4),
9123 Self::UnknownValue(u) => u.0.value(),
9124 }
9125 }
9126
9127 /// Gets the enum value as a string.
9128 ///
9129 /// Returns `None` if the enum contains an unknown value deserialized from
9130 /// the integer representation of enums.
9131 pub fn name(&self) -> std::option::Option<&str> {
9132 match self {
9133 Self::Unspecified => std::option::Option::Some("BANDWIDTH_UNSPECIFIED"),
9134 Self::Bw1Gbps => std::option::Option::Some("BW_1_GBPS"),
9135 Self::Bw2Gbps => std::option::Option::Some("BW_2_GBPS"),
9136 Self::Bw5Gbps => std::option::Option::Some("BW_5_GBPS"),
9137 Self::Bw10Gbps => std::option::Option::Some("BW_10_GBPS"),
9138 Self::UnknownValue(u) => u.0.name(),
9139 }
9140 }
9141 }
9142
9143 impl std::default::Default for Bandwidth {
9144 fn default() -> Self {
9145 use std::convert::From;
9146 Self::from(0)
9147 }
9148 }
9149
9150 impl std::fmt::Display for Bandwidth {
9151 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9152 wkt::internal::display_enum(f, self.name(), self.value())
9153 }
9154 }
9155
9156 impl std::convert::From<i32> for Bandwidth {
9157 fn from(value: i32) -> Self {
9158 match value {
9159 0 => Self::Unspecified,
9160 1 => Self::Bw1Gbps,
9161 2 => Self::Bw2Gbps,
9162 3 => Self::Bw5Gbps,
9163 4 => Self::Bw10Gbps,
9164 _ => Self::UnknownValue(bandwidth::UnknownValue(
9165 wkt::internal::UnknownEnumValue::Integer(value),
9166 )),
9167 }
9168 }
9169 }
9170
9171 impl std::convert::From<&str> for Bandwidth {
9172 fn from(value: &str) -> Self {
9173 use std::string::ToString;
9174 match value {
9175 "BANDWIDTH_UNSPECIFIED" => Self::Unspecified,
9176 "BW_1_GBPS" => Self::Bw1Gbps,
9177 "BW_2_GBPS" => Self::Bw2Gbps,
9178 "BW_5_GBPS" => Self::Bw5Gbps,
9179 "BW_10_GBPS" => Self::Bw10Gbps,
9180 _ => Self::UnknownValue(bandwidth::UnknownValue(
9181 wkt::internal::UnknownEnumValue::String(value.to_string()),
9182 )),
9183 }
9184 }
9185 }
9186
9187 impl serde::ser::Serialize for Bandwidth {
9188 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9189 where
9190 S: serde::Serializer,
9191 {
9192 match self {
9193 Self::Unspecified => serializer.serialize_i32(0),
9194 Self::Bw1Gbps => serializer.serialize_i32(1),
9195 Self::Bw2Gbps => serializer.serialize_i32(2),
9196 Self::Bw5Gbps => serializer.serialize_i32(3),
9197 Self::Bw10Gbps => serializer.serialize_i32(4),
9198 Self::UnknownValue(u) => u.0.serialize(serializer),
9199 }
9200 }
9201 }
9202
9203 impl<'de> serde::de::Deserialize<'de> for Bandwidth {
9204 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9205 where
9206 D: serde::Deserializer<'de>,
9207 {
9208 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Bandwidth>::new(
9209 ".google.cloud.baremetalsolution.v2.NetworkConfig.Bandwidth",
9210 ))
9211 }
9212 }
9213
9214 /// Service network block.
9215 ///
9216 /// # Working with unknown values
9217 ///
9218 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9219 /// additional enum variants at any time. Adding new variants is not considered
9220 /// a breaking change. Applications should write their code in anticipation of:
9221 ///
9222 /// - New values appearing in future releases of the client library, **and**
9223 /// - New values received dynamically, without application changes.
9224 ///
9225 /// Please consult the [Working with enums] section in the user guide for some
9226 /// guidelines.
9227 ///
9228 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9229 #[derive(Clone, Debug, PartialEq)]
9230 #[non_exhaustive]
9231 pub enum ServiceCidr {
9232 /// Unspecified value.
9233 Unspecified,
9234 /// Services are disabled for the given network.
9235 Disabled,
9236 /// Use the highest /26 block of the network to host services.
9237 High26,
9238 /// Use the highest /27 block of the network to host services.
9239 High27,
9240 /// Use the highest /28 block of the network to host services.
9241 High28,
9242 /// If set, the enum was initialized with an unknown value.
9243 ///
9244 /// Applications can examine the value using [ServiceCidr::value] or
9245 /// [ServiceCidr::name].
9246 UnknownValue(service_cidr::UnknownValue),
9247 }
9248
9249 #[doc(hidden)]
9250 pub mod service_cidr {
9251 #[allow(unused_imports)]
9252 use super::*;
9253 #[derive(Clone, Debug, PartialEq)]
9254 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9255 }
9256
9257 impl ServiceCidr {
9258 /// Gets the enum value.
9259 ///
9260 /// Returns `None` if the enum contains an unknown value deserialized from
9261 /// the string representation of enums.
9262 pub fn value(&self) -> std::option::Option<i32> {
9263 match self {
9264 Self::Unspecified => std::option::Option::Some(0),
9265 Self::Disabled => std::option::Option::Some(1),
9266 Self::High26 => std::option::Option::Some(2),
9267 Self::High27 => std::option::Option::Some(3),
9268 Self::High28 => std::option::Option::Some(4),
9269 Self::UnknownValue(u) => u.0.value(),
9270 }
9271 }
9272
9273 /// Gets the enum value as a string.
9274 ///
9275 /// Returns `None` if the enum contains an unknown value deserialized from
9276 /// the integer representation of enums.
9277 pub fn name(&self) -> std::option::Option<&str> {
9278 match self {
9279 Self::Unspecified => std::option::Option::Some("SERVICE_CIDR_UNSPECIFIED"),
9280 Self::Disabled => std::option::Option::Some("DISABLED"),
9281 Self::High26 => std::option::Option::Some("HIGH_26"),
9282 Self::High27 => std::option::Option::Some("HIGH_27"),
9283 Self::High28 => std::option::Option::Some("HIGH_28"),
9284 Self::UnknownValue(u) => u.0.name(),
9285 }
9286 }
9287 }
9288
9289 impl std::default::Default for ServiceCidr {
9290 fn default() -> Self {
9291 use std::convert::From;
9292 Self::from(0)
9293 }
9294 }
9295
9296 impl std::fmt::Display for ServiceCidr {
9297 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9298 wkt::internal::display_enum(f, self.name(), self.value())
9299 }
9300 }
9301
9302 impl std::convert::From<i32> for ServiceCidr {
9303 fn from(value: i32) -> Self {
9304 match value {
9305 0 => Self::Unspecified,
9306 1 => Self::Disabled,
9307 2 => Self::High26,
9308 3 => Self::High27,
9309 4 => Self::High28,
9310 _ => Self::UnknownValue(service_cidr::UnknownValue(
9311 wkt::internal::UnknownEnumValue::Integer(value),
9312 )),
9313 }
9314 }
9315 }
9316
9317 impl std::convert::From<&str> for ServiceCidr {
9318 fn from(value: &str) -> Self {
9319 use std::string::ToString;
9320 match value {
9321 "SERVICE_CIDR_UNSPECIFIED" => Self::Unspecified,
9322 "DISABLED" => Self::Disabled,
9323 "HIGH_26" => Self::High26,
9324 "HIGH_27" => Self::High27,
9325 "HIGH_28" => Self::High28,
9326 _ => Self::UnknownValue(service_cidr::UnknownValue(
9327 wkt::internal::UnknownEnumValue::String(value.to_string()),
9328 )),
9329 }
9330 }
9331 }
9332
9333 impl serde::ser::Serialize for ServiceCidr {
9334 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9335 where
9336 S: serde::Serializer,
9337 {
9338 match self {
9339 Self::Unspecified => serializer.serialize_i32(0),
9340 Self::Disabled => serializer.serialize_i32(1),
9341 Self::High26 => serializer.serialize_i32(2),
9342 Self::High27 => serializer.serialize_i32(3),
9343 Self::High28 => serializer.serialize_i32(4),
9344 Self::UnknownValue(u) => u.0.serialize(serializer),
9345 }
9346 }
9347 }
9348
9349 impl<'de> serde::de::Deserialize<'de> for ServiceCidr {
9350 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9351 where
9352 D: serde::Deserializer<'de>,
9353 {
9354 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceCidr>::new(
9355 ".google.cloud.baremetalsolution.v2.NetworkConfig.ServiceCidr",
9356 ))
9357 }
9358 }
9359}
9360
9361/// A resource budget.
9362#[derive(Clone, Default, PartialEq)]
9363#[non_exhaustive]
9364pub struct InstanceQuota {
9365 /// Output only. The name of the instance quota.
9366 pub name: std::string::String,
9367
9368 /// Instance type.
9369 /// Deprecated: use gcp_service.
9370 #[deprecated]
9371 pub instance_type: std::string::String,
9372
9373 /// The gcp service of the provisioning quota.
9374 pub gcp_service: std::string::String,
9375
9376 /// Location where the quota applies.
9377 pub location: std::string::String,
9378
9379 /// Number of machines than can be created for the given location and
9380 /// instance_type.
9381 pub available_machine_count: i32,
9382
9383 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9384}
9385
9386impl InstanceQuota {
9387 pub fn new() -> Self {
9388 std::default::Default::default()
9389 }
9390
9391 /// Sets the value of [name][crate::model::InstanceQuota::name].
9392 ///
9393 /// # Example
9394 /// ```ignore,no_run
9395 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9396 /// let x = InstanceQuota::new().set_name("example");
9397 /// ```
9398 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9399 self.name = v.into();
9400 self
9401 }
9402
9403 /// Sets the value of [instance_type][crate::model::InstanceQuota::instance_type].
9404 ///
9405 /// # Example
9406 /// ```ignore,no_run
9407 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9408 /// let x = InstanceQuota::new().set_instance_type("example");
9409 /// ```
9410 #[deprecated]
9411 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9412 self.instance_type = v.into();
9413 self
9414 }
9415
9416 /// Sets the value of [gcp_service][crate::model::InstanceQuota::gcp_service].
9417 ///
9418 /// # Example
9419 /// ```ignore,no_run
9420 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9421 /// let x = InstanceQuota::new().set_gcp_service("example");
9422 /// ```
9423 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9424 self.gcp_service = v.into();
9425 self
9426 }
9427
9428 /// Sets the value of [location][crate::model::InstanceQuota::location].
9429 ///
9430 /// # Example
9431 /// ```ignore,no_run
9432 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9433 /// let x = InstanceQuota::new().set_location("example");
9434 /// ```
9435 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9436 self.location = v.into();
9437 self
9438 }
9439
9440 /// Sets the value of [available_machine_count][crate::model::InstanceQuota::available_machine_count].
9441 ///
9442 /// # Example
9443 /// ```ignore,no_run
9444 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9445 /// let x = InstanceQuota::new().set_available_machine_count(42);
9446 /// ```
9447 pub fn set_available_machine_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9448 self.available_machine_count = v.into();
9449 self
9450 }
9451}
9452
9453impl wkt::message::Message for InstanceQuota {
9454 fn typename() -> &'static str {
9455 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceQuota"
9456 }
9457}
9458
9459/// Request for GetProvisioningConfig.
9460#[derive(Clone, Default, PartialEq)]
9461#[non_exhaustive]
9462pub struct GetProvisioningConfigRequest {
9463 /// Required. Name of the ProvisioningConfig.
9464 pub name: std::string::String,
9465
9466 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9467}
9468
9469impl GetProvisioningConfigRequest {
9470 pub fn new() -> Self {
9471 std::default::Default::default()
9472 }
9473
9474 /// Sets the value of [name][crate::model::GetProvisioningConfigRequest::name].
9475 ///
9476 /// # Example
9477 /// ```ignore,no_run
9478 /// # use google_cloud_baremetalsolution_v2::model::GetProvisioningConfigRequest;
9479 /// let x = GetProvisioningConfigRequest::new().set_name("example");
9480 /// ```
9481 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9482 self.name = v.into();
9483 self
9484 }
9485}
9486
9487impl wkt::message::Message for GetProvisioningConfigRequest {
9488 fn typename() -> &'static str {
9489 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetProvisioningConfigRequest"
9490 }
9491}
9492
9493/// Request for CreateProvisioningConfig.
9494#[derive(Clone, Default, PartialEq)]
9495#[non_exhaustive]
9496pub struct CreateProvisioningConfigRequest {
9497 /// Required. The parent project and location containing the
9498 /// ProvisioningConfig.
9499 pub parent: std::string::String,
9500
9501 /// Required. The ProvisioningConfig to create.
9502 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9503
9504 /// Optional. Email provided to send a confirmation with provisioning config
9505 /// to.
9506 pub email: std::string::String,
9507
9508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9509}
9510
9511impl CreateProvisioningConfigRequest {
9512 pub fn new() -> Self {
9513 std::default::Default::default()
9514 }
9515
9516 /// Sets the value of [parent][crate::model::CreateProvisioningConfigRequest::parent].
9517 ///
9518 /// # Example
9519 /// ```ignore,no_run
9520 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9521 /// let x = CreateProvisioningConfigRequest::new().set_parent("example");
9522 /// ```
9523 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9524 self.parent = v.into();
9525 self
9526 }
9527
9528 /// Sets the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9529 ///
9530 /// # Example
9531 /// ```ignore,no_run
9532 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9533 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9534 /// let x = CreateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9535 /// ```
9536 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9537 where
9538 T: std::convert::Into<crate::model::ProvisioningConfig>,
9539 {
9540 self.provisioning_config = std::option::Option::Some(v.into());
9541 self
9542 }
9543
9544 /// Sets or clears the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9545 ///
9546 /// # Example
9547 /// ```ignore,no_run
9548 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9549 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9550 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9551 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9552 /// ```
9553 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9554 where
9555 T: std::convert::Into<crate::model::ProvisioningConfig>,
9556 {
9557 self.provisioning_config = v.map(|x| x.into());
9558 self
9559 }
9560
9561 /// Sets the value of [email][crate::model::CreateProvisioningConfigRequest::email].
9562 ///
9563 /// # Example
9564 /// ```ignore,no_run
9565 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9566 /// let x = CreateProvisioningConfigRequest::new().set_email("example");
9567 /// ```
9568 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9569 self.email = v.into();
9570 self
9571 }
9572}
9573
9574impl wkt::message::Message for CreateProvisioningConfigRequest {
9575 fn typename() -> &'static str {
9576 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateProvisioningConfigRequest"
9577 }
9578}
9579
9580/// Message for updating a ProvisioningConfig.
9581#[derive(Clone, Default, PartialEq)]
9582#[non_exhaustive]
9583pub struct UpdateProvisioningConfigRequest {
9584 /// Required. The ProvisioningConfig to update.
9585 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9586
9587 /// Required. The list of fields to update.
9588 pub update_mask: std::option::Option<wkt::FieldMask>,
9589
9590 /// Optional. Email provided to send a confirmation with provisioning config
9591 /// to.
9592 pub email: std::string::String,
9593
9594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9595}
9596
9597impl UpdateProvisioningConfigRequest {
9598 pub fn new() -> Self {
9599 std::default::Default::default()
9600 }
9601
9602 /// Sets the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9603 ///
9604 /// # Example
9605 /// ```ignore,no_run
9606 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9607 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9608 /// let x = UpdateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9609 /// ```
9610 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9611 where
9612 T: std::convert::Into<crate::model::ProvisioningConfig>,
9613 {
9614 self.provisioning_config = std::option::Option::Some(v.into());
9615 self
9616 }
9617
9618 /// Sets or clears the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9619 ///
9620 /// # Example
9621 /// ```ignore,no_run
9622 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9623 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9624 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9625 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9626 /// ```
9627 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9628 where
9629 T: std::convert::Into<crate::model::ProvisioningConfig>,
9630 {
9631 self.provisioning_config = v.map(|x| x.into());
9632 self
9633 }
9634
9635 /// Sets the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9636 ///
9637 /// # Example
9638 /// ```ignore,no_run
9639 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9640 /// use wkt::FieldMask;
9641 /// let x = UpdateProvisioningConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9642 /// ```
9643 pub fn set_update_mask<T>(mut self, v: T) -> Self
9644 where
9645 T: std::convert::Into<wkt::FieldMask>,
9646 {
9647 self.update_mask = std::option::Option::Some(v.into());
9648 self
9649 }
9650
9651 /// Sets or clears the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9652 ///
9653 /// # Example
9654 /// ```ignore,no_run
9655 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9656 /// use wkt::FieldMask;
9657 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9658 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9659 /// ```
9660 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9661 where
9662 T: std::convert::Into<wkt::FieldMask>,
9663 {
9664 self.update_mask = v.map(|x| x.into());
9665 self
9666 }
9667
9668 /// Sets the value of [email][crate::model::UpdateProvisioningConfigRequest::email].
9669 ///
9670 /// # Example
9671 /// ```ignore,no_run
9672 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9673 /// let x = UpdateProvisioningConfigRequest::new().set_email("example");
9674 /// ```
9675 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9676 self.email = v.into();
9677 self
9678 }
9679}
9680
9681impl wkt::message::Message for UpdateProvisioningConfigRequest {
9682 fn typename() -> &'static str {
9683 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateProvisioningConfigRequest"
9684 }
9685}
9686
9687/// An SSH key, used for authorizing with the interactive serial console feature.
9688#[derive(Clone, Default, PartialEq)]
9689#[non_exhaustive]
9690pub struct SSHKey {
9691 /// Output only. The name of this SSH key.
9692 /// Currently, the only valid value for the location is "global".
9693 pub name: std::string::String,
9694
9695 /// The public SSH key. This must be in OpenSSH .authorized_keys format.
9696 pub public_key: std::string::String,
9697
9698 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9699}
9700
9701impl SSHKey {
9702 pub fn new() -> Self {
9703 std::default::Default::default()
9704 }
9705
9706 /// Sets the value of [name][crate::model::SSHKey::name].
9707 ///
9708 /// # Example
9709 /// ```ignore,no_run
9710 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9711 /// let x = SSHKey::new().set_name("example");
9712 /// ```
9713 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9714 self.name = v.into();
9715 self
9716 }
9717
9718 /// Sets the value of [public_key][crate::model::SSHKey::public_key].
9719 ///
9720 /// # Example
9721 /// ```ignore,no_run
9722 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9723 /// let x = SSHKey::new().set_public_key("example");
9724 /// ```
9725 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9726 self.public_key = v.into();
9727 self
9728 }
9729}
9730
9731impl wkt::message::Message for SSHKey {
9732 fn typename() -> &'static str {
9733 "type.googleapis.com/google.cloud.baremetalsolution.v2.SSHKey"
9734 }
9735}
9736
9737/// Message for listing the public SSH keys in a project.
9738#[derive(Clone, Default, PartialEq)]
9739#[non_exhaustive]
9740pub struct ListSSHKeysRequest {
9741 /// Required. The parent containing the SSH keys.
9742 /// Currently, the only valid value for the location is "global".
9743 pub parent: std::string::String,
9744
9745 /// The maximum number of items to return.
9746 pub page_size: i32,
9747
9748 /// The next_page_token value returned from a previous List request, if any.
9749 pub page_token: std::string::String,
9750
9751 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9752}
9753
9754impl ListSSHKeysRequest {
9755 pub fn new() -> Self {
9756 std::default::Default::default()
9757 }
9758
9759 /// Sets the value of [parent][crate::model::ListSSHKeysRequest::parent].
9760 ///
9761 /// # Example
9762 /// ```ignore,no_run
9763 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9764 /// let x = ListSSHKeysRequest::new().set_parent("example");
9765 /// ```
9766 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9767 self.parent = v.into();
9768 self
9769 }
9770
9771 /// Sets the value of [page_size][crate::model::ListSSHKeysRequest::page_size].
9772 ///
9773 /// # Example
9774 /// ```ignore,no_run
9775 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9776 /// let x = ListSSHKeysRequest::new().set_page_size(42);
9777 /// ```
9778 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9779 self.page_size = v.into();
9780 self
9781 }
9782
9783 /// Sets the value of [page_token][crate::model::ListSSHKeysRequest::page_token].
9784 ///
9785 /// # Example
9786 /// ```ignore,no_run
9787 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9788 /// let x = ListSSHKeysRequest::new().set_page_token("example");
9789 /// ```
9790 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9791 self.page_token = v.into();
9792 self
9793 }
9794}
9795
9796impl wkt::message::Message for ListSSHKeysRequest {
9797 fn typename() -> &'static str {
9798 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysRequest"
9799 }
9800}
9801
9802/// Message for response of ListSSHKeys.
9803#[derive(Clone, Default, PartialEq)]
9804#[non_exhaustive]
9805pub struct ListSSHKeysResponse {
9806 /// The SSH keys registered in the project.
9807 pub ssh_keys: std::vec::Vec<crate::model::SSHKey>,
9808
9809 /// Token to retrieve the next page of results, or empty if there are no more
9810 /// results in the list.
9811 pub next_page_token: std::string::String,
9812
9813 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9814}
9815
9816impl ListSSHKeysResponse {
9817 pub fn new() -> Self {
9818 std::default::Default::default()
9819 }
9820
9821 /// Sets the value of [ssh_keys][crate::model::ListSSHKeysResponse::ssh_keys].
9822 ///
9823 /// # Example
9824 /// ```ignore,no_run
9825 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
9826 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9827 /// let x = ListSSHKeysResponse::new()
9828 /// .set_ssh_keys([
9829 /// SSHKey::default()/* use setters */,
9830 /// SSHKey::default()/* use (different) setters */,
9831 /// ]);
9832 /// ```
9833 pub fn set_ssh_keys<T, V>(mut self, v: T) -> Self
9834 where
9835 T: std::iter::IntoIterator<Item = V>,
9836 V: std::convert::Into<crate::model::SSHKey>,
9837 {
9838 use std::iter::Iterator;
9839 self.ssh_keys = v.into_iter().map(|i| i.into()).collect();
9840 self
9841 }
9842
9843 /// Sets the value of [next_page_token][crate::model::ListSSHKeysResponse::next_page_token].
9844 ///
9845 /// # Example
9846 /// ```ignore,no_run
9847 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
9848 /// let x = ListSSHKeysResponse::new().set_next_page_token("example");
9849 /// ```
9850 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9851 self.next_page_token = v.into();
9852 self
9853 }
9854}
9855
9856impl wkt::message::Message for ListSSHKeysResponse {
9857 fn typename() -> &'static str {
9858 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysResponse"
9859 }
9860}
9861
9862#[doc(hidden)]
9863impl google_cloud_gax::paginator::internal::PageableResponse for ListSSHKeysResponse {
9864 type PageItem = crate::model::SSHKey;
9865
9866 fn items(self) -> std::vec::Vec<Self::PageItem> {
9867 self.ssh_keys
9868 }
9869
9870 fn next_page_token(&self) -> std::string::String {
9871 use std::clone::Clone;
9872 self.next_page_token.clone()
9873 }
9874}
9875
9876/// Message for registering a public SSH key in a project.
9877#[derive(Clone, Default, PartialEq)]
9878#[non_exhaustive]
9879pub struct CreateSSHKeyRequest {
9880 /// Required. The parent containing the SSH keys.
9881 pub parent: std::string::String,
9882
9883 /// Required. The SSH key to register.
9884 pub ssh_key: std::option::Option<crate::model::SSHKey>,
9885
9886 /// Required. The ID to use for the key, which will become the final component
9887 /// of the key's resource name.
9888 ///
9889 /// This value must match the regex:
9890 /// [a-zA-Z0-9@.\-_]{1,64}
9891 pub ssh_key_id: std::string::String,
9892
9893 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9894}
9895
9896impl CreateSSHKeyRequest {
9897 pub fn new() -> Self {
9898 std::default::Default::default()
9899 }
9900
9901 /// Sets the value of [parent][crate::model::CreateSSHKeyRequest::parent].
9902 ///
9903 /// # Example
9904 /// ```ignore,no_run
9905 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9906 /// let x = CreateSSHKeyRequest::new().set_parent("example");
9907 /// ```
9908 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9909 self.parent = v.into();
9910 self
9911 }
9912
9913 /// Sets the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
9914 ///
9915 /// # Example
9916 /// ```ignore,no_run
9917 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9918 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9919 /// let x = CreateSSHKeyRequest::new().set_ssh_key(SSHKey::default()/* use setters */);
9920 /// ```
9921 pub fn set_ssh_key<T>(mut self, v: T) -> Self
9922 where
9923 T: std::convert::Into<crate::model::SSHKey>,
9924 {
9925 self.ssh_key = std::option::Option::Some(v.into());
9926 self
9927 }
9928
9929 /// Sets or clears the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
9930 ///
9931 /// # Example
9932 /// ```ignore,no_run
9933 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9934 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9935 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(Some(SSHKey::default()/* use setters */));
9936 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(None::<SSHKey>);
9937 /// ```
9938 pub fn set_or_clear_ssh_key<T>(mut self, v: std::option::Option<T>) -> Self
9939 where
9940 T: std::convert::Into<crate::model::SSHKey>,
9941 {
9942 self.ssh_key = v.map(|x| x.into());
9943 self
9944 }
9945
9946 /// Sets the value of [ssh_key_id][crate::model::CreateSSHKeyRequest::ssh_key_id].
9947 ///
9948 /// # Example
9949 /// ```ignore,no_run
9950 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9951 /// let x = CreateSSHKeyRequest::new().set_ssh_key_id("example");
9952 /// ```
9953 pub fn set_ssh_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9954 self.ssh_key_id = v.into();
9955 self
9956 }
9957}
9958
9959impl wkt::message::Message for CreateSSHKeyRequest {
9960 fn typename() -> &'static str {
9961 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateSSHKeyRequest"
9962 }
9963}
9964
9965/// Message for deleting an SSH key from a project.
9966#[derive(Clone, Default, PartialEq)]
9967#[non_exhaustive]
9968pub struct DeleteSSHKeyRequest {
9969 /// Required. The name of the SSH key to delete.
9970 /// Currently, the only valid value for the location is "global".
9971 pub name: std::string::String,
9972
9973 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9974}
9975
9976impl DeleteSSHKeyRequest {
9977 pub fn new() -> Self {
9978 std::default::Default::default()
9979 }
9980
9981 /// Sets the value of [name][crate::model::DeleteSSHKeyRequest::name].
9982 ///
9983 /// # Example
9984 /// ```ignore,no_run
9985 /// # use google_cloud_baremetalsolution_v2::model::DeleteSSHKeyRequest;
9986 /// let x = DeleteSSHKeyRequest::new().set_name("example");
9987 /// ```
9988 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9989 self.name = v.into();
9990 self
9991 }
9992}
9993
9994impl wkt::message::Message for DeleteSSHKeyRequest {
9995 fn typename() -> &'static str {
9996 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteSSHKeyRequest"
9997 }
9998}
9999
10000/// A storage volume.
10001#[derive(Clone, Default, PartialEq)]
10002#[non_exhaustive]
10003pub struct Volume {
10004 /// Output only. The resource name of this `Volume`.
10005 /// Resource names are schemeless URIs that follow the conventions in
10006 /// <https://cloud.google.com/apis/design/resource_names>.
10007 /// Format:
10008 /// `projects/{project}/locations/{location}/volumes/{volume}`
10009 pub name: std::string::String,
10010
10011 /// An identifier for the `Volume`, generated by the backend.
10012 pub id: std::string::String,
10013
10014 /// The storage type for this volume.
10015 pub storage_type: crate::model::volume::StorageType,
10016
10017 /// The state of this storage volume.
10018 pub state: crate::model::volume::State,
10019
10020 /// The requested size of this storage volume, in GiB.
10021 pub requested_size_gib: i64,
10022
10023 /// Originally requested size, in GiB.
10024 pub originally_requested_size_gib: i64,
10025
10026 /// The current size of this storage volume, in GiB, including space reserved
10027 /// for snapshots. This size might be different than the requested size if the
10028 /// storage volume has been configured with auto grow or auto shrink.
10029 pub current_size_gib: i64,
10030
10031 /// Additional emergency size that was requested for this Volume, in GiB.
10032 /// current_size_gib includes this value.
10033 pub emergency_size_gib: i64,
10034
10035 /// Maximum size volume can be expanded to in case of evergency, in GiB.
10036 pub max_size_gib: i64,
10037
10038 /// The size, in GiB, that this storage volume has expanded as a result of an
10039 /// auto grow policy. In the absence of auto-grow, the value is 0.
10040 pub auto_grown_size_gib: i64,
10041
10042 /// The space remaining in the storage volume for new LUNs, in GiB, excluding
10043 /// space reserved for snapshots.
10044 pub remaining_space_gib: i64,
10045
10046 /// Details about snapshot space reservation and usage on the storage volume.
10047 pub snapshot_reservation_detail:
10048 std::option::Option<crate::model::volume::SnapshotReservationDetail>,
10049
10050 /// The behavior to use when snapshot reserved space is full.
10051 pub snapshot_auto_delete_behavior: crate::model::volume::SnapshotAutoDeleteBehavior,
10052
10053 /// Labels as key value pairs.
10054 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10055
10056 /// Whether snapshots are enabled.
10057 pub snapshot_enabled: bool,
10058
10059 /// Immutable. Pod name.
10060 pub pod: std::string::String,
10061
10062 /// Output only. Storage protocol for the Volume.
10063 pub protocol: crate::model::volume::Protocol,
10064
10065 /// Output only. Whether this volume is a boot volume. A boot volume is one
10066 /// which contains a boot LUN.
10067 pub boot_volume: bool,
10068
10069 /// Immutable. Performance tier of the Volume.
10070 /// Default is SHARED.
10071 pub performance_tier: crate::model::VolumePerformanceTier,
10072
10073 /// Input only. User-specified notes for new Volume.
10074 /// Used to provision Volumes that require manual intervention.
10075 pub notes: std::string::String,
10076
10077 /// The workload profile for the volume.
10078 pub workload_profile: crate::model::volume::WorkloadProfile,
10079
10080 /// Output only. Time after which volume will be fully deleted.
10081 /// It is filled only for volumes in COOLOFF state.
10082 pub expire_time: std::option::Option<wkt::Timestamp>,
10083
10084 /// Output only. Instances this Volume is attached to.
10085 /// This field is set only in Get requests.
10086 pub instances: std::vec::Vec<std::string::String>,
10087
10088 /// Output only. Is the Volume attached at at least one instance.
10089 /// This field is a lightweight counterpart of `instances` field.
10090 /// It is filled in List responses as well.
10091 pub attached: bool,
10092
10093 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10094}
10095
10096impl Volume {
10097 pub fn new() -> Self {
10098 std::default::Default::default()
10099 }
10100
10101 /// Sets the value of [name][crate::model::Volume::name].
10102 ///
10103 /// # Example
10104 /// ```ignore,no_run
10105 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10106 /// let x = Volume::new().set_name("example");
10107 /// ```
10108 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10109 self.name = v.into();
10110 self
10111 }
10112
10113 /// Sets the value of [id][crate::model::Volume::id].
10114 ///
10115 /// # Example
10116 /// ```ignore,no_run
10117 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10118 /// let x = Volume::new().set_id("example");
10119 /// ```
10120 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10121 self.id = v.into();
10122 self
10123 }
10124
10125 /// Sets the value of [storage_type][crate::model::Volume::storage_type].
10126 ///
10127 /// # Example
10128 /// ```ignore,no_run
10129 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10130 /// use google_cloud_baremetalsolution_v2::model::volume::StorageType;
10131 /// let x0 = Volume::new().set_storage_type(StorageType::Ssd);
10132 /// let x1 = Volume::new().set_storage_type(StorageType::Hdd);
10133 /// ```
10134 pub fn set_storage_type<T: std::convert::Into<crate::model::volume::StorageType>>(
10135 mut self,
10136 v: T,
10137 ) -> Self {
10138 self.storage_type = v.into();
10139 self
10140 }
10141
10142 /// Sets the value of [state][crate::model::Volume::state].
10143 ///
10144 /// # Example
10145 /// ```ignore,no_run
10146 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10147 /// use google_cloud_baremetalsolution_v2::model::volume::State;
10148 /// let x0 = Volume::new().set_state(State::Creating);
10149 /// let x1 = Volume::new().set_state(State::Ready);
10150 /// let x2 = Volume::new().set_state(State::Deleting);
10151 /// ```
10152 pub fn set_state<T: std::convert::Into<crate::model::volume::State>>(mut self, v: T) -> Self {
10153 self.state = v.into();
10154 self
10155 }
10156
10157 /// Sets the value of [requested_size_gib][crate::model::Volume::requested_size_gib].
10158 ///
10159 /// # Example
10160 /// ```ignore,no_run
10161 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10162 /// let x = Volume::new().set_requested_size_gib(42);
10163 /// ```
10164 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10165 self.requested_size_gib = v.into();
10166 self
10167 }
10168
10169 /// Sets the value of [originally_requested_size_gib][crate::model::Volume::originally_requested_size_gib].
10170 ///
10171 /// # Example
10172 /// ```ignore,no_run
10173 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10174 /// let x = Volume::new().set_originally_requested_size_gib(42);
10175 /// ```
10176 pub fn set_originally_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10177 self.originally_requested_size_gib = v.into();
10178 self
10179 }
10180
10181 /// Sets the value of [current_size_gib][crate::model::Volume::current_size_gib].
10182 ///
10183 /// # Example
10184 /// ```ignore,no_run
10185 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10186 /// let x = Volume::new().set_current_size_gib(42);
10187 /// ```
10188 pub fn set_current_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10189 self.current_size_gib = v.into();
10190 self
10191 }
10192
10193 /// Sets the value of [emergency_size_gib][crate::model::Volume::emergency_size_gib].
10194 ///
10195 /// # Example
10196 /// ```ignore,no_run
10197 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10198 /// let x = Volume::new().set_emergency_size_gib(42);
10199 /// ```
10200 pub fn set_emergency_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10201 self.emergency_size_gib = v.into();
10202 self
10203 }
10204
10205 /// Sets the value of [max_size_gib][crate::model::Volume::max_size_gib].
10206 ///
10207 /// # Example
10208 /// ```ignore,no_run
10209 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10210 /// let x = Volume::new().set_max_size_gib(42);
10211 /// ```
10212 pub fn set_max_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10213 self.max_size_gib = v.into();
10214 self
10215 }
10216
10217 /// Sets the value of [auto_grown_size_gib][crate::model::Volume::auto_grown_size_gib].
10218 ///
10219 /// # Example
10220 /// ```ignore,no_run
10221 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10222 /// let x = Volume::new().set_auto_grown_size_gib(42);
10223 /// ```
10224 pub fn set_auto_grown_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10225 self.auto_grown_size_gib = v.into();
10226 self
10227 }
10228
10229 /// Sets the value of [remaining_space_gib][crate::model::Volume::remaining_space_gib].
10230 ///
10231 /// # Example
10232 /// ```ignore,no_run
10233 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10234 /// let x = Volume::new().set_remaining_space_gib(42);
10235 /// ```
10236 pub fn set_remaining_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10237 self.remaining_space_gib = v.into();
10238 self
10239 }
10240
10241 /// Sets the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10242 ///
10243 /// # Example
10244 /// ```ignore,no_run
10245 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10246 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10247 /// let x = Volume::new().set_snapshot_reservation_detail(SnapshotReservationDetail::default()/* use setters */);
10248 /// ```
10249 pub fn set_snapshot_reservation_detail<T>(mut self, v: T) -> Self
10250 where
10251 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10252 {
10253 self.snapshot_reservation_detail = std::option::Option::Some(v.into());
10254 self
10255 }
10256
10257 /// Sets or clears the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10258 ///
10259 /// # Example
10260 /// ```ignore,no_run
10261 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10262 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10263 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(Some(SnapshotReservationDetail::default()/* use setters */));
10264 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(None::<SnapshotReservationDetail>);
10265 /// ```
10266 pub fn set_or_clear_snapshot_reservation_detail<T>(mut self, v: std::option::Option<T>) -> Self
10267 where
10268 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10269 {
10270 self.snapshot_reservation_detail = v.map(|x| x.into());
10271 self
10272 }
10273
10274 /// Sets the value of [snapshot_auto_delete_behavior][crate::model::Volume::snapshot_auto_delete_behavior].
10275 ///
10276 /// # Example
10277 /// ```ignore,no_run
10278 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10279 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotAutoDeleteBehavior;
10280 /// let x0 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::Disabled);
10281 /// let x1 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::OldestFirst);
10282 /// let x2 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::NewestFirst);
10283 /// ```
10284 pub fn set_snapshot_auto_delete_behavior<
10285 T: std::convert::Into<crate::model::volume::SnapshotAutoDeleteBehavior>,
10286 >(
10287 mut self,
10288 v: T,
10289 ) -> Self {
10290 self.snapshot_auto_delete_behavior = v.into();
10291 self
10292 }
10293
10294 /// Sets the value of [labels][crate::model::Volume::labels].
10295 ///
10296 /// # Example
10297 /// ```ignore,no_run
10298 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10299 /// let x = Volume::new().set_labels([
10300 /// ("key0", "abc"),
10301 /// ("key1", "xyz"),
10302 /// ]);
10303 /// ```
10304 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10305 where
10306 T: std::iter::IntoIterator<Item = (K, V)>,
10307 K: std::convert::Into<std::string::String>,
10308 V: std::convert::Into<std::string::String>,
10309 {
10310 use std::iter::Iterator;
10311 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10312 self
10313 }
10314
10315 /// Sets the value of [snapshot_enabled][crate::model::Volume::snapshot_enabled].
10316 ///
10317 /// # Example
10318 /// ```ignore,no_run
10319 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10320 /// let x = Volume::new().set_snapshot_enabled(true);
10321 /// ```
10322 pub fn set_snapshot_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10323 self.snapshot_enabled = v.into();
10324 self
10325 }
10326
10327 /// Sets the value of [pod][crate::model::Volume::pod].
10328 ///
10329 /// # Example
10330 /// ```ignore,no_run
10331 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10332 /// let x = Volume::new().set_pod("example");
10333 /// ```
10334 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10335 self.pod = v.into();
10336 self
10337 }
10338
10339 /// Sets the value of [protocol][crate::model::Volume::protocol].
10340 ///
10341 /// # Example
10342 /// ```ignore,no_run
10343 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10344 /// use google_cloud_baremetalsolution_v2::model::volume::Protocol;
10345 /// let x0 = Volume::new().set_protocol(Protocol::FibreChannel);
10346 /// let x1 = Volume::new().set_protocol(Protocol::Nfs);
10347 /// ```
10348 pub fn set_protocol<T: std::convert::Into<crate::model::volume::Protocol>>(
10349 mut self,
10350 v: T,
10351 ) -> Self {
10352 self.protocol = v.into();
10353 self
10354 }
10355
10356 /// Sets the value of [boot_volume][crate::model::Volume::boot_volume].
10357 ///
10358 /// # Example
10359 /// ```ignore,no_run
10360 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10361 /// let x = Volume::new().set_boot_volume(true);
10362 /// ```
10363 pub fn set_boot_volume<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10364 self.boot_volume = v.into();
10365 self
10366 }
10367
10368 /// Sets the value of [performance_tier][crate::model::Volume::performance_tier].
10369 ///
10370 /// # Example
10371 /// ```ignore,no_run
10372 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10373 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
10374 /// let x0 = Volume::new().set_performance_tier(VolumePerformanceTier::Shared);
10375 /// let x1 = Volume::new().set_performance_tier(VolumePerformanceTier::Assigned);
10376 /// let x2 = Volume::new().set_performance_tier(VolumePerformanceTier::Ht);
10377 /// ```
10378 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
10379 mut self,
10380 v: T,
10381 ) -> Self {
10382 self.performance_tier = v.into();
10383 self
10384 }
10385
10386 /// Sets the value of [notes][crate::model::Volume::notes].
10387 ///
10388 /// # Example
10389 /// ```ignore,no_run
10390 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10391 /// let x = Volume::new().set_notes("example");
10392 /// ```
10393 pub fn set_notes<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10394 self.notes = v.into();
10395 self
10396 }
10397
10398 /// Sets the value of [workload_profile][crate::model::Volume::workload_profile].
10399 ///
10400 /// # Example
10401 /// ```ignore,no_run
10402 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10403 /// use google_cloud_baremetalsolution_v2::model::volume::WorkloadProfile;
10404 /// let x0 = Volume::new().set_workload_profile(WorkloadProfile::Generic);
10405 /// let x1 = Volume::new().set_workload_profile(WorkloadProfile::Hana);
10406 /// ```
10407 pub fn set_workload_profile<T: std::convert::Into<crate::model::volume::WorkloadProfile>>(
10408 mut self,
10409 v: T,
10410 ) -> Self {
10411 self.workload_profile = v.into();
10412 self
10413 }
10414
10415 /// Sets the value of [expire_time][crate::model::Volume::expire_time].
10416 ///
10417 /// # Example
10418 /// ```ignore,no_run
10419 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10420 /// use wkt::Timestamp;
10421 /// let x = Volume::new().set_expire_time(Timestamp::default()/* use setters */);
10422 /// ```
10423 pub fn set_expire_time<T>(mut self, v: T) -> Self
10424 where
10425 T: std::convert::Into<wkt::Timestamp>,
10426 {
10427 self.expire_time = std::option::Option::Some(v.into());
10428 self
10429 }
10430
10431 /// Sets or clears the value of [expire_time][crate::model::Volume::expire_time].
10432 ///
10433 /// # Example
10434 /// ```ignore,no_run
10435 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10436 /// use wkt::Timestamp;
10437 /// let x = Volume::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10438 /// let x = Volume::new().set_or_clear_expire_time(None::<Timestamp>);
10439 /// ```
10440 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10441 where
10442 T: std::convert::Into<wkt::Timestamp>,
10443 {
10444 self.expire_time = v.map(|x| x.into());
10445 self
10446 }
10447
10448 /// Sets the value of [instances][crate::model::Volume::instances].
10449 ///
10450 /// # Example
10451 /// ```ignore,no_run
10452 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10453 /// let x = Volume::new().set_instances(["a", "b", "c"]);
10454 /// ```
10455 pub fn set_instances<T, V>(mut self, v: T) -> Self
10456 where
10457 T: std::iter::IntoIterator<Item = V>,
10458 V: std::convert::Into<std::string::String>,
10459 {
10460 use std::iter::Iterator;
10461 self.instances = v.into_iter().map(|i| i.into()).collect();
10462 self
10463 }
10464
10465 /// Sets the value of [attached][crate::model::Volume::attached].
10466 ///
10467 /// # Example
10468 /// ```ignore,no_run
10469 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10470 /// let x = Volume::new().set_attached(true);
10471 /// ```
10472 pub fn set_attached<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10473 self.attached = v.into();
10474 self
10475 }
10476}
10477
10478impl wkt::message::Message for Volume {
10479 fn typename() -> &'static str {
10480 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume"
10481 }
10482}
10483
10484/// Defines additional types related to [Volume].
10485pub mod volume {
10486 #[allow(unused_imports)]
10487 use super::*;
10488
10489 /// Details about snapshot space reservation and usage on the storage volume.
10490 #[derive(Clone, Default, PartialEq)]
10491 #[non_exhaustive]
10492 pub struct SnapshotReservationDetail {
10493 /// The space on this storage volume reserved for snapshots, shown in GiB.
10494 pub reserved_space_gib: i64,
10495
10496 /// The percent of snapshot space on this storage volume actually being used
10497 /// by the snapshot copies. This value might be higher than 100% if the
10498 /// snapshot copies have overflowed into the data portion of the storage
10499 /// volume.
10500 pub reserved_space_used_percent: i32,
10501
10502 /// The amount, in GiB, of available space in this storage volume's reserved
10503 /// snapshot space.
10504 pub reserved_space_remaining_gib: i64,
10505
10506 /// Percent of the total Volume size reserved for snapshot copies.
10507 /// Enabling snapshots requires reserving 20% or more of
10508 /// the storage volume space for snapshots. Maximum reserved space for
10509 /// snapshots is 40%.
10510 /// Setting this field will effectively set snapshot_enabled to true.
10511 pub reserved_space_percent: i32,
10512
10513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10514 }
10515
10516 impl SnapshotReservationDetail {
10517 pub fn new() -> Self {
10518 std::default::Default::default()
10519 }
10520
10521 /// Sets the value of [reserved_space_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_gib].
10522 ///
10523 /// # Example
10524 /// ```ignore,no_run
10525 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10526 /// let x = SnapshotReservationDetail::new().set_reserved_space_gib(42);
10527 /// ```
10528 pub fn set_reserved_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10529 self.reserved_space_gib = v.into();
10530 self
10531 }
10532
10533 /// Sets the value of [reserved_space_used_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_used_percent].
10534 ///
10535 /// # Example
10536 /// ```ignore,no_run
10537 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10538 /// let x = SnapshotReservationDetail::new().set_reserved_space_used_percent(42);
10539 /// ```
10540 pub fn set_reserved_space_used_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10541 self.reserved_space_used_percent = v.into();
10542 self
10543 }
10544
10545 /// Sets the value of [reserved_space_remaining_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_remaining_gib].
10546 ///
10547 /// # Example
10548 /// ```ignore,no_run
10549 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10550 /// let x = SnapshotReservationDetail::new().set_reserved_space_remaining_gib(42);
10551 /// ```
10552 pub fn set_reserved_space_remaining_gib<T: std::convert::Into<i64>>(
10553 mut self,
10554 v: T,
10555 ) -> Self {
10556 self.reserved_space_remaining_gib = v.into();
10557 self
10558 }
10559
10560 /// Sets the value of [reserved_space_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_percent].
10561 ///
10562 /// # Example
10563 /// ```ignore,no_run
10564 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10565 /// let x = SnapshotReservationDetail::new().set_reserved_space_percent(42);
10566 /// ```
10567 pub fn set_reserved_space_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10568 self.reserved_space_percent = v.into();
10569 self
10570 }
10571 }
10572
10573 impl wkt::message::Message for SnapshotReservationDetail {
10574 fn typename() -> &'static str {
10575 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume.SnapshotReservationDetail"
10576 }
10577 }
10578
10579 /// The storage type for a volume.
10580 ///
10581 /// # Working with unknown values
10582 ///
10583 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10584 /// additional enum variants at any time. Adding new variants is not considered
10585 /// a breaking change. Applications should write their code in anticipation of:
10586 ///
10587 /// - New values appearing in future releases of the client library, **and**
10588 /// - New values received dynamically, without application changes.
10589 ///
10590 /// Please consult the [Working with enums] section in the user guide for some
10591 /// guidelines.
10592 ///
10593 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10594 #[derive(Clone, Debug, PartialEq)]
10595 #[non_exhaustive]
10596 pub enum StorageType {
10597 /// The storage type for this volume is unknown.
10598 Unspecified,
10599 /// The storage type for this volume is SSD.
10600 Ssd,
10601 /// This storage type for this volume is HDD.
10602 Hdd,
10603 /// If set, the enum was initialized with an unknown value.
10604 ///
10605 /// Applications can examine the value using [StorageType::value] or
10606 /// [StorageType::name].
10607 UnknownValue(storage_type::UnknownValue),
10608 }
10609
10610 #[doc(hidden)]
10611 pub mod storage_type {
10612 #[allow(unused_imports)]
10613 use super::*;
10614 #[derive(Clone, Debug, PartialEq)]
10615 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10616 }
10617
10618 impl StorageType {
10619 /// Gets the enum value.
10620 ///
10621 /// Returns `None` if the enum contains an unknown value deserialized from
10622 /// the string representation of enums.
10623 pub fn value(&self) -> std::option::Option<i32> {
10624 match self {
10625 Self::Unspecified => std::option::Option::Some(0),
10626 Self::Ssd => std::option::Option::Some(1),
10627 Self::Hdd => std::option::Option::Some(2),
10628 Self::UnknownValue(u) => u.0.value(),
10629 }
10630 }
10631
10632 /// Gets the enum value as a string.
10633 ///
10634 /// Returns `None` if the enum contains an unknown value deserialized from
10635 /// the integer representation of enums.
10636 pub fn name(&self) -> std::option::Option<&str> {
10637 match self {
10638 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
10639 Self::Ssd => std::option::Option::Some("SSD"),
10640 Self::Hdd => std::option::Option::Some("HDD"),
10641 Self::UnknownValue(u) => u.0.name(),
10642 }
10643 }
10644 }
10645
10646 impl std::default::Default for StorageType {
10647 fn default() -> Self {
10648 use std::convert::From;
10649 Self::from(0)
10650 }
10651 }
10652
10653 impl std::fmt::Display for StorageType {
10654 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10655 wkt::internal::display_enum(f, self.name(), self.value())
10656 }
10657 }
10658
10659 impl std::convert::From<i32> for StorageType {
10660 fn from(value: i32) -> Self {
10661 match value {
10662 0 => Self::Unspecified,
10663 1 => Self::Ssd,
10664 2 => Self::Hdd,
10665 _ => Self::UnknownValue(storage_type::UnknownValue(
10666 wkt::internal::UnknownEnumValue::Integer(value),
10667 )),
10668 }
10669 }
10670 }
10671
10672 impl std::convert::From<&str> for StorageType {
10673 fn from(value: &str) -> Self {
10674 use std::string::ToString;
10675 match value {
10676 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
10677 "SSD" => Self::Ssd,
10678 "HDD" => Self::Hdd,
10679 _ => Self::UnknownValue(storage_type::UnknownValue(
10680 wkt::internal::UnknownEnumValue::String(value.to_string()),
10681 )),
10682 }
10683 }
10684 }
10685
10686 impl serde::ser::Serialize for StorageType {
10687 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10688 where
10689 S: serde::Serializer,
10690 {
10691 match self {
10692 Self::Unspecified => serializer.serialize_i32(0),
10693 Self::Ssd => serializer.serialize_i32(1),
10694 Self::Hdd => serializer.serialize_i32(2),
10695 Self::UnknownValue(u) => u.0.serialize(serializer),
10696 }
10697 }
10698 }
10699
10700 impl<'de> serde::de::Deserialize<'de> for StorageType {
10701 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10702 where
10703 D: serde::Deserializer<'de>,
10704 {
10705 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
10706 ".google.cloud.baremetalsolution.v2.Volume.StorageType",
10707 ))
10708 }
10709 }
10710
10711 /// The possible states for a storage volume.
10712 ///
10713 /// # Working with unknown values
10714 ///
10715 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10716 /// additional enum variants at any time. Adding new variants is not considered
10717 /// a breaking change. Applications should write their code in anticipation of:
10718 ///
10719 /// - New values appearing in future releases of the client library, **and**
10720 /// - New values received dynamically, without application changes.
10721 ///
10722 /// Please consult the [Working with enums] section in the user guide for some
10723 /// guidelines.
10724 ///
10725 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10726 #[derive(Clone, Debug, PartialEq)]
10727 #[non_exhaustive]
10728 pub enum State {
10729 /// The storage volume is in an unknown state.
10730 Unspecified,
10731 /// The storage volume is being created.
10732 Creating,
10733 /// The storage volume is ready for use.
10734 Ready,
10735 /// The storage volume has been requested to be deleted.
10736 Deleting,
10737 /// The storage volume is being updated.
10738 Updating,
10739 /// The storage volume is in cool off state. It will be deleted after
10740 /// `expire_time`.
10741 CoolOff,
10742 /// If set, the enum was initialized with an unknown value.
10743 ///
10744 /// Applications can examine the value using [State::value] or
10745 /// [State::name].
10746 UnknownValue(state::UnknownValue),
10747 }
10748
10749 #[doc(hidden)]
10750 pub mod state {
10751 #[allow(unused_imports)]
10752 use super::*;
10753 #[derive(Clone, Debug, PartialEq)]
10754 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10755 }
10756
10757 impl State {
10758 /// Gets the enum value.
10759 ///
10760 /// Returns `None` if the enum contains an unknown value deserialized from
10761 /// the string representation of enums.
10762 pub fn value(&self) -> std::option::Option<i32> {
10763 match self {
10764 Self::Unspecified => std::option::Option::Some(0),
10765 Self::Creating => std::option::Option::Some(1),
10766 Self::Ready => std::option::Option::Some(2),
10767 Self::Deleting => std::option::Option::Some(3),
10768 Self::Updating => std::option::Option::Some(4),
10769 Self::CoolOff => std::option::Option::Some(5),
10770 Self::UnknownValue(u) => u.0.value(),
10771 }
10772 }
10773
10774 /// Gets the enum value as a string.
10775 ///
10776 /// Returns `None` if the enum contains an unknown value deserialized from
10777 /// the integer representation of enums.
10778 pub fn name(&self) -> std::option::Option<&str> {
10779 match self {
10780 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10781 Self::Creating => std::option::Option::Some("CREATING"),
10782 Self::Ready => std::option::Option::Some("READY"),
10783 Self::Deleting => std::option::Option::Some("DELETING"),
10784 Self::Updating => std::option::Option::Some("UPDATING"),
10785 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
10786 Self::UnknownValue(u) => u.0.name(),
10787 }
10788 }
10789 }
10790
10791 impl std::default::Default for State {
10792 fn default() -> Self {
10793 use std::convert::From;
10794 Self::from(0)
10795 }
10796 }
10797
10798 impl std::fmt::Display for State {
10799 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10800 wkt::internal::display_enum(f, self.name(), self.value())
10801 }
10802 }
10803
10804 impl std::convert::From<i32> for State {
10805 fn from(value: i32) -> Self {
10806 match value {
10807 0 => Self::Unspecified,
10808 1 => Self::Creating,
10809 2 => Self::Ready,
10810 3 => Self::Deleting,
10811 4 => Self::Updating,
10812 5 => Self::CoolOff,
10813 _ => Self::UnknownValue(state::UnknownValue(
10814 wkt::internal::UnknownEnumValue::Integer(value),
10815 )),
10816 }
10817 }
10818 }
10819
10820 impl std::convert::From<&str> for State {
10821 fn from(value: &str) -> Self {
10822 use std::string::ToString;
10823 match value {
10824 "STATE_UNSPECIFIED" => Self::Unspecified,
10825 "CREATING" => Self::Creating,
10826 "READY" => Self::Ready,
10827 "DELETING" => Self::Deleting,
10828 "UPDATING" => Self::Updating,
10829 "COOL_OFF" => Self::CoolOff,
10830 _ => Self::UnknownValue(state::UnknownValue(
10831 wkt::internal::UnknownEnumValue::String(value.to_string()),
10832 )),
10833 }
10834 }
10835 }
10836
10837 impl serde::ser::Serialize for State {
10838 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10839 where
10840 S: serde::Serializer,
10841 {
10842 match self {
10843 Self::Unspecified => serializer.serialize_i32(0),
10844 Self::Creating => serializer.serialize_i32(1),
10845 Self::Ready => serializer.serialize_i32(2),
10846 Self::Deleting => serializer.serialize_i32(3),
10847 Self::Updating => serializer.serialize_i32(4),
10848 Self::CoolOff => serializer.serialize_i32(5),
10849 Self::UnknownValue(u) => u.0.serialize(serializer),
10850 }
10851 }
10852 }
10853
10854 impl<'de> serde::de::Deserialize<'de> for State {
10855 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10856 where
10857 D: serde::Deserializer<'de>,
10858 {
10859 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10860 ".google.cloud.baremetalsolution.v2.Volume.State",
10861 ))
10862 }
10863 }
10864
10865 /// The kinds of auto delete behavior to use when snapshot reserved space is
10866 /// full.
10867 ///
10868 /// # Working with unknown values
10869 ///
10870 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10871 /// additional enum variants at any time. Adding new variants is not considered
10872 /// a breaking change. Applications should write their code in anticipation of:
10873 ///
10874 /// - New values appearing in future releases of the client library, **and**
10875 /// - New values received dynamically, without application changes.
10876 ///
10877 /// Please consult the [Working with enums] section in the user guide for some
10878 /// guidelines.
10879 ///
10880 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10881 #[derive(Clone, Debug, PartialEq)]
10882 #[non_exhaustive]
10883 pub enum SnapshotAutoDeleteBehavior {
10884 /// The unspecified behavior.
10885 Unspecified,
10886 /// Don't delete any snapshots. This disables new snapshot creation, as
10887 /// long as the snapshot reserved space is full.
10888 Disabled,
10889 /// Delete the oldest snapshots first.
10890 OldestFirst,
10891 /// Delete the newest snapshots first.
10892 NewestFirst,
10893 /// If set, the enum was initialized with an unknown value.
10894 ///
10895 /// Applications can examine the value using [SnapshotAutoDeleteBehavior::value] or
10896 /// [SnapshotAutoDeleteBehavior::name].
10897 UnknownValue(snapshot_auto_delete_behavior::UnknownValue),
10898 }
10899
10900 #[doc(hidden)]
10901 pub mod snapshot_auto_delete_behavior {
10902 #[allow(unused_imports)]
10903 use super::*;
10904 #[derive(Clone, Debug, PartialEq)]
10905 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10906 }
10907
10908 impl SnapshotAutoDeleteBehavior {
10909 /// Gets the enum value.
10910 ///
10911 /// Returns `None` if the enum contains an unknown value deserialized from
10912 /// the string representation of enums.
10913 pub fn value(&self) -> std::option::Option<i32> {
10914 match self {
10915 Self::Unspecified => std::option::Option::Some(0),
10916 Self::Disabled => std::option::Option::Some(1),
10917 Self::OldestFirst => std::option::Option::Some(2),
10918 Self::NewestFirst => std::option::Option::Some(3),
10919 Self::UnknownValue(u) => u.0.value(),
10920 }
10921 }
10922
10923 /// Gets the enum value as a string.
10924 ///
10925 /// Returns `None` if the enum contains an unknown value deserialized from
10926 /// the integer representation of enums.
10927 pub fn name(&self) -> std::option::Option<&str> {
10928 match self {
10929 Self::Unspecified => {
10930 std::option::Option::Some("SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED")
10931 }
10932 Self::Disabled => std::option::Option::Some("DISABLED"),
10933 Self::OldestFirst => std::option::Option::Some("OLDEST_FIRST"),
10934 Self::NewestFirst => std::option::Option::Some("NEWEST_FIRST"),
10935 Self::UnknownValue(u) => u.0.name(),
10936 }
10937 }
10938 }
10939
10940 impl std::default::Default for SnapshotAutoDeleteBehavior {
10941 fn default() -> Self {
10942 use std::convert::From;
10943 Self::from(0)
10944 }
10945 }
10946
10947 impl std::fmt::Display for SnapshotAutoDeleteBehavior {
10948 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10949 wkt::internal::display_enum(f, self.name(), self.value())
10950 }
10951 }
10952
10953 impl std::convert::From<i32> for SnapshotAutoDeleteBehavior {
10954 fn from(value: i32) -> Self {
10955 match value {
10956 0 => Self::Unspecified,
10957 1 => Self::Disabled,
10958 2 => Self::OldestFirst,
10959 3 => Self::NewestFirst,
10960 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
10961 wkt::internal::UnknownEnumValue::Integer(value),
10962 )),
10963 }
10964 }
10965 }
10966
10967 impl std::convert::From<&str> for SnapshotAutoDeleteBehavior {
10968 fn from(value: &str) -> Self {
10969 use std::string::ToString;
10970 match value {
10971 "SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
10972 "DISABLED" => Self::Disabled,
10973 "OLDEST_FIRST" => Self::OldestFirst,
10974 "NEWEST_FIRST" => Self::NewestFirst,
10975 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
10976 wkt::internal::UnknownEnumValue::String(value.to_string()),
10977 )),
10978 }
10979 }
10980 }
10981
10982 impl serde::ser::Serialize for SnapshotAutoDeleteBehavior {
10983 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10984 where
10985 S: serde::Serializer,
10986 {
10987 match self {
10988 Self::Unspecified => serializer.serialize_i32(0),
10989 Self::Disabled => serializer.serialize_i32(1),
10990 Self::OldestFirst => serializer.serialize_i32(2),
10991 Self::NewestFirst => serializer.serialize_i32(3),
10992 Self::UnknownValue(u) => u.0.serialize(serializer),
10993 }
10994 }
10995 }
10996
10997 impl<'de> serde::de::Deserialize<'de> for SnapshotAutoDeleteBehavior {
10998 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10999 where
11000 D: serde::Deserializer<'de>,
11001 {
11002 deserializer.deserialize_any(
11003 wkt::internal::EnumVisitor::<SnapshotAutoDeleteBehavior>::new(
11004 ".google.cloud.baremetalsolution.v2.Volume.SnapshotAutoDeleteBehavior",
11005 ),
11006 )
11007 }
11008 }
11009
11010 /// Storage protocol.
11011 ///
11012 /// # Working with unknown values
11013 ///
11014 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11015 /// additional enum variants at any time. Adding new variants is not considered
11016 /// a breaking change. Applications should write their code in anticipation of:
11017 ///
11018 /// - New values appearing in future releases of the client library, **and**
11019 /// - New values received dynamically, without application changes.
11020 ///
11021 /// Please consult the [Working with enums] section in the user guide for some
11022 /// guidelines.
11023 ///
11024 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11025 #[derive(Clone, Debug, PartialEq)]
11026 #[non_exhaustive]
11027 pub enum Protocol {
11028 /// Value is not specified.
11029 Unspecified,
11030 /// Fibre Channel protocol.
11031 FibreChannel,
11032 /// NFS protocol means Volume is a NFS Share volume.
11033 /// Such volumes cannot be manipulated via Volumes API.
11034 Nfs,
11035 /// If set, the enum was initialized with an unknown value.
11036 ///
11037 /// Applications can examine the value using [Protocol::value] or
11038 /// [Protocol::name].
11039 UnknownValue(protocol::UnknownValue),
11040 }
11041
11042 #[doc(hidden)]
11043 pub mod protocol {
11044 #[allow(unused_imports)]
11045 use super::*;
11046 #[derive(Clone, Debug, PartialEq)]
11047 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11048 }
11049
11050 impl Protocol {
11051 /// Gets the enum value.
11052 ///
11053 /// Returns `None` if the enum contains an unknown value deserialized from
11054 /// the string representation of enums.
11055 pub fn value(&self) -> std::option::Option<i32> {
11056 match self {
11057 Self::Unspecified => std::option::Option::Some(0),
11058 Self::FibreChannel => std::option::Option::Some(1),
11059 Self::Nfs => std::option::Option::Some(2),
11060 Self::UnknownValue(u) => u.0.value(),
11061 }
11062 }
11063
11064 /// Gets the enum value as a string.
11065 ///
11066 /// Returns `None` if the enum contains an unknown value deserialized from
11067 /// the integer representation of enums.
11068 pub fn name(&self) -> std::option::Option<&str> {
11069 match self {
11070 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
11071 Self::FibreChannel => std::option::Option::Some("FIBRE_CHANNEL"),
11072 Self::Nfs => std::option::Option::Some("NFS"),
11073 Self::UnknownValue(u) => u.0.name(),
11074 }
11075 }
11076 }
11077
11078 impl std::default::Default for Protocol {
11079 fn default() -> Self {
11080 use std::convert::From;
11081 Self::from(0)
11082 }
11083 }
11084
11085 impl std::fmt::Display for Protocol {
11086 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11087 wkt::internal::display_enum(f, self.name(), self.value())
11088 }
11089 }
11090
11091 impl std::convert::From<i32> for Protocol {
11092 fn from(value: i32) -> Self {
11093 match value {
11094 0 => Self::Unspecified,
11095 1 => Self::FibreChannel,
11096 2 => Self::Nfs,
11097 _ => Self::UnknownValue(protocol::UnknownValue(
11098 wkt::internal::UnknownEnumValue::Integer(value),
11099 )),
11100 }
11101 }
11102 }
11103
11104 impl std::convert::From<&str> for Protocol {
11105 fn from(value: &str) -> Self {
11106 use std::string::ToString;
11107 match value {
11108 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
11109 "FIBRE_CHANNEL" => Self::FibreChannel,
11110 "NFS" => Self::Nfs,
11111 _ => Self::UnknownValue(protocol::UnknownValue(
11112 wkt::internal::UnknownEnumValue::String(value.to_string()),
11113 )),
11114 }
11115 }
11116 }
11117
11118 impl serde::ser::Serialize for Protocol {
11119 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11120 where
11121 S: serde::Serializer,
11122 {
11123 match self {
11124 Self::Unspecified => serializer.serialize_i32(0),
11125 Self::FibreChannel => serializer.serialize_i32(1),
11126 Self::Nfs => serializer.serialize_i32(2),
11127 Self::UnknownValue(u) => u.0.serialize(serializer),
11128 }
11129 }
11130 }
11131
11132 impl<'de> serde::de::Deserialize<'de> for Protocol {
11133 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11134 where
11135 D: serde::Deserializer<'de>,
11136 {
11137 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
11138 ".google.cloud.baremetalsolution.v2.Volume.Protocol",
11139 ))
11140 }
11141 }
11142
11143 /// The possible values for a workload profile.
11144 ///
11145 /// # Working with unknown values
11146 ///
11147 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11148 /// additional enum variants at any time. Adding new variants is not considered
11149 /// a breaking change. Applications should write their code in anticipation of:
11150 ///
11151 /// - New values appearing in future releases of the client library, **and**
11152 /// - New values received dynamically, without application changes.
11153 ///
11154 /// Please consult the [Working with enums] section in the user guide for some
11155 /// guidelines.
11156 ///
11157 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11158 #[derive(Clone, Debug, PartialEq)]
11159 #[non_exhaustive]
11160 pub enum WorkloadProfile {
11161 /// The workload profile is in an unknown state.
11162 Unspecified,
11163 /// The workload profile is generic.
11164 Generic,
11165 /// The workload profile is hana.
11166 Hana,
11167 /// If set, the enum was initialized with an unknown value.
11168 ///
11169 /// Applications can examine the value using [WorkloadProfile::value] or
11170 /// [WorkloadProfile::name].
11171 UnknownValue(workload_profile::UnknownValue),
11172 }
11173
11174 #[doc(hidden)]
11175 pub mod workload_profile {
11176 #[allow(unused_imports)]
11177 use super::*;
11178 #[derive(Clone, Debug, PartialEq)]
11179 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11180 }
11181
11182 impl WorkloadProfile {
11183 /// Gets the enum value.
11184 ///
11185 /// Returns `None` if the enum contains an unknown value deserialized from
11186 /// the string representation of enums.
11187 pub fn value(&self) -> std::option::Option<i32> {
11188 match self {
11189 Self::Unspecified => std::option::Option::Some(0),
11190 Self::Generic => std::option::Option::Some(1),
11191 Self::Hana => std::option::Option::Some(2),
11192 Self::UnknownValue(u) => u.0.value(),
11193 }
11194 }
11195
11196 /// Gets the enum value as a string.
11197 ///
11198 /// Returns `None` if the enum contains an unknown value deserialized from
11199 /// the integer representation of enums.
11200 pub fn name(&self) -> std::option::Option<&str> {
11201 match self {
11202 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
11203 Self::Generic => std::option::Option::Some("GENERIC"),
11204 Self::Hana => std::option::Option::Some("HANA"),
11205 Self::UnknownValue(u) => u.0.name(),
11206 }
11207 }
11208 }
11209
11210 impl std::default::Default for WorkloadProfile {
11211 fn default() -> Self {
11212 use std::convert::From;
11213 Self::from(0)
11214 }
11215 }
11216
11217 impl std::fmt::Display for WorkloadProfile {
11218 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11219 wkt::internal::display_enum(f, self.name(), self.value())
11220 }
11221 }
11222
11223 impl std::convert::From<i32> for WorkloadProfile {
11224 fn from(value: i32) -> Self {
11225 match value {
11226 0 => Self::Unspecified,
11227 1 => Self::Generic,
11228 2 => Self::Hana,
11229 _ => Self::UnknownValue(workload_profile::UnknownValue(
11230 wkt::internal::UnknownEnumValue::Integer(value),
11231 )),
11232 }
11233 }
11234 }
11235
11236 impl std::convert::From<&str> for WorkloadProfile {
11237 fn from(value: &str) -> Self {
11238 use std::string::ToString;
11239 match value {
11240 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
11241 "GENERIC" => Self::Generic,
11242 "HANA" => Self::Hana,
11243 _ => Self::UnknownValue(workload_profile::UnknownValue(
11244 wkt::internal::UnknownEnumValue::String(value.to_string()),
11245 )),
11246 }
11247 }
11248 }
11249
11250 impl serde::ser::Serialize for WorkloadProfile {
11251 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11252 where
11253 S: serde::Serializer,
11254 {
11255 match self {
11256 Self::Unspecified => serializer.serialize_i32(0),
11257 Self::Generic => serializer.serialize_i32(1),
11258 Self::Hana => serializer.serialize_i32(2),
11259 Self::UnknownValue(u) => u.0.serialize(serializer),
11260 }
11261 }
11262 }
11263
11264 impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
11265 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11266 where
11267 D: serde::Deserializer<'de>,
11268 {
11269 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
11270 ".google.cloud.baremetalsolution.v2.Volume.WorkloadProfile",
11271 ))
11272 }
11273 }
11274}
11275
11276/// Message for requesting storage volume information.
11277#[derive(Clone, Default, PartialEq)]
11278#[non_exhaustive]
11279pub struct GetVolumeRequest {
11280 /// Required. Name of the resource.
11281 pub name: std::string::String,
11282
11283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11284}
11285
11286impl GetVolumeRequest {
11287 pub fn new() -> Self {
11288 std::default::Default::default()
11289 }
11290
11291 /// Sets the value of [name][crate::model::GetVolumeRequest::name].
11292 ///
11293 /// # Example
11294 /// ```ignore,no_run
11295 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeRequest;
11296 /// let x = GetVolumeRequest::new().set_name("example");
11297 /// ```
11298 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11299 self.name = v.into();
11300 self
11301 }
11302}
11303
11304impl wkt::message::Message for GetVolumeRequest {
11305 fn typename() -> &'static str {
11306 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeRequest"
11307 }
11308}
11309
11310/// Message for requesting a list of storage volumes.
11311#[derive(Clone, Default, PartialEq)]
11312#[non_exhaustive]
11313pub struct ListVolumesRequest {
11314 /// Required. Parent value for ListVolumesRequest.
11315 pub parent: std::string::String,
11316
11317 /// Requested page size. The server might return fewer items than requested.
11318 /// If unspecified, server will pick an appropriate default.
11319 pub page_size: i32,
11320
11321 /// A token identifying a page of results from the server.
11322 pub page_token: std::string::String,
11323
11324 /// List filter.
11325 pub filter: std::string::String,
11326
11327 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11328}
11329
11330impl ListVolumesRequest {
11331 pub fn new() -> Self {
11332 std::default::Default::default()
11333 }
11334
11335 /// Sets the value of [parent][crate::model::ListVolumesRequest::parent].
11336 ///
11337 /// # Example
11338 /// ```ignore,no_run
11339 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11340 /// let x = ListVolumesRequest::new().set_parent("example");
11341 /// ```
11342 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11343 self.parent = v.into();
11344 self
11345 }
11346
11347 /// Sets the value of [page_size][crate::model::ListVolumesRequest::page_size].
11348 ///
11349 /// # Example
11350 /// ```ignore,no_run
11351 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11352 /// let x = ListVolumesRequest::new().set_page_size(42);
11353 /// ```
11354 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11355 self.page_size = v.into();
11356 self
11357 }
11358
11359 /// Sets the value of [page_token][crate::model::ListVolumesRequest::page_token].
11360 ///
11361 /// # Example
11362 /// ```ignore,no_run
11363 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11364 /// let x = ListVolumesRequest::new().set_page_token("example");
11365 /// ```
11366 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11367 self.page_token = v.into();
11368 self
11369 }
11370
11371 /// Sets the value of [filter][crate::model::ListVolumesRequest::filter].
11372 ///
11373 /// # Example
11374 /// ```ignore,no_run
11375 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11376 /// let x = ListVolumesRequest::new().set_filter("example");
11377 /// ```
11378 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11379 self.filter = v.into();
11380 self
11381 }
11382}
11383
11384impl wkt::message::Message for ListVolumesRequest {
11385 fn typename() -> &'static str {
11386 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesRequest"
11387 }
11388}
11389
11390/// Response message containing the list of storage volumes.
11391#[derive(Clone, Default, PartialEq)]
11392#[non_exhaustive]
11393pub struct ListVolumesResponse {
11394 /// The list of storage volumes.
11395 pub volumes: std::vec::Vec<crate::model::Volume>,
11396
11397 /// A token identifying a page of results from the server.
11398 pub next_page_token: std::string::String,
11399
11400 /// Locations that could not be reached.
11401 pub unreachable: std::vec::Vec<std::string::String>,
11402
11403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11404}
11405
11406impl ListVolumesResponse {
11407 pub fn new() -> Self {
11408 std::default::Default::default()
11409 }
11410
11411 /// Sets the value of [volumes][crate::model::ListVolumesResponse::volumes].
11412 ///
11413 /// # Example
11414 /// ```ignore,no_run
11415 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11416 /// use google_cloud_baremetalsolution_v2::model::Volume;
11417 /// let x = ListVolumesResponse::new()
11418 /// .set_volumes([
11419 /// Volume::default()/* use setters */,
11420 /// Volume::default()/* use (different) setters */,
11421 /// ]);
11422 /// ```
11423 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11424 where
11425 T: std::iter::IntoIterator<Item = V>,
11426 V: std::convert::Into<crate::model::Volume>,
11427 {
11428 use std::iter::Iterator;
11429 self.volumes = v.into_iter().map(|i| i.into()).collect();
11430 self
11431 }
11432
11433 /// Sets the value of [next_page_token][crate::model::ListVolumesResponse::next_page_token].
11434 ///
11435 /// # Example
11436 /// ```ignore,no_run
11437 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11438 /// let x = ListVolumesResponse::new().set_next_page_token("example");
11439 /// ```
11440 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11441 self.next_page_token = v.into();
11442 self
11443 }
11444
11445 /// Sets the value of [unreachable][crate::model::ListVolumesResponse::unreachable].
11446 ///
11447 /// # Example
11448 /// ```ignore,no_run
11449 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11450 /// let x = ListVolumesResponse::new().set_unreachable(["a", "b", "c"]);
11451 /// ```
11452 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
11453 where
11454 T: std::iter::IntoIterator<Item = V>,
11455 V: std::convert::Into<std::string::String>,
11456 {
11457 use std::iter::Iterator;
11458 self.unreachable = v.into_iter().map(|i| i.into()).collect();
11459 self
11460 }
11461}
11462
11463impl wkt::message::Message for ListVolumesResponse {
11464 fn typename() -> &'static str {
11465 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesResponse"
11466 }
11467}
11468
11469#[doc(hidden)]
11470impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumesResponse {
11471 type PageItem = crate::model::Volume;
11472
11473 fn items(self) -> std::vec::Vec<Self::PageItem> {
11474 self.volumes
11475 }
11476
11477 fn next_page_token(&self) -> std::string::String {
11478 use std::clone::Clone;
11479 self.next_page_token.clone()
11480 }
11481}
11482
11483/// Message for updating a volume.
11484#[derive(Clone, Default, PartialEq)]
11485#[non_exhaustive]
11486pub struct UpdateVolumeRequest {
11487 /// Required. The volume to update.
11488 ///
11489 /// The `name` field is used to identify the volume to update.
11490 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11491 pub volume: std::option::Option<crate::model::Volume>,
11492
11493 /// The list of fields to update.
11494 /// The only currently supported fields are:
11495 /// 'labels'
11496 pub update_mask: std::option::Option<wkt::FieldMask>,
11497
11498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11499}
11500
11501impl UpdateVolumeRequest {
11502 pub fn new() -> Self {
11503 std::default::Default::default()
11504 }
11505
11506 /// Sets the value of [volume][crate::model::UpdateVolumeRequest::volume].
11507 ///
11508 /// # Example
11509 /// ```ignore,no_run
11510 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11511 /// use google_cloud_baremetalsolution_v2::model::Volume;
11512 /// let x = UpdateVolumeRequest::new().set_volume(Volume::default()/* use setters */);
11513 /// ```
11514 pub fn set_volume<T>(mut self, v: T) -> Self
11515 where
11516 T: std::convert::Into<crate::model::Volume>,
11517 {
11518 self.volume = std::option::Option::Some(v.into());
11519 self
11520 }
11521
11522 /// Sets or clears the value of [volume][crate::model::UpdateVolumeRequest::volume].
11523 ///
11524 /// # Example
11525 /// ```ignore,no_run
11526 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11527 /// use google_cloud_baremetalsolution_v2::model::Volume;
11528 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(Some(Volume::default()/* use setters */));
11529 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(None::<Volume>);
11530 /// ```
11531 pub fn set_or_clear_volume<T>(mut self, v: std::option::Option<T>) -> Self
11532 where
11533 T: std::convert::Into<crate::model::Volume>,
11534 {
11535 self.volume = v.map(|x| x.into());
11536 self
11537 }
11538
11539 /// Sets the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11540 ///
11541 /// # Example
11542 /// ```ignore,no_run
11543 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11544 /// use wkt::FieldMask;
11545 /// let x = UpdateVolumeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11546 /// ```
11547 pub fn set_update_mask<T>(mut self, v: T) -> Self
11548 where
11549 T: std::convert::Into<wkt::FieldMask>,
11550 {
11551 self.update_mask = std::option::Option::Some(v.into());
11552 self
11553 }
11554
11555 /// Sets or clears the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11556 ///
11557 /// # Example
11558 /// ```ignore,no_run
11559 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11560 /// use wkt::FieldMask;
11561 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11562 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11563 /// ```
11564 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11565 where
11566 T: std::convert::Into<wkt::FieldMask>,
11567 {
11568 self.update_mask = v.map(|x| x.into());
11569 self
11570 }
11571}
11572
11573impl wkt::message::Message for UpdateVolumeRequest {
11574 fn typename() -> &'static str {
11575 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateVolumeRequest"
11576 }
11577}
11578
11579/// Message requesting rename of a server.
11580#[derive(Clone, Default, PartialEq)]
11581#[non_exhaustive]
11582pub struct RenameVolumeRequest {
11583 /// Required. The `name` field is used to identify the volume.
11584 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11585 pub name: std::string::String,
11586
11587 /// Required. The new `id` of the volume.
11588 pub new_volume_id: std::string::String,
11589
11590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11591}
11592
11593impl RenameVolumeRequest {
11594 pub fn new() -> Self {
11595 std::default::Default::default()
11596 }
11597
11598 /// Sets the value of [name][crate::model::RenameVolumeRequest::name].
11599 ///
11600 /// # Example
11601 /// ```ignore,no_run
11602 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11603 /// let x = RenameVolumeRequest::new().set_name("example");
11604 /// ```
11605 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11606 self.name = v.into();
11607 self
11608 }
11609
11610 /// Sets the value of [new_volume_id][crate::model::RenameVolumeRequest::new_volume_id].
11611 ///
11612 /// # Example
11613 /// ```ignore,no_run
11614 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11615 /// let x = RenameVolumeRequest::new().set_new_volume_id("example");
11616 /// ```
11617 pub fn set_new_volume_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11618 self.new_volume_id = v.into();
11619 self
11620 }
11621}
11622
11623impl wkt::message::Message for RenameVolumeRequest {
11624 fn typename() -> &'static str {
11625 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameVolumeRequest"
11626 }
11627}
11628
11629/// Request for skip volume cooloff and delete it.
11630#[derive(Clone, Default, PartialEq)]
11631#[non_exhaustive]
11632pub struct EvictVolumeRequest {
11633 /// Required. The name of the Volume.
11634 pub name: std::string::String,
11635
11636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11637}
11638
11639impl EvictVolumeRequest {
11640 pub fn new() -> Self {
11641 std::default::Default::default()
11642 }
11643
11644 /// Sets the value of [name][crate::model::EvictVolumeRequest::name].
11645 ///
11646 /// # Example
11647 /// ```ignore,no_run
11648 /// # use google_cloud_baremetalsolution_v2::model::EvictVolumeRequest;
11649 /// let x = EvictVolumeRequest::new().set_name("example");
11650 /// ```
11651 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11652 self.name = v.into();
11653 self
11654 }
11655}
11656
11657impl wkt::message::Message for EvictVolumeRequest {
11658 fn typename() -> &'static str {
11659 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictVolumeRequest"
11660 }
11661}
11662
11663/// Request for emergency resize Volume.
11664#[derive(Clone, Default, PartialEq)]
11665#[non_exhaustive]
11666pub struct ResizeVolumeRequest {
11667 /// Required. Volume to resize.
11668 pub volume: std::string::String,
11669
11670 /// New Volume size, in GiB.
11671 pub size_gib: i64,
11672
11673 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11674}
11675
11676impl ResizeVolumeRequest {
11677 pub fn new() -> Self {
11678 std::default::Default::default()
11679 }
11680
11681 /// Sets the value of [volume][crate::model::ResizeVolumeRequest::volume].
11682 ///
11683 /// # Example
11684 /// ```ignore,no_run
11685 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11686 /// let x = ResizeVolumeRequest::new().set_volume("example");
11687 /// ```
11688 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11689 self.volume = v.into();
11690 self
11691 }
11692
11693 /// Sets the value of [size_gib][crate::model::ResizeVolumeRequest::size_gib].
11694 ///
11695 /// # Example
11696 /// ```ignore,no_run
11697 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11698 /// let x = ResizeVolumeRequest::new().set_size_gib(42);
11699 /// ```
11700 pub fn set_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11701 self.size_gib = v.into();
11702 self
11703 }
11704}
11705
11706impl wkt::message::Message for ResizeVolumeRequest {
11707 fn typename() -> &'static str {
11708 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResizeVolumeRequest"
11709 }
11710}
11711
11712/// A snapshot of a volume. Only boot volumes can have snapshots.
11713#[derive(Clone, Default, PartialEq)]
11714#[non_exhaustive]
11715pub struct VolumeSnapshot {
11716 /// The name of the snapshot.
11717 pub name: std::string::String,
11718
11719 /// Output only. An identifier for the snapshot, generated by the backend.
11720 pub id: std::string::String,
11721
11722 /// The description of the snapshot.
11723 pub description: std::string::String,
11724
11725 /// Output only. The creation time of the snapshot.
11726 pub create_time: std::option::Option<wkt::Timestamp>,
11727
11728 /// Output only. The name of the volume which this snapshot belongs to.
11729 pub storage_volume: std::string::String,
11730
11731 /// Output only. The type of the snapshot which indicates whether it was
11732 /// scheduled or manual/ad-hoc.
11733 pub r#type: crate::model::volume_snapshot::SnapshotType,
11734
11735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11736}
11737
11738impl VolumeSnapshot {
11739 pub fn new() -> Self {
11740 std::default::Default::default()
11741 }
11742
11743 /// Sets the value of [name][crate::model::VolumeSnapshot::name].
11744 ///
11745 /// # Example
11746 /// ```ignore,no_run
11747 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11748 /// let x = VolumeSnapshot::new().set_name("example");
11749 /// ```
11750 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11751 self.name = v.into();
11752 self
11753 }
11754
11755 /// Sets the value of [id][crate::model::VolumeSnapshot::id].
11756 ///
11757 /// # Example
11758 /// ```ignore,no_run
11759 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11760 /// let x = VolumeSnapshot::new().set_id("example");
11761 /// ```
11762 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11763 self.id = v.into();
11764 self
11765 }
11766
11767 /// Sets the value of [description][crate::model::VolumeSnapshot::description].
11768 ///
11769 /// # Example
11770 /// ```ignore,no_run
11771 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11772 /// let x = VolumeSnapshot::new().set_description("example");
11773 /// ```
11774 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11775 self.description = v.into();
11776 self
11777 }
11778
11779 /// Sets the value of [create_time][crate::model::VolumeSnapshot::create_time].
11780 ///
11781 /// # Example
11782 /// ```ignore,no_run
11783 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11784 /// use wkt::Timestamp;
11785 /// let x = VolumeSnapshot::new().set_create_time(Timestamp::default()/* use setters */);
11786 /// ```
11787 pub fn set_create_time<T>(mut self, v: T) -> Self
11788 where
11789 T: std::convert::Into<wkt::Timestamp>,
11790 {
11791 self.create_time = std::option::Option::Some(v.into());
11792 self
11793 }
11794
11795 /// Sets or clears the value of [create_time][crate::model::VolumeSnapshot::create_time].
11796 ///
11797 /// # Example
11798 /// ```ignore,no_run
11799 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11800 /// use wkt::Timestamp;
11801 /// let x = VolumeSnapshot::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11802 /// let x = VolumeSnapshot::new().set_or_clear_create_time(None::<Timestamp>);
11803 /// ```
11804 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11805 where
11806 T: std::convert::Into<wkt::Timestamp>,
11807 {
11808 self.create_time = v.map(|x| x.into());
11809 self
11810 }
11811
11812 /// Sets the value of [storage_volume][crate::model::VolumeSnapshot::storage_volume].
11813 ///
11814 /// # Example
11815 /// ```ignore,no_run
11816 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11817 /// let x = VolumeSnapshot::new().set_storage_volume("example");
11818 /// ```
11819 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11820 self.storage_volume = v.into();
11821 self
11822 }
11823
11824 /// Sets the value of [r#type][crate::model::VolumeSnapshot::type].
11825 ///
11826 /// # Example
11827 /// ```ignore,no_run
11828 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11829 /// use google_cloud_baremetalsolution_v2::model::volume_snapshot::SnapshotType;
11830 /// let x0 = VolumeSnapshot::new().set_type(SnapshotType::AdHoc);
11831 /// let x1 = VolumeSnapshot::new().set_type(SnapshotType::Scheduled);
11832 /// ```
11833 pub fn set_type<T: std::convert::Into<crate::model::volume_snapshot::SnapshotType>>(
11834 mut self,
11835 v: T,
11836 ) -> Self {
11837 self.r#type = v.into();
11838 self
11839 }
11840}
11841
11842impl wkt::message::Message for VolumeSnapshot {
11843 fn typename() -> &'static str {
11844 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeSnapshot"
11845 }
11846}
11847
11848/// Defines additional types related to [VolumeSnapshot].
11849pub mod volume_snapshot {
11850 #[allow(unused_imports)]
11851 use super::*;
11852
11853 /// Represents the type of a snapshot.
11854 ///
11855 /// # Working with unknown values
11856 ///
11857 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11858 /// additional enum variants at any time. Adding new variants is not considered
11859 /// a breaking change. Applications should write their code in anticipation of:
11860 ///
11861 /// - New values appearing in future releases of the client library, **and**
11862 /// - New values received dynamically, without application changes.
11863 ///
11864 /// Please consult the [Working with enums] section in the user guide for some
11865 /// guidelines.
11866 ///
11867 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11868 #[derive(Clone, Debug, PartialEq)]
11869 #[non_exhaustive]
11870 pub enum SnapshotType {
11871 /// Type is not specified.
11872 Unspecified,
11873 /// Snapshot was taken manually by user.
11874 AdHoc,
11875 /// Snapshot was taken automatically as a part of a snapshot schedule.
11876 Scheduled,
11877 /// If set, the enum was initialized with an unknown value.
11878 ///
11879 /// Applications can examine the value using [SnapshotType::value] or
11880 /// [SnapshotType::name].
11881 UnknownValue(snapshot_type::UnknownValue),
11882 }
11883
11884 #[doc(hidden)]
11885 pub mod snapshot_type {
11886 #[allow(unused_imports)]
11887 use super::*;
11888 #[derive(Clone, Debug, PartialEq)]
11889 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11890 }
11891
11892 impl SnapshotType {
11893 /// Gets the enum value.
11894 ///
11895 /// Returns `None` if the enum contains an unknown value deserialized from
11896 /// the string representation of enums.
11897 pub fn value(&self) -> std::option::Option<i32> {
11898 match self {
11899 Self::Unspecified => std::option::Option::Some(0),
11900 Self::AdHoc => std::option::Option::Some(1),
11901 Self::Scheduled => std::option::Option::Some(2),
11902 Self::UnknownValue(u) => u.0.value(),
11903 }
11904 }
11905
11906 /// Gets the enum value as a string.
11907 ///
11908 /// Returns `None` if the enum contains an unknown value deserialized from
11909 /// the integer representation of enums.
11910 pub fn name(&self) -> std::option::Option<&str> {
11911 match self {
11912 Self::Unspecified => std::option::Option::Some("SNAPSHOT_TYPE_UNSPECIFIED"),
11913 Self::AdHoc => std::option::Option::Some("AD_HOC"),
11914 Self::Scheduled => std::option::Option::Some("SCHEDULED"),
11915 Self::UnknownValue(u) => u.0.name(),
11916 }
11917 }
11918 }
11919
11920 impl std::default::Default for SnapshotType {
11921 fn default() -> Self {
11922 use std::convert::From;
11923 Self::from(0)
11924 }
11925 }
11926
11927 impl std::fmt::Display for SnapshotType {
11928 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11929 wkt::internal::display_enum(f, self.name(), self.value())
11930 }
11931 }
11932
11933 impl std::convert::From<i32> for SnapshotType {
11934 fn from(value: i32) -> Self {
11935 match value {
11936 0 => Self::Unspecified,
11937 1 => Self::AdHoc,
11938 2 => Self::Scheduled,
11939 _ => Self::UnknownValue(snapshot_type::UnknownValue(
11940 wkt::internal::UnknownEnumValue::Integer(value),
11941 )),
11942 }
11943 }
11944 }
11945
11946 impl std::convert::From<&str> for SnapshotType {
11947 fn from(value: &str) -> Self {
11948 use std::string::ToString;
11949 match value {
11950 "SNAPSHOT_TYPE_UNSPECIFIED" => Self::Unspecified,
11951 "AD_HOC" => Self::AdHoc,
11952 "SCHEDULED" => Self::Scheduled,
11953 _ => Self::UnknownValue(snapshot_type::UnknownValue(
11954 wkt::internal::UnknownEnumValue::String(value.to_string()),
11955 )),
11956 }
11957 }
11958 }
11959
11960 impl serde::ser::Serialize for SnapshotType {
11961 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11962 where
11963 S: serde::Serializer,
11964 {
11965 match self {
11966 Self::Unspecified => serializer.serialize_i32(0),
11967 Self::AdHoc => serializer.serialize_i32(1),
11968 Self::Scheduled => serializer.serialize_i32(2),
11969 Self::UnknownValue(u) => u.0.serialize(serializer),
11970 }
11971 }
11972 }
11973
11974 impl<'de> serde::de::Deserialize<'de> for SnapshotType {
11975 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11976 where
11977 D: serde::Deserializer<'de>,
11978 {
11979 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotType>::new(
11980 ".google.cloud.baremetalsolution.v2.VolumeSnapshot.SnapshotType",
11981 ))
11982 }
11983 }
11984}
11985
11986/// Message for requesting volume snapshot information.
11987#[derive(Clone, Default, PartialEq)]
11988#[non_exhaustive]
11989pub struct GetVolumeSnapshotRequest {
11990 /// Required. The name of the snapshot.
11991 pub name: std::string::String,
11992
11993 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11994}
11995
11996impl GetVolumeSnapshotRequest {
11997 pub fn new() -> Self {
11998 std::default::Default::default()
11999 }
12000
12001 /// Sets the value of [name][crate::model::GetVolumeSnapshotRequest::name].
12002 ///
12003 /// # Example
12004 /// ```ignore,no_run
12005 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeSnapshotRequest;
12006 /// let x = GetVolumeSnapshotRequest::new().set_name("example");
12007 /// ```
12008 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12009 self.name = v.into();
12010 self
12011 }
12012}
12013
12014impl wkt::message::Message for GetVolumeSnapshotRequest {
12015 fn typename() -> &'static str {
12016 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeSnapshotRequest"
12017 }
12018}
12019
12020/// Message for requesting a list of volume snapshots.
12021#[derive(Clone, Default, PartialEq)]
12022#[non_exhaustive]
12023pub struct ListVolumeSnapshotsRequest {
12024 /// Required. Parent value for ListVolumesRequest.
12025 pub parent: std::string::String,
12026
12027 /// Requested page size. The server might return fewer items than requested.
12028 /// If unspecified, server will pick an appropriate default.
12029 pub page_size: i32,
12030
12031 /// A token identifying a page of results from the server.
12032 pub page_token: std::string::String,
12033
12034 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12035}
12036
12037impl ListVolumeSnapshotsRequest {
12038 pub fn new() -> Self {
12039 std::default::Default::default()
12040 }
12041
12042 /// Sets the value of [parent][crate::model::ListVolumeSnapshotsRequest::parent].
12043 ///
12044 /// # Example
12045 /// ```ignore,no_run
12046 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12047 /// let x = ListVolumeSnapshotsRequest::new().set_parent("example");
12048 /// ```
12049 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12050 self.parent = v.into();
12051 self
12052 }
12053
12054 /// Sets the value of [page_size][crate::model::ListVolumeSnapshotsRequest::page_size].
12055 ///
12056 /// # Example
12057 /// ```ignore,no_run
12058 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12059 /// let x = ListVolumeSnapshotsRequest::new().set_page_size(42);
12060 /// ```
12061 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12062 self.page_size = v.into();
12063 self
12064 }
12065
12066 /// Sets the value of [page_token][crate::model::ListVolumeSnapshotsRequest::page_token].
12067 ///
12068 /// # Example
12069 /// ```ignore,no_run
12070 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12071 /// let x = ListVolumeSnapshotsRequest::new().set_page_token("example");
12072 /// ```
12073 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12074 self.page_token = v.into();
12075 self
12076 }
12077}
12078
12079impl wkt::message::Message for ListVolumeSnapshotsRequest {
12080 fn typename() -> &'static str {
12081 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsRequest"
12082 }
12083}
12084
12085/// Response message containing the list of volume snapshots.
12086#[derive(Clone, Default, PartialEq)]
12087#[non_exhaustive]
12088pub struct ListVolumeSnapshotsResponse {
12089 /// The list of snapshots.
12090 pub volume_snapshots: std::vec::Vec<crate::model::VolumeSnapshot>,
12091
12092 /// A token identifying a page of results from the server.
12093 pub next_page_token: std::string::String,
12094
12095 /// Locations that could not be reached.
12096 pub unreachable: std::vec::Vec<std::string::String>,
12097
12098 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12099}
12100
12101impl ListVolumeSnapshotsResponse {
12102 pub fn new() -> Self {
12103 std::default::Default::default()
12104 }
12105
12106 /// Sets the value of [volume_snapshots][crate::model::ListVolumeSnapshotsResponse::volume_snapshots].
12107 ///
12108 /// # Example
12109 /// ```ignore,no_run
12110 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12111 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12112 /// let x = ListVolumeSnapshotsResponse::new()
12113 /// .set_volume_snapshots([
12114 /// VolumeSnapshot::default()/* use setters */,
12115 /// VolumeSnapshot::default()/* use (different) setters */,
12116 /// ]);
12117 /// ```
12118 pub fn set_volume_snapshots<T, V>(mut self, v: T) -> Self
12119 where
12120 T: std::iter::IntoIterator<Item = V>,
12121 V: std::convert::Into<crate::model::VolumeSnapshot>,
12122 {
12123 use std::iter::Iterator;
12124 self.volume_snapshots = v.into_iter().map(|i| i.into()).collect();
12125 self
12126 }
12127
12128 /// Sets the value of [next_page_token][crate::model::ListVolumeSnapshotsResponse::next_page_token].
12129 ///
12130 /// # Example
12131 /// ```ignore,no_run
12132 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12133 /// let x = ListVolumeSnapshotsResponse::new().set_next_page_token("example");
12134 /// ```
12135 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12136 self.next_page_token = v.into();
12137 self
12138 }
12139
12140 /// Sets the value of [unreachable][crate::model::ListVolumeSnapshotsResponse::unreachable].
12141 ///
12142 /// # Example
12143 /// ```ignore,no_run
12144 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12145 /// let x = ListVolumeSnapshotsResponse::new().set_unreachable(["a", "b", "c"]);
12146 /// ```
12147 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
12148 where
12149 T: std::iter::IntoIterator<Item = V>,
12150 V: std::convert::Into<std::string::String>,
12151 {
12152 use std::iter::Iterator;
12153 self.unreachable = v.into_iter().map(|i| i.into()).collect();
12154 self
12155 }
12156}
12157
12158impl wkt::message::Message for ListVolumeSnapshotsResponse {
12159 fn typename() -> &'static str {
12160 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsResponse"
12161 }
12162}
12163
12164#[doc(hidden)]
12165impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumeSnapshotsResponse {
12166 type PageItem = crate::model::VolumeSnapshot;
12167
12168 fn items(self) -> std::vec::Vec<Self::PageItem> {
12169 self.volume_snapshots
12170 }
12171
12172 fn next_page_token(&self) -> std::string::String {
12173 use std::clone::Clone;
12174 self.next_page_token.clone()
12175 }
12176}
12177
12178/// Message for deleting named Volume snapshot.
12179#[derive(Clone, Default, PartialEq)]
12180#[non_exhaustive]
12181pub struct DeleteVolumeSnapshotRequest {
12182 /// Required. The name of the snapshot to delete.
12183 pub name: std::string::String,
12184
12185 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12186}
12187
12188impl DeleteVolumeSnapshotRequest {
12189 pub fn new() -> Self {
12190 std::default::Default::default()
12191 }
12192
12193 /// Sets the value of [name][crate::model::DeleteVolumeSnapshotRequest::name].
12194 ///
12195 /// # Example
12196 /// ```ignore,no_run
12197 /// # use google_cloud_baremetalsolution_v2::model::DeleteVolumeSnapshotRequest;
12198 /// let x = DeleteVolumeSnapshotRequest::new().set_name("example");
12199 /// ```
12200 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12201 self.name = v.into();
12202 self
12203 }
12204}
12205
12206impl wkt::message::Message for DeleteVolumeSnapshotRequest {
12207 fn typename() -> &'static str {
12208 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteVolumeSnapshotRequest"
12209 }
12210}
12211
12212/// Message for creating a volume snapshot.
12213#[derive(Clone, Default, PartialEq)]
12214#[non_exhaustive]
12215pub struct CreateVolumeSnapshotRequest {
12216 /// Required. The volume to snapshot.
12217 pub parent: std::string::String,
12218
12219 /// Required. The snapshot to create.
12220 pub volume_snapshot: std::option::Option<crate::model::VolumeSnapshot>,
12221
12222 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12223}
12224
12225impl CreateVolumeSnapshotRequest {
12226 pub fn new() -> Self {
12227 std::default::Default::default()
12228 }
12229
12230 /// Sets the value of [parent][crate::model::CreateVolumeSnapshotRequest::parent].
12231 ///
12232 /// # Example
12233 /// ```ignore,no_run
12234 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12235 /// let x = CreateVolumeSnapshotRequest::new().set_parent("example");
12236 /// ```
12237 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12238 self.parent = v.into();
12239 self
12240 }
12241
12242 /// Sets the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12243 ///
12244 /// # Example
12245 /// ```ignore,no_run
12246 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12247 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12248 /// let x = CreateVolumeSnapshotRequest::new().set_volume_snapshot(VolumeSnapshot::default()/* use setters */);
12249 /// ```
12250 pub fn set_volume_snapshot<T>(mut self, v: T) -> Self
12251 where
12252 T: std::convert::Into<crate::model::VolumeSnapshot>,
12253 {
12254 self.volume_snapshot = std::option::Option::Some(v.into());
12255 self
12256 }
12257
12258 /// Sets or clears the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12259 ///
12260 /// # Example
12261 /// ```ignore,no_run
12262 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12263 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12264 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(Some(VolumeSnapshot::default()/* use setters */));
12265 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(None::<VolumeSnapshot>);
12266 /// ```
12267 pub fn set_or_clear_volume_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
12268 where
12269 T: std::convert::Into<crate::model::VolumeSnapshot>,
12270 {
12271 self.volume_snapshot = v.map(|x| x.into());
12272 self
12273 }
12274}
12275
12276impl wkt::message::Message for CreateVolumeSnapshotRequest {
12277 fn typename() -> &'static str {
12278 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateVolumeSnapshotRequest"
12279 }
12280}
12281
12282/// Message for restoring a volume snapshot.
12283#[derive(Clone, Default, PartialEq)]
12284#[non_exhaustive]
12285pub struct RestoreVolumeSnapshotRequest {
12286 /// Required. Name of the snapshot which will be used to restore its parent
12287 /// volume.
12288 pub volume_snapshot: std::string::String,
12289
12290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12291}
12292
12293impl RestoreVolumeSnapshotRequest {
12294 pub fn new() -> Self {
12295 std::default::Default::default()
12296 }
12297
12298 /// Sets the value of [volume_snapshot][crate::model::RestoreVolumeSnapshotRequest::volume_snapshot].
12299 ///
12300 /// # Example
12301 /// ```ignore,no_run
12302 /// # use google_cloud_baremetalsolution_v2::model::RestoreVolumeSnapshotRequest;
12303 /// let x = RestoreVolumeSnapshotRequest::new().set_volume_snapshot("example");
12304 /// ```
12305 pub fn set_volume_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12306 self.volume_snapshot = v.into();
12307 self
12308 }
12309}
12310
12311impl wkt::message::Message for RestoreVolumeSnapshotRequest {
12312 fn typename() -> &'static str {
12313 "type.googleapis.com/google.cloud.baremetalsolution.v2.RestoreVolumeSnapshotRequest"
12314 }
12315}
12316
12317/// Performance tier of the Volume.
12318///
12319/// # Working with unknown values
12320///
12321/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12322/// additional enum variants at any time. Adding new variants is not considered
12323/// a breaking change. Applications should write their code in anticipation of:
12324///
12325/// - New values appearing in future releases of the client library, **and**
12326/// - New values received dynamically, without application changes.
12327///
12328/// Please consult the [Working with enums] section in the user guide for some
12329/// guidelines.
12330///
12331/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12332#[derive(Clone, Debug, PartialEq)]
12333#[non_exhaustive]
12334pub enum VolumePerformanceTier {
12335 /// Value is not specified.
12336 Unspecified,
12337 /// Regular volumes, shared aggregates.
12338 Shared,
12339 /// Assigned aggregates.
12340 Assigned,
12341 /// High throughput aggregates.
12342 Ht,
12343 /// If set, the enum was initialized with an unknown value.
12344 ///
12345 /// Applications can examine the value using [VolumePerformanceTier::value] or
12346 /// [VolumePerformanceTier::name].
12347 UnknownValue(volume_performance_tier::UnknownValue),
12348}
12349
12350#[doc(hidden)]
12351pub mod volume_performance_tier {
12352 #[allow(unused_imports)]
12353 use super::*;
12354 #[derive(Clone, Debug, PartialEq)]
12355 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12356}
12357
12358impl VolumePerformanceTier {
12359 /// Gets the enum value.
12360 ///
12361 /// Returns `None` if the enum contains an unknown value deserialized from
12362 /// the string representation of enums.
12363 pub fn value(&self) -> std::option::Option<i32> {
12364 match self {
12365 Self::Unspecified => std::option::Option::Some(0),
12366 Self::Shared => std::option::Option::Some(1),
12367 Self::Assigned => std::option::Option::Some(2),
12368 Self::Ht => std::option::Option::Some(3),
12369 Self::UnknownValue(u) => u.0.value(),
12370 }
12371 }
12372
12373 /// Gets the enum value as a string.
12374 ///
12375 /// Returns `None` if the enum contains an unknown value deserialized from
12376 /// the integer representation of enums.
12377 pub fn name(&self) -> std::option::Option<&str> {
12378 match self {
12379 Self::Unspecified => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_UNSPECIFIED"),
12380 Self::Shared => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_SHARED"),
12381 Self::Assigned => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_ASSIGNED"),
12382 Self::Ht => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_HT"),
12383 Self::UnknownValue(u) => u.0.name(),
12384 }
12385 }
12386}
12387
12388impl std::default::Default for VolumePerformanceTier {
12389 fn default() -> Self {
12390 use std::convert::From;
12391 Self::from(0)
12392 }
12393}
12394
12395impl std::fmt::Display for VolumePerformanceTier {
12396 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12397 wkt::internal::display_enum(f, self.name(), self.value())
12398 }
12399}
12400
12401impl std::convert::From<i32> for VolumePerformanceTier {
12402 fn from(value: i32) -> Self {
12403 match value {
12404 0 => Self::Unspecified,
12405 1 => Self::Shared,
12406 2 => Self::Assigned,
12407 3 => Self::Ht,
12408 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12409 wkt::internal::UnknownEnumValue::Integer(value),
12410 )),
12411 }
12412 }
12413}
12414
12415impl std::convert::From<&str> for VolumePerformanceTier {
12416 fn from(value: &str) -> Self {
12417 use std::string::ToString;
12418 match value {
12419 "VOLUME_PERFORMANCE_TIER_UNSPECIFIED" => Self::Unspecified,
12420 "VOLUME_PERFORMANCE_TIER_SHARED" => Self::Shared,
12421 "VOLUME_PERFORMANCE_TIER_ASSIGNED" => Self::Assigned,
12422 "VOLUME_PERFORMANCE_TIER_HT" => Self::Ht,
12423 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12424 wkt::internal::UnknownEnumValue::String(value.to_string()),
12425 )),
12426 }
12427 }
12428}
12429
12430impl serde::ser::Serialize for VolumePerformanceTier {
12431 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12432 where
12433 S: serde::Serializer,
12434 {
12435 match self {
12436 Self::Unspecified => serializer.serialize_i32(0),
12437 Self::Shared => serializer.serialize_i32(1),
12438 Self::Assigned => serializer.serialize_i32(2),
12439 Self::Ht => serializer.serialize_i32(3),
12440 Self::UnknownValue(u) => u.0.serialize(serializer),
12441 }
12442 }
12443}
12444
12445impl<'de> serde::de::Deserialize<'de> for VolumePerformanceTier {
12446 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12447 where
12448 D: serde::Deserializer<'de>,
12449 {
12450 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumePerformanceTier>::new(
12451 ".google.cloud.baremetalsolution.v2.VolumePerformanceTier",
12452 ))
12453 }
12454}
12455
12456/// The possible values for a workload profile.
12457///
12458/// # Working with unknown values
12459///
12460/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12461/// additional enum variants at any time. Adding new variants is not considered
12462/// a breaking change. Applications should write their code in anticipation of:
12463///
12464/// - New values appearing in future releases of the client library, **and**
12465/// - New values received dynamically, without application changes.
12466///
12467/// Please consult the [Working with enums] section in the user guide for some
12468/// guidelines.
12469///
12470/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12471#[derive(Clone, Debug, PartialEq)]
12472#[non_exhaustive]
12473pub enum WorkloadProfile {
12474 /// The workload profile is in an unknown state.
12475 Unspecified,
12476 /// The workload profile is generic.
12477 Generic,
12478 /// The workload profile is hana.
12479 Hana,
12480 /// If set, the enum was initialized with an unknown value.
12481 ///
12482 /// Applications can examine the value using [WorkloadProfile::value] or
12483 /// [WorkloadProfile::name].
12484 UnknownValue(workload_profile::UnknownValue),
12485}
12486
12487#[doc(hidden)]
12488pub mod workload_profile {
12489 #[allow(unused_imports)]
12490 use super::*;
12491 #[derive(Clone, Debug, PartialEq)]
12492 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12493}
12494
12495impl WorkloadProfile {
12496 /// Gets the enum value.
12497 ///
12498 /// Returns `None` if the enum contains an unknown value deserialized from
12499 /// the string representation of enums.
12500 pub fn value(&self) -> std::option::Option<i32> {
12501 match self {
12502 Self::Unspecified => std::option::Option::Some(0),
12503 Self::Generic => std::option::Option::Some(1),
12504 Self::Hana => std::option::Option::Some(2),
12505 Self::UnknownValue(u) => u.0.value(),
12506 }
12507 }
12508
12509 /// Gets the enum value as a string.
12510 ///
12511 /// Returns `None` if the enum contains an unknown value deserialized from
12512 /// the integer representation of enums.
12513 pub fn name(&self) -> std::option::Option<&str> {
12514 match self {
12515 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
12516 Self::Generic => std::option::Option::Some("WORKLOAD_PROFILE_GENERIC"),
12517 Self::Hana => std::option::Option::Some("WORKLOAD_PROFILE_HANA"),
12518 Self::UnknownValue(u) => u.0.name(),
12519 }
12520 }
12521}
12522
12523impl std::default::Default for WorkloadProfile {
12524 fn default() -> Self {
12525 use std::convert::From;
12526 Self::from(0)
12527 }
12528}
12529
12530impl std::fmt::Display for WorkloadProfile {
12531 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12532 wkt::internal::display_enum(f, self.name(), self.value())
12533 }
12534}
12535
12536impl std::convert::From<i32> for WorkloadProfile {
12537 fn from(value: i32) -> Self {
12538 match value {
12539 0 => Self::Unspecified,
12540 1 => Self::Generic,
12541 2 => Self::Hana,
12542 _ => Self::UnknownValue(workload_profile::UnknownValue(
12543 wkt::internal::UnknownEnumValue::Integer(value),
12544 )),
12545 }
12546 }
12547}
12548
12549impl std::convert::From<&str> for WorkloadProfile {
12550 fn from(value: &str) -> Self {
12551 use std::string::ToString;
12552 match value {
12553 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
12554 "WORKLOAD_PROFILE_GENERIC" => Self::Generic,
12555 "WORKLOAD_PROFILE_HANA" => Self::Hana,
12556 _ => Self::UnknownValue(workload_profile::UnknownValue(
12557 wkt::internal::UnknownEnumValue::String(value.to_string()),
12558 )),
12559 }
12560 }
12561}
12562
12563impl serde::ser::Serialize for WorkloadProfile {
12564 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12565 where
12566 S: serde::Serializer,
12567 {
12568 match self {
12569 Self::Unspecified => serializer.serialize_i32(0),
12570 Self::Generic => serializer.serialize_i32(1),
12571 Self::Hana => serializer.serialize_i32(2),
12572 Self::UnknownValue(u) => u.0.serialize(serializer),
12573 }
12574 }
12575}
12576
12577impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
12578 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12579 where
12580 D: serde::Deserializer<'de>,
12581 {
12582 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
12583 ".google.cloud.baremetalsolution.v2.WorkloadProfile",
12584 ))
12585 }
12586}