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 /// Creates a new default instance.
74 pub fn new() -> Self {
75 std::default::Default::default()
76 }
77
78 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
79 ///
80 /// # Example
81 /// ```ignore,no_run
82 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
83 /// use wkt::Timestamp;
84 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
85 /// ```
86 pub fn set_create_time<T>(mut self, v: T) -> Self
87 where
88 T: std::convert::Into<wkt::Timestamp>,
89 {
90 self.create_time = std::option::Option::Some(v.into());
91 self
92 }
93
94 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
95 ///
96 /// # Example
97 /// ```ignore,no_run
98 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
99 /// use wkt::Timestamp;
100 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
101 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
102 /// ```
103 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
104 where
105 T: std::convert::Into<wkt::Timestamp>,
106 {
107 self.create_time = v.map(|x| x.into());
108 self
109 }
110
111 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
112 ///
113 /// # Example
114 /// ```ignore,no_run
115 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
116 /// use wkt::Timestamp;
117 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
118 /// ```
119 pub fn set_end_time<T>(mut self, v: T) -> Self
120 where
121 T: std::convert::Into<wkt::Timestamp>,
122 {
123 self.end_time = std::option::Option::Some(v.into());
124 self
125 }
126
127 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
128 ///
129 /// # Example
130 /// ```ignore,no_run
131 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
132 /// use wkt::Timestamp;
133 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
134 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
135 /// ```
136 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
137 where
138 T: std::convert::Into<wkt::Timestamp>,
139 {
140 self.end_time = v.map(|x| x.into());
141 self
142 }
143
144 /// Sets the value of [target][crate::model::OperationMetadata::target].
145 ///
146 /// # Example
147 /// ```ignore,no_run
148 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
149 /// let x = OperationMetadata::new().set_target("example");
150 /// ```
151 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
152 self.target = v.into();
153 self
154 }
155
156 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
157 ///
158 /// # Example
159 /// ```ignore,no_run
160 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
161 /// let x = OperationMetadata::new().set_verb("example");
162 /// ```
163 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
164 self.verb = v.into();
165 self
166 }
167
168 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
169 ///
170 /// # Example
171 /// ```ignore,no_run
172 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
173 /// let x = OperationMetadata::new().set_status_message("example");
174 /// ```
175 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
176 self.status_message = v.into();
177 self
178 }
179
180 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
181 ///
182 /// # Example
183 /// ```ignore,no_run
184 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
185 /// let x = OperationMetadata::new().set_requested_cancellation(true);
186 /// ```
187 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
188 self.requested_cancellation = v.into();
189 self
190 }
191
192 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
193 ///
194 /// # Example
195 /// ```ignore,no_run
196 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
197 /// let x = OperationMetadata::new().set_api_version("example");
198 /// ```
199 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
200 self.api_version = v.into();
201 self
202 }
203}
204
205impl wkt::message::Message for OperationMetadata {
206 fn typename() -> &'static str {
207 "type.googleapis.com/google.cloud.baremetalsolution.v2.OperationMetadata"
208 }
209}
210
211/// Response message from resetting a server.
212#[derive(Clone, Default, PartialEq)]
213#[non_exhaustive]
214pub struct ResetInstanceResponse {
215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
216}
217
218impl ResetInstanceResponse {
219 /// Creates a new default instance.
220 pub fn new() -> Self {
221 std::default::Default::default()
222 }
223}
224
225impl wkt::message::Message for ResetInstanceResponse {
226 fn typename() -> &'static str {
227 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceResponse"
228 }
229}
230
231/// A server.
232#[derive(Clone, Default, PartialEq)]
233#[non_exhaustive]
234pub struct Instance {
235 /// Immutable. The resource name of this `Instance`.
236 /// Resource names are schemeless URIs that follow the conventions in
237 /// <https://cloud.google.com/apis/design/resource_names>.
238 /// Format:
239 /// `projects/{project}/locations/{location}/instances/{instance}`
240 pub name: std::string::String,
241
242 /// Output only. An identifier for the `Instance`, generated by the backend.
243 pub id: std::string::String,
244
245 /// Output only. Create a time stamp.
246 pub create_time: std::option::Option<wkt::Timestamp>,
247
248 /// Output only. Update a time stamp.
249 pub update_time: std::option::Option<wkt::Timestamp>,
250
251 /// Immutable. The server type.
252 /// [Available server
253 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
254 pub machine_type: std::string::String,
255
256 /// Output only. The state of the server.
257 pub state: crate::model::instance::State,
258
259 /// True if you enable hyperthreading for the server, otherwise false.
260 /// The default value is false.
261 pub hyperthreading_enabled: bool,
262
263 /// Labels as key value pairs.
264 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
265
266 /// Immutable. List of LUNs associated with this server.
267 pub luns: std::vec::Vec<crate::model::Lun>,
268
269 /// Input only. List of Volumes to attach to this Instance on creation.
270 /// This field won't be populated in Get/List responses.
271 pub volumes: std::vec::Vec<crate::model::Volume>,
272
273 /// Output only. List of networks associated with this server.
274 pub networks: std::vec::Vec<crate::model::Network>,
275
276 /// Output only. True if the interactive serial console feature is enabled for
277 /// the instance, false otherwise. The default value is false.
278 pub interactive_serial_console_enabled: bool,
279
280 /// The OS image currently installed on the server.
281 pub os_image: std::string::String,
282
283 /// Immutable. Pod name.
284 /// Pod is an independent part of infrastructure.
285 /// Instance can be connected to the assets (networks, volumes) allocated
286 /// in the same pod only.
287 pub pod: std::string::String,
288
289 /// Instance network template name. For eg, bondaa-bondaa, bondab-nic, etc.
290 /// Generally, the template name follows the syntax of
291 /// "bond<bond_mode>" or "nic".
292 pub network_template: std::string::String,
293
294 /// List of logical interfaces for the instance. The number of logical
295 /// interfaces will be the same as number of hardware bond/nic on the chosen
296 /// network template. For the non-multivlan configurations (for eg, existing
297 /// servers) that use existing default network template (bondaa-bondaa), both
298 /// the Instance.networks field and the Instance.logical_interfaces fields will
299 /// be filled to ensure backward compatibility. For the others, only
300 /// Instance.logical_interfaces will be filled.
301 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
302
303 /// Output only. Text field about info for logging in.
304 pub login_info: std::string::String,
305
306 /// The workload profile for the instance.
307 pub workload_profile: crate::model::WorkloadProfile,
308
309 /// Output only. The firmware version for the instance.
310 pub firmware_version: std::string::String,
311
312 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
313}
314
315impl Instance {
316 /// Creates a new default instance.
317 pub fn new() -> Self {
318 std::default::Default::default()
319 }
320
321 /// Sets the value of [name][crate::model::Instance::name].
322 ///
323 /// # Example
324 /// ```ignore,no_run
325 /// # use google_cloud_baremetalsolution_v2::model::Instance;
326 /// let x = Instance::new().set_name("example");
327 /// ```
328 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
329 self.name = v.into();
330 self
331 }
332
333 /// Sets the value of [id][crate::model::Instance::id].
334 ///
335 /// # Example
336 /// ```ignore,no_run
337 /// # use google_cloud_baremetalsolution_v2::model::Instance;
338 /// let x = Instance::new().set_id("example");
339 /// ```
340 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
341 self.id = v.into();
342 self
343 }
344
345 /// Sets the value of [create_time][crate::model::Instance::create_time].
346 ///
347 /// # Example
348 /// ```ignore,no_run
349 /// # use google_cloud_baremetalsolution_v2::model::Instance;
350 /// use wkt::Timestamp;
351 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
352 /// ```
353 pub fn set_create_time<T>(mut self, v: T) -> Self
354 where
355 T: std::convert::Into<wkt::Timestamp>,
356 {
357 self.create_time = std::option::Option::Some(v.into());
358 self
359 }
360
361 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
362 ///
363 /// # Example
364 /// ```ignore,no_run
365 /// # use google_cloud_baremetalsolution_v2::model::Instance;
366 /// use wkt::Timestamp;
367 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
368 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
369 /// ```
370 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
371 where
372 T: std::convert::Into<wkt::Timestamp>,
373 {
374 self.create_time = v.map(|x| x.into());
375 self
376 }
377
378 /// Sets the value of [update_time][crate::model::Instance::update_time].
379 ///
380 /// # Example
381 /// ```ignore,no_run
382 /// # use google_cloud_baremetalsolution_v2::model::Instance;
383 /// use wkt::Timestamp;
384 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
385 /// ```
386 pub fn set_update_time<T>(mut self, v: T) -> Self
387 where
388 T: std::convert::Into<wkt::Timestamp>,
389 {
390 self.update_time = std::option::Option::Some(v.into());
391 self
392 }
393
394 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
395 ///
396 /// # Example
397 /// ```ignore,no_run
398 /// # use google_cloud_baremetalsolution_v2::model::Instance;
399 /// use wkt::Timestamp;
400 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
401 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
402 /// ```
403 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
404 where
405 T: std::convert::Into<wkt::Timestamp>,
406 {
407 self.update_time = v.map(|x| x.into());
408 self
409 }
410
411 /// Sets the value of [machine_type][crate::model::Instance::machine_type].
412 ///
413 /// # Example
414 /// ```ignore,no_run
415 /// # use google_cloud_baremetalsolution_v2::model::Instance;
416 /// let x = Instance::new().set_machine_type("example");
417 /// ```
418 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
419 self.machine_type = v.into();
420 self
421 }
422
423 /// Sets the value of [state][crate::model::Instance::state].
424 ///
425 /// # Example
426 /// ```ignore,no_run
427 /// # use google_cloud_baremetalsolution_v2::model::Instance;
428 /// use google_cloud_baremetalsolution_v2::model::instance::State;
429 /// let x0 = Instance::new().set_state(State::Provisioning);
430 /// let x1 = Instance::new().set_state(State::Running);
431 /// let x2 = Instance::new().set_state(State::Deleted);
432 /// ```
433 pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
434 self.state = v.into();
435 self
436 }
437
438 /// Sets the value of [hyperthreading_enabled][crate::model::Instance::hyperthreading_enabled].
439 ///
440 /// # Example
441 /// ```ignore,no_run
442 /// # use google_cloud_baremetalsolution_v2::model::Instance;
443 /// let x = Instance::new().set_hyperthreading_enabled(true);
444 /// ```
445 pub fn set_hyperthreading_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
446 self.hyperthreading_enabled = v.into();
447 self
448 }
449
450 /// Sets the value of [labels][crate::model::Instance::labels].
451 ///
452 /// # Example
453 /// ```ignore,no_run
454 /// # use google_cloud_baremetalsolution_v2::model::Instance;
455 /// let x = Instance::new().set_labels([
456 /// ("key0", "abc"),
457 /// ("key1", "xyz"),
458 /// ]);
459 /// ```
460 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
461 where
462 T: std::iter::IntoIterator<Item = (K, V)>,
463 K: std::convert::Into<std::string::String>,
464 V: std::convert::Into<std::string::String>,
465 {
466 use std::iter::Iterator;
467 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
468 self
469 }
470
471 /// Sets the value of [luns][crate::model::Instance::luns].
472 ///
473 /// # Example
474 /// ```ignore,no_run
475 /// # use google_cloud_baremetalsolution_v2::model::Instance;
476 /// use google_cloud_baremetalsolution_v2::model::Lun;
477 /// let x = Instance::new()
478 /// .set_luns([
479 /// Lun::default()/* use setters */,
480 /// Lun::default()/* use (different) setters */,
481 /// ]);
482 /// ```
483 pub fn set_luns<T, V>(mut self, v: T) -> Self
484 where
485 T: std::iter::IntoIterator<Item = V>,
486 V: std::convert::Into<crate::model::Lun>,
487 {
488 use std::iter::Iterator;
489 self.luns = v.into_iter().map(|i| i.into()).collect();
490 self
491 }
492
493 /// Sets the value of [volumes][crate::model::Instance::volumes].
494 ///
495 /// # Example
496 /// ```ignore,no_run
497 /// # use google_cloud_baremetalsolution_v2::model::Instance;
498 /// use google_cloud_baremetalsolution_v2::model::Volume;
499 /// let x = Instance::new()
500 /// .set_volumes([
501 /// Volume::default()/* use setters */,
502 /// Volume::default()/* use (different) setters */,
503 /// ]);
504 /// ```
505 pub fn set_volumes<T, V>(mut self, v: T) -> Self
506 where
507 T: std::iter::IntoIterator<Item = V>,
508 V: std::convert::Into<crate::model::Volume>,
509 {
510 use std::iter::Iterator;
511 self.volumes = v.into_iter().map(|i| i.into()).collect();
512 self
513 }
514
515 /// Sets the value of [networks][crate::model::Instance::networks].
516 ///
517 /// # Example
518 /// ```ignore,no_run
519 /// # use google_cloud_baremetalsolution_v2::model::Instance;
520 /// use google_cloud_baremetalsolution_v2::model::Network;
521 /// let x = Instance::new()
522 /// .set_networks([
523 /// Network::default()/* use setters */,
524 /// Network::default()/* use (different) setters */,
525 /// ]);
526 /// ```
527 pub fn set_networks<T, V>(mut self, v: T) -> Self
528 where
529 T: std::iter::IntoIterator<Item = V>,
530 V: std::convert::Into<crate::model::Network>,
531 {
532 use std::iter::Iterator;
533 self.networks = v.into_iter().map(|i| i.into()).collect();
534 self
535 }
536
537 /// Sets the value of [interactive_serial_console_enabled][crate::model::Instance::interactive_serial_console_enabled].
538 ///
539 /// # Example
540 /// ```ignore,no_run
541 /// # use google_cloud_baremetalsolution_v2::model::Instance;
542 /// let x = Instance::new().set_interactive_serial_console_enabled(true);
543 /// ```
544 pub fn set_interactive_serial_console_enabled<T: std::convert::Into<bool>>(
545 mut self,
546 v: T,
547 ) -> Self {
548 self.interactive_serial_console_enabled = v.into();
549 self
550 }
551
552 /// Sets the value of [os_image][crate::model::Instance::os_image].
553 ///
554 /// # Example
555 /// ```ignore,no_run
556 /// # use google_cloud_baremetalsolution_v2::model::Instance;
557 /// let x = Instance::new().set_os_image("example");
558 /// ```
559 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
560 self.os_image = v.into();
561 self
562 }
563
564 /// Sets the value of [pod][crate::model::Instance::pod].
565 ///
566 /// # Example
567 /// ```ignore,no_run
568 /// # use google_cloud_baremetalsolution_v2::model::Instance;
569 /// let x = Instance::new().set_pod("example");
570 /// ```
571 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
572 self.pod = v.into();
573 self
574 }
575
576 /// Sets the value of [network_template][crate::model::Instance::network_template].
577 ///
578 /// # Example
579 /// ```ignore,no_run
580 /// # use google_cloud_baremetalsolution_v2::model::Instance;
581 /// let x = Instance::new().set_network_template("example");
582 /// ```
583 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
584 mut self,
585 v: T,
586 ) -> Self {
587 self.network_template = v.into();
588 self
589 }
590
591 /// Sets the value of [logical_interfaces][crate::model::Instance::logical_interfaces].
592 ///
593 /// # Example
594 /// ```ignore,no_run
595 /// # use google_cloud_baremetalsolution_v2::model::Instance;
596 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
597 /// let x = Instance::new()
598 /// .set_logical_interfaces([
599 /// LogicalInterface::default()/* use setters */,
600 /// LogicalInterface::default()/* use (different) setters */,
601 /// ]);
602 /// ```
603 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
604 where
605 T: std::iter::IntoIterator<Item = V>,
606 V: std::convert::Into<crate::model::LogicalInterface>,
607 {
608 use std::iter::Iterator;
609 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
610 self
611 }
612
613 /// Sets the value of [login_info][crate::model::Instance::login_info].
614 ///
615 /// # Example
616 /// ```ignore,no_run
617 /// # use google_cloud_baremetalsolution_v2::model::Instance;
618 /// let x = Instance::new().set_login_info("example");
619 /// ```
620 pub fn set_login_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
621 self.login_info = v.into();
622 self
623 }
624
625 /// Sets the value of [workload_profile][crate::model::Instance::workload_profile].
626 ///
627 /// # Example
628 /// ```ignore,no_run
629 /// # use google_cloud_baremetalsolution_v2::model::Instance;
630 /// use google_cloud_baremetalsolution_v2::model::WorkloadProfile;
631 /// let x0 = Instance::new().set_workload_profile(WorkloadProfile::Generic);
632 /// let x1 = Instance::new().set_workload_profile(WorkloadProfile::Hana);
633 /// ```
634 pub fn set_workload_profile<T: std::convert::Into<crate::model::WorkloadProfile>>(
635 mut self,
636 v: T,
637 ) -> Self {
638 self.workload_profile = v.into();
639 self
640 }
641
642 /// Sets the value of [firmware_version][crate::model::Instance::firmware_version].
643 ///
644 /// # Example
645 /// ```ignore,no_run
646 /// # use google_cloud_baremetalsolution_v2::model::Instance;
647 /// let x = Instance::new().set_firmware_version("example");
648 /// ```
649 pub fn set_firmware_version<T: std::convert::Into<std::string::String>>(
650 mut self,
651 v: T,
652 ) -> Self {
653 self.firmware_version = v.into();
654 self
655 }
656}
657
658impl wkt::message::Message for Instance {
659 fn typename() -> &'static str {
660 "type.googleapis.com/google.cloud.baremetalsolution.v2.Instance"
661 }
662}
663
664/// Defines additional types related to [Instance].
665pub mod instance {
666 #[allow(unused_imports)]
667 use super::*;
668
669 /// The possible states for this server.
670 ///
671 /// # Working with unknown values
672 ///
673 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
674 /// additional enum variants at any time. Adding new variants is not considered
675 /// a breaking change. Applications should write their code in anticipation of:
676 ///
677 /// - New values appearing in future releases of the client library, **and**
678 /// - New values received dynamically, without application changes.
679 ///
680 /// Please consult the [Working with enums] section in the user guide for some
681 /// guidelines.
682 ///
683 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
684 #[derive(Clone, Debug, PartialEq)]
685 #[non_exhaustive]
686 pub enum State {
687 /// The server is in an unknown state.
688 Unspecified,
689 /// The server is being provisioned.
690 Provisioning,
691 /// The server is running.
692 Running,
693 /// The server has been deleted.
694 Deleted,
695 /// The server is being updated.
696 Updating,
697 /// The server is starting.
698 Starting,
699 /// The server is stopping.
700 Stopping,
701 /// The server is shutdown.
702 Shutdown,
703 /// If set, the enum was initialized with an unknown value.
704 ///
705 /// Applications can examine the value using [State::value] or
706 /// [State::name].
707 UnknownValue(state::UnknownValue),
708 }
709
710 #[doc(hidden)]
711 pub mod state {
712 #[allow(unused_imports)]
713 use super::*;
714 #[derive(Clone, Debug, PartialEq)]
715 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
716 }
717
718 impl State {
719 /// Gets the enum value.
720 ///
721 /// Returns `None` if the enum contains an unknown value deserialized from
722 /// the string representation of enums.
723 pub fn value(&self) -> std::option::Option<i32> {
724 match self {
725 Self::Unspecified => std::option::Option::Some(0),
726 Self::Provisioning => std::option::Option::Some(1),
727 Self::Running => std::option::Option::Some(2),
728 Self::Deleted => std::option::Option::Some(3),
729 Self::Updating => std::option::Option::Some(4),
730 Self::Starting => std::option::Option::Some(5),
731 Self::Stopping => std::option::Option::Some(6),
732 Self::Shutdown => std::option::Option::Some(7),
733 Self::UnknownValue(u) => u.0.value(),
734 }
735 }
736
737 /// Gets the enum value as a string.
738 ///
739 /// Returns `None` if the enum contains an unknown value deserialized from
740 /// the integer representation of enums.
741 pub fn name(&self) -> std::option::Option<&str> {
742 match self {
743 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
744 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
745 Self::Running => std::option::Option::Some("RUNNING"),
746 Self::Deleted => std::option::Option::Some("DELETED"),
747 Self::Updating => std::option::Option::Some("UPDATING"),
748 Self::Starting => std::option::Option::Some("STARTING"),
749 Self::Stopping => std::option::Option::Some("STOPPING"),
750 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
751 Self::UnknownValue(u) => u.0.name(),
752 }
753 }
754 }
755
756 impl std::default::Default for State {
757 fn default() -> Self {
758 use std::convert::From;
759 Self::from(0)
760 }
761 }
762
763 impl std::fmt::Display for State {
764 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
765 wkt::internal::display_enum(f, self.name(), self.value())
766 }
767 }
768
769 impl std::convert::From<i32> for State {
770 fn from(value: i32) -> Self {
771 match value {
772 0 => Self::Unspecified,
773 1 => Self::Provisioning,
774 2 => Self::Running,
775 3 => Self::Deleted,
776 4 => Self::Updating,
777 5 => Self::Starting,
778 6 => Self::Stopping,
779 7 => Self::Shutdown,
780 _ => Self::UnknownValue(state::UnknownValue(
781 wkt::internal::UnknownEnumValue::Integer(value),
782 )),
783 }
784 }
785 }
786
787 impl std::convert::From<&str> for State {
788 fn from(value: &str) -> Self {
789 use std::string::ToString;
790 match value {
791 "STATE_UNSPECIFIED" => Self::Unspecified,
792 "PROVISIONING" => Self::Provisioning,
793 "RUNNING" => Self::Running,
794 "DELETED" => Self::Deleted,
795 "UPDATING" => Self::Updating,
796 "STARTING" => Self::Starting,
797 "STOPPING" => Self::Stopping,
798 "SHUTDOWN" => Self::Shutdown,
799 _ => Self::UnknownValue(state::UnknownValue(
800 wkt::internal::UnknownEnumValue::String(value.to_string()),
801 )),
802 }
803 }
804 }
805
806 impl serde::ser::Serialize for State {
807 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
808 where
809 S: serde::Serializer,
810 {
811 match self {
812 Self::Unspecified => serializer.serialize_i32(0),
813 Self::Provisioning => serializer.serialize_i32(1),
814 Self::Running => serializer.serialize_i32(2),
815 Self::Deleted => serializer.serialize_i32(3),
816 Self::Updating => serializer.serialize_i32(4),
817 Self::Starting => serializer.serialize_i32(5),
818 Self::Stopping => serializer.serialize_i32(6),
819 Self::Shutdown => serializer.serialize_i32(7),
820 Self::UnknownValue(u) => u.0.serialize(serializer),
821 }
822 }
823 }
824
825 impl<'de> serde::de::Deserialize<'de> for State {
826 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
827 where
828 D: serde::Deserializer<'de>,
829 {
830 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
831 ".google.cloud.baremetalsolution.v2.Instance.State",
832 ))
833 }
834 }
835}
836
837/// Message for requesting server information.
838#[derive(Clone, Default, PartialEq)]
839#[non_exhaustive]
840pub struct GetInstanceRequest {
841 /// Required. Name of the resource.
842 pub name: std::string::String,
843
844 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
845}
846
847impl GetInstanceRequest {
848 /// Creates a new default instance.
849 pub fn new() -> Self {
850 std::default::Default::default()
851 }
852
853 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
854 ///
855 /// # Example
856 /// ```ignore,no_run
857 /// # use google_cloud_baremetalsolution_v2::model::GetInstanceRequest;
858 /// let x = GetInstanceRequest::new().set_name("example");
859 /// ```
860 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
861 self.name = v.into();
862 self
863 }
864}
865
866impl wkt::message::Message for GetInstanceRequest {
867 fn typename() -> &'static str {
868 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetInstanceRequest"
869 }
870}
871
872/// Message for requesting the list of servers.
873#[derive(Clone, Default, PartialEq)]
874#[non_exhaustive]
875pub struct ListInstancesRequest {
876 /// Required. Parent value for ListInstancesRequest.
877 pub parent: std::string::String,
878
879 /// Requested page size. Server may return fewer items than requested.
880 /// If unspecified, the server will pick an appropriate default.
881 pub page_size: i32,
882
883 /// A token identifying a page of results from the server.
884 pub page_token: std::string::String,
885
886 /// List filter.
887 pub filter: std::string::String,
888
889 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
890}
891
892impl ListInstancesRequest {
893 /// Creates a new default instance.
894 pub fn new() -> Self {
895 std::default::Default::default()
896 }
897
898 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
899 ///
900 /// # Example
901 /// ```ignore,no_run
902 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
903 /// let x = ListInstancesRequest::new().set_parent("example");
904 /// ```
905 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
906 self.parent = v.into();
907 self
908 }
909
910 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
911 ///
912 /// # Example
913 /// ```ignore,no_run
914 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
915 /// let x = ListInstancesRequest::new().set_page_size(42);
916 /// ```
917 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
918 self.page_size = v.into();
919 self
920 }
921
922 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
923 ///
924 /// # Example
925 /// ```ignore,no_run
926 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
927 /// let x = ListInstancesRequest::new().set_page_token("example");
928 /// ```
929 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
930 self.page_token = v.into();
931 self
932 }
933
934 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
935 ///
936 /// # Example
937 /// ```ignore,no_run
938 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
939 /// let x = ListInstancesRequest::new().set_filter("example");
940 /// ```
941 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
942 self.filter = v.into();
943 self
944 }
945}
946
947impl wkt::message::Message for ListInstancesRequest {
948 fn typename() -> &'static str {
949 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesRequest"
950 }
951}
952
953/// Response message for the list of servers.
954#[derive(Clone, Default, PartialEq)]
955#[non_exhaustive]
956pub struct ListInstancesResponse {
957 /// The list of servers.
958 pub instances: std::vec::Vec<crate::model::Instance>,
959
960 /// A token identifying a page of results from the server.
961 pub next_page_token: std::string::String,
962
963 /// Locations that could not be reached.
964 pub unreachable: std::vec::Vec<std::string::String>,
965
966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
967}
968
969impl ListInstancesResponse {
970 /// Creates a new default instance.
971 pub fn new() -> Self {
972 std::default::Default::default()
973 }
974
975 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
976 ///
977 /// # Example
978 /// ```ignore,no_run
979 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
980 /// use google_cloud_baremetalsolution_v2::model::Instance;
981 /// let x = ListInstancesResponse::new()
982 /// .set_instances([
983 /// Instance::default()/* use setters */,
984 /// Instance::default()/* use (different) setters */,
985 /// ]);
986 /// ```
987 pub fn set_instances<T, V>(mut self, v: T) -> Self
988 where
989 T: std::iter::IntoIterator<Item = V>,
990 V: std::convert::Into<crate::model::Instance>,
991 {
992 use std::iter::Iterator;
993 self.instances = v.into_iter().map(|i| i.into()).collect();
994 self
995 }
996
997 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
998 ///
999 /// # Example
1000 /// ```ignore,no_run
1001 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
1002 /// let x = ListInstancesResponse::new().set_next_page_token("example");
1003 /// ```
1004 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1005 self.next_page_token = v.into();
1006 self
1007 }
1008
1009 /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
1010 ///
1011 /// # Example
1012 /// ```ignore,no_run
1013 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
1014 /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
1015 /// ```
1016 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1017 where
1018 T: std::iter::IntoIterator<Item = V>,
1019 V: std::convert::Into<std::string::String>,
1020 {
1021 use std::iter::Iterator;
1022 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1023 self
1024 }
1025}
1026
1027impl wkt::message::Message for ListInstancesResponse {
1028 fn typename() -> &'static str {
1029 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesResponse"
1030 }
1031}
1032
1033#[doc(hidden)]
1034impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
1035 type PageItem = crate::model::Instance;
1036
1037 fn items(self) -> std::vec::Vec<Self::PageItem> {
1038 self.instances
1039 }
1040
1041 fn next_page_token(&self) -> std::string::String {
1042 use std::clone::Clone;
1043 self.next_page_token.clone()
1044 }
1045}
1046
1047/// Message requesting to updating a server.
1048#[derive(Clone, Default, PartialEq)]
1049#[non_exhaustive]
1050pub struct UpdateInstanceRequest {
1051 /// Required. The server to update.
1052 ///
1053 /// The `name` field is used to identify the instance to update.
1054 /// Format: projects/{project}/locations/{location}/instances/{instance}
1055 pub instance: std::option::Option<crate::model::Instance>,
1056
1057 /// The list of fields to update.
1058 /// The currently supported fields are:
1059 /// `labels`
1060 /// `hyperthreading_enabled`
1061 /// `os_image`
1062 pub update_mask: std::option::Option<wkt::FieldMask>,
1063
1064 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1065}
1066
1067impl UpdateInstanceRequest {
1068 /// Creates a new default instance.
1069 pub fn new() -> Self {
1070 std::default::Default::default()
1071 }
1072
1073 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
1074 ///
1075 /// # Example
1076 /// ```ignore,no_run
1077 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1078 /// use google_cloud_baremetalsolution_v2::model::Instance;
1079 /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
1080 /// ```
1081 pub fn set_instance<T>(mut self, v: T) -> Self
1082 where
1083 T: std::convert::Into<crate::model::Instance>,
1084 {
1085 self.instance = std::option::Option::Some(v.into());
1086 self
1087 }
1088
1089 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
1090 ///
1091 /// # Example
1092 /// ```ignore,no_run
1093 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1094 /// use google_cloud_baremetalsolution_v2::model::Instance;
1095 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
1096 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
1097 /// ```
1098 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1099 where
1100 T: std::convert::Into<crate::model::Instance>,
1101 {
1102 self.instance = v.map(|x| x.into());
1103 self
1104 }
1105
1106 /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1107 ///
1108 /// # Example
1109 /// ```ignore,no_run
1110 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1111 /// use wkt::FieldMask;
1112 /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1113 /// ```
1114 pub fn set_update_mask<T>(mut self, v: T) -> Self
1115 where
1116 T: std::convert::Into<wkt::FieldMask>,
1117 {
1118 self.update_mask = std::option::Option::Some(v.into());
1119 self
1120 }
1121
1122 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1123 ///
1124 /// # Example
1125 /// ```ignore,no_run
1126 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1127 /// use wkt::FieldMask;
1128 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1129 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1130 /// ```
1131 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1132 where
1133 T: std::convert::Into<wkt::FieldMask>,
1134 {
1135 self.update_mask = v.map(|x| x.into());
1136 self
1137 }
1138}
1139
1140impl wkt::message::Message for UpdateInstanceRequest {
1141 fn typename() -> &'static str {
1142 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateInstanceRequest"
1143 }
1144}
1145
1146/// Message requesting rename of a server.
1147#[derive(Clone, Default, PartialEq)]
1148#[non_exhaustive]
1149pub struct RenameInstanceRequest {
1150 /// Required. The `name` field is used to identify the instance.
1151 /// Format: projects/{project}/locations/{location}/instances/{instance}
1152 pub name: std::string::String,
1153
1154 /// Required. The new `id` of the instance.
1155 pub new_instance_id: std::string::String,
1156
1157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1158}
1159
1160impl RenameInstanceRequest {
1161 /// Creates a new default instance.
1162 pub fn new() -> Self {
1163 std::default::Default::default()
1164 }
1165
1166 /// Sets the value of [name][crate::model::RenameInstanceRequest::name].
1167 ///
1168 /// # Example
1169 /// ```ignore,no_run
1170 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1171 /// let x = RenameInstanceRequest::new().set_name("example");
1172 /// ```
1173 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1174 self.name = v.into();
1175 self
1176 }
1177
1178 /// Sets the value of [new_instance_id][crate::model::RenameInstanceRequest::new_instance_id].
1179 ///
1180 /// # Example
1181 /// ```ignore,no_run
1182 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1183 /// let x = RenameInstanceRequest::new().set_new_instance_id("example");
1184 /// ```
1185 pub fn set_new_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1186 self.new_instance_id = v.into();
1187 self
1188 }
1189}
1190
1191impl wkt::message::Message for RenameInstanceRequest {
1192 fn typename() -> &'static str {
1193 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameInstanceRequest"
1194 }
1195}
1196
1197/// Message requesting to reset a server.
1198#[derive(Clone, Default, PartialEq)]
1199#[non_exhaustive]
1200pub struct ResetInstanceRequest {
1201 /// Required. Name of the resource.
1202 pub name: std::string::String,
1203
1204 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1205}
1206
1207impl ResetInstanceRequest {
1208 /// Creates a new default instance.
1209 pub fn new() -> Self {
1210 std::default::Default::default()
1211 }
1212
1213 /// Sets the value of [name][crate::model::ResetInstanceRequest::name].
1214 ///
1215 /// # Example
1216 /// ```ignore,no_run
1217 /// # use google_cloud_baremetalsolution_v2::model::ResetInstanceRequest;
1218 /// let x = ResetInstanceRequest::new().set_name("example");
1219 /// ```
1220 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1221 self.name = v.into();
1222 self
1223 }
1224}
1225
1226impl wkt::message::Message for ResetInstanceRequest {
1227 fn typename() -> &'static str {
1228 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceRequest"
1229 }
1230}
1231
1232/// Message requesting to start a server.
1233#[derive(Clone, Default, PartialEq)]
1234#[non_exhaustive]
1235pub struct StartInstanceRequest {
1236 /// Required. Name of the resource.
1237 pub name: std::string::String,
1238
1239 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1240}
1241
1242impl StartInstanceRequest {
1243 /// Creates a new default instance.
1244 pub fn new() -> Self {
1245 std::default::Default::default()
1246 }
1247
1248 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
1249 ///
1250 /// # Example
1251 /// ```ignore,no_run
1252 /// # use google_cloud_baremetalsolution_v2::model::StartInstanceRequest;
1253 /// let x = StartInstanceRequest::new().set_name("example");
1254 /// ```
1255 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1256 self.name = v.into();
1257 self
1258 }
1259}
1260
1261impl wkt::message::Message for StartInstanceRequest {
1262 fn typename() -> &'static str {
1263 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceRequest"
1264 }
1265}
1266
1267/// Response message from starting a server.
1268#[derive(Clone, Default, PartialEq)]
1269#[non_exhaustive]
1270pub struct StartInstanceResponse {
1271 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1272}
1273
1274impl StartInstanceResponse {
1275 /// Creates a new default instance.
1276 pub fn new() -> Self {
1277 std::default::Default::default()
1278 }
1279}
1280
1281impl wkt::message::Message for StartInstanceResponse {
1282 fn typename() -> &'static str {
1283 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceResponse"
1284 }
1285}
1286
1287/// Message requesting to stop a server.
1288#[derive(Clone, Default, PartialEq)]
1289#[non_exhaustive]
1290pub struct StopInstanceRequest {
1291 /// Required. Name of the resource.
1292 pub name: std::string::String,
1293
1294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1295}
1296
1297impl StopInstanceRequest {
1298 /// Creates a new default instance.
1299 pub fn new() -> Self {
1300 std::default::Default::default()
1301 }
1302
1303 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
1304 ///
1305 /// # Example
1306 /// ```ignore,no_run
1307 /// # use google_cloud_baremetalsolution_v2::model::StopInstanceRequest;
1308 /// let x = StopInstanceRequest::new().set_name("example");
1309 /// ```
1310 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1311 self.name = v.into();
1312 self
1313 }
1314}
1315
1316impl wkt::message::Message for StopInstanceRequest {
1317 fn typename() -> &'static str {
1318 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceRequest"
1319 }
1320}
1321
1322/// Response message from stopping a server.
1323#[derive(Clone, Default, PartialEq)]
1324#[non_exhaustive]
1325pub struct StopInstanceResponse {
1326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1327}
1328
1329impl StopInstanceResponse {
1330 /// Creates a new default instance.
1331 pub fn new() -> Self {
1332 std::default::Default::default()
1333 }
1334}
1335
1336impl wkt::message::Message for StopInstanceResponse {
1337 fn typename() -> &'static str {
1338 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceResponse"
1339 }
1340}
1341
1342/// Message for enabling the interactive serial console on an instance.
1343#[derive(Clone, Default, PartialEq)]
1344#[non_exhaustive]
1345pub struct EnableInteractiveSerialConsoleRequest {
1346 /// Required. Name of the resource.
1347 pub name: std::string::String,
1348
1349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1350}
1351
1352impl EnableInteractiveSerialConsoleRequest {
1353 /// Creates a new default instance.
1354 pub fn new() -> Self {
1355 std::default::Default::default()
1356 }
1357
1358 /// Sets the value of [name][crate::model::EnableInteractiveSerialConsoleRequest::name].
1359 ///
1360 /// # Example
1361 /// ```ignore,no_run
1362 /// # use google_cloud_baremetalsolution_v2::model::EnableInteractiveSerialConsoleRequest;
1363 /// let x = EnableInteractiveSerialConsoleRequest::new().set_name("example");
1364 /// ```
1365 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1366 self.name = v.into();
1367 self
1368 }
1369}
1370
1371impl wkt::message::Message for EnableInteractiveSerialConsoleRequest {
1372 fn typename() -> &'static str {
1373 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleRequest"
1374 }
1375}
1376
1377/// Message for response of EnableInteractiveSerialConsole.
1378#[derive(Clone, Default, PartialEq)]
1379#[non_exhaustive]
1380pub struct EnableInteractiveSerialConsoleResponse {
1381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1382}
1383
1384impl EnableInteractiveSerialConsoleResponse {
1385 /// Creates a new default instance.
1386 pub fn new() -> Self {
1387 std::default::Default::default()
1388 }
1389}
1390
1391impl wkt::message::Message for EnableInteractiveSerialConsoleResponse {
1392 fn typename() -> &'static str {
1393 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleResponse"
1394 }
1395}
1396
1397/// Message for disabling the interactive serial console on an instance.
1398#[derive(Clone, Default, PartialEq)]
1399#[non_exhaustive]
1400pub struct DisableInteractiveSerialConsoleRequest {
1401 /// Required. Name of the resource.
1402 pub name: std::string::String,
1403
1404 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1405}
1406
1407impl DisableInteractiveSerialConsoleRequest {
1408 /// Creates a new default instance.
1409 pub fn new() -> Self {
1410 std::default::Default::default()
1411 }
1412
1413 /// Sets the value of [name][crate::model::DisableInteractiveSerialConsoleRequest::name].
1414 ///
1415 /// # Example
1416 /// ```ignore,no_run
1417 /// # use google_cloud_baremetalsolution_v2::model::DisableInteractiveSerialConsoleRequest;
1418 /// let x = DisableInteractiveSerialConsoleRequest::new().set_name("example");
1419 /// ```
1420 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1421 self.name = v.into();
1422 self
1423 }
1424}
1425
1426impl wkt::message::Message for DisableInteractiveSerialConsoleRequest {
1427 fn typename() -> &'static str {
1428 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleRequest"
1429 }
1430}
1431
1432/// Message for response of DisableInteractiveSerialConsole.
1433#[derive(Clone, Default, PartialEq)]
1434#[non_exhaustive]
1435pub struct DisableInteractiveSerialConsoleResponse {
1436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1437}
1438
1439impl DisableInteractiveSerialConsoleResponse {
1440 /// Creates a new default instance.
1441 pub fn new() -> Self {
1442 std::default::Default::default()
1443 }
1444}
1445
1446impl wkt::message::Message for DisableInteractiveSerialConsoleResponse {
1447 fn typename() -> &'static str {
1448 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleResponse"
1449 }
1450}
1451
1452/// Message for detach specific LUN from an Instance.
1453#[derive(Clone, Default, PartialEq)]
1454#[non_exhaustive]
1455pub struct DetachLunRequest {
1456 /// Required. Name of the instance.
1457 pub instance: std::string::String,
1458
1459 /// Required. Name of the Lun to detach.
1460 pub lun: std::string::String,
1461
1462 /// If true, performs lun unmapping without instance reboot.
1463 pub skip_reboot: bool,
1464
1465 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1466}
1467
1468impl DetachLunRequest {
1469 /// Creates a new default instance.
1470 pub fn new() -> Self {
1471 std::default::Default::default()
1472 }
1473
1474 /// Sets the value of [instance][crate::model::DetachLunRequest::instance].
1475 ///
1476 /// # Example
1477 /// ```ignore,no_run
1478 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1479 /// let x = DetachLunRequest::new().set_instance("example");
1480 /// ```
1481 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1482 self.instance = v.into();
1483 self
1484 }
1485
1486 /// Sets the value of [lun][crate::model::DetachLunRequest::lun].
1487 ///
1488 /// # Example
1489 /// ```ignore,no_run
1490 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1491 /// let x = DetachLunRequest::new().set_lun("example");
1492 /// ```
1493 pub fn set_lun<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1494 self.lun = v.into();
1495 self
1496 }
1497
1498 /// Sets the value of [skip_reboot][crate::model::DetachLunRequest::skip_reboot].
1499 ///
1500 /// # Example
1501 /// ```ignore,no_run
1502 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1503 /// let x = DetachLunRequest::new().set_skip_reboot(true);
1504 /// ```
1505 pub fn set_skip_reboot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1506 self.skip_reboot = v.into();
1507 self
1508 }
1509}
1510
1511impl wkt::message::Message for DetachLunRequest {
1512 fn typename() -> &'static str {
1513 "type.googleapis.com/google.cloud.baremetalsolution.v2.DetachLunRequest"
1514 }
1515}
1516
1517/// Network template.
1518#[derive(Clone, Default, PartialEq)]
1519#[non_exhaustive]
1520pub struct ServerNetworkTemplate {
1521 /// Output only. Template's unique name. The full resource name follows the
1522 /// pattern:
1523 /// `projects/{project}/locations/{location}/serverNetworkTemplate/{server_network_template}`
1524 /// Generally, the {server_network_template} follows the syntax of
1525 /// "bond<interface_type_index><bond_mode>" or "nic<interface_type_index>".
1526 pub name: std::string::String,
1527
1528 /// Instance types this template is applicable to.
1529 pub applicable_instance_types: std::vec::Vec<std::string::String>,
1530
1531 /// Logical interfaces.
1532 pub logical_interfaces: std::vec::Vec<crate::model::server_network_template::LogicalInterface>,
1533
1534 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1535}
1536
1537impl ServerNetworkTemplate {
1538 /// Creates a new default instance.
1539 pub fn new() -> Self {
1540 std::default::Default::default()
1541 }
1542
1543 /// Sets the value of [name][crate::model::ServerNetworkTemplate::name].
1544 ///
1545 /// # Example
1546 /// ```ignore,no_run
1547 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1548 /// let x = ServerNetworkTemplate::new().set_name("example");
1549 /// ```
1550 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1551 self.name = v.into();
1552 self
1553 }
1554
1555 /// Sets the value of [applicable_instance_types][crate::model::ServerNetworkTemplate::applicable_instance_types].
1556 ///
1557 /// # Example
1558 /// ```ignore,no_run
1559 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1560 /// let x = ServerNetworkTemplate::new().set_applicable_instance_types(["a", "b", "c"]);
1561 /// ```
1562 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
1563 where
1564 T: std::iter::IntoIterator<Item = V>,
1565 V: std::convert::Into<std::string::String>,
1566 {
1567 use std::iter::Iterator;
1568 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
1569 self
1570 }
1571
1572 /// Sets the value of [logical_interfaces][crate::model::ServerNetworkTemplate::logical_interfaces].
1573 ///
1574 /// # Example
1575 /// ```ignore,no_run
1576 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1577 /// use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1578 /// let x = ServerNetworkTemplate::new()
1579 /// .set_logical_interfaces([
1580 /// LogicalInterface::default()/* use setters */,
1581 /// LogicalInterface::default()/* use (different) setters */,
1582 /// ]);
1583 /// ```
1584 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
1585 where
1586 T: std::iter::IntoIterator<Item = V>,
1587 V: std::convert::Into<crate::model::server_network_template::LogicalInterface>,
1588 {
1589 use std::iter::Iterator;
1590 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
1591 self
1592 }
1593}
1594
1595impl wkt::message::Message for ServerNetworkTemplate {
1596 fn typename() -> &'static str {
1597 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate"
1598 }
1599}
1600
1601/// Defines additional types related to [ServerNetworkTemplate].
1602pub mod server_network_template {
1603 #[allow(unused_imports)]
1604 use super::*;
1605
1606 /// Logical interface.
1607 #[derive(Clone, Default, PartialEq)]
1608 #[non_exhaustive]
1609 pub struct LogicalInterface {
1610 /// Interface name.
1611 /// This is not a globally unique identifier.
1612 /// Name is unique only inside the ServerNetworkTemplate. This is of syntax
1613 /// \<bond\><interface_type_index><bond_mode> or \<nic\><interface_type_index>
1614 /// and forms part of the network template name.
1615 pub name: std::string::String,
1616
1617 /// Interface type.
1618 pub r#type: crate::model::server_network_template::logical_interface::InterfaceType,
1619
1620 /// If true, interface must have network connected.
1621 pub required: bool,
1622
1623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1624 }
1625
1626 impl LogicalInterface {
1627 /// Creates a new default instance.
1628 pub fn new() -> Self {
1629 std::default::Default::default()
1630 }
1631
1632 /// Sets the value of [name][crate::model::server_network_template::LogicalInterface::name].
1633 ///
1634 /// # Example
1635 /// ```ignore,no_run
1636 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1637 /// let x = LogicalInterface::new().set_name("example");
1638 /// ```
1639 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1640 self.name = v.into();
1641 self
1642 }
1643
1644 /// Sets the value of [r#type][crate::model::server_network_template::LogicalInterface::type].
1645 ///
1646 /// # Example
1647 /// ```ignore,no_run
1648 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1649 /// use google_cloud_baremetalsolution_v2::model::server_network_template::logical_interface::InterfaceType;
1650 /// let x0 = LogicalInterface::new().set_type(InterfaceType::Bond);
1651 /// let x1 = LogicalInterface::new().set_type(InterfaceType::Nic);
1652 /// ```
1653 pub fn set_type<
1654 T: std::convert::Into<
1655 crate::model::server_network_template::logical_interface::InterfaceType,
1656 >,
1657 >(
1658 mut self,
1659 v: T,
1660 ) -> Self {
1661 self.r#type = v.into();
1662 self
1663 }
1664
1665 /// Sets the value of [required][crate::model::server_network_template::LogicalInterface::required].
1666 ///
1667 /// # Example
1668 /// ```ignore,no_run
1669 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1670 /// let x = LogicalInterface::new().set_required(true);
1671 /// ```
1672 pub fn set_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1673 self.required = v.into();
1674 self
1675 }
1676 }
1677
1678 impl wkt::message::Message for LogicalInterface {
1679 fn typename() -> &'static str {
1680 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface"
1681 }
1682 }
1683
1684 /// Defines additional types related to [LogicalInterface].
1685 pub mod logical_interface {
1686 #[allow(unused_imports)]
1687 use super::*;
1688
1689 /// Interface type.
1690 ///
1691 /// # Working with unknown values
1692 ///
1693 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1694 /// additional enum variants at any time. Adding new variants is not considered
1695 /// a breaking change. Applications should write their code in anticipation of:
1696 ///
1697 /// - New values appearing in future releases of the client library, **and**
1698 /// - New values received dynamically, without application changes.
1699 ///
1700 /// Please consult the [Working with enums] section in the user guide for some
1701 /// guidelines.
1702 ///
1703 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1704 #[derive(Clone, Debug, PartialEq)]
1705 #[non_exhaustive]
1706 pub enum InterfaceType {
1707 /// Unspecified value.
1708 Unspecified,
1709 /// Bond interface type.
1710 Bond,
1711 /// NIC interface type.
1712 Nic,
1713 /// If set, the enum was initialized with an unknown value.
1714 ///
1715 /// Applications can examine the value using [InterfaceType::value] or
1716 /// [InterfaceType::name].
1717 UnknownValue(interface_type::UnknownValue),
1718 }
1719
1720 #[doc(hidden)]
1721 pub mod interface_type {
1722 #[allow(unused_imports)]
1723 use super::*;
1724 #[derive(Clone, Debug, PartialEq)]
1725 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1726 }
1727
1728 impl InterfaceType {
1729 /// Gets the enum value.
1730 ///
1731 /// Returns `None` if the enum contains an unknown value deserialized from
1732 /// the string representation of enums.
1733 pub fn value(&self) -> std::option::Option<i32> {
1734 match self {
1735 Self::Unspecified => std::option::Option::Some(0),
1736 Self::Bond => std::option::Option::Some(1),
1737 Self::Nic => std::option::Option::Some(2),
1738 Self::UnknownValue(u) => u.0.value(),
1739 }
1740 }
1741
1742 /// Gets the enum value as a string.
1743 ///
1744 /// Returns `None` if the enum contains an unknown value deserialized from
1745 /// the integer representation of enums.
1746 pub fn name(&self) -> std::option::Option<&str> {
1747 match self {
1748 Self::Unspecified => std::option::Option::Some("INTERFACE_TYPE_UNSPECIFIED"),
1749 Self::Bond => std::option::Option::Some("BOND"),
1750 Self::Nic => std::option::Option::Some("NIC"),
1751 Self::UnknownValue(u) => u.0.name(),
1752 }
1753 }
1754 }
1755
1756 impl std::default::Default for InterfaceType {
1757 fn default() -> Self {
1758 use std::convert::From;
1759 Self::from(0)
1760 }
1761 }
1762
1763 impl std::fmt::Display for InterfaceType {
1764 fn fmt(
1765 &self,
1766 f: &mut std::fmt::Formatter<'_>,
1767 ) -> std::result::Result<(), std::fmt::Error> {
1768 wkt::internal::display_enum(f, self.name(), self.value())
1769 }
1770 }
1771
1772 impl std::convert::From<i32> for InterfaceType {
1773 fn from(value: i32) -> Self {
1774 match value {
1775 0 => Self::Unspecified,
1776 1 => Self::Bond,
1777 2 => Self::Nic,
1778 _ => Self::UnknownValue(interface_type::UnknownValue(
1779 wkt::internal::UnknownEnumValue::Integer(value),
1780 )),
1781 }
1782 }
1783 }
1784
1785 impl std::convert::From<&str> for InterfaceType {
1786 fn from(value: &str) -> Self {
1787 use std::string::ToString;
1788 match value {
1789 "INTERFACE_TYPE_UNSPECIFIED" => Self::Unspecified,
1790 "BOND" => Self::Bond,
1791 "NIC" => Self::Nic,
1792 _ => Self::UnknownValue(interface_type::UnknownValue(
1793 wkt::internal::UnknownEnumValue::String(value.to_string()),
1794 )),
1795 }
1796 }
1797 }
1798
1799 impl serde::ser::Serialize for InterfaceType {
1800 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1801 where
1802 S: serde::Serializer,
1803 {
1804 match self {
1805 Self::Unspecified => serializer.serialize_i32(0),
1806 Self::Bond => serializer.serialize_i32(1),
1807 Self::Nic => serializer.serialize_i32(2),
1808 Self::UnknownValue(u) => u.0.serialize(serializer),
1809 }
1810 }
1811 }
1812
1813 impl<'de> serde::de::Deserialize<'de> for InterfaceType {
1814 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1815 where
1816 D: serde::Deserializer<'de>,
1817 {
1818 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InterfaceType>::new(
1819 ".google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface.InterfaceType"))
1820 }
1821 }
1822 }
1823}
1824
1825/// A storage volume logical unit number (LUN).
1826#[derive(Clone, Default, PartialEq)]
1827#[non_exhaustive]
1828pub struct Lun {
1829 /// Output only. The name of the LUN.
1830 pub name: std::string::String,
1831
1832 /// An identifier for the LUN, generated by the backend.
1833 pub id: std::string::String,
1834
1835 /// The state of this storage volume.
1836 pub state: crate::model::lun::State,
1837
1838 /// The size of this LUN, in gigabytes.
1839 pub size_gb: i64,
1840
1841 /// The LUN multiprotocol type ensures the characteristics of the LUN are
1842 /// optimized for each operating system.
1843 pub multiprotocol_type: crate::model::lun::MultiprotocolType,
1844
1845 /// Display the storage volume for this LUN.
1846 pub storage_volume: std::string::String,
1847
1848 /// Display if this LUN can be shared between multiple physical servers.
1849 pub shareable: bool,
1850
1851 /// Display if this LUN is a boot LUN.
1852 pub boot_lun: bool,
1853
1854 /// The storage type for this LUN.
1855 pub storage_type: crate::model::lun::StorageType,
1856
1857 /// The WWID for this LUN.
1858 pub wwid: std::string::String,
1859
1860 /// Output only. Time after which LUN will be fully deleted.
1861 /// It is filled only for LUNs in COOL_OFF state.
1862 pub expire_time: std::option::Option<wkt::Timestamp>,
1863
1864 /// Output only. Instances this Lun is attached to.
1865 pub instances: std::vec::Vec<std::string::String>,
1866
1867 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1868}
1869
1870impl Lun {
1871 /// Creates a new default instance.
1872 pub fn new() -> Self {
1873 std::default::Default::default()
1874 }
1875
1876 /// Sets the value of [name][crate::model::Lun::name].
1877 ///
1878 /// # Example
1879 /// ```ignore,no_run
1880 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1881 /// let x = Lun::new().set_name("example");
1882 /// ```
1883 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1884 self.name = v.into();
1885 self
1886 }
1887
1888 /// Sets the value of [id][crate::model::Lun::id].
1889 ///
1890 /// # Example
1891 /// ```ignore,no_run
1892 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1893 /// let x = Lun::new().set_id("example");
1894 /// ```
1895 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1896 self.id = v.into();
1897 self
1898 }
1899
1900 /// Sets the value of [state][crate::model::Lun::state].
1901 ///
1902 /// # Example
1903 /// ```ignore,no_run
1904 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1905 /// use google_cloud_baremetalsolution_v2::model::lun::State;
1906 /// let x0 = Lun::new().set_state(State::Creating);
1907 /// let x1 = Lun::new().set_state(State::Updating);
1908 /// let x2 = Lun::new().set_state(State::Ready);
1909 /// ```
1910 pub fn set_state<T: std::convert::Into<crate::model::lun::State>>(mut self, v: T) -> Self {
1911 self.state = v.into();
1912 self
1913 }
1914
1915 /// Sets the value of [size_gb][crate::model::Lun::size_gb].
1916 ///
1917 /// # Example
1918 /// ```ignore,no_run
1919 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1920 /// let x = Lun::new().set_size_gb(42);
1921 /// ```
1922 pub fn set_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1923 self.size_gb = v.into();
1924 self
1925 }
1926
1927 /// Sets the value of [multiprotocol_type][crate::model::Lun::multiprotocol_type].
1928 ///
1929 /// # Example
1930 /// ```ignore,no_run
1931 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1932 /// use google_cloud_baremetalsolution_v2::model::lun::MultiprotocolType;
1933 /// let x0 = Lun::new().set_multiprotocol_type(MultiprotocolType::Linux);
1934 /// ```
1935 pub fn set_multiprotocol_type<T: std::convert::Into<crate::model::lun::MultiprotocolType>>(
1936 mut self,
1937 v: T,
1938 ) -> Self {
1939 self.multiprotocol_type = v.into();
1940 self
1941 }
1942
1943 /// Sets the value of [storage_volume][crate::model::Lun::storage_volume].
1944 ///
1945 /// # Example
1946 /// ```ignore,no_run
1947 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1948 /// let x = Lun::new().set_storage_volume("example");
1949 /// ```
1950 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1951 self.storage_volume = v.into();
1952 self
1953 }
1954
1955 /// Sets the value of [shareable][crate::model::Lun::shareable].
1956 ///
1957 /// # Example
1958 /// ```ignore,no_run
1959 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1960 /// let x = Lun::new().set_shareable(true);
1961 /// ```
1962 pub fn set_shareable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1963 self.shareable = v.into();
1964 self
1965 }
1966
1967 /// Sets the value of [boot_lun][crate::model::Lun::boot_lun].
1968 ///
1969 /// # Example
1970 /// ```ignore,no_run
1971 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1972 /// let x = Lun::new().set_boot_lun(true);
1973 /// ```
1974 pub fn set_boot_lun<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1975 self.boot_lun = v.into();
1976 self
1977 }
1978
1979 /// Sets the value of [storage_type][crate::model::Lun::storage_type].
1980 ///
1981 /// # Example
1982 /// ```ignore,no_run
1983 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1984 /// use google_cloud_baremetalsolution_v2::model::lun::StorageType;
1985 /// let x0 = Lun::new().set_storage_type(StorageType::Ssd);
1986 /// let x1 = Lun::new().set_storage_type(StorageType::Hdd);
1987 /// ```
1988 pub fn set_storage_type<T: std::convert::Into<crate::model::lun::StorageType>>(
1989 mut self,
1990 v: T,
1991 ) -> Self {
1992 self.storage_type = v.into();
1993 self
1994 }
1995
1996 /// Sets the value of [wwid][crate::model::Lun::wwid].
1997 ///
1998 /// # Example
1999 /// ```ignore,no_run
2000 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2001 /// let x = Lun::new().set_wwid("example");
2002 /// ```
2003 pub fn set_wwid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2004 self.wwid = v.into();
2005 self
2006 }
2007
2008 /// Sets the value of [expire_time][crate::model::Lun::expire_time].
2009 ///
2010 /// # Example
2011 /// ```ignore,no_run
2012 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2013 /// use wkt::Timestamp;
2014 /// let x = Lun::new().set_expire_time(Timestamp::default()/* use setters */);
2015 /// ```
2016 pub fn set_expire_time<T>(mut self, v: T) -> Self
2017 where
2018 T: std::convert::Into<wkt::Timestamp>,
2019 {
2020 self.expire_time = std::option::Option::Some(v.into());
2021 self
2022 }
2023
2024 /// Sets or clears the value of [expire_time][crate::model::Lun::expire_time].
2025 ///
2026 /// # Example
2027 /// ```ignore,no_run
2028 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2029 /// use wkt::Timestamp;
2030 /// let x = Lun::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2031 /// let x = Lun::new().set_or_clear_expire_time(None::<Timestamp>);
2032 /// ```
2033 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2034 where
2035 T: std::convert::Into<wkt::Timestamp>,
2036 {
2037 self.expire_time = v.map(|x| x.into());
2038 self
2039 }
2040
2041 /// Sets the value of [instances][crate::model::Lun::instances].
2042 ///
2043 /// # Example
2044 /// ```ignore,no_run
2045 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2046 /// let x = Lun::new().set_instances(["a", "b", "c"]);
2047 /// ```
2048 pub fn set_instances<T, V>(mut self, v: T) -> Self
2049 where
2050 T: std::iter::IntoIterator<Item = V>,
2051 V: std::convert::Into<std::string::String>,
2052 {
2053 use std::iter::Iterator;
2054 self.instances = v.into_iter().map(|i| i.into()).collect();
2055 self
2056 }
2057}
2058
2059impl wkt::message::Message for Lun {
2060 fn typename() -> &'static str {
2061 "type.googleapis.com/google.cloud.baremetalsolution.v2.Lun"
2062 }
2063}
2064
2065/// Defines additional types related to [Lun].
2066pub mod lun {
2067 #[allow(unused_imports)]
2068 use super::*;
2069
2070 /// The possible states for the LUN.
2071 ///
2072 /// # Working with unknown values
2073 ///
2074 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2075 /// additional enum variants at any time. Adding new variants is not considered
2076 /// a breaking change. Applications should write their code in anticipation of:
2077 ///
2078 /// - New values appearing in future releases of the client library, **and**
2079 /// - New values received dynamically, without application changes.
2080 ///
2081 /// Please consult the [Working with enums] section in the user guide for some
2082 /// guidelines.
2083 ///
2084 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2085 #[derive(Clone, Debug, PartialEq)]
2086 #[non_exhaustive]
2087 pub enum State {
2088 /// The LUN is in an unknown state.
2089 Unspecified,
2090 /// The LUN is being created.
2091 Creating,
2092 /// The LUN is being updated.
2093 Updating,
2094 /// The LUN is ready for use.
2095 Ready,
2096 /// The LUN has been requested to be deleted.
2097 Deleting,
2098 /// The LUN is in cool off state. It will be deleted after `expire_time`.
2099 CoolOff,
2100 /// If set, the enum was initialized with an unknown value.
2101 ///
2102 /// Applications can examine the value using [State::value] or
2103 /// [State::name].
2104 UnknownValue(state::UnknownValue),
2105 }
2106
2107 #[doc(hidden)]
2108 pub mod state {
2109 #[allow(unused_imports)]
2110 use super::*;
2111 #[derive(Clone, Debug, PartialEq)]
2112 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2113 }
2114
2115 impl State {
2116 /// Gets the enum value.
2117 ///
2118 /// Returns `None` if the enum contains an unknown value deserialized from
2119 /// the string representation of enums.
2120 pub fn value(&self) -> std::option::Option<i32> {
2121 match self {
2122 Self::Unspecified => std::option::Option::Some(0),
2123 Self::Creating => std::option::Option::Some(1),
2124 Self::Updating => std::option::Option::Some(2),
2125 Self::Ready => std::option::Option::Some(3),
2126 Self::Deleting => std::option::Option::Some(4),
2127 Self::CoolOff => std::option::Option::Some(5),
2128 Self::UnknownValue(u) => u.0.value(),
2129 }
2130 }
2131
2132 /// Gets the enum value as a string.
2133 ///
2134 /// Returns `None` if the enum contains an unknown value deserialized from
2135 /// the integer representation of enums.
2136 pub fn name(&self) -> std::option::Option<&str> {
2137 match self {
2138 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2139 Self::Creating => std::option::Option::Some("CREATING"),
2140 Self::Updating => std::option::Option::Some("UPDATING"),
2141 Self::Ready => std::option::Option::Some("READY"),
2142 Self::Deleting => std::option::Option::Some("DELETING"),
2143 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
2144 Self::UnknownValue(u) => u.0.name(),
2145 }
2146 }
2147 }
2148
2149 impl std::default::Default for State {
2150 fn default() -> Self {
2151 use std::convert::From;
2152 Self::from(0)
2153 }
2154 }
2155
2156 impl std::fmt::Display for State {
2157 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2158 wkt::internal::display_enum(f, self.name(), self.value())
2159 }
2160 }
2161
2162 impl std::convert::From<i32> for State {
2163 fn from(value: i32) -> Self {
2164 match value {
2165 0 => Self::Unspecified,
2166 1 => Self::Creating,
2167 2 => Self::Updating,
2168 3 => Self::Ready,
2169 4 => Self::Deleting,
2170 5 => Self::CoolOff,
2171 _ => Self::UnknownValue(state::UnknownValue(
2172 wkt::internal::UnknownEnumValue::Integer(value),
2173 )),
2174 }
2175 }
2176 }
2177
2178 impl std::convert::From<&str> for State {
2179 fn from(value: &str) -> Self {
2180 use std::string::ToString;
2181 match value {
2182 "STATE_UNSPECIFIED" => Self::Unspecified,
2183 "CREATING" => Self::Creating,
2184 "UPDATING" => Self::Updating,
2185 "READY" => Self::Ready,
2186 "DELETING" => Self::Deleting,
2187 "COOL_OFF" => Self::CoolOff,
2188 _ => Self::UnknownValue(state::UnknownValue(
2189 wkt::internal::UnknownEnumValue::String(value.to_string()),
2190 )),
2191 }
2192 }
2193 }
2194
2195 impl serde::ser::Serialize for State {
2196 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2197 where
2198 S: serde::Serializer,
2199 {
2200 match self {
2201 Self::Unspecified => serializer.serialize_i32(0),
2202 Self::Creating => serializer.serialize_i32(1),
2203 Self::Updating => serializer.serialize_i32(2),
2204 Self::Ready => serializer.serialize_i32(3),
2205 Self::Deleting => serializer.serialize_i32(4),
2206 Self::CoolOff => serializer.serialize_i32(5),
2207 Self::UnknownValue(u) => u.0.serialize(serializer),
2208 }
2209 }
2210 }
2211
2212 impl<'de> serde::de::Deserialize<'de> for State {
2213 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2214 where
2215 D: serde::Deserializer<'de>,
2216 {
2217 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2218 ".google.cloud.baremetalsolution.v2.Lun.State",
2219 ))
2220 }
2221 }
2222
2223 /// Display the operating systems present for the LUN multiprotocol type.
2224 ///
2225 /// # Working with unknown values
2226 ///
2227 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2228 /// additional enum variants at any time. Adding new variants is not considered
2229 /// a breaking change. Applications should write their code in anticipation of:
2230 ///
2231 /// - New values appearing in future releases of the client library, **and**
2232 /// - New values received dynamically, without application changes.
2233 ///
2234 /// Please consult the [Working with enums] section in the user guide for some
2235 /// guidelines.
2236 ///
2237 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2238 #[derive(Clone, Debug, PartialEq)]
2239 #[non_exhaustive]
2240 pub enum MultiprotocolType {
2241 /// Server has no OS specified.
2242 Unspecified,
2243 /// Server with Linux OS.
2244 Linux,
2245 /// If set, the enum was initialized with an unknown value.
2246 ///
2247 /// Applications can examine the value using [MultiprotocolType::value] or
2248 /// [MultiprotocolType::name].
2249 UnknownValue(multiprotocol_type::UnknownValue),
2250 }
2251
2252 #[doc(hidden)]
2253 pub mod multiprotocol_type {
2254 #[allow(unused_imports)]
2255 use super::*;
2256 #[derive(Clone, Debug, PartialEq)]
2257 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2258 }
2259
2260 impl MultiprotocolType {
2261 /// Gets the enum value.
2262 ///
2263 /// Returns `None` if the enum contains an unknown value deserialized from
2264 /// the string representation of enums.
2265 pub fn value(&self) -> std::option::Option<i32> {
2266 match self {
2267 Self::Unspecified => std::option::Option::Some(0),
2268 Self::Linux => std::option::Option::Some(1),
2269 Self::UnknownValue(u) => u.0.value(),
2270 }
2271 }
2272
2273 /// Gets the enum value as a string.
2274 ///
2275 /// Returns `None` if the enum contains an unknown value deserialized from
2276 /// the integer representation of enums.
2277 pub fn name(&self) -> std::option::Option<&str> {
2278 match self {
2279 Self::Unspecified => std::option::Option::Some("MULTIPROTOCOL_TYPE_UNSPECIFIED"),
2280 Self::Linux => std::option::Option::Some("LINUX"),
2281 Self::UnknownValue(u) => u.0.name(),
2282 }
2283 }
2284 }
2285
2286 impl std::default::Default for MultiprotocolType {
2287 fn default() -> Self {
2288 use std::convert::From;
2289 Self::from(0)
2290 }
2291 }
2292
2293 impl std::fmt::Display for MultiprotocolType {
2294 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2295 wkt::internal::display_enum(f, self.name(), self.value())
2296 }
2297 }
2298
2299 impl std::convert::From<i32> for MultiprotocolType {
2300 fn from(value: i32) -> Self {
2301 match value {
2302 0 => Self::Unspecified,
2303 1 => Self::Linux,
2304 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2305 wkt::internal::UnknownEnumValue::Integer(value),
2306 )),
2307 }
2308 }
2309 }
2310
2311 impl std::convert::From<&str> for MultiprotocolType {
2312 fn from(value: &str) -> Self {
2313 use std::string::ToString;
2314 match value {
2315 "MULTIPROTOCOL_TYPE_UNSPECIFIED" => Self::Unspecified,
2316 "LINUX" => Self::Linux,
2317 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2318 wkt::internal::UnknownEnumValue::String(value.to_string()),
2319 )),
2320 }
2321 }
2322 }
2323
2324 impl serde::ser::Serialize for MultiprotocolType {
2325 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2326 where
2327 S: serde::Serializer,
2328 {
2329 match self {
2330 Self::Unspecified => serializer.serialize_i32(0),
2331 Self::Linux => serializer.serialize_i32(1),
2332 Self::UnknownValue(u) => u.0.serialize(serializer),
2333 }
2334 }
2335 }
2336
2337 impl<'de> serde::de::Deserialize<'de> for MultiprotocolType {
2338 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2339 where
2340 D: serde::Deserializer<'de>,
2341 {
2342 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MultiprotocolType>::new(
2343 ".google.cloud.baremetalsolution.v2.Lun.MultiprotocolType",
2344 ))
2345 }
2346 }
2347
2348 /// The storage types for a LUN.
2349 ///
2350 /// # Working with unknown values
2351 ///
2352 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2353 /// additional enum variants at any time. Adding new variants is not considered
2354 /// a breaking change. Applications should write their code in anticipation of:
2355 ///
2356 /// - New values appearing in future releases of the client library, **and**
2357 /// - New values received dynamically, without application changes.
2358 ///
2359 /// Please consult the [Working with enums] section in the user guide for some
2360 /// guidelines.
2361 ///
2362 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2363 #[derive(Clone, Debug, PartialEq)]
2364 #[non_exhaustive]
2365 pub enum StorageType {
2366 /// The storage type for this LUN is unknown.
2367 Unspecified,
2368 /// This storage type for this LUN is SSD.
2369 Ssd,
2370 /// This storage type for this LUN is HDD.
2371 Hdd,
2372 /// If set, the enum was initialized with an unknown value.
2373 ///
2374 /// Applications can examine the value using [StorageType::value] or
2375 /// [StorageType::name].
2376 UnknownValue(storage_type::UnknownValue),
2377 }
2378
2379 #[doc(hidden)]
2380 pub mod storage_type {
2381 #[allow(unused_imports)]
2382 use super::*;
2383 #[derive(Clone, Debug, PartialEq)]
2384 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2385 }
2386
2387 impl StorageType {
2388 /// Gets the enum value.
2389 ///
2390 /// Returns `None` if the enum contains an unknown value deserialized from
2391 /// the string representation of enums.
2392 pub fn value(&self) -> std::option::Option<i32> {
2393 match self {
2394 Self::Unspecified => std::option::Option::Some(0),
2395 Self::Ssd => std::option::Option::Some(1),
2396 Self::Hdd => std::option::Option::Some(2),
2397 Self::UnknownValue(u) => u.0.value(),
2398 }
2399 }
2400
2401 /// Gets the enum value as a string.
2402 ///
2403 /// Returns `None` if the enum contains an unknown value deserialized from
2404 /// the integer representation of enums.
2405 pub fn name(&self) -> std::option::Option<&str> {
2406 match self {
2407 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
2408 Self::Ssd => std::option::Option::Some("SSD"),
2409 Self::Hdd => std::option::Option::Some("HDD"),
2410 Self::UnknownValue(u) => u.0.name(),
2411 }
2412 }
2413 }
2414
2415 impl std::default::Default for StorageType {
2416 fn default() -> Self {
2417 use std::convert::From;
2418 Self::from(0)
2419 }
2420 }
2421
2422 impl std::fmt::Display for StorageType {
2423 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2424 wkt::internal::display_enum(f, self.name(), self.value())
2425 }
2426 }
2427
2428 impl std::convert::From<i32> for StorageType {
2429 fn from(value: i32) -> Self {
2430 match value {
2431 0 => Self::Unspecified,
2432 1 => Self::Ssd,
2433 2 => Self::Hdd,
2434 _ => Self::UnknownValue(storage_type::UnknownValue(
2435 wkt::internal::UnknownEnumValue::Integer(value),
2436 )),
2437 }
2438 }
2439 }
2440
2441 impl std::convert::From<&str> for StorageType {
2442 fn from(value: &str) -> Self {
2443 use std::string::ToString;
2444 match value {
2445 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
2446 "SSD" => Self::Ssd,
2447 "HDD" => Self::Hdd,
2448 _ => Self::UnknownValue(storage_type::UnknownValue(
2449 wkt::internal::UnknownEnumValue::String(value.to_string()),
2450 )),
2451 }
2452 }
2453 }
2454
2455 impl serde::ser::Serialize for StorageType {
2456 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2457 where
2458 S: serde::Serializer,
2459 {
2460 match self {
2461 Self::Unspecified => serializer.serialize_i32(0),
2462 Self::Ssd => serializer.serialize_i32(1),
2463 Self::Hdd => serializer.serialize_i32(2),
2464 Self::UnknownValue(u) => u.0.serialize(serializer),
2465 }
2466 }
2467 }
2468
2469 impl<'de> serde::de::Deserialize<'de> for StorageType {
2470 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2471 where
2472 D: serde::Deserializer<'de>,
2473 {
2474 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
2475 ".google.cloud.baremetalsolution.v2.Lun.StorageType",
2476 ))
2477 }
2478 }
2479}
2480
2481/// Message for requesting storage lun information.
2482#[derive(Clone, Default, PartialEq)]
2483#[non_exhaustive]
2484pub struct GetLunRequest {
2485 /// Required. Name of the resource.
2486 pub name: std::string::String,
2487
2488 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2489}
2490
2491impl GetLunRequest {
2492 /// Creates a new default instance.
2493 pub fn new() -> Self {
2494 std::default::Default::default()
2495 }
2496
2497 /// Sets the value of [name][crate::model::GetLunRequest::name].
2498 ///
2499 /// # Example
2500 /// ```ignore,no_run
2501 /// # use google_cloud_baremetalsolution_v2::model::GetLunRequest;
2502 /// let x = GetLunRequest::new().set_name("example");
2503 /// ```
2504 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2505 self.name = v.into();
2506 self
2507 }
2508}
2509
2510impl wkt::message::Message for GetLunRequest {
2511 fn typename() -> &'static str {
2512 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetLunRequest"
2513 }
2514}
2515
2516/// Message for requesting a list of storage volume luns.
2517#[derive(Clone, Default, PartialEq)]
2518#[non_exhaustive]
2519pub struct ListLunsRequest {
2520 /// Required. Parent value for ListLunsRequest.
2521 pub parent: std::string::String,
2522
2523 /// Requested page size. The server might return fewer items than requested.
2524 /// If unspecified, server will pick an appropriate default.
2525 pub page_size: i32,
2526
2527 /// A token identifying a page of results from the server.
2528 pub page_token: std::string::String,
2529
2530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2531}
2532
2533impl ListLunsRequest {
2534 /// Creates a new default instance.
2535 pub fn new() -> Self {
2536 std::default::Default::default()
2537 }
2538
2539 /// Sets the value of [parent][crate::model::ListLunsRequest::parent].
2540 ///
2541 /// # Example
2542 /// ```ignore,no_run
2543 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2544 /// let x = ListLunsRequest::new().set_parent("example");
2545 /// ```
2546 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2547 self.parent = v.into();
2548 self
2549 }
2550
2551 /// Sets the value of [page_size][crate::model::ListLunsRequest::page_size].
2552 ///
2553 /// # Example
2554 /// ```ignore,no_run
2555 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2556 /// let x = ListLunsRequest::new().set_page_size(42);
2557 /// ```
2558 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2559 self.page_size = v.into();
2560 self
2561 }
2562
2563 /// Sets the value of [page_token][crate::model::ListLunsRequest::page_token].
2564 ///
2565 /// # Example
2566 /// ```ignore,no_run
2567 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2568 /// let x = ListLunsRequest::new().set_page_token("example");
2569 /// ```
2570 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2571 self.page_token = v.into();
2572 self
2573 }
2574}
2575
2576impl wkt::message::Message for ListLunsRequest {
2577 fn typename() -> &'static str {
2578 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsRequest"
2579 }
2580}
2581
2582/// Response message containing the list of storage volume luns.
2583#[derive(Clone, Default, PartialEq)]
2584#[non_exhaustive]
2585pub struct ListLunsResponse {
2586 /// The list of luns.
2587 pub luns: std::vec::Vec<crate::model::Lun>,
2588
2589 /// A token identifying a page of results from the server.
2590 pub next_page_token: std::string::String,
2591
2592 /// Locations that could not be reached.
2593 pub unreachable: std::vec::Vec<std::string::String>,
2594
2595 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2596}
2597
2598impl ListLunsResponse {
2599 /// Creates a new default instance.
2600 pub fn new() -> Self {
2601 std::default::Default::default()
2602 }
2603
2604 /// Sets the value of [luns][crate::model::ListLunsResponse::luns].
2605 ///
2606 /// # Example
2607 /// ```ignore,no_run
2608 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2609 /// use google_cloud_baremetalsolution_v2::model::Lun;
2610 /// let x = ListLunsResponse::new()
2611 /// .set_luns([
2612 /// Lun::default()/* use setters */,
2613 /// Lun::default()/* use (different) setters */,
2614 /// ]);
2615 /// ```
2616 pub fn set_luns<T, V>(mut self, v: T) -> Self
2617 where
2618 T: std::iter::IntoIterator<Item = V>,
2619 V: std::convert::Into<crate::model::Lun>,
2620 {
2621 use std::iter::Iterator;
2622 self.luns = v.into_iter().map(|i| i.into()).collect();
2623 self
2624 }
2625
2626 /// Sets the value of [next_page_token][crate::model::ListLunsResponse::next_page_token].
2627 ///
2628 /// # Example
2629 /// ```ignore,no_run
2630 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2631 /// let x = ListLunsResponse::new().set_next_page_token("example");
2632 /// ```
2633 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2634 self.next_page_token = v.into();
2635 self
2636 }
2637
2638 /// Sets the value of [unreachable][crate::model::ListLunsResponse::unreachable].
2639 ///
2640 /// # Example
2641 /// ```ignore,no_run
2642 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2643 /// let x = ListLunsResponse::new().set_unreachable(["a", "b", "c"]);
2644 /// ```
2645 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2646 where
2647 T: std::iter::IntoIterator<Item = V>,
2648 V: std::convert::Into<std::string::String>,
2649 {
2650 use std::iter::Iterator;
2651 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2652 self
2653 }
2654}
2655
2656impl wkt::message::Message for ListLunsResponse {
2657 fn typename() -> &'static str {
2658 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsResponse"
2659 }
2660}
2661
2662#[doc(hidden)]
2663impl google_cloud_gax::paginator::internal::PageableResponse for ListLunsResponse {
2664 type PageItem = crate::model::Lun;
2665
2666 fn items(self) -> std::vec::Vec<Self::PageItem> {
2667 self.luns
2668 }
2669
2670 fn next_page_token(&self) -> std::string::String {
2671 use std::clone::Clone;
2672 self.next_page_token.clone()
2673 }
2674}
2675
2676/// Request for skip lun cooloff and delete it.
2677#[derive(Clone, Default, PartialEq)]
2678#[non_exhaustive]
2679pub struct EvictLunRequest {
2680 /// Required. The name of the lun.
2681 pub name: std::string::String,
2682
2683 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2684}
2685
2686impl EvictLunRequest {
2687 /// Creates a new default instance.
2688 pub fn new() -> Self {
2689 std::default::Default::default()
2690 }
2691
2692 /// Sets the value of [name][crate::model::EvictLunRequest::name].
2693 ///
2694 /// # Example
2695 /// ```ignore,no_run
2696 /// # use google_cloud_baremetalsolution_v2::model::EvictLunRequest;
2697 /// let x = EvictLunRequest::new().set_name("example");
2698 /// ```
2699 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2700 self.name = v.into();
2701 self
2702 }
2703}
2704
2705impl wkt::message::Message for EvictLunRequest {
2706 fn typename() -> &'static str {
2707 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictLunRequest"
2708 }
2709}
2710
2711/// A Network.
2712#[derive(Clone, Default, PartialEq)]
2713#[non_exhaustive]
2714pub struct Network {
2715 /// Output only. The resource name of this `Network`.
2716 /// Resource names are schemeless URIs that follow the conventions in
2717 /// <https://cloud.google.com/apis/design/resource_names>.
2718 /// Format:
2719 /// `projects/{project}/locations/{location}/networks/{network}`
2720 pub name: std::string::String,
2721
2722 /// An identifier for the `Network`, generated by the backend.
2723 pub id: std::string::String,
2724
2725 /// The type of this network.
2726 pub r#type: crate::model::network::Type,
2727
2728 /// IP address configured.
2729 pub ip_address: std::string::String,
2730
2731 /// List of physical interfaces.
2732 pub mac_address: std::vec::Vec<std::string::String>,
2733
2734 /// The Network state.
2735 pub state: crate::model::network::State,
2736
2737 /// The vlan id of the Network.
2738 pub vlan_id: std::string::String,
2739
2740 /// The cidr of the Network.
2741 pub cidr: std::string::String,
2742
2743 /// The vrf for the Network.
2744 pub vrf: std::option::Option<crate::model::Vrf>,
2745
2746 /// Labels as key value pairs.
2747 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2748
2749 /// IP range for reserved for services (e.g. NFS).
2750 pub services_cidr: std::string::String,
2751
2752 /// List of IP address reservations in this network.
2753 /// When updating this field, an error will be generated if a reservation
2754 /// conflicts with an IP address already allocated to a physical server.
2755 pub reservations: std::vec::Vec<crate::model::NetworkAddressReservation>,
2756
2757 /// Output only. Pod name.
2758 pub pod: std::string::String,
2759
2760 /// Input only. List of mount points to attach the network to.
2761 pub mount_points: std::vec::Vec<crate::model::NetworkMountPoint>,
2762
2763 /// Whether network uses standard frames or jumbo ones.
2764 pub jumbo_frames_enabled: bool,
2765
2766 /// Output only. Gateway ip address.
2767 pub gateway_ip: std::string::String,
2768
2769 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2770}
2771
2772impl Network {
2773 /// Creates a new default instance.
2774 pub fn new() -> Self {
2775 std::default::Default::default()
2776 }
2777
2778 /// Sets the value of [name][crate::model::Network::name].
2779 ///
2780 /// # Example
2781 /// ```ignore,no_run
2782 /// # use google_cloud_baremetalsolution_v2::model::Network;
2783 /// let x = Network::new().set_name("example");
2784 /// ```
2785 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2786 self.name = v.into();
2787 self
2788 }
2789
2790 /// Sets the value of [id][crate::model::Network::id].
2791 ///
2792 /// # Example
2793 /// ```ignore,no_run
2794 /// # use google_cloud_baremetalsolution_v2::model::Network;
2795 /// let x = Network::new().set_id("example");
2796 /// ```
2797 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2798 self.id = v.into();
2799 self
2800 }
2801
2802 /// Sets the value of [r#type][crate::model::Network::type].
2803 ///
2804 /// # Example
2805 /// ```ignore,no_run
2806 /// # use google_cloud_baremetalsolution_v2::model::Network;
2807 /// use google_cloud_baremetalsolution_v2::model::network::Type;
2808 /// let x0 = Network::new().set_type(Type::Client);
2809 /// let x1 = Network::new().set_type(Type::Private);
2810 /// ```
2811 pub fn set_type<T: std::convert::Into<crate::model::network::Type>>(mut self, v: T) -> Self {
2812 self.r#type = v.into();
2813 self
2814 }
2815
2816 /// Sets the value of [ip_address][crate::model::Network::ip_address].
2817 ///
2818 /// # Example
2819 /// ```ignore,no_run
2820 /// # use google_cloud_baremetalsolution_v2::model::Network;
2821 /// let x = Network::new().set_ip_address("example");
2822 /// ```
2823 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2824 self.ip_address = v.into();
2825 self
2826 }
2827
2828 /// Sets the value of [mac_address][crate::model::Network::mac_address].
2829 ///
2830 /// # Example
2831 /// ```ignore,no_run
2832 /// # use google_cloud_baremetalsolution_v2::model::Network;
2833 /// let x = Network::new().set_mac_address(["a", "b", "c"]);
2834 /// ```
2835 pub fn set_mac_address<T, V>(mut self, v: T) -> Self
2836 where
2837 T: std::iter::IntoIterator<Item = V>,
2838 V: std::convert::Into<std::string::String>,
2839 {
2840 use std::iter::Iterator;
2841 self.mac_address = v.into_iter().map(|i| i.into()).collect();
2842 self
2843 }
2844
2845 /// Sets the value of [state][crate::model::Network::state].
2846 ///
2847 /// # Example
2848 /// ```ignore,no_run
2849 /// # use google_cloud_baremetalsolution_v2::model::Network;
2850 /// use google_cloud_baremetalsolution_v2::model::network::State;
2851 /// let x0 = Network::new().set_state(State::Provisioning);
2852 /// let x1 = Network::new().set_state(State::Provisioned);
2853 /// let x2 = Network::new().set_state(State::Deprovisioning);
2854 /// ```
2855 pub fn set_state<T: std::convert::Into<crate::model::network::State>>(mut self, v: T) -> Self {
2856 self.state = v.into();
2857 self
2858 }
2859
2860 /// Sets the value of [vlan_id][crate::model::Network::vlan_id].
2861 ///
2862 /// # Example
2863 /// ```ignore,no_run
2864 /// # use google_cloud_baremetalsolution_v2::model::Network;
2865 /// let x = Network::new().set_vlan_id("example");
2866 /// ```
2867 pub fn set_vlan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2868 self.vlan_id = v.into();
2869 self
2870 }
2871
2872 /// Sets the value of [cidr][crate::model::Network::cidr].
2873 ///
2874 /// # Example
2875 /// ```ignore,no_run
2876 /// # use google_cloud_baremetalsolution_v2::model::Network;
2877 /// let x = Network::new().set_cidr("example");
2878 /// ```
2879 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2880 self.cidr = v.into();
2881 self
2882 }
2883
2884 /// Sets the value of [vrf][crate::model::Network::vrf].
2885 ///
2886 /// # Example
2887 /// ```ignore,no_run
2888 /// # use google_cloud_baremetalsolution_v2::model::Network;
2889 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2890 /// let x = Network::new().set_vrf(Vrf::default()/* use setters */);
2891 /// ```
2892 pub fn set_vrf<T>(mut self, v: T) -> Self
2893 where
2894 T: std::convert::Into<crate::model::Vrf>,
2895 {
2896 self.vrf = std::option::Option::Some(v.into());
2897 self
2898 }
2899
2900 /// Sets or clears the value of [vrf][crate::model::Network::vrf].
2901 ///
2902 /// # Example
2903 /// ```ignore,no_run
2904 /// # use google_cloud_baremetalsolution_v2::model::Network;
2905 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2906 /// let x = Network::new().set_or_clear_vrf(Some(Vrf::default()/* use setters */));
2907 /// let x = Network::new().set_or_clear_vrf(None::<Vrf>);
2908 /// ```
2909 pub fn set_or_clear_vrf<T>(mut self, v: std::option::Option<T>) -> Self
2910 where
2911 T: std::convert::Into<crate::model::Vrf>,
2912 {
2913 self.vrf = v.map(|x| x.into());
2914 self
2915 }
2916
2917 /// Sets the value of [labels][crate::model::Network::labels].
2918 ///
2919 /// # Example
2920 /// ```ignore,no_run
2921 /// # use google_cloud_baremetalsolution_v2::model::Network;
2922 /// let x = Network::new().set_labels([
2923 /// ("key0", "abc"),
2924 /// ("key1", "xyz"),
2925 /// ]);
2926 /// ```
2927 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2928 where
2929 T: std::iter::IntoIterator<Item = (K, V)>,
2930 K: std::convert::Into<std::string::String>,
2931 V: std::convert::Into<std::string::String>,
2932 {
2933 use std::iter::Iterator;
2934 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2935 self
2936 }
2937
2938 /// Sets the value of [services_cidr][crate::model::Network::services_cidr].
2939 ///
2940 /// # Example
2941 /// ```ignore,no_run
2942 /// # use google_cloud_baremetalsolution_v2::model::Network;
2943 /// let x = Network::new().set_services_cidr("example");
2944 /// ```
2945 pub fn set_services_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2946 self.services_cidr = v.into();
2947 self
2948 }
2949
2950 /// Sets the value of [reservations][crate::model::Network::reservations].
2951 ///
2952 /// # Example
2953 /// ```ignore,no_run
2954 /// # use google_cloud_baremetalsolution_v2::model::Network;
2955 /// use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
2956 /// let x = Network::new()
2957 /// .set_reservations([
2958 /// NetworkAddressReservation::default()/* use setters */,
2959 /// NetworkAddressReservation::default()/* use (different) setters */,
2960 /// ]);
2961 /// ```
2962 pub fn set_reservations<T, V>(mut self, v: T) -> Self
2963 where
2964 T: std::iter::IntoIterator<Item = V>,
2965 V: std::convert::Into<crate::model::NetworkAddressReservation>,
2966 {
2967 use std::iter::Iterator;
2968 self.reservations = v.into_iter().map(|i| i.into()).collect();
2969 self
2970 }
2971
2972 /// Sets the value of [pod][crate::model::Network::pod].
2973 ///
2974 /// # Example
2975 /// ```ignore,no_run
2976 /// # use google_cloud_baremetalsolution_v2::model::Network;
2977 /// let x = Network::new().set_pod("example");
2978 /// ```
2979 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2980 self.pod = v.into();
2981 self
2982 }
2983
2984 /// Sets the value of [mount_points][crate::model::Network::mount_points].
2985 ///
2986 /// # Example
2987 /// ```ignore,no_run
2988 /// # use google_cloud_baremetalsolution_v2::model::Network;
2989 /// use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
2990 /// let x = Network::new()
2991 /// .set_mount_points([
2992 /// NetworkMountPoint::default()/* use setters */,
2993 /// NetworkMountPoint::default()/* use (different) setters */,
2994 /// ]);
2995 /// ```
2996 pub fn set_mount_points<T, V>(mut self, v: T) -> Self
2997 where
2998 T: std::iter::IntoIterator<Item = V>,
2999 V: std::convert::Into<crate::model::NetworkMountPoint>,
3000 {
3001 use std::iter::Iterator;
3002 self.mount_points = v.into_iter().map(|i| i.into()).collect();
3003 self
3004 }
3005
3006 /// Sets the value of [jumbo_frames_enabled][crate::model::Network::jumbo_frames_enabled].
3007 ///
3008 /// # Example
3009 /// ```ignore,no_run
3010 /// # use google_cloud_baremetalsolution_v2::model::Network;
3011 /// let x = Network::new().set_jumbo_frames_enabled(true);
3012 /// ```
3013 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3014 self.jumbo_frames_enabled = v.into();
3015 self
3016 }
3017
3018 /// Sets the value of [gateway_ip][crate::model::Network::gateway_ip].
3019 ///
3020 /// # Example
3021 /// ```ignore,no_run
3022 /// # use google_cloud_baremetalsolution_v2::model::Network;
3023 /// let x = Network::new().set_gateway_ip("example");
3024 /// ```
3025 pub fn set_gateway_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3026 self.gateway_ip = v.into();
3027 self
3028 }
3029}
3030
3031impl wkt::message::Message for Network {
3032 fn typename() -> &'static str {
3033 "type.googleapis.com/google.cloud.baremetalsolution.v2.Network"
3034 }
3035}
3036
3037/// Defines additional types related to [Network].
3038pub mod network {
3039 #[allow(unused_imports)]
3040 use super::*;
3041
3042 /// Network type.
3043 ///
3044 /// # Working with unknown values
3045 ///
3046 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3047 /// additional enum variants at any time. Adding new variants is not considered
3048 /// a breaking change. Applications should write their code in anticipation of:
3049 ///
3050 /// - New values appearing in future releases of the client library, **and**
3051 /// - New values received dynamically, without application changes.
3052 ///
3053 /// Please consult the [Working with enums] section in the user guide for some
3054 /// guidelines.
3055 ///
3056 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3057 #[derive(Clone, Debug, PartialEq)]
3058 #[non_exhaustive]
3059 pub enum Type {
3060 /// Unspecified value.
3061 Unspecified,
3062 /// Client network, a network peered to a Google Cloud VPC.
3063 Client,
3064 /// Private network, a network local to the Bare Metal Solution environment.
3065 Private,
3066 /// If set, the enum was initialized with an unknown value.
3067 ///
3068 /// Applications can examine the value using [Type::value] or
3069 /// [Type::name].
3070 UnknownValue(r#type::UnknownValue),
3071 }
3072
3073 #[doc(hidden)]
3074 pub mod r#type {
3075 #[allow(unused_imports)]
3076 use super::*;
3077 #[derive(Clone, Debug, PartialEq)]
3078 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3079 }
3080
3081 impl Type {
3082 /// Gets the enum value.
3083 ///
3084 /// Returns `None` if the enum contains an unknown value deserialized from
3085 /// the string representation of enums.
3086 pub fn value(&self) -> std::option::Option<i32> {
3087 match self {
3088 Self::Unspecified => std::option::Option::Some(0),
3089 Self::Client => std::option::Option::Some(1),
3090 Self::Private => std::option::Option::Some(2),
3091 Self::UnknownValue(u) => u.0.value(),
3092 }
3093 }
3094
3095 /// Gets the enum value as a string.
3096 ///
3097 /// Returns `None` if the enum contains an unknown value deserialized from
3098 /// the integer representation of enums.
3099 pub fn name(&self) -> std::option::Option<&str> {
3100 match self {
3101 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
3102 Self::Client => std::option::Option::Some("CLIENT"),
3103 Self::Private => std::option::Option::Some("PRIVATE"),
3104 Self::UnknownValue(u) => u.0.name(),
3105 }
3106 }
3107 }
3108
3109 impl std::default::Default for Type {
3110 fn default() -> Self {
3111 use std::convert::From;
3112 Self::from(0)
3113 }
3114 }
3115
3116 impl std::fmt::Display for Type {
3117 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3118 wkt::internal::display_enum(f, self.name(), self.value())
3119 }
3120 }
3121
3122 impl std::convert::From<i32> for Type {
3123 fn from(value: i32) -> Self {
3124 match value {
3125 0 => Self::Unspecified,
3126 1 => Self::Client,
3127 2 => Self::Private,
3128 _ => Self::UnknownValue(r#type::UnknownValue(
3129 wkt::internal::UnknownEnumValue::Integer(value),
3130 )),
3131 }
3132 }
3133 }
3134
3135 impl std::convert::From<&str> for Type {
3136 fn from(value: &str) -> Self {
3137 use std::string::ToString;
3138 match value {
3139 "TYPE_UNSPECIFIED" => Self::Unspecified,
3140 "CLIENT" => Self::Client,
3141 "PRIVATE" => Self::Private,
3142 _ => Self::UnknownValue(r#type::UnknownValue(
3143 wkt::internal::UnknownEnumValue::String(value.to_string()),
3144 )),
3145 }
3146 }
3147 }
3148
3149 impl serde::ser::Serialize for Type {
3150 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3151 where
3152 S: serde::Serializer,
3153 {
3154 match self {
3155 Self::Unspecified => serializer.serialize_i32(0),
3156 Self::Client => serializer.serialize_i32(1),
3157 Self::Private => serializer.serialize_i32(2),
3158 Self::UnknownValue(u) => u.0.serialize(serializer),
3159 }
3160 }
3161 }
3162
3163 impl<'de> serde::de::Deserialize<'de> for Type {
3164 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3165 where
3166 D: serde::Deserializer<'de>,
3167 {
3168 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
3169 ".google.cloud.baremetalsolution.v2.Network.Type",
3170 ))
3171 }
3172 }
3173
3174 /// The possible states for this Network.
3175 ///
3176 /// # Working with unknown values
3177 ///
3178 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3179 /// additional enum variants at any time. Adding new variants is not considered
3180 /// a breaking change. Applications should write their code in anticipation of:
3181 ///
3182 /// - New values appearing in future releases of the client library, **and**
3183 /// - New values received dynamically, without application changes.
3184 ///
3185 /// Please consult the [Working with enums] section in the user guide for some
3186 /// guidelines.
3187 ///
3188 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3189 #[derive(Clone, Debug, PartialEq)]
3190 #[non_exhaustive]
3191 pub enum State {
3192 /// The Network is in an unknown state.
3193 Unspecified,
3194 /// The Network is provisioning.
3195 Provisioning,
3196 /// The Network has been provisioned.
3197 Provisioned,
3198 /// The Network is being deprovisioned.
3199 Deprovisioning,
3200 /// The Network is being updated.
3201 Updating,
3202 /// If set, the enum was initialized with an unknown value.
3203 ///
3204 /// Applications can examine the value using [State::value] or
3205 /// [State::name].
3206 UnknownValue(state::UnknownValue),
3207 }
3208
3209 #[doc(hidden)]
3210 pub mod state {
3211 #[allow(unused_imports)]
3212 use super::*;
3213 #[derive(Clone, Debug, PartialEq)]
3214 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3215 }
3216
3217 impl State {
3218 /// Gets the enum value.
3219 ///
3220 /// Returns `None` if the enum contains an unknown value deserialized from
3221 /// the string representation of enums.
3222 pub fn value(&self) -> std::option::Option<i32> {
3223 match self {
3224 Self::Unspecified => std::option::Option::Some(0),
3225 Self::Provisioning => std::option::Option::Some(1),
3226 Self::Provisioned => std::option::Option::Some(2),
3227 Self::Deprovisioning => std::option::Option::Some(3),
3228 Self::Updating => std::option::Option::Some(4),
3229 Self::UnknownValue(u) => u.0.value(),
3230 }
3231 }
3232
3233 /// Gets the enum value as a string.
3234 ///
3235 /// Returns `None` if the enum contains an unknown value deserialized from
3236 /// the integer representation of enums.
3237 pub fn name(&self) -> std::option::Option<&str> {
3238 match self {
3239 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3240 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3241 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3242 Self::Deprovisioning => std::option::Option::Some("DEPROVISIONING"),
3243 Self::Updating => std::option::Option::Some("UPDATING"),
3244 Self::UnknownValue(u) => u.0.name(),
3245 }
3246 }
3247 }
3248
3249 impl std::default::Default for State {
3250 fn default() -> Self {
3251 use std::convert::From;
3252 Self::from(0)
3253 }
3254 }
3255
3256 impl std::fmt::Display for State {
3257 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3258 wkt::internal::display_enum(f, self.name(), self.value())
3259 }
3260 }
3261
3262 impl std::convert::From<i32> for State {
3263 fn from(value: i32) -> Self {
3264 match value {
3265 0 => Self::Unspecified,
3266 1 => Self::Provisioning,
3267 2 => Self::Provisioned,
3268 3 => Self::Deprovisioning,
3269 4 => Self::Updating,
3270 _ => Self::UnknownValue(state::UnknownValue(
3271 wkt::internal::UnknownEnumValue::Integer(value),
3272 )),
3273 }
3274 }
3275 }
3276
3277 impl std::convert::From<&str> for State {
3278 fn from(value: &str) -> Self {
3279 use std::string::ToString;
3280 match value {
3281 "STATE_UNSPECIFIED" => Self::Unspecified,
3282 "PROVISIONING" => Self::Provisioning,
3283 "PROVISIONED" => Self::Provisioned,
3284 "DEPROVISIONING" => Self::Deprovisioning,
3285 "UPDATING" => Self::Updating,
3286 _ => Self::UnknownValue(state::UnknownValue(
3287 wkt::internal::UnknownEnumValue::String(value.to_string()),
3288 )),
3289 }
3290 }
3291 }
3292
3293 impl serde::ser::Serialize for State {
3294 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3295 where
3296 S: serde::Serializer,
3297 {
3298 match self {
3299 Self::Unspecified => serializer.serialize_i32(0),
3300 Self::Provisioning => serializer.serialize_i32(1),
3301 Self::Provisioned => serializer.serialize_i32(2),
3302 Self::Deprovisioning => serializer.serialize_i32(3),
3303 Self::Updating => serializer.serialize_i32(4),
3304 Self::UnknownValue(u) => u.0.serialize(serializer),
3305 }
3306 }
3307 }
3308
3309 impl<'de> serde::de::Deserialize<'de> for State {
3310 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3311 where
3312 D: serde::Deserializer<'de>,
3313 {
3314 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3315 ".google.cloud.baremetalsolution.v2.Network.State",
3316 ))
3317 }
3318 }
3319}
3320
3321/// A reservation of one or more addresses in a network.
3322#[derive(Clone, Default, PartialEq)]
3323#[non_exhaustive]
3324pub struct NetworkAddressReservation {
3325 /// The first address of this reservation block.
3326 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3327 pub start_address: std::string::String,
3328
3329 /// The last address of this reservation block, inclusive. I.e., for cases when
3330 /// reservations are only single addresses, end_address and start_address will
3331 /// be the same.
3332 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3333 pub end_address: std::string::String,
3334
3335 /// A note about this reservation, intended for human consumption.
3336 pub note: std::string::String,
3337
3338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3339}
3340
3341impl NetworkAddressReservation {
3342 /// Creates a new default instance.
3343 pub fn new() -> Self {
3344 std::default::Default::default()
3345 }
3346
3347 /// Sets the value of [start_address][crate::model::NetworkAddressReservation::start_address].
3348 ///
3349 /// # Example
3350 /// ```ignore,no_run
3351 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3352 /// let x = NetworkAddressReservation::new().set_start_address("example");
3353 /// ```
3354 pub fn set_start_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3355 self.start_address = v.into();
3356 self
3357 }
3358
3359 /// Sets the value of [end_address][crate::model::NetworkAddressReservation::end_address].
3360 ///
3361 /// # Example
3362 /// ```ignore,no_run
3363 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3364 /// let x = NetworkAddressReservation::new().set_end_address("example");
3365 /// ```
3366 pub fn set_end_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3367 self.end_address = v.into();
3368 self
3369 }
3370
3371 /// Sets the value of [note][crate::model::NetworkAddressReservation::note].
3372 ///
3373 /// # Example
3374 /// ```ignore,no_run
3375 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3376 /// let x = NetworkAddressReservation::new().set_note("example");
3377 /// ```
3378 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3379 self.note = v.into();
3380 self
3381 }
3382}
3383
3384impl wkt::message::Message for NetworkAddressReservation {
3385 fn typename() -> &'static str {
3386 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkAddressReservation"
3387 }
3388}
3389
3390/// A network VRF.
3391#[derive(Clone, Default, PartialEq)]
3392#[non_exhaustive]
3393pub struct Vrf {
3394 /// The name of the VRF.
3395 pub name: std::string::String,
3396
3397 /// The possible state of VRF.
3398 pub state: crate::model::vrf::State,
3399
3400 /// The QOS policy applied to this VRF.
3401 /// The value is only meaningful when all the vlan attachments have the same
3402 /// QoS. This field should not be used for new integrations, use vlan
3403 /// attachment level qos instead. The field is left for backward-compatibility.
3404 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3405
3406 /// The list of VLAN attachments for the VRF.
3407 pub vlan_attachments: std::vec::Vec<crate::model::vrf::VlanAttachment>,
3408
3409 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3410}
3411
3412impl Vrf {
3413 /// Creates a new default instance.
3414 pub fn new() -> Self {
3415 std::default::Default::default()
3416 }
3417
3418 /// Sets the value of [name][crate::model::Vrf::name].
3419 ///
3420 /// # Example
3421 /// ```ignore,no_run
3422 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3423 /// let x = Vrf::new().set_name("example");
3424 /// ```
3425 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3426 self.name = v.into();
3427 self
3428 }
3429
3430 /// Sets the value of [state][crate::model::Vrf::state].
3431 ///
3432 /// # Example
3433 /// ```ignore,no_run
3434 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3435 /// use google_cloud_baremetalsolution_v2::model::vrf::State;
3436 /// let x0 = Vrf::new().set_state(State::Provisioning);
3437 /// let x1 = Vrf::new().set_state(State::Provisioned);
3438 /// ```
3439 pub fn set_state<T: std::convert::Into<crate::model::vrf::State>>(mut self, v: T) -> Self {
3440 self.state = v.into();
3441 self
3442 }
3443
3444 /// Sets the value of [qos_policy][crate::model::Vrf::qos_policy].
3445 ///
3446 /// # Example
3447 /// ```ignore,no_run
3448 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3449 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3450 /// let x = Vrf::new().set_qos_policy(QosPolicy::default()/* use setters */);
3451 /// ```
3452 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3453 where
3454 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3455 {
3456 self.qos_policy = std::option::Option::Some(v.into());
3457 self
3458 }
3459
3460 /// Sets or clears the value of [qos_policy][crate::model::Vrf::qos_policy].
3461 ///
3462 /// # Example
3463 /// ```ignore,no_run
3464 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3465 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3466 /// let x = Vrf::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3467 /// let x = Vrf::new().set_or_clear_qos_policy(None::<QosPolicy>);
3468 /// ```
3469 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3470 where
3471 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3472 {
3473 self.qos_policy = v.map(|x| x.into());
3474 self
3475 }
3476
3477 /// Sets the value of [vlan_attachments][crate::model::Vrf::vlan_attachments].
3478 ///
3479 /// # Example
3480 /// ```ignore,no_run
3481 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3482 /// use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3483 /// let x = Vrf::new()
3484 /// .set_vlan_attachments([
3485 /// VlanAttachment::default()/* use setters */,
3486 /// VlanAttachment::default()/* use (different) setters */,
3487 /// ]);
3488 /// ```
3489 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
3490 where
3491 T: std::iter::IntoIterator<Item = V>,
3492 V: std::convert::Into<crate::model::vrf::VlanAttachment>,
3493 {
3494 use std::iter::Iterator;
3495 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
3496 self
3497 }
3498}
3499
3500impl wkt::message::Message for Vrf {
3501 fn typename() -> &'static str {
3502 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF"
3503 }
3504}
3505
3506/// Defines additional types related to [Vrf].
3507pub mod vrf {
3508 #[allow(unused_imports)]
3509 use super::*;
3510
3511 /// QOS policy parameters.
3512 #[derive(Clone, Default, PartialEq)]
3513 #[non_exhaustive]
3514 pub struct QosPolicy {
3515 /// The bandwidth permitted by the QOS policy, in gbps.
3516 pub bandwidth_gbps: f64,
3517
3518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3519 }
3520
3521 impl QosPolicy {
3522 /// Creates a new default instance.
3523 pub fn new() -> Self {
3524 std::default::Default::default()
3525 }
3526
3527 /// Sets the value of [bandwidth_gbps][crate::model::vrf::QosPolicy::bandwidth_gbps].
3528 ///
3529 /// # Example
3530 /// ```ignore,no_run
3531 /// # use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3532 /// let x = QosPolicy::new().set_bandwidth_gbps(42.0);
3533 /// ```
3534 pub fn set_bandwidth_gbps<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3535 self.bandwidth_gbps = v.into();
3536 self
3537 }
3538 }
3539
3540 impl wkt::message::Message for QosPolicy {
3541 fn typename() -> &'static str {
3542 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.QosPolicy"
3543 }
3544 }
3545
3546 /// VLAN attachment details.
3547 #[derive(Clone, Default, PartialEq)]
3548 #[non_exhaustive]
3549 pub struct VlanAttachment {
3550 /// The peer vlan ID of the attachment.
3551 pub peer_vlan_id: i64,
3552
3553 /// The peer IP of the attachment.
3554 pub peer_ip: std::string::String,
3555
3556 /// The router IP of the attachment.
3557 pub router_ip: std::string::String,
3558
3559 /// Input only. Pairing key.
3560 pub pairing_key: std::string::String,
3561
3562 /// The QOS policy applied to this VLAN attachment.
3563 /// This value should be preferred to using qos at vrf level.
3564 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3565
3566 /// Immutable. The identifier of the attachment within vrf.
3567 pub id: std::string::String,
3568
3569 /// Optional. The name of the vlan attachment within vrf. This is of the form
3570 /// projects/{project_number}/regions/{region}/interconnectAttachments/{interconnect_attachment}
3571 pub interconnect_attachment: std::string::String,
3572
3573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3574 }
3575
3576 impl VlanAttachment {
3577 /// Creates a new default instance.
3578 pub fn new() -> Self {
3579 std::default::Default::default()
3580 }
3581
3582 /// Sets the value of [peer_vlan_id][crate::model::vrf::VlanAttachment::peer_vlan_id].
3583 ///
3584 /// # Example
3585 /// ```ignore,no_run
3586 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3587 /// let x = VlanAttachment::new().set_peer_vlan_id(42);
3588 /// ```
3589 pub fn set_peer_vlan_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3590 self.peer_vlan_id = v.into();
3591 self
3592 }
3593
3594 /// Sets the value of [peer_ip][crate::model::vrf::VlanAttachment::peer_ip].
3595 ///
3596 /// # Example
3597 /// ```ignore,no_run
3598 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3599 /// let x = VlanAttachment::new().set_peer_ip("example");
3600 /// ```
3601 pub fn set_peer_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3602 self.peer_ip = v.into();
3603 self
3604 }
3605
3606 /// Sets the value of [router_ip][crate::model::vrf::VlanAttachment::router_ip].
3607 ///
3608 /// # Example
3609 /// ```ignore,no_run
3610 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3611 /// let x = VlanAttachment::new().set_router_ip("example");
3612 /// ```
3613 pub fn set_router_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3614 self.router_ip = v.into();
3615 self
3616 }
3617
3618 /// Sets the value of [pairing_key][crate::model::vrf::VlanAttachment::pairing_key].
3619 ///
3620 /// # Example
3621 /// ```ignore,no_run
3622 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3623 /// let x = VlanAttachment::new().set_pairing_key("example");
3624 /// ```
3625 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3626 self.pairing_key = v.into();
3627 self
3628 }
3629
3630 /// Sets the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3631 ///
3632 /// # Example
3633 /// ```ignore,no_run
3634 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3635 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3636 /// let x = VlanAttachment::new().set_qos_policy(QosPolicy::default()/* use setters */);
3637 /// ```
3638 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3639 where
3640 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3641 {
3642 self.qos_policy = std::option::Option::Some(v.into());
3643 self
3644 }
3645
3646 /// Sets or clears the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3647 ///
3648 /// # Example
3649 /// ```ignore,no_run
3650 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3651 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3652 /// let x = VlanAttachment::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3653 /// let x = VlanAttachment::new().set_or_clear_qos_policy(None::<QosPolicy>);
3654 /// ```
3655 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3656 where
3657 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3658 {
3659 self.qos_policy = v.map(|x| x.into());
3660 self
3661 }
3662
3663 /// Sets the value of [id][crate::model::vrf::VlanAttachment::id].
3664 ///
3665 /// # Example
3666 /// ```ignore,no_run
3667 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3668 /// let x = VlanAttachment::new().set_id("example");
3669 /// ```
3670 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3671 self.id = v.into();
3672 self
3673 }
3674
3675 /// Sets the value of [interconnect_attachment][crate::model::vrf::VlanAttachment::interconnect_attachment].
3676 ///
3677 /// # Example
3678 /// ```ignore,no_run
3679 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3680 /// let x = VlanAttachment::new().set_interconnect_attachment("example");
3681 /// ```
3682 pub fn set_interconnect_attachment<T: std::convert::Into<std::string::String>>(
3683 mut self,
3684 v: T,
3685 ) -> Self {
3686 self.interconnect_attachment = v.into();
3687 self
3688 }
3689 }
3690
3691 impl wkt::message::Message for VlanAttachment {
3692 fn typename() -> &'static str {
3693 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.VlanAttachment"
3694 }
3695 }
3696
3697 /// The possible states for this VRF.
3698 ///
3699 /// # Working with unknown values
3700 ///
3701 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3702 /// additional enum variants at any time. Adding new variants is not considered
3703 /// a breaking change. Applications should write their code in anticipation of:
3704 ///
3705 /// - New values appearing in future releases of the client library, **and**
3706 /// - New values received dynamically, without application changes.
3707 ///
3708 /// Please consult the [Working with enums] section in the user guide for some
3709 /// guidelines.
3710 ///
3711 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3712 #[derive(Clone, Debug, PartialEq)]
3713 #[non_exhaustive]
3714 pub enum State {
3715 /// The unspecified state.
3716 Unspecified,
3717 /// The vrf is provisioning.
3718 Provisioning,
3719 /// The vrf is provisioned.
3720 Provisioned,
3721 /// If set, the enum was initialized with an unknown value.
3722 ///
3723 /// Applications can examine the value using [State::value] or
3724 /// [State::name].
3725 UnknownValue(state::UnknownValue),
3726 }
3727
3728 #[doc(hidden)]
3729 pub mod state {
3730 #[allow(unused_imports)]
3731 use super::*;
3732 #[derive(Clone, Debug, PartialEq)]
3733 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3734 }
3735
3736 impl State {
3737 /// Gets the enum value.
3738 ///
3739 /// Returns `None` if the enum contains an unknown value deserialized from
3740 /// the string representation of enums.
3741 pub fn value(&self) -> std::option::Option<i32> {
3742 match self {
3743 Self::Unspecified => std::option::Option::Some(0),
3744 Self::Provisioning => std::option::Option::Some(1),
3745 Self::Provisioned => std::option::Option::Some(2),
3746 Self::UnknownValue(u) => u.0.value(),
3747 }
3748 }
3749
3750 /// Gets the enum value as a string.
3751 ///
3752 /// Returns `None` if the enum contains an unknown value deserialized from
3753 /// the integer representation of enums.
3754 pub fn name(&self) -> std::option::Option<&str> {
3755 match self {
3756 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3757 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3758 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3759 Self::UnknownValue(u) => u.0.name(),
3760 }
3761 }
3762 }
3763
3764 impl std::default::Default for State {
3765 fn default() -> Self {
3766 use std::convert::From;
3767 Self::from(0)
3768 }
3769 }
3770
3771 impl std::fmt::Display for State {
3772 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3773 wkt::internal::display_enum(f, self.name(), self.value())
3774 }
3775 }
3776
3777 impl std::convert::From<i32> for State {
3778 fn from(value: i32) -> Self {
3779 match value {
3780 0 => Self::Unspecified,
3781 1 => Self::Provisioning,
3782 2 => Self::Provisioned,
3783 _ => Self::UnknownValue(state::UnknownValue(
3784 wkt::internal::UnknownEnumValue::Integer(value),
3785 )),
3786 }
3787 }
3788 }
3789
3790 impl std::convert::From<&str> for State {
3791 fn from(value: &str) -> Self {
3792 use std::string::ToString;
3793 match value {
3794 "STATE_UNSPECIFIED" => Self::Unspecified,
3795 "PROVISIONING" => Self::Provisioning,
3796 "PROVISIONED" => Self::Provisioned,
3797 _ => Self::UnknownValue(state::UnknownValue(
3798 wkt::internal::UnknownEnumValue::String(value.to_string()),
3799 )),
3800 }
3801 }
3802 }
3803
3804 impl serde::ser::Serialize for State {
3805 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3806 where
3807 S: serde::Serializer,
3808 {
3809 match self {
3810 Self::Unspecified => serializer.serialize_i32(0),
3811 Self::Provisioning => serializer.serialize_i32(1),
3812 Self::Provisioned => serializer.serialize_i32(2),
3813 Self::UnknownValue(u) => u.0.serialize(serializer),
3814 }
3815 }
3816 }
3817
3818 impl<'de> serde::de::Deserialize<'de> for State {
3819 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3820 where
3821 D: serde::Deserializer<'de>,
3822 {
3823 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3824 ".google.cloud.baremetalsolution.v2.VRF.State",
3825 ))
3826 }
3827 }
3828}
3829
3830/// Each logical interface represents a logical abstraction of the underlying
3831/// physical interface (for eg. bond, nic) of the instance. Each logical
3832/// interface can effectively map to multiple network-IP pairs and still be
3833/// mapped to one underlying physical interface.
3834#[derive(Clone, Default, PartialEq)]
3835#[non_exhaustive]
3836pub struct LogicalInterface {
3837 /// List of logical network interfaces within a logical interface.
3838 pub logical_network_interfaces:
3839 std::vec::Vec<crate::model::logical_interface::LogicalNetworkInterface>,
3840
3841 /// Interface name. This is of syntax \<bond\><bond_mode> or \<nic\> and
3842 /// forms part of the network template name.
3843 pub name: std::string::String,
3844
3845 /// The index of the logical interface mapping to the index of the hardware
3846 /// bond or nic on the chosen network template. This field is deprecated.
3847 #[deprecated]
3848 pub interface_index: i32,
3849
3850 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3851}
3852
3853impl LogicalInterface {
3854 /// Creates a new default instance.
3855 pub fn new() -> Self {
3856 std::default::Default::default()
3857 }
3858
3859 /// Sets the value of [logical_network_interfaces][crate::model::LogicalInterface::logical_network_interfaces].
3860 ///
3861 /// # Example
3862 /// ```ignore,no_run
3863 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3864 /// use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3865 /// let x = LogicalInterface::new()
3866 /// .set_logical_network_interfaces([
3867 /// LogicalNetworkInterface::default()/* use setters */,
3868 /// LogicalNetworkInterface::default()/* use (different) setters */,
3869 /// ]);
3870 /// ```
3871 pub fn set_logical_network_interfaces<T, V>(mut self, v: T) -> Self
3872 where
3873 T: std::iter::IntoIterator<Item = V>,
3874 V: std::convert::Into<crate::model::logical_interface::LogicalNetworkInterface>,
3875 {
3876 use std::iter::Iterator;
3877 self.logical_network_interfaces = v.into_iter().map(|i| i.into()).collect();
3878 self
3879 }
3880
3881 /// Sets the value of [name][crate::model::LogicalInterface::name].
3882 ///
3883 /// # Example
3884 /// ```ignore,no_run
3885 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3886 /// let x = LogicalInterface::new().set_name("example");
3887 /// ```
3888 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3889 self.name = v.into();
3890 self
3891 }
3892
3893 /// Sets the value of [interface_index][crate::model::LogicalInterface::interface_index].
3894 ///
3895 /// # Example
3896 /// ```ignore,no_run
3897 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3898 /// let x = LogicalInterface::new().set_interface_index(42);
3899 /// ```
3900 #[deprecated]
3901 pub fn set_interface_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3902 self.interface_index = v.into();
3903 self
3904 }
3905}
3906
3907impl wkt::message::Message for LogicalInterface {
3908 fn typename() -> &'static str {
3909 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface"
3910 }
3911}
3912
3913/// Defines additional types related to [LogicalInterface].
3914pub mod logical_interface {
3915 #[allow(unused_imports)]
3916 use super::*;
3917
3918 /// Each logical network interface is effectively a network and IP pair.
3919 #[derive(Clone, Default, PartialEq)]
3920 #[non_exhaustive]
3921 pub struct LogicalNetworkInterface {
3922 /// Name of the network
3923 pub network: std::string::String,
3924
3925 /// IP address in the network
3926 pub ip_address: std::string::String,
3927
3928 /// Whether this interface is the default gateway for the instance. Only
3929 /// one interface can be the default gateway for the instance.
3930 pub default_gateway: bool,
3931
3932 /// Type of network.
3933 pub network_type: crate::model::network::Type,
3934
3935 /// An identifier for the `Network`, generated by the backend.
3936 pub id: std::string::String,
3937
3938 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3939 }
3940
3941 impl LogicalNetworkInterface {
3942 /// Creates a new default instance.
3943 pub fn new() -> Self {
3944 std::default::Default::default()
3945 }
3946
3947 /// Sets the value of [network][crate::model::logical_interface::LogicalNetworkInterface::network].
3948 ///
3949 /// # Example
3950 /// ```ignore,no_run
3951 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3952 /// let x = LogicalNetworkInterface::new().set_network("example");
3953 /// ```
3954 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3955 self.network = v.into();
3956 self
3957 }
3958
3959 /// Sets the value of [ip_address][crate::model::logical_interface::LogicalNetworkInterface::ip_address].
3960 ///
3961 /// # Example
3962 /// ```ignore,no_run
3963 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3964 /// let x = LogicalNetworkInterface::new().set_ip_address("example");
3965 /// ```
3966 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3967 self.ip_address = v.into();
3968 self
3969 }
3970
3971 /// Sets the value of [default_gateway][crate::model::logical_interface::LogicalNetworkInterface::default_gateway].
3972 ///
3973 /// # Example
3974 /// ```ignore,no_run
3975 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3976 /// let x = LogicalNetworkInterface::new().set_default_gateway(true);
3977 /// ```
3978 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3979 self.default_gateway = v.into();
3980 self
3981 }
3982
3983 /// Sets the value of [network_type][crate::model::logical_interface::LogicalNetworkInterface::network_type].
3984 ///
3985 /// # Example
3986 /// ```ignore,no_run
3987 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3988 /// use google_cloud_baremetalsolution_v2::model::network::Type;
3989 /// let x0 = LogicalNetworkInterface::new().set_network_type(Type::Client);
3990 /// let x1 = LogicalNetworkInterface::new().set_network_type(Type::Private);
3991 /// ```
3992 pub fn set_network_type<T: std::convert::Into<crate::model::network::Type>>(
3993 mut self,
3994 v: T,
3995 ) -> Self {
3996 self.network_type = v.into();
3997 self
3998 }
3999
4000 /// Sets the value of [id][crate::model::logical_interface::LogicalNetworkInterface::id].
4001 ///
4002 /// # Example
4003 /// ```ignore,no_run
4004 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4005 /// let x = LogicalNetworkInterface::new().set_id("example");
4006 /// ```
4007 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4008 self.id = v.into();
4009 self
4010 }
4011 }
4012
4013 impl wkt::message::Message for LogicalNetworkInterface {
4014 fn typename() -> &'static str {
4015 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface.LogicalNetworkInterface"
4016 }
4017 }
4018}
4019
4020/// Message for requesting network information.
4021#[derive(Clone, Default, PartialEq)]
4022#[non_exhaustive]
4023pub struct GetNetworkRequest {
4024 /// Required. Name of the resource.
4025 pub name: std::string::String,
4026
4027 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4028}
4029
4030impl GetNetworkRequest {
4031 /// Creates a new default instance.
4032 pub fn new() -> Self {
4033 std::default::Default::default()
4034 }
4035
4036 /// Sets the value of [name][crate::model::GetNetworkRequest::name].
4037 ///
4038 /// # Example
4039 /// ```ignore,no_run
4040 /// # use google_cloud_baremetalsolution_v2::model::GetNetworkRequest;
4041 /// let x = GetNetworkRequest::new().set_name("example");
4042 /// ```
4043 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4044 self.name = v.into();
4045 self
4046 }
4047}
4048
4049impl wkt::message::Message for GetNetworkRequest {
4050 fn typename() -> &'static str {
4051 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNetworkRequest"
4052 }
4053}
4054
4055/// Message for requesting a list of networks.
4056#[derive(Clone, Default, PartialEq)]
4057#[non_exhaustive]
4058pub struct ListNetworksRequest {
4059 /// Required. Parent value for ListNetworksRequest.
4060 pub parent: std::string::String,
4061
4062 /// Requested page size. The server might return fewer items than requested.
4063 /// If unspecified, server will pick an appropriate default.
4064 pub page_size: i32,
4065
4066 /// A token identifying a page of results from the server.
4067 pub page_token: std::string::String,
4068
4069 /// List filter.
4070 pub filter: std::string::String,
4071
4072 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4073}
4074
4075impl ListNetworksRequest {
4076 /// Creates a new default instance.
4077 pub fn new() -> Self {
4078 std::default::Default::default()
4079 }
4080
4081 /// Sets the value of [parent][crate::model::ListNetworksRequest::parent].
4082 ///
4083 /// # Example
4084 /// ```ignore,no_run
4085 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4086 /// let x = ListNetworksRequest::new().set_parent("example");
4087 /// ```
4088 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4089 self.parent = v.into();
4090 self
4091 }
4092
4093 /// Sets the value of [page_size][crate::model::ListNetworksRequest::page_size].
4094 ///
4095 /// # Example
4096 /// ```ignore,no_run
4097 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4098 /// let x = ListNetworksRequest::new().set_page_size(42);
4099 /// ```
4100 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4101 self.page_size = v.into();
4102 self
4103 }
4104
4105 /// Sets the value of [page_token][crate::model::ListNetworksRequest::page_token].
4106 ///
4107 /// # Example
4108 /// ```ignore,no_run
4109 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4110 /// let x = ListNetworksRequest::new().set_page_token("example");
4111 /// ```
4112 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4113 self.page_token = v.into();
4114 self
4115 }
4116
4117 /// Sets the value of [filter][crate::model::ListNetworksRequest::filter].
4118 ///
4119 /// # Example
4120 /// ```ignore,no_run
4121 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4122 /// let x = ListNetworksRequest::new().set_filter("example");
4123 /// ```
4124 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4125 self.filter = v.into();
4126 self
4127 }
4128}
4129
4130impl wkt::message::Message for ListNetworksRequest {
4131 fn typename() -> &'static str {
4132 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksRequest"
4133 }
4134}
4135
4136/// Response message containing the list of networks.
4137#[derive(Clone, Default, PartialEq)]
4138#[non_exhaustive]
4139pub struct ListNetworksResponse {
4140 /// The list of networks.
4141 pub networks: std::vec::Vec<crate::model::Network>,
4142
4143 /// A token identifying a page of results from the server.
4144 pub next_page_token: std::string::String,
4145
4146 /// Locations that could not be reached.
4147 pub unreachable: std::vec::Vec<std::string::String>,
4148
4149 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4150}
4151
4152impl ListNetworksResponse {
4153 /// Creates a new default instance.
4154 pub fn new() -> Self {
4155 std::default::Default::default()
4156 }
4157
4158 /// Sets the value of [networks][crate::model::ListNetworksResponse::networks].
4159 ///
4160 /// # Example
4161 /// ```ignore,no_run
4162 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4163 /// use google_cloud_baremetalsolution_v2::model::Network;
4164 /// let x = ListNetworksResponse::new()
4165 /// .set_networks([
4166 /// Network::default()/* use setters */,
4167 /// Network::default()/* use (different) setters */,
4168 /// ]);
4169 /// ```
4170 pub fn set_networks<T, V>(mut self, v: T) -> Self
4171 where
4172 T: std::iter::IntoIterator<Item = V>,
4173 V: std::convert::Into<crate::model::Network>,
4174 {
4175 use std::iter::Iterator;
4176 self.networks = v.into_iter().map(|i| i.into()).collect();
4177 self
4178 }
4179
4180 /// Sets the value of [next_page_token][crate::model::ListNetworksResponse::next_page_token].
4181 ///
4182 /// # Example
4183 /// ```ignore,no_run
4184 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4185 /// let x = ListNetworksResponse::new().set_next_page_token("example");
4186 /// ```
4187 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4188 self.next_page_token = v.into();
4189 self
4190 }
4191
4192 /// Sets the value of [unreachable][crate::model::ListNetworksResponse::unreachable].
4193 ///
4194 /// # Example
4195 /// ```ignore,no_run
4196 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4197 /// let x = ListNetworksResponse::new().set_unreachable(["a", "b", "c"]);
4198 /// ```
4199 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4200 where
4201 T: std::iter::IntoIterator<Item = V>,
4202 V: std::convert::Into<std::string::String>,
4203 {
4204 use std::iter::Iterator;
4205 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4206 self
4207 }
4208}
4209
4210impl wkt::message::Message for ListNetworksResponse {
4211 fn typename() -> &'static str {
4212 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksResponse"
4213 }
4214}
4215
4216#[doc(hidden)]
4217impl google_cloud_gax::paginator::internal::PageableResponse for ListNetworksResponse {
4218 type PageItem = crate::model::Network;
4219
4220 fn items(self) -> std::vec::Vec<Self::PageItem> {
4221 self.networks
4222 }
4223
4224 fn next_page_token(&self) -> std::string::String {
4225 use std::clone::Clone;
4226 self.next_page_token.clone()
4227 }
4228}
4229
4230/// Message requesting to updating a network.
4231#[derive(Clone, Default, PartialEq)]
4232#[non_exhaustive]
4233pub struct UpdateNetworkRequest {
4234 /// Required. The network to update.
4235 ///
4236 /// The `name` field is used to identify the instance to update.
4237 /// Format: projects/{project}/locations/{location}/networks/{network}
4238 pub network: std::option::Option<crate::model::Network>,
4239
4240 /// The list of fields to update.
4241 /// The only currently supported fields are:
4242 /// `labels`, `reservations`, `vrf.vlan_attachments`
4243 pub update_mask: std::option::Option<wkt::FieldMask>,
4244
4245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4246}
4247
4248impl UpdateNetworkRequest {
4249 /// Creates a new default instance.
4250 pub fn new() -> Self {
4251 std::default::Default::default()
4252 }
4253
4254 /// Sets the value of [network][crate::model::UpdateNetworkRequest::network].
4255 ///
4256 /// # Example
4257 /// ```ignore,no_run
4258 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4259 /// use google_cloud_baremetalsolution_v2::model::Network;
4260 /// let x = UpdateNetworkRequest::new().set_network(Network::default()/* use setters */);
4261 /// ```
4262 pub fn set_network<T>(mut self, v: T) -> Self
4263 where
4264 T: std::convert::Into<crate::model::Network>,
4265 {
4266 self.network = std::option::Option::Some(v.into());
4267 self
4268 }
4269
4270 /// Sets or clears the value of [network][crate::model::UpdateNetworkRequest::network].
4271 ///
4272 /// # Example
4273 /// ```ignore,no_run
4274 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4275 /// use google_cloud_baremetalsolution_v2::model::Network;
4276 /// let x = UpdateNetworkRequest::new().set_or_clear_network(Some(Network::default()/* use setters */));
4277 /// let x = UpdateNetworkRequest::new().set_or_clear_network(None::<Network>);
4278 /// ```
4279 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4280 where
4281 T: std::convert::Into<crate::model::Network>,
4282 {
4283 self.network = v.map(|x| x.into());
4284 self
4285 }
4286
4287 /// Sets the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4288 ///
4289 /// # Example
4290 /// ```ignore,no_run
4291 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4292 /// use wkt::FieldMask;
4293 /// let x = UpdateNetworkRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4294 /// ```
4295 pub fn set_update_mask<T>(mut self, v: T) -> Self
4296 where
4297 T: std::convert::Into<wkt::FieldMask>,
4298 {
4299 self.update_mask = std::option::Option::Some(v.into());
4300 self
4301 }
4302
4303 /// Sets or clears the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4304 ///
4305 /// # Example
4306 /// ```ignore,no_run
4307 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4308 /// use wkt::FieldMask;
4309 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4310 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4311 /// ```
4312 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4313 where
4314 T: std::convert::Into<wkt::FieldMask>,
4315 {
4316 self.update_mask = v.map(|x| x.into());
4317 self
4318 }
4319}
4320
4321impl wkt::message::Message for UpdateNetworkRequest {
4322 fn typename() -> &'static str {
4323 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNetworkRequest"
4324 }
4325}
4326
4327/// Network with all used IP addresses.
4328#[derive(Clone, Default, PartialEq)]
4329#[non_exhaustive]
4330pub struct NetworkUsage {
4331 /// Network.
4332 pub network: std::option::Option<crate::model::Network>,
4333
4334 /// All used IP addresses in this network.
4335 pub used_ips: std::vec::Vec<std::string::String>,
4336
4337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4338}
4339
4340impl NetworkUsage {
4341 /// Creates a new default instance.
4342 pub fn new() -> Self {
4343 std::default::Default::default()
4344 }
4345
4346 /// Sets the value of [network][crate::model::NetworkUsage::network].
4347 ///
4348 /// # Example
4349 /// ```ignore,no_run
4350 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4351 /// use google_cloud_baremetalsolution_v2::model::Network;
4352 /// let x = NetworkUsage::new().set_network(Network::default()/* use setters */);
4353 /// ```
4354 pub fn set_network<T>(mut self, v: T) -> Self
4355 where
4356 T: std::convert::Into<crate::model::Network>,
4357 {
4358 self.network = std::option::Option::Some(v.into());
4359 self
4360 }
4361
4362 /// Sets or clears the value of [network][crate::model::NetworkUsage::network].
4363 ///
4364 /// # Example
4365 /// ```ignore,no_run
4366 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4367 /// use google_cloud_baremetalsolution_v2::model::Network;
4368 /// let x = NetworkUsage::new().set_or_clear_network(Some(Network::default()/* use setters */));
4369 /// let x = NetworkUsage::new().set_or_clear_network(None::<Network>);
4370 /// ```
4371 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4372 where
4373 T: std::convert::Into<crate::model::Network>,
4374 {
4375 self.network = v.map(|x| x.into());
4376 self
4377 }
4378
4379 /// Sets the value of [used_ips][crate::model::NetworkUsage::used_ips].
4380 ///
4381 /// # Example
4382 /// ```ignore,no_run
4383 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4384 /// let x = NetworkUsage::new().set_used_ips(["a", "b", "c"]);
4385 /// ```
4386 pub fn set_used_ips<T, V>(mut self, v: T) -> Self
4387 where
4388 T: std::iter::IntoIterator<Item = V>,
4389 V: std::convert::Into<std::string::String>,
4390 {
4391 use std::iter::Iterator;
4392 self.used_ips = v.into_iter().map(|i| i.into()).collect();
4393 self
4394 }
4395}
4396
4397impl wkt::message::Message for NetworkUsage {
4398 fn typename() -> &'static str {
4399 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkUsage"
4400 }
4401}
4402
4403/// Request to get networks with IPs.
4404#[derive(Clone, Default, PartialEq)]
4405#[non_exhaustive]
4406pub struct ListNetworkUsageRequest {
4407 /// Required. Parent value (project and location).
4408 pub location: std::string::String,
4409
4410 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4411}
4412
4413impl ListNetworkUsageRequest {
4414 /// Creates a new default instance.
4415 pub fn new() -> Self {
4416 std::default::Default::default()
4417 }
4418
4419 /// Sets the value of [location][crate::model::ListNetworkUsageRequest::location].
4420 ///
4421 /// # Example
4422 /// ```ignore,no_run
4423 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageRequest;
4424 /// let x = ListNetworkUsageRequest::new().set_location("example");
4425 /// ```
4426 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4427 self.location = v.into();
4428 self
4429 }
4430}
4431
4432impl wkt::message::Message for ListNetworkUsageRequest {
4433 fn typename() -> &'static str {
4434 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageRequest"
4435 }
4436}
4437
4438/// Response with Networks with IPs
4439#[derive(Clone, Default, PartialEq)]
4440#[non_exhaustive]
4441pub struct ListNetworkUsageResponse {
4442 /// Networks with IPs.
4443 pub networks: std::vec::Vec<crate::model::NetworkUsage>,
4444
4445 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4446}
4447
4448impl ListNetworkUsageResponse {
4449 /// Creates a new default instance.
4450 pub fn new() -> Self {
4451 std::default::Default::default()
4452 }
4453
4454 /// Sets the value of [networks][crate::model::ListNetworkUsageResponse::networks].
4455 ///
4456 /// # Example
4457 /// ```ignore,no_run
4458 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageResponse;
4459 /// use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4460 /// let x = ListNetworkUsageResponse::new()
4461 /// .set_networks([
4462 /// NetworkUsage::default()/* use setters */,
4463 /// NetworkUsage::default()/* use (different) setters */,
4464 /// ]);
4465 /// ```
4466 pub fn set_networks<T, V>(mut self, v: T) -> Self
4467 where
4468 T: std::iter::IntoIterator<Item = V>,
4469 V: std::convert::Into<crate::model::NetworkUsage>,
4470 {
4471 use std::iter::Iterator;
4472 self.networks = v.into_iter().map(|i| i.into()).collect();
4473 self
4474 }
4475}
4476
4477impl wkt::message::Message for ListNetworkUsageResponse {
4478 fn typename() -> &'static str {
4479 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageResponse"
4480 }
4481}
4482
4483/// Mount point for a network.
4484#[derive(Clone, Default, PartialEq)]
4485#[non_exhaustive]
4486pub struct NetworkMountPoint {
4487 /// Instance to attach network to.
4488 pub instance: std::string::String,
4489
4490 /// Logical interface to detach from.
4491 pub logical_interface: std::string::String,
4492
4493 /// Network should be a default gateway.
4494 pub default_gateway: bool,
4495
4496 /// Ip address of the server.
4497 pub ip_address: std::string::String,
4498
4499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4500}
4501
4502impl NetworkMountPoint {
4503 /// Creates a new default instance.
4504 pub fn new() -> Self {
4505 std::default::Default::default()
4506 }
4507
4508 /// Sets the value of [instance][crate::model::NetworkMountPoint::instance].
4509 ///
4510 /// # Example
4511 /// ```ignore,no_run
4512 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4513 /// let x = NetworkMountPoint::new().set_instance("example");
4514 /// ```
4515 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4516 self.instance = v.into();
4517 self
4518 }
4519
4520 /// Sets the value of [logical_interface][crate::model::NetworkMountPoint::logical_interface].
4521 ///
4522 /// # Example
4523 /// ```ignore,no_run
4524 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4525 /// let x = NetworkMountPoint::new().set_logical_interface("example");
4526 /// ```
4527 pub fn set_logical_interface<T: std::convert::Into<std::string::String>>(
4528 mut self,
4529 v: T,
4530 ) -> Self {
4531 self.logical_interface = v.into();
4532 self
4533 }
4534
4535 /// Sets the value of [default_gateway][crate::model::NetworkMountPoint::default_gateway].
4536 ///
4537 /// # Example
4538 /// ```ignore,no_run
4539 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4540 /// let x = NetworkMountPoint::new().set_default_gateway(true);
4541 /// ```
4542 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4543 self.default_gateway = v.into();
4544 self
4545 }
4546
4547 /// Sets the value of [ip_address][crate::model::NetworkMountPoint::ip_address].
4548 ///
4549 /// # Example
4550 /// ```ignore,no_run
4551 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4552 /// let x = NetworkMountPoint::new().set_ip_address("example");
4553 /// ```
4554 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4555 self.ip_address = v.into();
4556 self
4557 }
4558}
4559
4560impl wkt::message::Message for NetworkMountPoint {
4561 fn typename() -> &'static str {
4562 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkMountPoint"
4563 }
4564}
4565
4566/// Message requesting rename of a server.
4567#[derive(Clone, Default, PartialEq)]
4568#[non_exhaustive]
4569pub struct RenameNetworkRequest {
4570 /// Required. The `name` field is used to identify the network.
4571 /// Format: projects/{project}/locations/{location}/networks/{network}
4572 pub name: std::string::String,
4573
4574 /// Required. The new `id` of the network.
4575 pub new_network_id: std::string::String,
4576
4577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4578}
4579
4580impl RenameNetworkRequest {
4581 /// Creates a new default instance.
4582 pub fn new() -> Self {
4583 std::default::Default::default()
4584 }
4585
4586 /// Sets the value of [name][crate::model::RenameNetworkRequest::name].
4587 ///
4588 /// # Example
4589 /// ```ignore,no_run
4590 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4591 /// let x = RenameNetworkRequest::new().set_name("example");
4592 /// ```
4593 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4594 self.name = v.into();
4595 self
4596 }
4597
4598 /// Sets the value of [new_network_id][crate::model::RenameNetworkRequest::new_network_id].
4599 ///
4600 /// # Example
4601 /// ```ignore,no_run
4602 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4603 /// let x = RenameNetworkRequest::new().set_new_network_id("example");
4604 /// ```
4605 pub fn set_new_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4606 self.new_network_id = v.into();
4607 self
4608 }
4609}
4610
4611impl wkt::message::Message for RenameNetworkRequest {
4612 fn typename() -> &'static str {
4613 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNetworkRequest"
4614 }
4615}
4616
4617/// An NFS share.
4618#[derive(Clone, Default, PartialEq)]
4619#[non_exhaustive]
4620pub struct NfsShare {
4621 /// Immutable. The name of the NFS share.
4622 pub name: std::string::String,
4623
4624 /// Output only. An identifier for the NFS share, generated by the backend.
4625 /// This field will be deprecated in the future, use `id` instead.
4626 pub nfs_share_id: std::string::String,
4627
4628 /// Output only. An identifier for the NFS share, generated by the backend.
4629 /// This is the same value as nfs_share_id and will replace it in the future.
4630 pub id: std::string::String,
4631
4632 /// Output only. The state of the NFS share.
4633 pub state: crate::model::nfs_share::State,
4634
4635 /// Output only. The underlying volume of the share. Created automatically
4636 /// during provisioning.
4637 pub volume: std::string::String,
4638
4639 /// List of allowed access points.
4640 pub allowed_clients: std::vec::Vec<crate::model::nfs_share::AllowedClient>,
4641
4642 /// Labels as key value pairs.
4643 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4644
4645 /// The requested size, in GiB.
4646 pub requested_size_gib: i64,
4647
4648 /// Immutable. The storage type of the underlying volume.
4649 pub storage_type: crate::model::nfs_share::StorageType,
4650
4651 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4652}
4653
4654impl NfsShare {
4655 /// Creates a new default instance.
4656 pub fn new() -> Self {
4657 std::default::Default::default()
4658 }
4659
4660 /// Sets the value of [name][crate::model::NfsShare::name].
4661 ///
4662 /// # Example
4663 /// ```ignore,no_run
4664 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4665 /// let x = NfsShare::new().set_name("example");
4666 /// ```
4667 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4668 self.name = v.into();
4669 self
4670 }
4671
4672 /// Sets the value of [nfs_share_id][crate::model::NfsShare::nfs_share_id].
4673 ///
4674 /// # Example
4675 /// ```ignore,no_run
4676 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4677 /// let x = NfsShare::new().set_nfs_share_id("example");
4678 /// ```
4679 pub fn set_nfs_share_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4680 self.nfs_share_id = v.into();
4681 self
4682 }
4683
4684 /// Sets the value of [id][crate::model::NfsShare::id].
4685 ///
4686 /// # Example
4687 /// ```ignore,no_run
4688 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4689 /// let x = NfsShare::new().set_id("example");
4690 /// ```
4691 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4692 self.id = v.into();
4693 self
4694 }
4695
4696 /// Sets the value of [state][crate::model::NfsShare::state].
4697 ///
4698 /// # Example
4699 /// ```ignore,no_run
4700 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4701 /// use google_cloud_baremetalsolution_v2::model::nfs_share::State;
4702 /// let x0 = NfsShare::new().set_state(State::Provisioned);
4703 /// let x1 = NfsShare::new().set_state(State::Creating);
4704 /// let x2 = NfsShare::new().set_state(State::Updating);
4705 /// ```
4706 pub fn set_state<T: std::convert::Into<crate::model::nfs_share::State>>(
4707 mut self,
4708 v: T,
4709 ) -> Self {
4710 self.state = v.into();
4711 self
4712 }
4713
4714 /// Sets the value of [volume][crate::model::NfsShare::volume].
4715 ///
4716 /// # Example
4717 /// ```ignore,no_run
4718 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4719 /// let x = NfsShare::new().set_volume("example");
4720 /// ```
4721 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4722 self.volume = v.into();
4723 self
4724 }
4725
4726 /// Sets the value of [allowed_clients][crate::model::NfsShare::allowed_clients].
4727 ///
4728 /// # Example
4729 /// ```ignore,no_run
4730 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4731 /// use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4732 /// let x = NfsShare::new()
4733 /// .set_allowed_clients([
4734 /// AllowedClient::default()/* use setters */,
4735 /// AllowedClient::default()/* use (different) setters */,
4736 /// ]);
4737 /// ```
4738 pub fn set_allowed_clients<T, V>(mut self, v: T) -> Self
4739 where
4740 T: std::iter::IntoIterator<Item = V>,
4741 V: std::convert::Into<crate::model::nfs_share::AllowedClient>,
4742 {
4743 use std::iter::Iterator;
4744 self.allowed_clients = v.into_iter().map(|i| i.into()).collect();
4745 self
4746 }
4747
4748 /// Sets the value of [labels][crate::model::NfsShare::labels].
4749 ///
4750 /// # Example
4751 /// ```ignore,no_run
4752 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4753 /// let x = NfsShare::new().set_labels([
4754 /// ("key0", "abc"),
4755 /// ("key1", "xyz"),
4756 /// ]);
4757 /// ```
4758 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4759 where
4760 T: std::iter::IntoIterator<Item = (K, V)>,
4761 K: std::convert::Into<std::string::String>,
4762 V: std::convert::Into<std::string::String>,
4763 {
4764 use std::iter::Iterator;
4765 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4766 self
4767 }
4768
4769 /// Sets the value of [requested_size_gib][crate::model::NfsShare::requested_size_gib].
4770 ///
4771 /// # Example
4772 /// ```ignore,no_run
4773 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4774 /// let x = NfsShare::new().set_requested_size_gib(42);
4775 /// ```
4776 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4777 self.requested_size_gib = v.into();
4778 self
4779 }
4780
4781 /// Sets the value of [storage_type][crate::model::NfsShare::storage_type].
4782 ///
4783 /// # Example
4784 /// ```ignore,no_run
4785 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4786 /// use google_cloud_baremetalsolution_v2::model::nfs_share::StorageType;
4787 /// let x0 = NfsShare::new().set_storage_type(StorageType::Ssd);
4788 /// let x1 = NfsShare::new().set_storage_type(StorageType::Hdd);
4789 /// ```
4790 pub fn set_storage_type<T: std::convert::Into<crate::model::nfs_share::StorageType>>(
4791 mut self,
4792 v: T,
4793 ) -> Self {
4794 self.storage_type = v.into();
4795 self
4796 }
4797}
4798
4799impl wkt::message::Message for NfsShare {
4800 fn typename() -> &'static str {
4801 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare"
4802 }
4803}
4804
4805/// Defines additional types related to [NfsShare].
4806pub mod nfs_share {
4807 #[allow(unused_imports)]
4808 use super::*;
4809
4810 /// Represents an 'access point' for the share.
4811 #[derive(Clone, Default, PartialEq)]
4812 #[non_exhaustive]
4813 pub struct AllowedClient {
4814 /// The network the access point sits on.
4815 pub network: std::string::String,
4816
4817 /// Output only. The IP address of the share on this network. Assigned
4818 /// automatically during provisioning based on the network's services_cidr.
4819 pub share_ip: std::string::String,
4820
4821 /// The subnet of IP addresses permitted to access the share.
4822 pub allowed_clients_cidr: std::string::String,
4823
4824 /// Mount permissions.
4825 pub mount_permissions: crate::model::nfs_share::MountPermissions,
4826
4827 /// Allow dev flag. Which controls whether to allow creation of devices.
4828 pub allow_dev: bool,
4829
4830 /// Allow the setuid flag.
4831 pub allow_suid: bool,
4832
4833 /// Disable root squashing, which is a feature of NFS.
4834 /// Root squash is a special mapping of the remote superuser (root) identity
4835 /// when using identity authentication.
4836 pub no_root_squash: bool,
4837
4838 /// Output only. The path to access NFS, in format shareIP:/InstanceID
4839 /// InstanceID is the generated ID instead of customer provided name.
4840 /// example like "10.0.0.0:/g123456789-nfs001"
4841 pub nfs_path: std::string::String,
4842
4843 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4844 }
4845
4846 impl AllowedClient {
4847 /// Creates a new default instance.
4848 pub fn new() -> Self {
4849 std::default::Default::default()
4850 }
4851
4852 /// Sets the value of [network][crate::model::nfs_share::AllowedClient::network].
4853 ///
4854 /// # Example
4855 /// ```ignore,no_run
4856 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4857 /// let x = AllowedClient::new().set_network("example");
4858 /// ```
4859 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4860 self.network = v.into();
4861 self
4862 }
4863
4864 /// Sets the value of [share_ip][crate::model::nfs_share::AllowedClient::share_ip].
4865 ///
4866 /// # Example
4867 /// ```ignore,no_run
4868 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4869 /// let x = AllowedClient::new().set_share_ip("example");
4870 /// ```
4871 pub fn set_share_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4872 self.share_ip = v.into();
4873 self
4874 }
4875
4876 /// Sets the value of [allowed_clients_cidr][crate::model::nfs_share::AllowedClient::allowed_clients_cidr].
4877 ///
4878 /// # Example
4879 /// ```ignore,no_run
4880 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4881 /// let x = AllowedClient::new().set_allowed_clients_cidr("example");
4882 /// ```
4883 pub fn set_allowed_clients_cidr<T: std::convert::Into<std::string::String>>(
4884 mut self,
4885 v: T,
4886 ) -> Self {
4887 self.allowed_clients_cidr = v.into();
4888 self
4889 }
4890
4891 /// Sets the value of [mount_permissions][crate::model::nfs_share::AllowedClient::mount_permissions].
4892 ///
4893 /// # Example
4894 /// ```ignore,no_run
4895 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4896 /// use google_cloud_baremetalsolution_v2::model::nfs_share::MountPermissions;
4897 /// let x0 = AllowedClient::new().set_mount_permissions(MountPermissions::Read);
4898 /// let x1 = AllowedClient::new().set_mount_permissions(MountPermissions::ReadWrite);
4899 /// ```
4900 pub fn set_mount_permissions<
4901 T: std::convert::Into<crate::model::nfs_share::MountPermissions>,
4902 >(
4903 mut self,
4904 v: T,
4905 ) -> Self {
4906 self.mount_permissions = v.into();
4907 self
4908 }
4909
4910 /// Sets the value of [allow_dev][crate::model::nfs_share::AllowedClient::allow_dev].
4911 ///
4912 /// # Example
4913 /// ```ignore,no_run
4914 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4915 /// let x = AllowedClient::new().set_allow_dev(true);
4916 /// ```
4917 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4918 self.allow_dev = v.into();
4919 self
4920 }
4921
4922 /// Sets the value of [allow_suid][crate::model::nfs_share::AllowedClient::allow_suid].
4923 ///
4924 /// # Example
4925 /// ```ignore,no_run
4926 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4927 /// let x = AllowedClient::new().set_allow_suid(true);
4928 /// ```
4929 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4930 self.allow_suid = v.into();
4931 self
4932 }
4933
4934 /// Sets the value of [no_root_squash][crate::model::nfs_share::AllowedClient::no_root_squash].
4935 ///
4936 /// # Example
4937 /// ```ignore,no_run
4938 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4939 /// let x = AllowedClient::new().set_no_root_squash(true);
4940 /// ```
4941 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4942 self.no_root_squash = v.into();
4943 self
4944 }
4945
4946 /// Sets the value of [nfs_path][crate::model::nfs_share::AllowedClient::nfs_path].
4947 ///
4948 /// # Example
4949 /// ```ignore,no_run
4950 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4951 /// let x = AllowedClient::new().set_nfs_path("example");
4952 /// ```
4953 pub fn set_nfs_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4954 self.nfs_path = v.into();
4955 self
4956 }
4957 }
4958
4959 impl wkt::message::Message for AllowedClient {
4960 fn typename() -> &'static str {
4961 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare.AllowedClient"
4962 }
4963 }
4964
4965 /// The possible states for this NFS share.
4966 ///
4967 /// # Working with unknown values
4968 ///
4969 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4970 /// additional enum variants at any time. Adding new variants is not considered
4971 /// a breaking change. Applications should write their code in anticipation of:
4972 ///
4973 /// - New values appearing in future releases of the client library, **and**
4974 /// - New values received dynamically, without application changes.
4975 ///
4976 /// Please consult the [Working with enums] section in the user guide for some
4977 /// guidelines.
4978 ///
4979 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4980 #[derive(Clone, Debug, PartialEq)]
4981 #[non_exhaustive]
4982 pub enum State {
4983 /// The share is in an unknown state.
4984 Unspecified,
4985 /// The share has been provisioned.
4986 Provisioned,
4987 /// The NFS Share is being created.
4988 Creating,
4989 /// The NFS Share is being updated.
4990 Updating,
4991 /// The NFS Share has been requested to be deleted.
4992 Deleting,
4993 /// If set, the enum was initialized with an unknown value.
4994 ///
4995 /// Applications can examine the value using [State::value] or
4996 /// [State::name].
4997 UnknownValue(state::UnknownValue),
4998 }
4999
5000 #[doc(hidden)]
5001 pub mod state {
5002 #[allow(unused_imports)]
5003 use super::*;
5004 #[derive(Clone, Debug, PartialEq)]
5005 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5006 }
5007
5008 impl State {
5009 /// Gets the enum value.
5010 ///
5011 /// Returns `None` if the enum contains an unknown value deserialized from
5012 /// the string representation of enums.
5013 pub fn value(&self) -> std::option::Option<i32> {
5014 match self {
5015 Self::Unspecified => std::option::Option::Some(0),
5016 Self::Provisioned => std::option::Option::Some(1),
5017 Self::Creating => std::option::Option::Some(2),
5018 Self::Updating => std::option::Option::Some(3),
5019 Self::Deleting => std::option::Option::Some(4),
5020 Self::UnknownValue(u) => u.0.value(),
5021 }
5022 }
5023
5024 /// Gets the enum value as a string.
5025 ///
5026 /// Returns `None` if the enum contains an unknown value deserialized from
5027 /// the integer representation of enums.
5028 pub fn name(&self) -> std::option::Option<&str> {
5029 match self {
5030 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5031 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
5032 Self::Creating => std::option::Option::Some("CREATING"),
5033 Self::Updating => std::option::Option::Some("UPDATING"),
5034 Self::Deleting => std::option::Option::Some("DELETING"),
5035 Self::UnknownValue(u) => u.0.name(),
5036 }
5037 }
5038 }
5039
5040 impl std::default::Default for State {
5041 fn default() -> Self {
5042 use std::convert::From;
5043 Self::from(0)
5044 }
5045 }
5046
5047 impl std::fmt::Display for State {
5048 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5049 wkt::internal::display_enum(f, self.name(), self.value())
5050 }
5051 }
5052
5053 impl std::convert::From<i32> for State {
5054 fn from(value: i32) -> Self {
5055 match value {
5056 0 => Self::Unspecified,
5057 1 => Self::Provisioned,
5058 2 => Self::Creating,
5059 3 => Self::Updating,
5060 4 => Self::Deleting,
5061 _ => Self::UnknownValue(state::UnknownValue(
5062 wkt::internal::UnknownEnumValue::Integer(value),
5063 )),
5064 }
5065 }
5066 }
5067
5068 impl std::convert::From<&str> for State {
5069 fn from(value: &str) -> Self {
5070 use std::string::ToString;
5071 match value {
5072 "STATE_UNSPECIFIED" => Self::Unspecified,
5073 "PROVISIONED" => Self::Provisioned,
5074 "CREATING" => Self::Creating,
5075 "UPDATING" => Self::Updating,
5076 "DELETING" => Self::Deleting,
5077 _ => Self::UnknownValue(state::UnknownValue(
5078 wkt::internal::UnknownEnumValue::String(value.to_string()),
5079 )),
5080 }
5081 }
5082 }
5083
5084 impl serde::ser::Serialize for State {
5085 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5086 where
5087 S: serde::Serializer,
5088 {
5089 match self {
5090 Self::Unspecified => serializer.serialize_i32(0),
5091 Self::Provisioned => serializer.serialize_i32(1),
5092 Self::Creating => serializer.serialize_i32(2),
5093 Self::Updating => serializer.serialize_i32(3),
5094 Self::Deleting => serializer.serialize_i32(4),
5095 Self::UnknownValue(u) => u.0.serialize(serializer),
5096 }
5097 }
5098 }
5099
5100 impl<'de> serde::de::Deserialize<'de> for State {
5101 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5102 where
5103 D: serde::Deserializer<'de>,
5104 {
5105 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5106 ".google.cloud.baremetalsolution.v2.NfsShare.State",
5107 ))
5108 }
5109 }
5110
5111 /// The possible mount permissions.
5112 ///
5113 /// # Working with unknown values
5114 ///
5115 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5116 /// additional enum variants at any time. Adding new variants is not considered
5117 /// a breaking change. Applications should write their code in anticipation of:
5118 ///
5119 /// - New values appearing in future releases of the client library, **and**
5120 /// - New values received dynamically, without application changes.
5121 ///
5122 /// Please consult the [Working with enums] section in the user guide for some
5123 /// guidelines.
5124 ///
5125 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5126 #[derive(Clone, Debug, PartialEq)]
5127 #[non_exhaustive]
5128 pub enum MountPermissions {
5129 /// Permissions were not specified.
5130 Unspecified,
5131 /// NFS share can be mount with read-only permissions.
5132 Read,
5133 /// NFS share can be mount with read-write permissions.
5134 ReadWrite,
5135 /// If set, the enum was initialized with an unknown value.
5136 ///
5137 /// Applications can examine the value using [MountPermissions::value] or
5138 /// [MountPermissions::name].
5139 UnknownValue(mount_permissions::UnknownValue),
5140 }
5141
5142 #[doc(hidden)]
5143 pub mod mount_permissions {
5144 #[allow(unused_imports)]
5145 use super::*;
5146 #[derive(Clone, Debug, PartialEq)]
5147 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5148 }
5149
5150 impl MountPermissions {
5151 /// Gets the enum value.
5152 ///
5153 /// Returns `None` if the enum contains an unknown value deserialized from
5154 /// the string representation of enums.
5155 pub fn value(&self) -> std::option::Option<i32> {
5156 match self {
5157 Self::Unspecified => std::option::Option::Some(0),
5158 Self::Read => std::option::Option::Some(1),
5159 Self::ReadWrite => std::option::Option::Some(2),
5160 Self::UnknownValue(u) => u.0.value(),
5161 }
5162 }
5163
5164 /// Gets the enum value as a string.
5165 ///
5166 /// Returns `None` if the enum contains an unknown value deserialized from
5167 /// the integer representation of enums.
5168 pub fn name(&self) -> std::option::Option<&str> {
5169 match self {
5170 Self::Unspecified => std::option::Option::Some("MOUNT_PERMISSIONS_UNSPECIFIED"),
5171 Self::Read => std::option::Option::Some("READ"),
5172 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
5173 Self::UnknownValue(u) => u.0.name(),
5174 }
5175 }
5176 }
5177
5178 impl std::default::Default for MountPermissions {
5179 fn default() -> Self {
5180 use std::convert::From;
5181 Self::from(0)
5182 }
5183 }
5184
5185 impl std::fmt::Display for MountPermissions {
5186 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5187 wkt::internal::display_enum(f, self.name(), self.value())
5188 }
5189 }
5190
5191 impl std::convert::From<i32> for MountPermissions {
5192 fn from(value: i32) -> Self {
5193 match value {
5194 0 => Self::Unspecified,
5195 1 => Self::Read,
5196 2 => Self::ReadWrite,
5197 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5198 wkt::internal::UnknownEnumValue::Integer(value),
5199 )),
5200 }
5201 }
5202 }
5203
5204 impl std::convert::From<&str> for MountPermissions {
5205 fn from(value: &str) -> Self {
5206 use std::string::ToString;
5207 match value {
5208 "MOUNT_PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
5209 "READ" => Self::Read,
5210 "READ_WRITE" => Self::ReadWrite,
5211 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5212 wkt::internal::UnknownEnumValue::String(value.to_string()),
5213 )),
5214 }
5215 }
5216 }
5217
5218 impl serde::ser::Serialize for MountPermissions {
5219 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5220 where
5221 S: serde::Serializer,
5222 {
5223 match self {
5224 Self::Unspecified => serializer.serialize_i32(0),
5225 Self::Read => serializer.serialize_i32(1),
5226 Self::ReadWrite => serializer.serialize_i32(2),
5227 Self::UnknownValue(u) => u.0.serialize(serializer),
5228 }
5229 }
5230 }
5231
5232 impl<'de> serde::de::Deserialize<'de> for MountPermissions {
5233 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5234 where
5235 D: serde::Deserializer<'de>,
5236 {
5237 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MountPermissions>::new(
5238 ".google.cloud.baremetalsolution.v2.NfsShare.MountPermissions",
5239 ))
5240 }
5241 }
5242
5243 /// The storage type for a volume.
5244 ///
5245 /// # Working with unknown values
5246 ///
5247 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5248 /// additional enum variants at any time. Adding new variants is not considered
5249 /// a breaking change. Applications should write their code in anticipation of:
5250 ///
5251 /// - New values appearing in future releases of the client library, **and**
5252 /// - New values received dynamically, without application changes.
5253 ///
5254 /// Please consult the [Working with enums] section in the user guide for some
5255 /// guidelines.
5256 ///
5257 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5258 #[derive(Clone, Debug, PartialEq)]
5259 #[non_exhaustive]
5260 pub enum StorageType {
5261 /// The storage type for this volume is unknown.
5262 Unspecified,
5263 /// The storage type for this volume is SSD.
5264 Ssd,
5265 /// This storage type for this volume is HDD.
5266 Hdd,
5267 /// If set, the enum was initialized with an unknown value.
5268 ///
5269 /// Applications can examine the value using [StorageType::value] or
5270 /// [StorageType::name].
5271 UnknownValue(storage_type::UnknownValue),
5272 }
5273
5274 #[doc(hidden)]
5275 pub mod storage_type {
5276 #[allow(unused_imports)]
5277 use super::*;
5278 #[derive(Clone, Debug, PartialEq)]
5279 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5280 }
5281
5282 impl StorageType {
5283 /// Gets the enum value.
5284 ///
5285 /// Returns `None` if the enum contains an unknown value deserialized from
5286 /// the string representation of enums.
5287 pub fn value(&self) -> std::option::Option<i32> {
5288 match self {
5289 Self::Unspecified => std::option::Option::Some(0),
5290 Self::Ssd => std::option::Option::Some(1),
5291 Self::Hdd => std::option::Option::Some(2),
5292 Self::UnknownValue(u) => u.0.value(),
5293 }
5294 }
5295
5296 /// Gets the enum value as a string.
5297 ///
5298 /// Returns `None` if the enum contains an unknown value deserialized from
5299 /// the integer representation of enums.
5300 pub fn name(&self) -> std::option::Option<&str> {
5301 match self {
5302 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
5303 Self::Ssd => std::option::Option::Some("SSD"),
5304 Self::Hdd => std::option::Option::Some("HDD"),
5305 Self::UnknownValue(u) => u.0.name(),
5306 }
5307 }
5308 }
5309
5310 impl std::default::Default for StorageType {
5311 fn default() -> Self {
5312 use std::convert::From;
5313 Self::from(0)
5314 }
5315 }
5316
5317 impl std::fmt::Display for StorageType {
5318 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5319 wkt::internal::display_enum(f, self.name(), self.value())
5320 }
5321 }
5322
5323 impl std::convert::From<i32> for StorageType {
5324 fn from(value: i32) -> Self {
5325 match value {
5326 0 => Self::Unspecified,
5327 1 => Self::Ssd,
5328 2 => Self::Hdd,
5329 _ => Self::UnknownValue(storage_type::UnknownValue(
5330 wkt::internal::UnknownEnumValue::Integer(value),
5331 )),
5332 }
5333 }
5334 }
5335
5336 impl std::convert::From<&str> for StorageType {
5337 fn from(value: &str) -> Self {
5338 use std::string::ToString;
5339 match value {
5340 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
5341 "SSD" => Self::Ssd,
5342 "HDD" => Self::Hdd,
5343 _ => Self::UnknownValue(storage_type::UnknownValue(
5344 wkt::internal::UnknownEnumValue::String(value.to_string()),
5345 )),
5346 }
5347 }
5348 }
5349
5350 impl serde::ser::Serialize for StorageType {
5351 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5352 where
5353 S: serde::Serializer,
5354 {
5355 match self {
5356 Self::Unspecified => serializer.serialize_i32(0),
5357 Self::Ssd => serializer.serialize_i32(1),
5358 Self::Hdd => serializer.serialize_i32(2),
5359 Self::UnknownValue(u) => u.0.serialize(serializer),
5360 }
5361 }
5362 }
5363
5364 impl<'de> serde::de::Deserialize<'de> for StorageType {
5365 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5366 where
5367 D: serde::Deserializer<'de>,
5368 {
5369 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
5370 ".google.cloud.baremetalsolution.v2.NfsShare.StorageType",
5371 ))
5372 }
5373 }
5374}
5375
5376/// Message for requesting NFS share information.
5377#[derive(Clone, Default, PartialEq)]
5378#[non_exhaustive]
5379pub struct GetNfsShareRequest {
5380 /// Required. Name of the resource.
5381 pub name: std::string::String,
5382
5383 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5384}
5385
5386impl GetNfsShareRequest {
5387 /// Creates a new default instance.
5388 pub fn new() -> Self {
5389 std::default::Default::default()
5390 }
5391
5392 /// Sets the value of [name][crate::model::GetNfsShareRequest::name].
5393 ///
5394 /// # Example
5395 /// ```ignore,no_run
5396 /// # use google_cloud_baremetalsolution_v2::model::GetNfsShareRequest;
5397 /// let x = GetNfsShareRequest::new().set_name("example");
5398 /// ```
5399 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5400 self.name = v.into();
5401 self
5402 }
5403}
5404
5405impl wkt::message::Message for GetNfsShareRequest {
5406 fn typename() -> &'static str {
5407 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNfsShareRequest"
5408 }
5409}
5410
5411/// Message for requesting a list of NFS shares.
5412#[derive(Clone, Default, PartialEq)]
5413#[non_exhaustive]
5414pub struct ListNfsSharesRequest {
5415 /// Required. Parent value for ListNfsSharesRequest.
5416 pub parent: std::string::String,
5417
5418 /// Requested page size. The server might return fewer items than requested.
5419 /// If unspecified, server will pick an appropriate default.
5420 pub page_size: i32,
5421
5422 /// A token identifying a page of results from the server.
5423 pub page_token: std::string::String,
5424
5425 /// List filter.
5426 pub filter: std::string::String,
5427
5428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5429}
5430
5431impl ListNfsSharesRequest {
5432 /// Creates a new default instance.
5433 pub fn new() -> Self {
5434 std::default::Default::default()
5435 }
5436
5437 /// Sets the value of [parent][crate::model::ListNfsSharesRequest::parent].
5438 ///
5439 /// # Example
5440 /// ```ignore,no_run
5441 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5442 /// let x = ListNfsSharesRequest::new().set_parent("example");
5443 /// ```
5444 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5445 self.parent = v.into();
5446 self
5447 }
5448
5449 /// Sets the value of [page_size][crate::model::ListNfsSharesRequest::page_size].
5450 ///
5451 /// # Example
5452 /// ```ignore,no_run
5453 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5454 /// let x = ListNfsSharesRequest::new().set_page_size(42);
5455 /// ```
5456 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5457 self.page_size = v.into();
5458 self
5459 }
5460
5461 /// Sets the value of [page_token][crate::model::ListNfsSharesRequest::page_token].
5462 ///
5463 /// # Example
5464 /// ```ignore,no_run
5465 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5466 /// let x = ListNfsSharesRequest::new().set_page_token("example");
5467 /// ```
5468 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5469 self.page_token = v.into();
5470 self
5471 }
5472
5473 /// Sets the value of [filter][crate::model::ListNfsSharesRequest::filter].
5474 ///
5475 /// # Example
5476 /// ```ignore,no_run
5477 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5478 /// let x = ListNfsSharesRequest::new().set_filter("example");
5479 /// ```
5480 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5481 self.filter = v.into();
5482 self
5483 }
5484}
5485
5486impl wkt::message::Message for ListNfsSharesRequest {
5487 fn typename() -> &'static str {
5488 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesRequest"
5489 }
5490}
5491
5492/// Response message containing the list of NFS shares.
5493#[derive(Clone, Default, PartialEq)]
5494#[non_exhaustive]
5495pub struct ListNfsSharesResponse {
5496 /// The list of NFS shares.
5497 pub nfs_shares: std::vec::Vec<crate::model::NfsShare>,
5498
5499 /// A token identifying a page of results from the server.
5500 pub next_page_token: std::string::String,
5501
5502 /// Locations that could not be reached.
5503 pub unreachable: std::vec::Vec<std::string::String>,
5504
5505 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5506}
5507
5508impl ListNfsSharesResponse {
5509 /// Creates a new default instance.
5510 pub fn new() -> Self {
5511 std::default::Default::default()
5512 }
5513
5514 /// Sets the value of [nfs_shares][crate::model::ListNfsSharesResponse::nfs_shares].
5515 ///
5516 /// # Example
5517 /// ```ignore,no_run
5518 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5519 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5520 /// let x = ListNfsSharesResponse::new()
5521 /// .set_nfs_shares([
5522 /// NfsShare::default()/* use setters */,
5523 /// NfsShare::default()/* use (different) setters */,
5524 /// ]);
5525 /// ```
5526 pub fn set_nfs_shares<T, V>(mut self, v: T) -> Self
5527 where
5528 T: std::iter::IntoIterator<Item = V>,
5529 V: std::convert::Into<crate::model::NfsShare>,
5530 {
5531 use std::iter::Iterator;
5532 self.nfs_shares = v.into_iter().map(|i| i.into()).collect();
5533 self
5534 }
5535
5536 /// Sets the value of [next_page_token][crate::model::ListNfsSharesResponse::next_page_token].
5537 ///
5538 /// # Example
5539 /// ```ignore,no_run
5540 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5541 /// let x = ListNfsSharesResponse::new().set_next_page_token("example");
5542 /// ```
5543 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5544 self.next_page_token = v.into();
5545 self
5546 }
5547
5548 /// Sets the value of [unreachable][crate::model::ListNfsSharesResponse::unreachable].
5549 ///
5550 /// # Example
5551 /// ```ignore,no_run
5552 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5553 /// let x = ListNfsSharesResponse::new().set_unreachable(["a", "b", "c"]);
5554 /// ```
5555 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5556 where
5557 T: std::iter::IntoIterator<Item = V>,
5558 V: std::convert::Into<std::string::String>,
5559 {
5560 use std::iter::Iterator;
5561 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5562 self
5563 }
5564}
5565
5566impl wkt::message::Message for ListNfsSharesResponse {
5567 fn typename() -> &'static str {
5568 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesResponse"
5569 }
5570}
5571
5572#[doc(hidden)]
5573impl google_cloud_gax::paginator::internal::PageableResponse for ListNfsSharesResponse {
5574 type PageItem = crate::model::NfsShare;
5575
5576 fn items(self) -> std::vec::Vec<Self::PageItem> {
5577 self.nfs_shares
5578 }
5579
5580 fn next_page_token(&self) -> std::string::String {
5581 use std::clone::Clone;
5582 self.next_page_token.clone()
5583 }
5584}
5585
5586/// Message requesting to updating an NFS share.
5587#[derive(Clone, Default, PartialEq)]
5588#[non_exhaustive]
5589pub struct UpdateNfsShareRequest {
5590 /// Required. The NFS share to update.
5591 ///
5592 /// The `name` field is used to identify the NFS share to update.
5593 /// Format: projects/{project}/locations/{location}/nfsShares/{nfs_share}
5594 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5595
5596 /// The list of fields to update.
5597 /// The only currently supported fields are:
5598 /// `labels`
5599 /// `allowed_clients`
5600 pub update_mask: std::option::Option<wkt::FieldMask>,
5601
5602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5603}
5604
5605impl UpdateNfsShareRequest {
5606 /// Creates a new default instance.
5607 pub fn new() -> Self {
5608 std::default::Default::default()
5609 }
5610
5611 /// Sets the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5612 ///
5613 /// # Example
5614 /// ```ignore,no_run
5615 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5616 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5617 /// let x = UpdateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5618 /// ```
5619 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5620 where
5621 T: std::convert::Into<crate::model::NfsShare>,
5622 {
5623 self.nfs_share = std::option::Option::Some(v.into());
5624 self
5625 }
5626
5627 /// Sets or clears the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5628 ///
5629 /// # Example
5630 /// ```ignore,no_run
5631 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5632 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5633 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5634 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5635 /// ```
5636 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5637 where
5638 T: std::convert::Into<crate::model::NfsShare>,
5639 {
5640 self.nfs_share = v.map(|x| x.into());
5641 self
5642 }
5643
5644 /// Sets the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5645 ///
5646 /// # Example
5647 /// ```ignore,no_run
5648 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5649 /// use wkt::FieldMask;
5650 /// let x = UpdateNfsShareRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5651 /// ```
5652 pub fn set_update_mask<T>(mut self, v: T) -> Self
5653 where
5654 T: std::convert::Into<wkt::FieldMask>,
5655 {
5656 self.update_mask = std::option::Option::Some(v.into());
5657 self
5658 }
5659
5660 /// Sets or clears the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5661 ///
5662 /// # Example
5663 /// ```ignore,no_run
5664 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5665 /// use wkt::FieldMask;
5666 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5667 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5668 /// ```
5669 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5670 where
5671 T: std::convert::Into<wkt::FieldMask>,
5672 {
5673 self.update_mask = v.map(|x| x.into());
5674 self
5675 }
5676}
5677
5678impl wkt::message::Message for UpdateNfsShareRequest {
5679 fn typename() -> &'static str {
5680 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNfsShareRequest"
5681 }
5682}
5683
5684/// Message requesting rename of a server.
5685#[derive(Clone, Default, PartialEq)]
5686#[non_exhaustive]
5687pub struct RenameNfsShareRequest {
5688 /// Required. The `name` field is used to identify the nfsshare.
5689 /// Format: projects/{project}/locations/{location}/nfsshares/{nfsshare}
5690 pub name: std::string::String,
5691
5692 /// Required. The new `id` of the nfsshare.
5693 pub new_nfsshare_id: std::string::String,
5694
5695 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5696}
5697
5698impl RenameNfsShareRequest {
5699 /// Creates a new default instance.
5700 pub fn new() -> Self {
5701 std::default::Default::default()
5702 }
5703
5704 /// Sets the value of [name][crate::model::RenameNfsShareRequest::name].
5705 ///
5706 /// # Example
5707 /// ```ignore,no_run
5708 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5709 /// let x = RenameNfsShareRequest::new().set_name("example");
5710 /// ```
5711 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5712 self.name = v.into();
5713 self
5714 }
5715
5716 /// Sets the value of [new_nfsshare_id][crate::model::RenameNfsShareRequest::new_nfsshare_id].
5717 ///
5718 /// # Example
5719 /// ```ignore,no_run
5720 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5721 /// let x = RenameNfsShareRequest::new().set_new_nfsshare_id("example");
5722 /// ```
5723 pub fn set_new_nfsshare_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5724 self.new_nfsshare_id = v.into();
5725 self
5726 }
5727}
5728
5729impl wkt::message::Message for RenameNfsShareRequest {
5730 fn typename() -> &'static str {
5731 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNfsShareRequest"
5732 }
5733}
5734
5735/// Message for creating an NFS share.
5736#[derive(Clone, Default, PartialEq)]
5737#[non_exhaustive]
5738pub struct CreateNfsShareRequest {
5739 /// Required. The parent project and location.
5740 pub parent: std::string::String,
5741
5742 /// Required. The NfsShare to create.
5743 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5744
5745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5746}
5747
5748impl CreateNfsShareRequest {
5749 /// Creates a new default instance.
5750 pub fn new() -> Self {
5751 std::default::Default::default()
5752 }
5753
5754 /// Sets the value of [parent][crate::model::CreateNfsShareRequest::parent].
5755 ///
5756 /// # Example
5757 /// ```ignore,no_run
5758 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5759 /// let x = CreateNfsShareRequest::new().set_parent("example");
5760 /// ```
5761 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5762 self.parent = v.into();
5763 self
5764 }
5765
5766 /// Sets the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5767 ///
5768 /// # Example
5769 /// ```ignore,no_run
5770 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5771 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5772 /// let x = CreateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5773 /// ```
5774 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5775 where
5776 T: std::convert::Into<crate::model::NfsShare>,
5777 {
5778 self.nfs_share = std::option::Option::Some(v.into());
5779 self
5780 }
5781
5782 /// Sets or clears the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5783 ///
5784 /// # Example
5785 /// ```ignore,no_run
5786 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5787 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5788 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5789 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5790 /// ```
5791 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5792 where
5793 T: std::convert::Into<crate::model::NfsShare>,
5794 {
5795 self.nfs_share = v.map(|x| x.into());
5796 self
5797 }
5798}
5799
5800impl wkt::message::Message for CreateNfsShareRequest {
5801 fn typename() -> &'static str {
5802 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateNfsShareRequest"
5803 }
5804}
5805
5806/// Message for deleting an NFS share.
5807#[derive(Clone, Default, PartialEq)]
5808#[non_exhaustive]
5809pub struct DeleteNfsShareRequest {
5810 /// Required. The name of the NFS share to delete.
5811 pub name: std::string::String,
5812
5813 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5814}
5815
5816impl DeleteNfsShareRequest {
5817 /// Creates a new default instance.
5818 pub fn new() -> Self {
5819 std::default::Default::default()
5820 }
5821
5822 /// Sets the value of [name][crate::model::DeleteNfsShareRequest::name].
5823 ///
5824 /// # Example
5825 /// ```ignore,no_run
5826 /// # use google_cloud_baremetalsolution_v2::model::DeleteNfsShareRequest;
5827 /// let x = DeleteNfsShareRequest::new().set_name("example");
5828 /// ```
5829 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5830 self.name = v.into();
5831 self
5832 }
5833}
5834
5835impl wkt::message::Message for DeleteNfsShareRequest {
5836 fn typename() -> &'static str {
5837 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteNfsShareRequest"
5838 }
5839}
5840
5841/// Operation System image.
5842#[derive(Clone, Default, PartialEq)]
5843#[non_exhaustive]
5844pub struct OSImage {
5845 /// Output only. OS Image's unique name.
5846 pub name: std::string::String,
5847
5848 /// OS Image code.
5849 pub code: std::string::String,
5850
5851 /// OS Image description.
5852 pub description: std::string::String,
5853
5854 /// Instance types this image is applicable to.
5855 /// [Available
5856 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
5857 pub applicable_instance_types: std::vec::Vec<std::string::String>,
5858
5859 /// Network templates that can be used with this OS Image.
5860 pub supported_network_templates: std::vec::Vec<std::string::String>,
5861
5862 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5863}
5864
5865impl OSImage {
5866 /// Creates a new default instance.
5867 pub fn new() -> Self {
5868 std::default::Default::default()
5869 }
5870
5871 /// Sets the value of [name][crate::model::OSImage::name].
5872 ///
5873 /// # Example
5874 /// ```ignore,no_run
5875 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5876 /// let x = OSImage::new().set_name("example");
5877 /// ```
5878 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5879 self.name = v.into();
5880 self
5881 }
5882
5883 /// Sets the value of [code][crate::model::OSImage::code].
5884 ///
5885 /// # Example
5886 /// ```ignore,no_run
5887 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5888 /// let x = OSImage::new().set_code("example");
5889 /// ```
5890 pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5891 self.code = v.into();
5892 self
5893 }
5894
5895 /// Sets the value of [description][crate::model::OSImage::description].
5896 ///
5897 /// # Example
5898 /// ```ignore,no_run
5899 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5900 /// let x = OSImage::new().set_description("example");
5901 /// ```
5902 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5903 self.description = v.into();
5904 self
5905 }
5906
5907 /// Sets the value of [applicable_instance_types][crate::model::OSImage::applicable_instance_types].
5908 ///
5909 /// # Example
5910 /// ```ignore,no_run
5911 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5912 /// let x = OSImage::new().set_applicable_instance_types(["a", "b", "c"]);
5913 /// ```
5914 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
5915 where
5916 T: std::iter::IntoIterator<Item = V>,
5917 V: std::convert::Into<std::string::String>,
5918 {
5919 use std::iter::Iterator;
5920 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
5921 self
5922 }
5923
5924 /// Sets the value of [supported_network_templates][crate::model::OSImage::supported_network_templates].
5925 ///
5926 /// # Example
5927 /// ```ignore,no_run
5928 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5929 /// let x = OSImage::new().set_supported_network_templates(["a", "b", "c"]);
5930 /// ```
5931 pub fn set_supported_network_templates<T, V>(mut self, v: T) -> Self
5932 where
5933 T: std::iter::IntoIterator<Item = V>,
5934 V: std::convert::Into<std::string::String>,
5935 {
5936 use std::iter::Iterator;
5937 self.supported_network_templates = v.into_iter().map(|i| i.into()).collect();
5938 self
5939 }
5940}
5941
5942impl wkt::message::Message for OSImage {
5943 fn typename() -> &'static str {
5944 "type.googleapis.com/google.cloud.baremetalsolution.v2.OSImage"
5945 }
5946}
5947
5948/// Request for getting all available OS images.
5949#[derive(Clone, Default, PartialEq)]
5950#[non_exhaustive]
5951pub struct ListOSImagesRequest {
5952 /// Required. Parent value for ListProvisioningQuotasRequest.
5953 pub parent: std::string::String,
5954
5955 /// Requested page size. The server might return fewer items than requested.
5956 /// If unspecified, server will pick an appropriate default.
5957 /// Notice that page_size field is not supported and won't be respected in
5958 /// the API request for now, will be updated when pagination is supported.
5959 pub page_size: i32,
5960
5961 /// A token identifying a page of results from the server.
5962 pub page_token: std::string::String,
5963
5964 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5965}
5966
5967impl ListOSImagesRequest {
5968 /// Creates a new default instance.
5969 pub fn new() -> Self {
5970 std::default::Default::default()
5971 }
5972
5973 /// Sets the value of [parent][crate::model::ListOSImagesRequest::parent].
5974 ///
5975 /// # Example
5976 /// ```ignore,no_run
5977 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5978 /// let x = ListOSImagesRequest::new().set_parent("example");
5979 /// ```
5980 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5981 self.parent = v.into();
5982 self
5983 }
5984
5985 /// Sets the value of [page_size][crate::model::ListOSImagesRequest::page_size].
5986 ///
5987 /// # Example
5988 /// ```ignore,no_run
5989 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
5990 /// let x = ListOSImagesRequest::new().set_page_size(42);
5991 /// ```
5992 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5993 self.page_size = v.into();
5994 self
5995 }
5996
5997 /// Sets the value of [page_token][crate::model::ListOSImagesRequest::page_token].
5998 ///
5999 /// # Example
6000 /// ```ignore,no_run
6001 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
6002 /// let x = ListOSImagesRequest::new().set_page_token("example");
6003 /// ```
6004 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6005 self.page_token = v.into();
6006 self
6007 }
6008}
6009
6010impl wkt::message::Message for ListOSImagesRequest {
6011 fn typename() -> &'static str {
6012 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesRequest"
6013 }
6014}
6015
6016/// Request for getting all available OS images.
6017#[derive(Clone, Default, PartialEq)]
6018#[non_exhaustive]
6019pub struct ListOSImagesResponse {
6020 /// The OS images available.
6021 pub os_images: std::vec::Vec<crate::model::OSImage>,
6022
6023 /// Token to retrieve the next page of results, or empty if there are no more
6024 /// results in the list.
6025 pub next_page_token: std::string::String,
6026
6027 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6028}
6029
6030impl ListOSImagesResponse {
6031 /// Creates a new default instance.
6032 pub fn new() -> Self {
6033 std::default::Default::default()
6034 }
6035
6036 /// Sets the value of [os_images][crate::model::ListOSImagesResponse::os_images].
6037 ///
6038 /// # Example
6039 /// ```ignore,no_run
6040 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
6041 /// use google_cloud_baremetalsolution_v2::model::OSImage;
6042 /// let x = ListOSImagesResponse::new()
6043 /// .set_os_images([
6044 /// OSImage::default()/* use setters */,
6045 /// OSImage::default()/* use (different) setters */,
6046 /// ]);
6047 /// ```
6048 pub fn set_os_images<T, V>(mut self, v: T) -> Self
6049 where
6050 T: std::iter::IntoIterator<Item = V>,
6051 V: std::convert::Into<crate::model::OSImage>,
6052 {
6053 use std::iter::Iterator;
6054 self.os_images = v.into_iter().map(|i| i.into()).collect();
6055 self
6056 }
6057
6058 /// Sets the value of [next_page_token][crate::model::ListOSImagesResponse::next_page_token].
6059 ///
6060 /// # Example
6061 /// ```ignore,no_run
6062 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
6063 /// let x = ListOSImagesResponse::new().set_next_page_token("example");
6064 /// ```
6065 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6066 self.next_page_token = v.into();
6067 self
6068 }
6069}
6070
6071impl wkt::message::Message for ListOSImagesResponse {
6072 fn typename() -> &'static str {
6073 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesResponse"
6074 }
6075}
6076
6077#[doc(hidden)]
6078impl google_cloud_gax::paginator::internal::PageableResponse for ListOSImagesResponse {
6079 type PageItem = crate::model::OSImage;
6080
6081 fn items(self) -> std::vec::Vec<Self::PageItem> {
6082 self.os_images
6083 }
6084
6085 fn next_page_token(&self) -> std::string::String {
6086 use std::clone::Clone;
6087 self.next_page_token.clone()
6088 }
6089}
6090
6091/// A provisioning configuration.
6092#[derive(Clone, Default, PartialEq)]
6093#[non_exhaustive]
6094pub struct ProvisioningConfig {
6095 /// Output only. The system-generated name of the provisioning config. This
6096 /// follows the UUID format.
6097 pub name: std::string::String,
6098
6099 /// Instances to be created.
6100 pub instances: std::vec::Vec<crate::model::InstanceConfig>,
6101
6102 /// Networks to be created.
6103 pub networks: std::vec::Vec<crate::model::NetworkConfig>,
6104
6105 /// Volumes to be created.
6106 pub volumes: std::vec::Vec<crate::model::VolumeConfig>,
6107
6108 /// A generated ticket id to track provisioning request.
6109 pub ticket_id: std::string::String,
6110
6111 /// A service account to enable customers to access instance credentials upon
6112 /// handover.
6113 pub handover_service_account: std::string::String,
6114
6115 /// Email provided to send a confirmation with provisioning config to.
6116 /// Deprecated in favour of email field in request messages.
6117 #[deprecated]
6118 pub email: std::string::String,
6119
6120 /// Output only. State of ProvisioningConfig.
6121 pub state: crate::model::provisioning_config::State,
6122
6123 /// Optional. Location name of this ProvisioningConfig.
6124 /// It is optional only for Intake UI transition period.
6125 pub location: std::string::String,
6126
6127 /// Output only. Last update timestamp.
6128 pub update_time: std::option::Option<wkt::Timestamp>,
6129
6130 /// Output only. URI to Cloud Console UI view of this provisioning config.
6131 pub cloud_console_uri: std::string::String,
6132
6133 /// If true, VPC SC is enabled for the cluster.
6134 pub vpc_sc_enabled: bool,
6135
6136 /// Optional status messages associated with the FAILED state.
6137 pub status_message: std::string::String,
6138
6139 /// Optional. The user-defined identifier of the provisioning config.
6140 pub custom_id: std::string::String,
6141
6142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6143}
6144
6145impl ProvisioningConfig {
6146 /// Creates a new default instance.
6147 pub fn new() -> Self {
6148 std::default::Default::default()
6149 }
6150
6151 /// Sets the value of [name][crate::model::ProvisioningConfig::name].
6152 ///
6153 /// # Example
6154 /// ```ignore,no_run
6155 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6156 /// let x = ProvisioningConfig::new().set_name("example");
6157 /// ```
6158 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6159 self.name = v.into();
6160 self
6161 }
6162
6163 /// Sets the value of [instances][crate::model::ProvisioningConfig::instances].
6164 ///
6165 /// # Example
6166 /// ```ignore,no_run
6167 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6168 /// use google_cloud_baremetalsolution_v2::model::InstanceConfig;
6169 /// let x = ProvisioningConfig::new()
6170 /// .set_instances([
6171 /// InstanceConfig::default()/* use setters */,
6172 /// InstanceConfig::default()/* use (different) setters */,
6173 /// ]);
6174 /// ```
6175 pub fn set_instances<T, V>(mut self, v: T) -> Self
6176 where
6177 T: std::iter::IntoIterator<Item = V>,
6178 V: std::convert::Into<crate::model::InstanceConfig>,
6179 {
6180 use std::iter::Iterator;
6181 self.instances = v.into_iter().map(|i| i.into()).collect();
6182 self
6183 }
6184
6185 /// Sets the value of [networks][crate::model::ProvisioningConfig::networks].
6186 ///
6187 /// # Example
6188 /// ```ignore,no_run
6189 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6190 /// use google_cloud_baremetalsolution_v2::model::NetworkConfig;
6191 /// let x = ProvisioningConfig::new()
6192 /// .set_networks([
6193 /// NetworkConfig::default()/* use setters */,
6194 /// NetworkConfig::default()/* use (different) setters */,
6195 /// ]);
6196 /// ```
6197 pub fn set_networks<T, V>(mut self, v: T) -> Self
6198 where
6199 T: std::iter::IntoIterator<Item = V>,
6200 V: std::convert::Into<crate::model::NetworkConfig>,
6201 {
6202 use std::iter::Iterator;
6203 self.networks = v.into_iter().map(|i| i.into()).collect();
6204 self
6205 }
6206
6207 /// Sets the value of [volumes][crate::model::ProvisioningConfig::volumes].
6208 ///
6209 /// # Example
6210 /// ```ignore,no_run
6211 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6212 /// use google_cloud_baremetalsolution_v2::model::VolumeConfig;
6213 /// let x = ProvisioningConfig::new()
6214 /// .set_volumes([
6215 /// VolumeConfig::default()/* use setters */,
6216 /// VolumeConfig::default()/* use (different) setters */,
6217 /// ]);
6218 /// ```
6219 pub fn set_volumes<T, V>(mut self, v: T) -> Self
6220 where
6221 T: std::iter::IntoIterator<Item = V>,
6222 V: std::convert::Into<crate::model::VolumeConfig>,
6223 {
6224 use std::iter::Iterator;
6225 self.volumes = v.into_iter().map(|i| i.into()).collect();
6226 self
6227 }
6228
6229 /// Sets the value of [ticket_id][crate::model::ProvisioningConfig::ticket_id].
6230 ///
6231 /// # Example
6232 /// ```ignore,no_run
6233 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6234 /// let x = ProvisioningConfig::new().set_ticket_id("example");
6235 /// ```
6236 pub fn set_ticket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6237 self.ticket_id = v.into();
6238 self
6239 }
6240
6241 /// Sets the value of [handover_service_account][crate::model::ProvisioningConfig::handover_service_account].
6242 ///
6243 /// # Example
6244 /// ```ignore,no_run
6245 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6246 /// let x = ProvisioningConfig::new().set_handover_service_account("example");
6247 /// ```
6248 pub fn set_handover_service_account<T: std::convert::Into<std::string::String>>(
6249 mut self,
6250 v: T,
6251 ) -> Self {
6252 self.handover_service_account = v.into();
6253 self
6254 }
6255
6256 /// Sets the value of [email][crate::model::ProvisioningConfig::email].
6257 ///
6258 /// # Example
6259 /// ```ignore,no_run
6260 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6261 /// let x = ProvisioningConfig::new().set_email("example");
6262 /// ```
6263 #[deprecated]
6264 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6265 self.email = v.into();
6266 self
6267 }
6268
6269 /// Sets the value of [state][crate::model::ProvisioningConfig::state].
6270 ///
6271 /// # Example
6272 /// ```ignore,no_run
6273 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6274 /// use google_cloud_baremetalsolution_v2::model::provisioning_config::State;
6275 /// let x0 = ProvisioningConfig::new().set_state(State::Draft);
6276 /// let x1 = ProvisioningConfig::new().set_state(State::Submitted);
6277 /// let x2 = ProvisioningConfig::new().set_state(State::Provisioning);
6278 /// ```
6279 pub fn set_state<T: std::convert::Into<crate::model::provisioning_config::State>>(
6280 mut self,
6281 v: T,
6282 ) -> Self {
6283 self.state = v.into();
6284 self
6285 }
6286
6287 /// Sets the value of [location][crate::model::ProvisioningConfig::location].
6288 ///
6289 /// # Example
6290 /// ```ignore,no_run
6291 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6292 /// let x = ProvisioningConfig::new().set_location("example");
6293 /// ```
6294 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6295 self.location = v.into();
6296 self
6297 }
6298
6299 /// Sets the value of [update_time][crate::model::ProvisioningConfig::update_time].
6300 ///
6301 /// # Example
6302 /// ```ignore,no_run
6303 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6304 /// use wkt::Timestamp;
6305 /// let x = ProvisioningConfig::new().set_update_time(Timestamp::default()/* use setters */);
6306 /// ```
6307 pub fn set_update_time<T>(mut self, v: T) -> Self
6308 where
6309 T: std::convert::Into<wkt::Timestamp>,
6310 {
6311 self.update_time = std::option::Option::Some(v.into());
6312 self
6313 }
6314
6315 /// Sets or clears the value of [update_time][crate::model::ProvisioningConfig::update_time].
6316 ///
6317 /// # Example
6318 /// ```ignore,no_run
6319 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6320 /// use wkt::Timestamp;
6321 /// let x = ProvisioningConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6322 /// let x = ProvisioningConfig::new().set_or_clear_update_time(None::<Timestamp>);
6323 /// ```
6324 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6325 where
6326 T: std::convert::Into<wkt::Timestamp>,
6327 {
6328 self.update_time = v.map(|x| x.into());
6329 self
6330 }
6331
6332 /// Sets the value of [cloud_console_uri][crate::model::ProvisioningConfig::cloud_console_uri].
6333 ///
6334 /// # Example
6335 /// ```ignore,no_run
6336 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6337 /// let x = ProvisioningConfig::new().set_cloud_console_uri("example");
6338 /// ```
6339 pub fn set_cloud_console_uri<T: std::convert::Into<std::string::String>>(
6340 mut self,
6341 v: T,
6342 ) -> Self {
6343 self.cloud_console_uri = v.into();
6344 self
6345 }
6346
6347 /// Sets the value of [vpc_sc_enabled][crate::model::ProvisioningConfig::vpc_sc_enabled].
6348 ///
6349 /// # Example
6350 /// ```ignore,no_run
6351 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6352 /// let x = ProvisioningConfig::new().set_vpc_sc_enabled(true);
6353 /// ```
6354 pub fn set_vpc_sc_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6355 self.vpc_sc_enabled = v.into();
6356 self
6357 }
6358
6359 /// Sets the value of [status_message][crate::model::ProvisioningConfig::status_message].
6360 ///
6361 /// # Example
6362 /// ```ignore,no_run
6363 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6364 /// let x = ProvisioningConfig::new().set_status_message("example");
6365 /// ```
6366 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6367 self.status_message = v.into();
6368 self
6369 }
6370
6371 /// Sets the value of [custom_id][crate::model::ProvisioningConfig::custom_id].
6372 ///
6373 /// # Example
6374 /// ```ignore,no_run
6375 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6376 /// let x = ProvisioningConfig::new().set_custom_id("example");
6377 /// ```
6378 pub fn set_custom_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6379 self.custom_id = v.into();
6380 self
6381 }
6382}
6383
6384impl wkt::message::Message for ProvisioningConfig {
6385 fn typename() -> &'static str {
6386 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningConfig"
6387 }
6388}
6389
6390/// Defines additional types related to [ProvisioningConfig].
6391pub mod provisioning_config {
6392 #[allow(unused_imports)]
6393 use super::*;
6394
6395 /// The possible states for this ProvisioningConfig.
6396 ///
6397 /// # Working with unknown values
6398 ///
6399 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6400 /// additional enum variants at any time. Adding new variants is not considered
6401 /// a breaking change. Applications should write their code in anticipation of:
6402 ///
6403 /// - New values appearing in future releases of the client library, **and**
6404 /// - New values received dynamically, without application changes.
6405 ///
6406 /// Please consult the [Working with enums] section in the user guide for some
6407 /// guidelines.
6408 ///
6409 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6410 #[derive(Clone, Debug, PartialEq)]
6411 #[non_exhaustive]
6412 pub enum State {
6413 /// State wasn't specified.
6414 Unspecified,
6415 /// ProvisioningConfig is a draft and can be freely modified.
6416 Draft,
6417 /// ProvisioningConfig was already submitted and cannot be modified.
6418 Submitted,
6419 /// ProvisioningConfig was in the provisioning state. Initially this state
6420 /// comes from the work order table in big query when SNOW is used. Later
6421 /// this field can be set by the work order API.
6422 Provisioning,
6423 /// ProvisioningConfig was provisioned, meaning the resources exist.
6424 Provisioned,
6425 /// ProvisioningConfig was validated. A validation tool will be run to
6426 /// set this state.
6427 Validated,
6428 /// ProvisioningConfig was canceled.
6429 Cancelled,
6430 /// The request is submitted for provisioning, with error return.
6431 Failed,
6432 /// If set, the enum was initialized with an unknown value.
6433 ///
6434 /// Applications can examine the value using [State::value] or
6435 /// [State::name].
6436 UnknownValue(state::UnknownValue),
6437 }
6438
6439 #[doc(hidden)]
6440 pub mod state {
6441 #[allow(unused_imports)]
6442 use super::*;
6443 #[derive(Clone, Debug, PartialEq)]
6444 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6445 }
6446
6447 impl State {
6448 /// Gets the enum value.
6449 ///
6450 /// Returns `None` if the enum contains an unknown value deserialized from
6451 /// the string representation of enums.
6452 pub fn value(&self) -> std::option::Option<i32> {
6453 match self {
6454 Self::Unspecified => std::option::Option::Some(0),
6455 Self::Draft => std::option::Option::Some(1),
6456 Self::Submitted => std::option::Option::Some(2),
6457 Self::Provisioning => std::option::Option::Some(3),
6458 Self::Provisioned => std::option::Option::Some(4),
6459 Self::Validated => std::option::Option::Some(5),
6460 Self::Cancelled => std::option::Option::Some(6),
6461 Self::Failed => std::option::Option::Some(7),
6462 Self::UnknownValue(u) => u.0.value(),
6463 }
6464 }
6465
6466 /// Gets the enum value as a string.
6467 ///
6468 /// Returns `None` if the enum contains an unknown value deserialized from
6469 /// the integer representation of enums.
6470 pub fn name(&self) -> std::option::Option<&str> {
6471 match self {
6472 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6473 Self::Draft => std::option::Option::Some("DRAFT"),
6474 Self::Submitted => std::option::Option::Some("SUBMITTED"),
6475 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
6476 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
6477 Self::Validated => std::option::Option::Some("VALIDATED"),
6478 Self::Cancelled => std::option::Option::Some("CANCELLED"),
6479 Self::Failed => std::option::Option::Some("FAILED"),
6480 Self::UnknownValue(u) => u.0.name(),
6481 }
6482 }
6483 }
6484
6485 impl std::default::Default for State {
6486 fn default() -> Self {
6487 use std::convert::From;
6488 Self::from(0)
6489 }
6490 }
6491
6492 impl std::fmt::Display for State {
6493 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6494 wkt::internal::display_enum(f, self.name(), self.value())
6495 }
6496 }
6497
6498 impl std::convert::From<i32> for State {
6499 fn from(value: i32) -> Self {
6500 match value {
6501 0 => Self::Unspecified,
6502 1 => Self::Draft,
6503 2 => Self::Submitted,
6504 3 => Self::Provisioning,
6505 4 => Self::Provisioned,
6506 5 => Self::Validated,
6507 6 => Self::Cancelled,
6508 7 => Self::Failed,
6509 _ => Self::UnknownValue(state::UnknownValue(
6510 wkt::internal::UnknownEnumValue::Integer(value),
6511 )),
6512 }
6513 }
6514 }
6515
6516 impl std::convert::From<&str> for State {
6517 fn from(value: &str) -> Self {
6518 use std::string::ToString;
6519 match value {
6520 "STATE_UNSPECIFIED" => Self::Unspecified,
6521 "DRAFT" => Self::Draft,
6522 "SUBMITTED" => Self::Submitted,
6523 "PROVISIONING" => Self::Provisioning,
6524 "PROVISIONED" => Self::Provisioned,
6525 "VALIDATED" => Self::Validated,
6526 "CANCELLED" => Self::Cancelled,
6527 "FAILED" => Self::Failed,
6528 _ => Self::UnknownValue(state::UnknownValue(
6529 wkt::internal::UnknownEnumValue::String(value.to_string()),
6530 )),
6531 }
6532 }
6533 }
6534
6535 impl serde::ser::Serialize for State {
6536 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6537 where
6538 S: serde::Serializer,
6539 {
6540 match self {
6541 Self::Unspecified => serializer.serialize_i32(0),
6542 Self::Draft => serializer.serialize_i32(1),
6543 Self::Submitted => serializer.serialize_i32(2),
6544 Self::Provisioning => serializer.serialize_i32(3),
6545 Self::Provisioned => serializer.serialize_i32(4),
6546 Self::Validated => serializer.serialize_i32(5),
6547 Self::Cancelled => serializer.serialize_i32(6),
6548 Self::Failed => serializer.serialize_i32(7),
6549 Self::UnknownValue(u) => u.0.serialize(serializer),
6550 }
6551 }
6552 }
6553
6554 impl<'de> serde::de::Deserialize<'de> for State {
6555 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6556 where
6557 D: serde::Deserializer<'de>,
6558 {
6559 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6560 ".google.cloud.baremetalsolution.v2.ProvisioningConfig.State",
6561 ))
6562 }
6563 }
6564}
6565
6566/// Request for SubmitProvisioningConfig.
6567#[derive(Clone, Default, PartialEq)]
6568#[non_exhaustive]
6569pub struct SubmitProvisioningConfigRequest {
6570 /// Required. The parent project and location containing the
6571 /// ProvisioningConfig.
6572 pub parent: std::string::String,
6573
6574 /// Required. The ProvisioningConfig to create.
6575 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6576
6577 /// Optional. Email provided to send a confirmation with provisioning config
6578 /// to.
6579 pub email: std::string::String,
6580
6581 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6582}
6583
6584impl SubmitProvisioningConfigRequest {
6585 /// Creates a new default instance.
6586 pub fn new() -> Self {
6587 std::default::Default::default()
6588 }
6589
6590 /// Sets the value of [parent][crate::model::SubmitProvisioningConfigRequest::parent].
6591 ///
6592 /// # Example
6593 /// ```ignore,no_run
6594 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6595 /// let x = SubmitProvisioningConfigRequest::new().set_parent("example");
6596 /// ```
6597 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6598 self.parent = v.into();
6599 self
6600 }
6601
6602 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6603 ///
6604 /// # Example
6605 /// ```ignore,no_run
6606 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6607 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6608 /// let x = SubmitProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6609 /// ```
6610 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6611 where
6612 T: std::convert::Into<crate::model::ProvisioningConfig>,
6613 {
6614 self.provisioning_config = std::option::Option::Some(v.into());
6615 self
6616 }
6617
6618 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6619 ///
6620 /// # Example
6621 /// ```ignore,no_run
6622 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6623 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6624 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6625 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6626 /// ```
6627 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6628 where
6629 T: std::convert::Into<crate::model::ProvisioningConfig>,
6630 {
6631 self.provisioning_config = v.map(|x| x.into());
6632 self
6633 }
6634
6635 /// Sets the value of [email][crate::model::SubmitProvisioningConfigRequest::email].
6636 ///
6637 /// # Example
6638 /// ```ignore,no_run
6639 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6640 /// let x = SubmitProvisioningConfigRequest::new().set_email("example");
6641 /// ```
6642 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6643 self.email = v.into();
6644 self
6645 }
6646}
6647
6648impl wkt::message::Message for SubmitProvisioningConfigRequest {
6649 fn typename() -> &'static str {
6650 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigRequest"
6651 }
6652}
6653
6654/// Response for SubmitProvisioningConfig.
6655#[derive(Clone, Default, PartialEq)]
6656#[non_exhaustive]
6657pub struct SubmitProvisioningConfigResponse {
6658 /// The submitted provisioning config.
6659 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6660
6661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6662}
6663
6664impl SubmitProvisioningConfigResponse {
6665 /// Creates a new default instance.
6666 pub fn new() -> Self {
6667 std::default::Default::default()
6668 }
6669
6670 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6671 ///
6672 /// # Example
6673 /// ```ignore,no_run
6674 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6675 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6676 /// let x = SubmitProvisioningConfigResponse::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6677 /// ```
6678 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6679 where
6680 T: std::convert::Into<crate::model::ProvisioningConfig>,
6681 {
6682 self.provisioning_config = std::option::Option::Some(v.into());
6683 self
6684 }
6685
6686 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6687 ///
6688 /// # Example
6689 /// ```ignore,no_run
6690 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6691 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6692 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6693 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6694 /// ```
6695 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6696 where
6697 T: std::convert::Into<crate::model::ProvisioningConfig>,
6698 {
6699 self.provisioning_config = v.map(|x| x.into());
6700 self
6701 }
6702}
6703
6704impl wkt::message::Message for SubmitProvisioningConfigResponse {
6705 fn typename() -> &'static str {
6706 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigResponse"
6707 }
6708}
6709
6710/// A provisioning quota for a given project.
6711#[derive(Clone, Default, PartialEq)]
6712#[non_exhaustive]
6713pub struct ProvisioningQuota {
6714 /// Output only. The name of the provisioning quota.
6715 pub name: std::string::String,
6716
6717 /// The asset type of this provisioning quota.
6718 pub asset_type: crate::model::provisioning_quota::AssetType,
6719
6720 /// The gcp service of the provisioning quota.
6721 pub gcp_service: std::string::String,
6722
6723 /// The specific location of the provisioining quota.
6724 pub location: std::string::String,
6725
6726 /// The available count of the provisioning quota.
6727 pub available_count: i32,
6728
6729 /// The quota of one asset type.
6730 pub quota: std::option::Option<crate::model::provisioning_quota::Quota>,
6731
6732 /// Available quantity based on asset type.
6733 pub availability: std::option::Option<crate::model::provisioning_quota::Availability>,
6734
6735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6736}
6737
6738impl ProvisioningQuota {
6739 /// Creates a new default instance.
6740 pub fn new() -> Self {
6741 std::default::Default::default()
6742 }
6743
6744 /// Sets the value of [name][crate::model::ProvisioningQuota::name].
6745 ///
6746 /// # Example
6747 /// ```ignore,no_run
6748 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6749 /// let x = ProvisioningQuota::new().set_name("example");
6750 /// ```
6751 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6752 self.name = v.into();
6753 self
6754 }
6755
6756 /// Sets the value of [asset_type][crate::model::ProvisioningQuota::asset_type].
6757 ///
6758 /// # Example
6759 /// ```ignore,no_run
6760 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6761 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::AssetType;
6762 /// let x0 = ProvisioningQuota::new().set_asset_type(AssetType::Server);
6763 /// let x1 = ProvisioningQuota::new().set_asset_type(AssetType::Storage);
6764 /// let x2 = ProvisioningQuota::new().set_asset_type(AssetType::Network);
6765 /// ```
6766 pub fn set_asset_type<T: std::convert::Into<crate::model::provisioning_quota::AssetType>>(
6767 mut self,
6768 v: T,
6769 ) -> Self {
6770 self.asset_type = v.into();
6771 self
6772 }
6773
6774 /// Sets the value of [gcp_service][crate::model::ProvisioningQuota::gcp_service].
6775 ///
6776 /// # Example
6777 /// ```ignore,no_run
6778 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6779 /// let x = ProvisioningQuota::new().set_gcp_service("example");
6780 /// ```
6781 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6782 self.gcp_service = v.into();
6783 self
6784 }
6785
6786 /// Sets the value of [location][crate::model::ProvisioningQuota::location].
6787 ///
6788 /// # Example
6789 /// ```ignore,no_run
6790 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6791 /// let x = ProvisioningQuota::new().set_location("example");
6792 /// ```
6793 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6794 self.location = v.into();
6795 self
6796 }
6797
6798 /// Sets the value of [available_count][crate::model::ProvisioningQuota::available_count].
6799 ///
6800 /// # Example
6801 /// ```ignore,no_run
6802 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6803 /// let x = ProvisioningQuota::new().set_available_count(42);
6804 /// ```
6805 pub fn set_available_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6806 self.available_count = v.into();
6807 self
6808 }
6809
6810 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota].
6811 ///
6812 /// Note that all the setters affecting `quota` are mutually
6813 /// exclusive.
6814 ///
6815 /// # Example
6816 /// ```ignore,no_run
6817 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6818 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6819 /// let x = ProvisioningQuota::new().set_quota(Some(
6820 /// google_cloud_baremetalsolution_v2::model::provisioning_quota::Quota::InstanceQuota(InstanceQuota::default().into())));
6821 /// ```
6822 pub fn set_quota<
6823 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Quota>>,
6824 >(
6825 mut self,
6826 v: T,
6827 ) -> Self {
6828 self.quota = v.into();
6829 self
6830 }
6831
6832 /// The value of [quota][crate::model::ProvisioningQuota::quota]
6833 /// if it holds a `InstanceQuota`, `None` if the field is not set or
6834 /// holds a different branch.
6835 pub fn instance_quota(
6836 &self,
6837 ) -> std::option::Option<&std::boxed::Box<crate::model::InstanceQuota>> {
6838 #[allow(unreachable_patterns)]
6839 self.quota.as_ref().and_then(|v| match v {
6840 crate::model::provisioning_quota::Quota::InstanceQuota(v) => {
6841 std::option::Option::Some(v)
6842 }
6843 _ => std::option::Option::None,
6844 })
6845 }
6846
6847 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota]
6848 /// to hold a `InstanceQuota`.
6849 ///
6850 /// Note that all the setters affecting `quota` are
6851 /// mutually exclusive.
6852 ///
6853 /// # Example
6854 /// ```ignore,no_run
6855 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6856 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6857 /// let x = ProvisioningQuota::new().set_instance_quota(InstanceQuota::default()/* use setters */);
6858 /// assert!(x.instance_quota().is_some());
6859 /// ```
6860 pub fn set_instance_quota<
6861 T: std::convert::Into<std::boxed::Box<crate::model::InstanceQuota>>,
6862 >(
6863 mut self,
6864 v: T,
6865 ) -> Self {
6866 self.quota = std::option::Option::Some(
6867 crate::model::provisioning_quota::Quota::InstanceQuota(v.into()),
6868 );
6869 self
6870 }
6871
6872 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability].
6873 ///
6874 /// Note that all the setters affecting `availability` are mutually
6875 /// exclusive.
6876 ///
6877 /// # Example
6878 /// ```ignore,no_run
6879 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6880 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::Availability;
6881 /// let x = ProvisioningQuota::new().set_availability(Some(Availability::ServerCount(42)));
6882 /// ```
6883 pub fn set_availability<
6884 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Availability>>,
6885 >(
6886 mut self,
6887 v: T,
6888 ) -> Self {
6889 self.availability = v.into();
6890 self
6891 }
6892
6893 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6894 /// if it holds a `ServerCount`, `None` if the field is not set or
6895 /// holds a different branch.
6896 pub fn server_count(&self) -> std::option::Option<&i64> {
6897 #[allow(unreachable_patterns)]
6898 self.availability.as_ref().and_then(|v| match v {
6899 crate::model::provisioning_quota::Availability::ServerCount(v) => {
6900 std::option::Option::Some(v)
6901 }
6902 _ => std::option::Option::None,
6903 })
6904 }
6905
6906 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6907 /// to hold a `ServerCount`.
6908 ///
6909 /// Note that all the setters affecting `availability` are
6910 /// mutually exclusive.
6911 ///
6912 /// # Example
6913 /// ```ignore,no_run
6914 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6915 /// let x = ProvisioningQuota::new().set_server_count(42);
6916 /// assert!(x.server_count().is_some());
6917 /// assert!(x.network_bandwidth().is_none());
6918 /// assert!(x.storage_gib().is_none());
6919 /// ```
6920 pub fn set_server_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6921 self.availability = std::option::Option::Some(
6922 crate::model::provisioning_quota::Availability::ServerCount(v.into()),
6923 );
6924 self
6925 }
6926
6927 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6928 /// if it holds a `NetworkBandwidth`, `None` if the field is not set or
6929 /// holds a different branch.
6930 pub fn network_bandwidth(&self) -> std::option::Option<&i64> {
6931 #[allow(unreachable_patterns)]
6932 self.availability.as_ref().and_then(|v| match v {
6933 crate::model::provisioning_quota::Availability::NetworkBandwidth(v) => {
6934 std::option::Option::Some(v)
6935 }
6936 _ => std::option::Option::None,
6937 })
6938 }
6939
6940 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6941 /// to hold a `NetworkBandwidth`.
6942 ///
6943 /// Note that all the setters affecting `availability` are
6944 /// mutually exclusive.
6945 ///
6946 /// # Example
6947 /// ```ignore,no_run
6948 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6949 /// let x = ProvisioningQuota::new().set_network_bandwidth(42);
6950 /// assert!(x.network_bandwidth().is_some());
6951 /// assert!(x.server_count().is_none());
6952 /// assert!(x.storage_gib().is_none());
6953 /// ```
6954 pub fn set_network_bandwidth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6955 self.availability = std::option::Option::Some(
6956 crate::model::provisioning_quota::Availability::NetworkBandwidth(v.into()),
6957 );
6958 self
6959 }
6960
6961 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6962 /// if it holds a `StorageGib`, `None` if the field is not set or
6963 /// holds a different branch.
6964 pub fn storage_gib(&self) -> std::option::Option<&i64> {
6965 #[allow(unreachable_patterns)]
6966 self.availability.as_ref().and_then(|v| match v {
6967 crate::model::provisioning_quota::Availability::StorageGib(v) => {
6968 std::option::Option::Some(v)
6969 }
6970 _ => std::option::Option::None,
6971 })
6972 }
6973
6974 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6975 /// to hold a `StorageGib`.
6976 ///
6977 /// Note that all the setters affecting `availability` are
6978 /// mutually exclusive.
6979 ///
6980 /// # Example
6981 /// ```ignore,no_run
6982 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6983 /// let x = ProvisioningQuota::new().set_storage_gib(42);
6984 /// assert!(x.storage_gib().is_some());
6985 /// assert!(x.server_count().is_none());
6986 /// assert!(x.network_bandwidth().is_none());
6987 /// ```
6988 pub fn set_storage_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6989 self.availability = std::option::Option::Some(
6990 crate::model::provisioning_quota::Availability::StorageGib(v.into()),
6991 );
6992 self
6993 }
6994}
6995
6996impl wkt::message::Message for ProvisioningQuota {
6997 fn typename() -> &'static str {
6998 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningQuota"
6999 }
7000}
7001
7002/// Defines additional types related to [ProvisioningQuota].
7003pub mod provisioning_quota {
7004 #[allow(unused_imports)]
7005 use super::*;
7006
7007 /// The available asset types for intake.
7008 ///
7009 /// # Working with unknown values
7010 ///
7011 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7012 /// additional enum variants at any time. Adding new variants is not considered
7013 /// a breaking change. Applications should write their code in anticipation of:
7014 ///
7015 /// - New values appearing in future releases of the client library, **and**
7016 /// - New values received dynamically, without application changes.
7017 ///
7018 /// Please consult the [Working with enums] section in the user guide for some
7019 /// guidelines.
7020 ///
7021 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7022 #[derive(Clone, Debug, PartialEq)]
7023 #[non_exhaustive]
7024 pub enum AssetType {
7025 /// The unspecified type.
7026 Unspecified,
7027 /// The server asset type.
7028 Server,
7029 /// The storage asset type.
7030 Storage,
7031 /// The network asset type.
7032 Network,
7033 /// If set, the enum was initialized with an unknown value.
7034 ///
7035 /// Applications can examine the value using [AssetType::value] or
7036 /// [AssetType::name].
7037 UnknownValue(asset_type::UnknownValue),
7038 }
7039
7040 #[doc(hidden)]
7041 pub mod asset_type {
7042 #[allow(unused_imports)]
7043 use super::*;
7044 #[derive(Clone, Debug, PartialEq)]
7045 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7046 }
7047
7048 impl AssetType {
7049 /// Gets the enum value.
7050 ///
7051 /// Returns `None` if the enum contains an unknown value deserialized from
7052 /// the string representation of enums.
7053 pub fn value(&self) -> std::option::Option<i32> {
7054 match self {
7055 Self::Unspecified => std::option::Option::Some(0),
7056 Self::Server => std::option::Option::Some(1),
7057 Self::Storage => std::option::Option::Some(2),
7058 Self::Network => std::option::Option::Some(3),
7059 Self::UnknownValue(u) => u.0.value(),
7060 }
7061 }
7062
7063 /// Gets the enum value as a string.
7064 ///
7065 /// Returns `None` if the enum contains an unknown value deserialized from
7066 /// the integer representation of enums.
7067 pub fn name(&self) -> std::option::Option<&str> {
7068 match self {
7069 Self::Unspecified => std::option::Option::Some("ASSET_TYPE_UNSPECIFIED"),
7070 Self::Server => std::option::Option::Some("ASSET_TYPE_SERVER"),
7071 Self::Storage => std::option::Option::Some("ASSET_TYPE_STORAGE"),
7072 Self::Network => std::option::Option::Some("ASSET_TYPE_NETWORK"),
7073 Self::UnknownValue(u) => u.0.name(),
7074 }
7075 }
7076 }
7077
7078 impl std::default::Default for AssetType {
7079 fn default() -> Self {
7080 use std::convert::From;
7081 Self::from(0)
7082 }
7083 }
7084
7085 impl std::fmt::Display for AssetType {
7086 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7087 wkt::internal::display_enum(f, self.name(), self.value())
7088 }
7089 }
7090
7091 impl std::convert::From<i32> for AssetType {
7092 fn from(value: i32) -> Self {
7093 match value {
7094 0 => Self::Unspecified,
7095 1 => Self::Server,
7096 2 => Self::Storage,
7097 3 => Self::Network,
7098 _ => Self::UnknownValue(asset_type::UnknownValue(
7099 wkt::internal::UnknownEnumValue::Integer(value),
7100 )),
7101 }
7102 }
7103 }
7104
7105 impl std::convert::From<&str> for AssetType {
7106 fn from(value: &str) -> Self {
7107 use std::string::ToString;
7108 match value {
7109 "ASSET_TYPE_UNSPECIFIED" => Self::Unspecified,
7110 "ASSET_TYPE_SERVER" => Self::Server,
7111 "ASSET_TYPE_STORAGE" => Self::Storage,
7112 "ASSET_TYPE_NETWORK" => Self::Network,
7113 _ => Self::UnknownValue(asset_type::UnknownValue(
7114 wkt::internal::UnknownEnumValue::String(value.to_string()),
7115 )),
7116 }
7117 }
7118 }
7119
7120 impl serde::ser::Serialize for AssetType {
7121 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7122 where
7123 S: serde::Serializer,
7124 {
7125 match self {
7126 Self::Unspecified => serializer.serialize_i32(0),
7127 Self::Server => serializer.serialize_i32(1),
7128 Self::Storage => serializer.serialize_i32(2),
7129 Self::Network => serializer.serialize_i32(3),
7130 Self::UnknownValue(u) => u.0.serialize(serializer),
7131 }
7132 }
7133 }
7134
7135 impl<'de> serde::de::Deserialize<'de> for AssetType {
7136 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7137 where
7138 D: serde::Deserializer<'de>,
7139 {
7140 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AssetType>::new(
7141 ".google.cloud.baremetalsolution.v2.ProvisioningQuota.AssetType",
7142 ))
7143 }
7144 }
7145
7146 /// The quota of one asset type.
7147 #[derive(Clone, Debug, PartialEq)]
7148 #[non_exhaustive]
7149 pub enum Quota {
7150 /// Instance quota.
7151 InstanceQuota(std::boxed::Box<crate::model::InstanceQuota>),
7152 }
7153
7154 /// Available quantity based on asset type.
7155 #[derive(Clone, Debug, PartialEq)]
7156 #[non_exhaustive]
7157 pub enum Availability {
7158 /// Server count.
7159 ServerCount(i64),
7160 /// Network bandwidth, Gbps
7161 NetworkBandwidth(i64),
7162 /// Storage size (GB).
7163 StorageGib(i64),
7164 }
7165}
7166
7167/// Message for requesting the list of provisioning quotas.
7168#[derive(Clone, Default, PartialEq)]
7169#[non_exhaustive]
7170pub struct ListProvisioningQuotasRequest {
7171 /// Required. Parent value for ListProvisioningQuotasRequest.
7172 pub parent: std::string::String,
7173
7174 /// Requested page size. The server might return fewer items than requested.
7175 /// If unspecified, server will pick an appropriate default.
7176 /// Notice that page_size field is not supported and won't be respected in
7177 /// the API request for now, will be updated when pagination is supported.
7178 pub page_size: i32,
7179
7180 /// A token identifying a page of results from the server.
7181 pub page_token: std::string::String,
7182
7183 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7184}
7185
7186impl ListProvisioningQuotasRequest {
7187 /// Creates a new default instance.
7188 pub fn new() -> Self {
7189 std::default::Default::default()
7190 }
7191
7192 /// Sets the value of [parent][crate::model::ListProvisioningQuotasRequest::parent].
7193 ///
7194 /// # Example
7195 /// ```ignore,no_run
7196 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7197 /// let x = ListProvisioningQuotasRequest::new().set_parent("example");
7198 /// ```
7199 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7200 self.parent = v.into();
7201 self
7202 }
7203
7204 /// Sets the value of [page_size][crate::model::ListProvisioningQuotasRequest::page_size].
7205 ///
7206 /// # Example
7207 /// ```ignore,no_run
7208 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7209 /// let x = ListProvisioningQuotasRequest::new().set_page_size(42);
7210 /// ```
7211 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7212 self.page_size = v.into();
7213 self
7214 }
7215
7216 /// Sets the value of [page_token][crate::model::ListProvisioningQuotasRequest::page_token].
7217 ///
7218 /// # Example
7219 /// ```ignore,no_run
7220 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7221 /// let x = ListProvisioningQuotasRequest::new().set_page_token("example");
7222 /// ```
7223 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7224 self.page_token = v.into();
7225 self
7226 }
7227}
7228
7229impl wkt::message::Message for ListProvisioningQuotasRequest {
7230 fn typename() -> &'static str {
7231 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasRequest"
7232 }
7233}
7234
7235/// Response message for the list of provisioning quotas.
7236#[derive(Clone, Default, PartialEq)]
7237#[non_exhaustive]
7238pub struct ListProvisioningQuotasResponse {
7239 /// The provisioning quotas registered in this project.
7240 pub provisioning_quotas: std::vec::Vec<crate::model::ProvisioningQuota>,
7241
7242 /// Token to retrieve the next page of results, or empty if there are no more
7243 /// results in the list.
7244 pub next_page_token: std::string::String,
7245
7246 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7247}
7248
7249impl ListProvisioningQuotasResponse {
7250 /// Creates a new default instance.
7251 pub fn new() -> Self {
7252 std::default::Default::default()
7253 }
7254
7255 /// Sets the value of [provisioning_quotas][crate::model::ListProvisioningQuotasResponse::provisioning_quotas].
7256 ///
7257 /// # Example
7258 /// ```ignore,no_run
7259 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7260 /// use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7261 /// let x = ListProvisioningQuotasResponse::new()
7262 /// .set_provisioning_quotas([
7263 /// ProvisioningQuota::default()/* use setters */,
7264 /// ProvisioningQuota::default()/* use (different) setters */,
7265 /// ]);
7266 /// ```
7267 pub fn set_provisioning_quotas<T, V>(mut self, v: T) -> Self
7268 where
7269 T: std::iter::IntoIterator<Item = V>,
7270 V: std::convert::Into<crate::model::ProvisioningQuota>,
7271 {
7272 use std::iter::Iterator;
7273 self.provisioning_quotas = v.into_iter().map(|i| i.into()).collect();
7274 self
7275 }
7276
7277 /// Sets the value of [next_page_token][crate::model::ListProvisioningQuotasResponse::next_page_token].
7278 ///
7279 /// # Example
7280 /// ```ignore,no_run
7281 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7282 /// let x = ListProvisioningQuotasResponse::new().set_next_page_token("example");
7283 /// ```
7284 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7285 self.next_page_token = v.into();
7286 self
7287 }
7288}
7289
7290impl wkt::message::Message for ListProvisioningQuotasResponse {
7291 fn typename() -> &'static str {
7292 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasResponse"
7293 }
7294}
7295
7296#[doc(hidden)]
7297impl google_cloud_gax::paginator::internal::PageableResponse for ListProvisioningQuotasResponse {
7298 type PageItem = crate::model::ProvisioningQuota;
7299
7300 fn items(self) -> std::vec::Vec<Self::PageItem> {
7301 self.provisioning_quotas
7302 }
7303
7304 fn next_page_token(&self) -> std::string::String {
7305 use std::clone::Clone;
7306 self.next_page_token.clone()
7307 }
7308}
7309
7310/// Configuration parameters for a new instance.
7311#[derive(Clone, Default, PartialEq)]
7312#[non_exhaustive]
7313pub struct InstanceConfig {
7314 /// Output only. The name of the instance config.
7315 pub name: std::string::String,
7316
7317 /// A transient unique identifier to idenfity an instance within an
7318 /// ProvisioningConfig request.
7319 pub id: std::string::String,
7320
7321 /// Instance type.
7322 /// [Available
7323 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7324 pub instance_type: std::string::String,
7325
7326 /// Whether the instance should be provisioned with Hyperthreading enabled.
7327 pub hyperthreading: bool,
7328
7329 /// OS image to initialize the instance.
7330 /// [Available
7331 /// images](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7332 pub os_image: std::string::String,
7333
7334 /// Client network address. Filled if InstanceConfig.multivlan_config is false.
7335 #[deprecated]
7336 pub client_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7337
7338 /// Private network address, if any. Filled if InstanceConfig.multivlan_config
7339 /// is false.
7340 #[deprecated]
7341 pub private_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7342
7343 /// User note field, it can be used by customers to add additional information
7344 /// for the BMS Ops team .
7345 pub user_note: std::string::String,
7346
7347 /// If true networks can be from different projects of the same vendor account.
7348 pub account_networks_enabled: bool,
7349
7350 /// The type of network configuration on the instance.
7351 pub network_config: crate::model::instance_config::NetworkConfig,
7352
7353 /// Server network template name. Filled if InstanceConfig.multivlan_config is
7354 /// true.
7355 pub network_template: std::string::String,
7356
7357 /// List of logical interfaces for the instance. The number of logical
7358 /// interfaces will be the same as number of hardware bond/nic on the chosen
7359 /// network template. Filled if InstanceConfig.multivlan_config is true.
7360 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
7361
7362 /// List of names of ssh keys used to provision the instance.
7363 pub ssh_key_names: std::vec::Vec<std::string::String>,
7364
7365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7366}
7367
7368impl InstanceConfig {
7369 /// Creates a new default instance.
7370 pub fn new() -> Self {
7371 std::default::Default::default()
7372 }
7373
7374 /// Sets the value of [name][crate::model::InstanceConfig::name].
7375 ///
7376 /// # Example
7377 /// ```ignore,no_run
7378 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7379 /// let x = InstanceConfig::new().set_name("example");
7380 /// ```
7381 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7382 self.name = v.into();
7383 self
7384 }
7385
7386 /// Sets the value of [id][crate::model::InstanceConfig::id].
7387 ///
7388 /// # Example
7389 /// ```ignore,no_run
7390 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7391 /// let x = InstanceConfig::new().set_id("example");
7392 /// ```
7393 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7394 self.id = v.into();
7395 self
7396 }
7397
7398 /// Sets the value of [instance_type][crate::model::InstanceConfig::instance_type].
7399 ///
7400 /// # Example
7401 /// ```ignore,no_run
7402 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7403 /// let x = InstanceConfig::new().set_instance_type("example");
7404 /// ```
7405 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7406 self.instance_type = v.into();
7407 self
7408 }
7409
7410 /// Sets the value of [hyperthreading][crate::model::InstanceConfig::hyperthreading].
7411 ///
7412 /// # Example
7413 /// ```ignore,no_run
7414 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7415 /// let x = InstanceConfig::new().set_hyperthreading(true);
7416 /// ```
7417 pub fn set_hyperthreading<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7418 self.hyperthreading = v.into();
7419 self
7420 }
7421
7422 /// Sets the value of [os_image][crate::model::InstanceConfig::os_image].
7423 ///
7424 /// # Example
7425 /// ```ignore,no_run
7426 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7427 /// let x = InstanceConfig::new().set_os_image("example");
7428 /// ```
7429 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7430 self.os_image = v.into();
7431 self
7432 }
7433
7434 /// Sets the value of [client_network][crate::model::InstanceConfig::client_network].
7435 ///
7436 /// # Example
7437 /// ```ignore,no_run
7438 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7439 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7440 /// let x = InstanceConfig::new().set_client_network(NetworkAddress::default()/* use setters */);
7441 /// ```
7442 #[deprecated]
7443 pub fn set_client_network<T>(mut self, v: T) -> Self
7444 where
7445 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7446 {
7447 self.client_network = std::option::Option::Some(v.into());
7448 self
7449 }
7450
7451 /// Sets or clears the value of [client_network][crate::model::InstanceConfig::client_network].
7452 ///
7453 /// # Example
7454 /// ```ignore,no_run
7455 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7456 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7457 /// let x = InstanceConfig::new().set_or_clear_client_network(Some(NetworkAddress::default()/* use setters */));
7458 /// let x = InstanceConfig::new().set_or_clear_client_network(None::<NetworkAddress>);
7459 /// ```
7460 #[deprecated]
7461 pub fn set_or_clear_client_network<T>(mut self, v: std::option::Option<T>) -> Self
7462 where
7463 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7464 {
7465 self.client_network = v.map(|x| x.into());
7466 self
7467 }
7468
7469 /// Sets the value of [private_network][crate::model::InstanceConfig::private_network].
7470 ///
7471 /// # Example
7472 /// ```ignore,no_run
7473 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7474 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7475 /// let x = InstanceConfig::new().set_private_network(NetworkAddress::default()/* use setters */);
7476 /// ```
7477 #[deprecated]
7478 pub fn set_private_network<T>(mut self, v: T) -> Self
7479 where
7480 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7481 {
7482 self.private_network = std::option::Option::Some(v.into());
7483 self
7484 }
7485
7486 /// Sets or clears the value of [private_network][crate::model::InstanceConfig::private_network].
7487 ///
7488 /// # Example
7489 /// ```ignore,no_run
7490 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7491 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7492 /// let x = InstanceConfig::new().set_or_clear_private_network(Some(NetworkAddress::default()/* use setters */));
7493 /// let x = InstanceConfig::new().set_or_clear_private_network(None::<NetworkAddress>);
7494 /// ```
7495 #[deprecated]
7496 pub fn set_or_clear_private_network<T>(mut self, v: std::option::Option<T>) -> Self
7497 where
7498 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7499 {
7500 self.private_network = v.map(|x| x.into());
7501 self
7502 }
7503
7504 /// Sets the value of [user_note][crate::model::InstanceConfig::user_note].
7505 ///
7506 /// # Example
7507 /// ```ignore,no_run
7508 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7509 /// let x = InstanceConfig::new().set_user_note("example");
7510 /// ```
7511 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7512 self.user_note = v.into();
7513 self
7514 }
7515
7516 /// Sets the value of [account_networks_enabled][crate::model::InstanceConfig::account_networks_enabled].
7517 ///
7518 /// # Example
7519 /// ```ignore,no_run
7520 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7521 /// let x = InstanceConfig::new().set_account_networks_enabled(true);
7522 /// ```
7523 pub fn set_account_networks_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7524 self.account_networks_enabled = v.into();
7525 self
7526 }
7527
7528 /// Sets the value of [network_config][crate::model::InstanceConfig::network_config].
7529 ///
7530 /// # Example
7531 /// ```ignore,no_run
7532 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7533 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkConfig;
7534 /// let x0 = InstanceConfig::new().set_network_config(NetworkConfig::SingleVlan);
7535 /// let x1 = InstanceConfig::new().set_network_config(NetworkConfig::MultiVlan);
7536 /// ```
7537 pub fn set_network_config<
7538 T: std::convert::Into<crate::model::instance_config::NetworkConfig>,
7539 >(
7540 mut self,
7541 v: T,
7542 ) -> Self {
7543 self.network_config = v.into();
7544 self
7545 }
7546
7547 /// Sets the value of [network_template][crate::model::InstanceConfig::network_template].
7548 ///
7549 /// # Example
7550 /// ```ignore,no_run
7551 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7552 /// let x = InstanceConfig::new().set_network_template("example");
7553 /// ```
7554 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
7555 mut self,
7556 v: T,
7557 ) -> Self {
7558 self.network_template = v.into();
7559 self
7560 }
7561
7562 /// Sets the value of [logical_interfaces][crate::model::InstanceConfig::logical_interfaces].
7563 ///
7564 /// # Example
7565 /// ```ignore,no_run
7566 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7567 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
7568 /// let x = InstanceConfig::new()
7569 /// .set_logical_interfaces([
7570 /// LogicalInterface::default()/* use setters */,
7571 /// LogicalInterface::default()/* use (different) setters */,
7572 /// ]);
7573 /// ```
7574 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
7575 where
7576 T: std::iter::IntoIterator<Item = V>,
7577 V: std::convert::Into<crate::model::LogicalInterface>,
7578 {
7579 use std::iter::Iterator;
7580 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
7581 self
7582 }
7583
7584 /// Sets the value of [ssh_key_names][crate::model::InstanceConfig::ssh_key_names].
7585 ///
7586 /// # Example
7587 /// ```ignore,no_run
7588 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7589 /// let x = InstanceConfig::new().set_ssh_key_names(["a", "b", "c"]);
7590 /// ```
7591 pub fn set_ssh_key_names<T, V>(mut self, v: T) -> Self
7592 where
7593 T: std::iter::IntoIterator<Item = V>,
7594 V: std::convert::Into<std::string::String>,
7595 {
7596 use std::iter::Iterator;
7597 self.ssh_key_names = v.into_iter().map(|i| i.into()).collect();
7598 self
7599 }
7600}
7601
7602impl wkt::message::Message for InstanceConfig {
7603 fn typename() -> &'static str {
7604 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig"
7605 }
7606}
7607
7608/// Defines additional types related to [InstanceConfig].
7609pub mod instance_config {
7610 #[allow(unused_imports)]
7611 use super::*;
7612
7613 /// A network.
7614 #[derive(Clone, Default, PartialEq)]
7615 #[non_exhaustive]
7616 pub struct NetworkAddress {
7617 /// Id of the network to use, within the same ProvisioningConfig request.
7618 pub network_id: std::string::String,
7619
7620 /// IPv4 address to be assigned to the server.
7621 pub address: std::string::String,
7622
7623 /// Name of the existing network to use.
7624 pub existing_network_id: std::string::String,
7625
7626 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7627 }
7628
7629 impl NetworkAddress {
7630 /// Creates a new default instance.
7631 pub fn new() -> Self {
7632 std::default::Default::default()
7633 }
7634
7635 /// Sets the value of [network_id][crate::model::instance_config::NetworkAddress::network_id].
7636 ///
7637 /// # Example
7638 /// ```ignore,no_run
7639 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7640 /// let x = NetworkAddress::new().set_network_id("example");
7641 /// ```
7642 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7643 self.network_id = v.into();
7644 self
7645 }
7646
7647 /// Sets the value of [address][crate::model::instance_config::NetworkAddress::address].
7648 ///
7649 /// # Example
7650 /// ```ignore,no_run
7651 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7652 /// let x = NetworkAddress::new().set_address("example");
7653 /// ```
7654 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7655 self.address = v.into();
7656 self
7657 }
7658
7659 /// Sets the value of [existing_network_id][crate::model::instance_config::NetworkAddress::existing_network_id].
7660 ///
7661 /// # Example
7662 /// ```ignore,no_run
7663 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7664 /// let x = NetworkAddress::new().set_existing_network_id("example");
7665 /// ```
7666 pub fn set_existing_network_id<T: std::convert::Into<std::string::String>>(
7667 mut self,
7668 v: T,
7669 ) -> Self {
7670 self.existing_network_id = v.into();
7671 self
7672 }
7673 }
7674
7675 impl wkt::message::Message for NetworkAddress {
7676 fn typename() -> &'static str {
7677 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig.NetworkAddress"
7678 }
7679 }
7680
7681 /// The network configuration of the instance.
7682 ///
7683 /// # Working with unknown values
7684 ///
7685 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7686 /// additional enum variants at any time. Adding new variants is not considered
7687 /// a breaking change. Applications should write their code in anticipation of:
7688 ///
7689 /// - New values appearing in future releases of the client library, **and**
7690 /// - New values received dynamically, without application changes.
7691 ///
7692 /// Please consult the [Working with enums] section in the user guide for some
7693 /// guidelines.
7694 ///
7695 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7696 #[derive(Clone, Debug, PartialEq)]
7697 #[non_exhaustive]
7698 pub enum NetworkConfig {
7699 /// The unspecified network configuration.
7700 NetworkconfigUnspecified,
7701 /// Instance part of single client network and single private network.
7702 SingleVlan,
7703 /// Instance part of multiple (or single) client networks and private
7704 /// networks.
7705 MultiVlan,
7706 /// If set, the enum was initialized with an unknown value.
7707 ///
7708 /// Applications can examine the value using [NetworkConfig::value] or
7709 /// [NetworkConfig::name].
7710 UnknownValue(network_config::UnknownValue),
7711 }
7712
7713 #[doc(hidden)]
7714 pub mod network_config {
7715 #[allow(unused_imports)]
7716 use super::*;
7717 #[derive(Clone, Debug, PartialEq)]
7718 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7719 }
7720
7721 impl NetworkConfig {
7722 /// Gets the enum value.
7723 ///
7724 /// Returns `None` if the enum contains an unknown value deserialized from
7725 /// the string representation of enums.
7726 pub fn value(&self) -> std::option::Option<i32> {
7727 match self {
7728 Self::NetworkconfigUnspecified => std::option::Option::Some(0),
7729 Self::SingleVlan => std::option::Option::Some(1),
7730 Self::MultiVlan => std::option::Option::Some(2),
7731 Self::UnknownValue(u) => u.0.value(),
7732 }
7733 }
7734
7735 /// Gets the enum value as a string.
7736 ///
7737 /// Returns `None` if the enum contains an unknown value deserialized from
7738 /// the integer representation of enums.
7739 pub fn name(&self) -> std::option::Option<&str> {
7740 match self {
7741 Self::NetworkconfigUnspecified => {
7742 std::option::Option::Some("NETWORKCONFIG_UNSPECIFIED")
7743 }
7744 Self::SingleVlan => std::option::Option::Some("SINGLE_VLAN"),
7745 Self::MultiVlan => std::option::Option::Some("MULTI_VLAN"),
7746 Self::UnknownValue(u) => u.0.name(),
7747 }
7748 }
7749 }
7750
7751 impl std::default::Default for NetworkConfig {
7752 fn default() -> Self {
7753 use std::convert::From;
7754 Self::from(0)
7755 }
7756 }
7757
7758 impl std::fmt::Display for NetworkConfig {
7759 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7760 wkt::internal::display_enum(f, self.name(), self.value())
7761 }
7762 }
7763
7764 impl std::convert::From<i32> for NetworkConfig {
7765 fn from(value: i32) -> Self {
7766 match value {
7767 0 => Self::NetworkconfigUnspecified,
7768 1 => Self::SingleVlan,
7769 2 => Self::MultiVlan,
7770 _ => Self::UnknownValue(network_config::UnknownValue(
7771 wkt::internal::UnknownEnumValue::Integer(value),
7772 )),
7773 }
7774 }
7775 }
7776
7777 impl std::convert::From<&str> for NetworkConfig {
7778 fn from(value: &str) -> Self {
7779 use std::string::ToString;
7780 match value {
7781 "NETWORKCONFIG_UNSPECIFIED" => Self::NetworkconfigUnspecified,
7782 "SINGLE_VLAN" => Self::SingleVlan,
7783 "MULTI_VLAN" => Self::MultiVlan,
7784 _ => Self::UnknownValue(network_config::UnknownValue(
7785 wkt::internal::UnknownEnumValue::String(value.to_string()),
7786 )),
7787 }
7788 }
7789 }
7790
7791 impl serde::ser::Serialize for NetworkConfig {
7792 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7793 where
7794 S: serde::Serializer,
7795 {
7796 match self {
7797 Self::NetworkconfigUnspecified => serializer.serialize_i32(0),
7798 Self::SingleVlan => serializer.serialize_i32(1),
7799 Self::MultiVlan => serializer.serialize_i32(2),
7800 Self::UnknownValue(u) => u.0.serialize(serializer),
7801 }
7802 }
7803 }
7804
7805 impl<'de> serde::de::Deserialize<'de> for NetworkConfig {
7806 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7807 where
7808 D: serde::Deserializer<'de>,
7809 {
7810 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NetworkConfig>::new(
7811 ".google.cloud.baremetalsolution.v2.InstanceConfig.NetworkConfig",
7812 ))
7813 }
7814 }
7815}
7816
7817/// Configuration parameters for a new volume.
7818#[derive(Clone, Default, PartialEq)]
7819#[non_exhaustive]
7820pub struct VolumeConfig {
7821 /// Output only. The name of the volume config.
7822 pub name: std::string::String,
7823
7824 /// A transient unique identifier to identify a volume within an
7825 /// ProvisioningConfig request.
7826 pub id: std::string::String,
7827
7828 /// Whether snapshots should be enabled.
7829 pub snapshots_enabled: bool,
7830
7831 /// The type of this Volume.
7832 pub r#type: crate::model::volume_config::Type,
7833
7834 /// Volume protocol.
7835 pub protocol: crate::model::volume_config::Protocol,
7836
7837 /// The requested size of this volume, in GB.
7838 pub size_gb: i32,
7839
7840 /// LUN ranges to be configured. Set only when protocol is PROTOCOL_FC.
7841 pub lun_ranges: std::vec::Vec<crate::model::volume_config::LunRange>,
7842
7843 /// Machine ids connected to this volume. Set only when protocol is
7844 /// PROTOCOL_FC.
7845 pub machine_ids: std::vec::Vec<std::string::String>,
7846
7847 /// NFS exports. Set only when protocol is PROTOCOL_NFS.
7848 pub nfs_exports: std::vec::Vec<crate::model::volume_config::NfsExport>,
7849
7850 /// User note field, it can be used by customers to add additional information
7851 /// for the BMS Ops team .
7852 pub user_note: std::string::String,
7853
7854 /// The GCP service of the storage volume. Available gcp_service are in
7855 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
7856 pub gcp_service: std::string::String,
7857
7858 /// Performance tier of the Volume.
7859 /// Default is SHARED.
7860 pub performance_tier: crate::model::VolumePerformanceTier,
7861
7862 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7863}
7864
7865impl VolumeConfig {
7866 /// Creates a new default instance.
7867 pub fn new() -> Self {
7868 std::default::Default::default()
7869 }
7870
7871 /// Sets the value of [name][crate::model::VolumeConfig::name].
7872 ///
7873 /// # Example
7874 /// ```ignore,no_run
7875 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7876 /// let x = VolumeConfig::new().set_name("example");
7877 /// ```
7878 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7879 self.name = v.into();
7880 self
7881 }
7882
7883 /// Sets the value of [id][crate::model::VolumeConfig::id].
7884 ///
7885 /// # Example
7886 /// ```ignore,no_run
7887 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7888 /// let x = VolumeConfig::new().set_id("example");
7889 /// ```
7890 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7891 self.id = v.into();
7892 self
7893 }
7894
7895 /// Sets the value of [snapshots_enabled][crate::model::VolumeConfig::snapshots_enabled].
7896 ///
7897 /// # Example
7898 /// ```ignore,no_run
7899 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7900 /// let x = VolumeConfig::new().set_snapshots_enabled(true);
7901 /// ```
7902 pub fn set_snapshots_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7903 self.snapshots_enabled = v.into();
7904 self
7905 }
7906
7907 /// Sets the value of [r#type][crate::model::VolumeConfig::type].
7908 ///
7909 /// # Example
7910 /// ```ignore,no_run
7911 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7912 /// use google_cloud_baremetalsolution_v2::model::volume_config::Type;
7913 /// let x0 = VolumeConfig::new().set_type(Type::Flash);
7914 /// let x1 = VolumeConfig::new().set_type(Type::Disk);
7915 /// ```
7916 pub fn set_type<T: std::convert::Into<crate::model::volume_config::Type>>(
7917 mut self,
7918 v: T,
7919 ) -> Self {
7920 self.r#type = v.into();
7921 self
7922 }
7923
7924 /// Sets the value of [protocol][crate::model::VolumeConfig::protocol].
7925 ///
7926 /// # Example
7927 /// ```ignore,no_run
7928 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7929 /// use google_cloud_baremetalsolution_v2::model::volume_config::Protocol;
7930 /// let x0 = VolumeConfig::new().set_protocol(Protocol::Fc);
7931 /// let x1 = VolumeConfig::new().set_protocol(Protocol::Nfs);
7932 /// ```
7933 pub fn set_protocol<T: std::convert::Into<crate::model::volume_config::Protocol>>(
7934 mut self,
7935 v: T,
7936 ) -> Self {
7937 self.protocol = v.into();
7938 self
7939 }
7940
7941 /// Sets the value of [size_gb][crate::model::VolumeConfig::size_gb].
7942 ///
7943 /// # Example
7944 /// ```ignore,no_run
7945 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7946 /// let x = VolumeConfig::new().set_size_gb(42);
7947 /// ```
7948 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7949 self.size_gb = v.into();
7950 self
7951 }
7952
7953 /// Sets the value of [lun_ranges][crate::model::VolumeConfig::lun_ranges].
7954 ///
7955 /// # Example
7956 /// ```ignore,no_run
7957 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7958 /// use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
7959 /// let x = VolumeConfig::new()
7960 /// .set_lun_ranges([
7961 /// LunRange::default()/* use setters */,
7962 /// LunRange::default()/* use (different) setters */,
7963 /// ]);
7964 /// ```
7965 pub fn set_lun_ranges<T, V>(mut self, v: T) -> Self
7966 where
7967 T: std::iter::IntoIterator<Item = V>,
7968 V: std::convert::Into<crate::model::volume_config::LunRange>,
7969 {
7970 use std::iter::Iterator;
7971 self.lun_ranges = v.into_iter().map(|i| i.into()).collect();
7972 self
7973 }
7974
7975 /// Sets the value of [machine_ids][crate::model::VolumeConfig::machine_ids].
7976 ///
7977 /// # Example
7978 /// ```ignore,no_run
7979 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7980 /// let x = VolumeConfig::new().set_machine_ids(["a", "b", "c"]);
7981 /// ```
7982 pub fn set_machine_ids<T, V>(mut self, v: T) -> Self
7983 where
7984 T: std::iter::IntoIterator<Item = V>,
7985 V: std::convert::Into<std::string::String>,
7986 {
7987 use std::iter::Iterator;
7988 self.machine_ids = v.into_iter().map(|i| i.into()).collect();
7989 self
7990 }
7991
7992 /// Sets the value of [nfs_exports][crate::model::VolumeConfig::nfs_exports].
7993 ///
7994 /// # Example
7995 /// ```ignore,no_run
7996 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7997 /// use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
7998 /// let x = VolumeConfig::new()
7999 /// .set_nfs_exports([
8000 /// NfsExport::default()/* use setters */,
8001 /// NfsExport::default()/* use (different) setters */,
8002 /// ]);
8003 /// ```
8004 pub fn set_nfs_exports<T, V>(mut self, v: T) -> Self
8005 where
8006 T: std::iter::IntoIterator<Item = V>,
8007 V: std::convert::Into<crate::model::volume_config::NfsExport>,
8008 {
8009 use std::iter::Iterator;
8010 self.nfs_exports = v.into_iter().map(|i| i.into()).collect();
8011 self
8012 }
8013
8014 /// Sets the value of [user_note][crate::model::VolumeConfig::user_note].
8015 ///
8016 /// # Example
8017 /// ```ignore,no_run
8018 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8019 /// let x = VolumeConfig::new().set_user_note("example");
8020 /// ```
8021 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8022 self.user_note = v.into();
8023 self
8024 }
8025
8026 /// Sets the value of [gcp_service][crate::model::VolumeConfig::gcp_service].
8027 ///
8028 /// # Example
8029 /// ```ignore,no_run
8030 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8031 /// let x = VolumeConfig::new().set_gcp_service("example");
8032 /// ```
8033 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8034 self.gcp_service = v.into();
8035 self
8036 }
8037
8038 /// Sets the value of [performance_tier][crate::model::VolumeConfig::performance_tier].
8039 ///
8040 /// # Example
8041 /// ```ignore,no_run
8042 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8043 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
8044 /// let x0 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Shared);
8045 /// let x1 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Assigned);
8046 /// let x2 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Ht);
8047 /// ```
8048 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
8049 mut self,
8050 v: T,
8051 ) -> Self {
8052 self.performance_tier = v.into();
8053 self
8054 }
8055}
8056
8057impl wkt::message::Message for VolumeConfig {
8058 fn typename() -> &'static str {
8059 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig"
8060 }
8061}
8062
8063/// Defines additional types related to [VolumeConfig].
8064pub mod volume_config {
8065 #[allow(unused_imports)]
8066 use super::*;
8067
8068 /// A LUN(Logical Unit Number) range.
8069 #[derive(Clone, Default, PartialEq)]
8070 #[non_exhaustive]
8071 pub struct LunRange {
8072 /// Number of LUNs to create.
8073 pub quantity: i32,
8074
8075 /// The requested size of each LUN, in GB.
8076 pub size_gb: i32,
8077
8078 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8079 }
8080
8081 impl LunRange {
8082 /// Creates a new default instance.
8083 pub fn new() -> Self {
8084 std::default::Default::default()
8085 }
8086
8087 /// Sets the value of [quantity][crate::model::volume_config::LunRange::quantity].
8088 ///
8089 /// # Example
8090 /// ```ignore,no_run
8091 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8092 /// let x = LunRange::new().set_quantity(42);
8093 /// ```
8094 pub fn set_quantity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8095 self.quantity = v.into();
8096 self
8097 }
8098
8099 /// Sets the value of [size_gb][crate::model::volume_config::LunRange::size_gb].
8100 ///
8101 /// # Example
8102 /// ```ignore,no_run
8103 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8104 /// let x = LunRange::new().set_size_gb(42);
8105 /// ```
8106 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8107 self.size_gb = v.into();
8108 self
8109 }
8110 }
8111
8112 impl wkt::message::Message for LunRange {
8113 fn typename() -> &'static str {
8114 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.LunRange"
8115 }
8116 }
8117
8118 /// A NFS export entry.
8119 #[derive(Clone, Default, PartialEq)]
8120 #[non_exhaustive]
8121 pub struct NfsExport {
8122 /// Network to use to publish the export.
8123 pub network_id: std::string::String,
8124
8125 /// Export permissions.
8126 pub permissions: crate::model::volume_config::nfs_export::Permissions,
8127
8128 /// Disable root squashing, which is a feature of NFS.
8129 /// Root squash is a special mapping of the remote superuser (root) identity
8130 /// when using identity authentication.
8131 pub no_root_squash: bool,
8132
8133 /// Allow the setuid flag.
8134 pub allow_suid: bool,
8135
8136 /// Allow dev flag in NfsShare AllowedClientsRequest.
8137 pub allow_dev: bool,
8138
8139 /// A client object.
8140 pub client: std::option::Option<crate::model::volume_config::nfs_export::Client>,
8141
8142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8143 }
8144
8145 impl NfsExport {
8146 /// Creates a new default instance.
8147 pub fn new() -> Self {
8148 std::default::Default::default()
8149 }
8150
8151 /// Sets the value of [network_id][crate::model::volume_config::NfsExport::network_id].
8152 ///
8153 /// # Example
8154 /// ```ignore,no_run
8155 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8156 /// let x = NfsExport::new().set_network_id("example");
8157 /// ```
8158 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8159 self.network_id = v.into();
8160 self
8161 }
8162
8163 /// Sets the value of [permissions][crate::model::volume_config::NfsExport::permissions].
8164 ///
8165 /// # Example
8166 /// ```ignore,no_run
8167 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8168 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Permissions;
8169 /// let x0 = NfsExport::new().set_permissions(Permissions::ReadOnly);
8170 /// let x1 = NfsExport::new().set_permissions(Permissions::ReadWrite);
8171 /// ```
8172 pub fn set_permissions<
8173 T: std::convert::Into<crate::model::volume_config::nfs_export::Permissions>,
8174 >(
8175 mut self,
8176 v: T,
8177 ) -> Self {
8178 self.permissions = v.into();
8179 self
8180 }
8181
8182 /// Sets the value of [no_root_squash][crate::model::volume_config::NfsExport::no_root_squash].
8183 ///
8184 /// # Example
8185 /// ```ignore,no_run
8186 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8187 /// let x = NfsExport::new().set_no_root_squash(true);
8188 /// ```
8189 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8190 self.no_root_squash = v.into();
8191 self
8192 }
8193
8194 /// Sets the value of [allow_suid][crate::model::volume_config::NfsExport::allow_suid].
8195 ///
8196 /// # Example
8197 /// ```ignore,no_run
8198 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8199 /// let x = NfsExport::new().set_allow_suid(true);
8200 /// ```
8201 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8202 self.allow_suid = v.into();
8203 self
8204 }
8205
8206 /// Sets the value of [allow_dev][crate::model::volume_config::NfsExport::allow_dev].
8207 ///
8208 /// # Example
8209 /// ```ignore,no_run
8210 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8211 /// let x = NfsExport::new().set_allow_dev(true);
8212 /// ```
8213 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8214 self.allow_dev = v.into();
8215 self
8216 }
8217
8218 /// Sets the value of [client][crate::model::volume_config::NfsExport::client].
8219 ///
8220 /// Note that all the setters affecting `client` are mutually
8221 /// exclusive.
8222 ///
8223 /// # Example
8224 /// ```ignore,no_run
8225 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8226 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Client;
8227 /// let x = NfsExport::new().set_client(Some(Client::MachineId("example".to_string())));
8228 /// ```
8229 pub fn set_client<
8230 T: std::convert::Into<
8231 std::option::Option<crate::model::volume_config::nfs_export::Client>,
8232 >,
8233 >(
8234 mut self,
8235 v: T,
8236 ) -> Self {
8237 self.client = v.into();
8238 self
8239 }
8240
8241 /// The value of [client][crate::model::volume_config::NfsExport::client]
8242 /// if it holds a `MachineId`, `None` if the field is not set or
8243 /// holds a different branch.
8244 pub fn machine_id(&self) -> std::option::Option<&std::string::String> {
8245 #[allow(unreachable_patterns)]
8246 self.client.as_ref().and_then(|v| match v {
8247 crate::model::volume_config::nfs_export::Client::MachineId(v) => {
8248 std::option::Option::Some(v)
8249 }
8250 _ => std::option::Option::None,
8251 })
8252 }
8253
8254 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8255 /// to hold a `MachineId`.
8256 ///
8257 /// Note that all the setters affecting `client` are
8258 /// mutually exclusive.
8259 ///
8260 /// # Example
8261 /// ```ignore,no_run
8262 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8263 /// let x = NfsExport::new().set_machine_id("example");
8264 /// assert!(x.machine_id().is_some());
8265 /// assert!(x.cidr().is_none());
8266 /// ```
8267 pub fn set_machine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8268 self.client = std::option::Option::Some(
8269 crate::model::volume_config::nfs_export::Client::MachineId(v.into()),
8270 );
8271 self
8272 }
8273
8274 /// The value of [client][crate::model::volume_config::NfsExport::client]
8275 /// if it holds a `Cidr`, `None` if the field is not set or
8276 /// holds a different branch.
8277 pub fn cidr(&self) -> std::option::Option<&std::string::String> {
8278 #[allow(unreachable_patterns)]
8279 self.client.as_ref().and_then(|v| match v {
8280 crate::model::volume_config::nfs_export::Client::Cidr(v) => {
8281 std::option::Option::Some(v)
8282 }
8283 _ => std::option::Option::None,
8284 })
8285 }
8286
8287 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8288 /// to hold a `Cidr`.
8289 ///
8290 /// Note that all the setters affecting `client` are
8291 /// mutually exclusive.
8292 ///
8293 /// # Example
8294 /// ```ignore,no_run
8295 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8296 /// let x = NfsExport::new().set_cidr("example");
8297 /// assert!(x.cidr().is_some());
8298 /// assert!(x.machine_id().is_none());
8299 /// ```
8300 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8301 self.client = std::option::Option::Some(
8302 crate::model::volume_config::nfs_export::Client::Cidr(v.into()),
8303 );
8304 self
8305 }
8306 }
8307
8308 impl wkt::message::Message for NfsExport {
8309 fn typename() -> &'static str {
8310 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport"
8311 }
8312 }
8313
8314 /// Defines additional types related to [NfsExport].
8315 pub mod nfs_export {
8316 #[allow(unused_imports)]
8317 use super::*;
8318
8319 /// Permissions that can granted for an export.
8320 ///
8321 /// # Working with unknown values
8322 ///
8323 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8324 /// additional enum variants at any time. Adding new variants is not considered
8325 /// a breaking change. Applications should write their code in anticipation of:
8326 ///
8327 /// - New values appearing in future releases of the client library, **and**
8328 /// - New values received dynamically, without application changes.
8329 ///
8330 /// Please consult the [Working with enums] section in the user guide for some
8331 /// guidelines.
8332 ///
8333 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8334 #[derive(Clone, Debug, PartialEq)]
8335 #[non_exhaustive]
8336 pub enum Permissions {
8337 /// Unspecified value.
8338 Unspecified,
8339 /// Read-only permission.
8340 ReadOnly,
8341 /// Read-write permission.
8342 ReadWrite,
8343 /// If set, the enum was initialized with an unknown value.
8344 ///
8345 /// Applications can examine the value using [Permissions::value] or
8346 /// [Permissions::name].
8347 UnknownValue(permissions::UnknownValue),
8348 }
8349
8350 #[doc(hidden)]
8351 pub mod permissions {
8352 #[allow(unused_imports)]
8353 use super::*;
8354 #[derive(Clone, Debug, PartialEq)]
8355 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8356 }
8357
8358 impl Permissions {
8359 /// Gets the enum value.
8360 ///
8361 /// Returns `None` if the enum contains an unknown value deserialized from
8362 /// the string representation of enums.
8363 pub fn value(&self) -> std::option::Option<i32> {
8364 match self {
8365 Self::Unspecified => std::option::Option::Some(0),
8366 Self::ReadOnly => std::option::Option::Some(1),
8367 Self::ReadWrite => std::option::Option::Some(2),
8368 Self::UnknownValue(u) => u.0.value(),
8369 }
8370 }
8371
8372 /// Gets the enum value as a string.
8373 ///
8374 /// Returns `None` if the enum contains an unknown value deserialized from
8375 /// the integer representation of enums.
8376 pub fn name(&self) -> std::option::Option<&str> {
8377 match self {
8378 Self::Unspecified => std::option::Option::Some("PERMISSIONS_UNSPECIFIED"),
8379 Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
8380 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
8381 Self::UnknownValue(u) => u.0.name(),
8382 }
8383 }
8384 }
8385
8386 impl std::default::Default for Permissions {
8387 fn default() -> Self {
8388 use std::convert::From;
8389 Self::from(0)
8390 }
8391 }
8392
8393 impl std::fmt::Display for Permissions {
8394 fn fmt(
8395 &self,
8396 f: &mut std::fmt::Formatter<'_>,
8397 ) -> std::result::Result<(), std::fmt::Error> {
8398 wkt::internal::display_enum(f, self.name(), self.value())
8399 }
8400 }
8401
8402 impl std::convert::From<i32> for Permissions {
8403 fn from(value: i32) -> Self {
8404 match value {
8405 0 => Self::Unspecified,
8406 1 => Self::ReadOnly,
8407 2 => Self::ReadWrite,
8408 _ => Self::UnknownValue(permissions::UnknownValue(
8409 wkt::internal::UnknownEnumValue::Integer(value),
8410 )),
8411 }
8412 }
8413 }
8414
8415 impl std::convert::From<&str> for Permissions {
8416 fn from(value: &str) -> Self {
8417 use std::string::ToString;
8418 match value {
8419 "PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
8420 "READ_ONLY" => Self::ReadOnly,
8421 "READ_WRITE" => Self::ReadWrite,
8422 _ => Self::UnknownValue(permissions::UnknownValue(
8423 wkt::internal::UnknownEnumValue::String(value.to_string()),
8424 )),
8425 }
8426 }
8427 }
8428
8429 impl serde::ser::Serialize for Permissions {
8430 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8431 where
8432 S: serde::Serializer,
8433 {
8434 match self {
8435 Self::Unspecified => serializer.serialize_i32(0),
8436 Self::ReadOnly => serializer.serialize_i32(1),
8437 Self::ReadWrite => serializer.serialize_i32(2),
8438 Self::UnknownValue(u) => u.0.serialize(serializer),
8439 }
8440 }
8441 }
8442
8443 impl<'de> serde::de::Deserialize<'de> for Permissions {
8444 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8445 where
8446 D: serde::Deserializer<'de>,
8447 {
8448 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Permissions>::new(
8449 ".google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport.Permissions",
8450 ))
8451 }
8452 }
8453
8454 /// A client object.
8455 #[derive(Clone, Debug, PartialEq)]
8456 #[non_exhaustive]
8457 pub enum Client {
8458 /// Either a single machine, identified by an ID, or a comma-separated
8459 /// list of machine IDs.
8460 MachineId(std::string::String),
8461 /// A CIDR range.
8462 Cidr(std::string::String),
8463 }
8464 }
8465
8466 /// The types of Volumes.
8467 ///
8468 /// # Working with unknown values
8469 ///
8470 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8471 /// additional enum variants at any time. Adding new variants is not considered
8472 /// a breaking change. Applications should write their code in anticipation of:
8473 ///
8474 /// - New values appearing in future releases of the client library, **and**
8475 /// - New values received dynamically, without application changes.
8476 ///
8477 /// Please consult the [Working with enums] section in the user guide for some
8478 /// guidelines.
8479 ///
8480 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8481 #[derive(Clone, Debug, PartialEq)]
8482 #[non_exhaustive]
8483 pub enum Type {
8484 /// The unspecified type.
8485 Unspecified,
8486 /// This Volume is on flash.
8487 Flash,
8488 /// This Volume is on disk.
8489 Disk,
8490 /// If set, the enum was initialized with an unknown value.
8491 ///
8492 /// Applications can examine the value using [Type::value] or
8493 /// [Type::name].
8494 UnknownValue(r#type::UnknownValue),
8495 }
8496
8497 #[doc(hidden)]
8498 pub mod r#type {
8499 #[allow(unused_imports)]
8500 use super::*;
8501 #[derive(Clone, Debug, PartialEq)]
8502 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8503 }
8504
8505 impl Type {
8506 /// Gets the enum value.
8507 ///
8508 /// Returns `None` if the enum contains an unknown value deserialized from
8509 /// the string representation of enums.
8510 pub fn value(&self) -> std::option::Option<i32> {
8511 match self {
8512 Self::Unspecified => std::option::Option::Some(0),
8513 Self::Flash => std::option::Option::Some(1),
8514 Self::Disk => std::option::Option::Some(2),
8515 Self::UnknownValue(u) => u.0.value(),
8516 }
8517 }
8518
8519 /// Gets the enum value as a string.
8520 ///
8521 /// Returns `None` if the enum contains an unknown value deserialized from
8522 /// the integer representation of enums.
8523 pub fn name(&self) -> std::option::Option<&str> {
8524 match self {
8525 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8526 Self::Flash => std::option::Option::Some("FLASH"),
8527 Self::Disk => std::option::Option::Some("DISK"),
8528 Self::UnknownValue(u) => u.0.name(),
8529 }
8530 }
8531 }
8532
8533 impl std::default::Default for Type {
8534 fn default() -> Self {
8535 use std::convert::From;
8536 Self::from(0)
8537 }
8538 }
8539
8540 impl std::fmt::Display for Type {
8541 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8542 wkt::internal::display_enum(f, self.name(), self.value())
8543 }
8544 }
8545
8546 impl std::convert::From<i32> for Type {
8547 fn from(value: i32) -> Self {
8548 match value {
8549 0 => Self::Unspecified,
8550 1 => Self::Flash,
8551 2 => Self::Disk,
8552 _ => Self::UnknownValue(r#type::UnknownValue(
8553 wkt::internal::UnknownEnumValue::Integer(value),
8554 )),
8555 }
8556 }
8557 }
8558
8559 impl std::convert::From<&str> for Type {
8560 fn from(value: &str) -> Self {
8561 use std::string::ToString;
8562 match value {
8563 "TYPE_UNSPECIFIED" => Self::Unspecified,
8564 "FLASH" => Self::Flash,
8565 "DISK" => Self::Disk,
8566 _ => Self::UnknownValue(r#type::UnknownValue(
8567 wkt::internal::UnknownEnumValue::String(value.to_string()),
8568 )),
8569 }
8570 }
8571 }
8572
8573 impl serde::ser::Serialize for Type {
8574 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8575 where
8576 S: serde::Serializer,
8577 {
8578 match self {
8579 Self::Unspecified => serializer.serialize_i32(0),
8580 Self::Flash => serializer.serialize_i32(1),
8581 Self::Disk => serializer.serialize_i32(2),
8582 Self::UnknownValue(u) => u.0.serialize(serializer),
8583 }
8584 }
8585 }
8586
8587 impl<'de> serde::de::Deserialize<'de> for Type {
8588 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8589 where
8590 D: serde::Deserializer<'de>,
8591 {
8592 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
8593 ".google.cloud.baremetalsolution.v2.VolumeConfig.Type",
8594 ))
8595 }
8596 }
8597
8598 /// The protocol used to access the volume.
8599 ///
8600 /// # Working with unknown values
8601 ///
8602 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8603 /// additional enum variants at any time. Adding new variants is not considered
8604 /// a breaking change. Applications should write their code in anticipation of:
8605 ///
8606 /// - New values appearing in future releases of the client library, **and**
8607 /// - New values received dynamically, without application changes.
8608 ///
8609 /// Please consult the [Working with enums] section in the user guide for some
8610 /// guidelines.
8611 ///
8612 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8613 #[derive(Clone, Debug, PartialEq)]
8614 #[non_exhaustive]
8615 pub enum Protocol {
8616 /// Unspecified value.
8617 Unspecified,
8618 /// Fibre channel.
8619 Fc,
8620 /// Network file system.
8621 Nfs,
8622 /// If set, the enum was initialized with an unknown value.
8623 ///
8624 /// Applications can examine the value using [Protocol::value] or
8625 /// [Protocol::name].
8626 UnknownValue(protocol::UnknownValue),
8627 }
8628
8629 #[doc(hidden)]
8630 pub mod protocol {
8631 #[allow(unused_imports)]
8632 use super::*;
8633 #[derive(Clone, Debug, PartialEq)]
8634 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8635 }
8636
8637 impl Protocol {
8638 /// Gets the enum value.
8639 ///
8640 /// Returns `None` if the enum contains an unknown value deserialized from
8641 /// the string representation of enums.
8642 pub fn value(&self) -> std::option::Option<i32> {
8643 match self {
8644 Self::Unspecified => std::option::Option::Some(0),
8645 Self::Fc => std::option::Option::Some(1),
8646 Self::Nfs => std::option::Option::Some(2),
8647 Self::UnknownValue(u) => u.0.value(),
8648 }
8649 }
8650
8651 /// Gets the enum value as a string.
8652 ///
8653 /// Returns `None` if the enum contains an unknown value deserialized from
8654 /// the integer representation of enums.
8655 pub fn name(&self) -> std::option::Option<&str> {
8656 match self {
8657 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
8658 Self::Fc => std::option::Option::Some("PROTOCOL_FC"),
8659 Self::Nfs => std::option::Option::Some("PROTOCOL_NFS"),
8660 Self::UnknownValue(u) => u.0.name(),
8661 }
8662 }
8663 }
8664
8665 impl std::default::Default for Protocol {
8666 fn default() -> Self {
8667 use std::convert::From;
8668 Self::from(0)
8669 }
8670 }
8671
8672 impl std::fmt::Display for Protocol {
8673 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8674 wkt::internal::display_enum(f, self.name(), self.value())
8675 }
8676 }
8677
8678 impl std::convert::From<i32> for Protocol {
8679 fn from(value: i32) -> Self {
8680 match value {
8681 0 => Self::Unspecified,
8682 1 => Self::Fc,
8683 2 => Self::Nfs,
8684 _ => Self::UnknownValue(protocol::UnknownValue(
8685 wkt::internal::UnknownEnumValue::Integer(value),
8686 )),
8687 }
8688 }
8689 }
8690
8691 impl std::convert::From<&str> for Protocol {
8692 fn from(value: &str) -> Self {
8693 use std::string::ToString;
8694 match value {
8695 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
8696 "PROTOCOL_FC" => Self::Fc,
8697 "PROTOCOL_NFS" => Self::Nfs,
8698 _ => Self::UnknownValue(protocol::UnknownValue(
8699 wkt::internal::UnknownEnumValue::String(value.to_string()),
8700 )),
8701 }
8702 }
8703 }
8704
8705 impl serde::ser::Serialize for Protocol {
8706 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8707 where
8708 S: serde::Serializer,
8709 {
8710 match self {
8711 Self::Unspecified => serializer.serialize_i32(0),
8712 Self::Fc => serializer.serialize_i32(1),
8713 Self::Nfs => serializer.serialize_i32(2),
8714 Self::UnknownValue(u) => u.0.serialize(serializer),
8715 }
8716 }
8717 }
8718
8719 impl<'de> serde::de::Deserialize<'de> for Protocol {
8720 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8721 where
8722 D: serde::Deserializer<'de>,
8723 {
8724 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
8725 ".google.cloud.baremetalsolution.v2.VolumeConfig.Protocol",
8726 ))
8727 }
8728 }
8729}
8730
8731/// Configuration parameters for a new network.
8732#[derive(Clone, Default, PartialEq)]
8733#[non_exhaustive]
8734pub struct NetworkConfig {
8735 /// Output only. The name of the network config.
8736 pub name: std::string::String,
8737
8738 /// A transient unique identifier to identify a volume within an
8739 /// ProvisioningConfig request.
8740 pub id: std::string::String,
8741
8742 /// The type of this network, either Client or Private.
8743 pub r#type: crate::model::network_config::Type,
8744
8745 /// Interconnect bandwidth. Set only when type is CLIENT.
8746 pub bandwidth: crate::model::network_config::Bandwidth,
8747
8748 /// List of VLAN attachments. As of now there are always 2 attachments, but it
8749 /// is going to change in the future (multi vlan).
8750 pub vlan_attachments: std::vec::Vec<crate::model::network_config::IntakeVlanAttachment>,
8751
8752 /// CIDR range of the network.
8753 pub cidr: std::string::String,
8754
8755 /// Service CIDR, if any.
8756 pub service_cidr: crate::model::network_config::ServiceCidr,
8757
8758 /// User note field, it can be used by customers to add additional information
8759 /// for the BMS Ops team .
8760 pub user_note: std::string::String,
8761
8762 /// The GCP service of the network. Available gcp_service are in
8763 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
8764 pub gcp_service: std::string::String,
8765
8766 /// Whether the VLAN attachment pair is located in the same project.
8767 pub vlan_same_project: bool,
8768
8769 /// The JumboFramesEnabled option for customer to set.
8770 pub jumbo_frames_enabled: bool,
8771
8772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8773}
8774
8775impl NetworkConfig {
8776 /// Creates a new default instance.
8777 pub fn new() -> Self {
8778 std::default::Default::default()
8779 }
8780
8781 /// Sets the value of [name][crate::model::NetworkConfig::name].
8782 ///
8783 /// # Example
8784 /// ```ignore,no_run
8785 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8786 /// let x = NetworkConfig::new().set_name("example");
8787 /// ```
8788 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8789 self.name = v.into();
8790 self
8791 }
8792
8793 /// Sets the value of [id][crate::model::NetworkConfig::id].
8794 ///
8795 /// # Example
8796 /// ```ignore,no_run
8797 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8798 /// let x = NetworkConfig::new().set_id("example");
8799 /// ```
8800 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8801 self.id = v.into();
8802 self
8803 }
8804
8805 /// Sets the value of [r#type][crate::model::NetworkConfig::type].
8806 ///
8807 /// # Example
8808 /// ```ignore,no_run
8809 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8810 /// use google_cloud_baremetalsolution_v2::model::network_config::Type;
8811 /// let x0 = NetworkConfig::new().set_type(Type::Client);
8812 /// let x1 = NetworkConfig::new().set_type(Type::Private);
8813 /// ```
8814 pub fn set_type<T: std::convert::Into<crate::model::network_config::Type>>(
8815 mut self,
8816 v: T,
8817 ) -> Self {
8818 self.r#type = v.into();
8819 self
8820 }
8821
8822 /// Sets the value of [bandwidth][crate::model::NetworkConfig::bandwidth].
8823 ///
8824 /// # Example
8825 /// ```ignore,no_run
8826 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8827 /// use google_cloud_baremetalsolution_v2::model::network_config::Bandwidth;
8828 /// let x0 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw1Gbps);
8829 /// let x1 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw2Gbps);
8830 /// let x2 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw5Gbps);
8831 /// ```
8832 pub fn set_bandwidth<T: std::convert::Into<crate::model::network_config::Bandwidth>>(
8833 mut self,
8834 v: T,
8835 ) -> Self {
8836 self.bandwidth = v.into();
8837 self
8838 }
8839
8840 /// Sets the value of [vlan_attachments][crate::model::NetworkConfig::vlan_attachments].
8841 ///
8842 /// # Example
8843 /// ```ignore,no_run
8844 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8845 /// use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8846 /// let x = NetworkConfig::new()
8847 /// .set_vlan_attachments([
8848 /// IntakeVlanAttachment::default()/* use setters */,
8849 /// IntakeVlanAttachment::default()/* use (different) setters */,
8850 /// ]);
8851 /// ```
8852 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
8853 where
8854 T: std::iter::IntoIterator<Item = V>,
8855 V: std::convert::Into<crate::model::network_config::IntakeVlanAttachment>,
8856 {
8857 use std::iter::Iterator;
8858 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
8859 self
8860 }
8861
8862 /// Sets the value of [cidr][crate::model::NetworkConfig::cidr].
8863 ///
8864 /// # Example
8865 /// ```ignore,no_run
8866 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8867 /// let x = NetworkConfig::new().set_cidr("example");
8868 /// ```
8869 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8870 self.cidr = v.into();
8871 self
8872 }
8873
8874 /// Sets the value of [service_cidr][crate::model::NetworkConfig::service_cidr].
8875 ///
8876 /// # Example
8877 /// ```ignore,no_run
8878 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8879 /// use google_cloud_baremetalsolution_v2::model::network_config::ServiceCidr;
8880 /// let x0 = NetworkConfig::new().set_service_cidr(ServiceCidr::Disabled);
8881 /// let x1 = NetworkConfig::new().set_service_cidr(ServiceCidr::High26);
8882 /// let x2 = NetworkConfig::new().set_service_cidr(ServiceCidr::High27);
8883 /// ```
8884 pub fn set_service_cidr<T: std::convert::Into<crate::model::network_config::ServiceCidr>>(
8885 mut self,
8886 v: T,
8887 ) -> Self {
8888 self.service_cidr = v.into();
8889 self
8890 }
8891
8892 /// Sets the value of [user_note][crate::model::NetworkConfig::user_note].
8893 ///
8894 /// # Example
8895 /// ```ignore,no_run
8896 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8897 /// let x = NetworkConfig::new().set_user_note("example");
8898 /// ```
8899 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8900 self.user_note = v.into();
8901 self
8902 }
8903
8904 /// Sets the value of [gcp_service][crate::model::NetworkConfig::gcp_service].
8905 ///
8906 /// # Example
8907 /// ```ignore,no_run
8908 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8909 /// let x = NetworkConfig::new().set_gcp_service("example");
8910 /// ```
8911 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8912 self.gcp_service = v.into();
8913 self
8914 }
8915
8916 /// Sets the value of [vlan_same_project][crate::model::NetworkConfig::vlan_same_project].
8917 ///
8918 /// # Example
8919 /// ```ignore,no_run
8920 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8921 /// let x = NetworkConfig::new().set_vlan_same_project(true);
8922 /// ```
8923 pub fn set_vlan_same_project<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8924 self.vlan_same_project = v.into();
8925 self
8926 }
8927
8928 /// Sets the value of [jumbo_frames_enabled][crate::model::NetworkConfig::jumbo_frames_enabled].
8929 ///
8930 /// # Example
8931 /// ```ignore,no_run
8932 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8933 /// let x = NetworkConfig::new().set_jumbo_frames_enabled(true);
8934 /// ```
8935 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8936 self.jumbo_frames_enabled = v.into();
8937 self
8938 }
8939}
8940
8941impl wkt::message::Message for NetworkConfig {
8942 fn typename() -> &'static str {
8943 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig"
8944 }
8945}
8946
8947/// Defines additional types related to [NetworkConfig].
8948pub mod network_config {
8949 #[allow(unused_imports)]
8950 use super::*;
8951
8952 /// A GCP vlan attachment.
8953 #[derive(Clone, Default, PartialEq)]
8954 #[non_exhaustive]
8955 pub struct IntakeVlanAttachment {
8956 /// Identifier of the VLAN attachment.
8957 pub id: std::string::String,
8958
8959 /// Attachment pairing key.
8960 pub pairing_key: std::string::String,
8961
8962 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8963 }
8964
8965 impl IntakeVlanAttachment {
8966 /// Creates a new default instance.
8967 pub fn new() -> Self {
8968 std::default::Default::default()
8969 }
8970
8971 /// Sets the value of [id][crate::model::network_config::IntakeVlanAttachment::id].
8972 ///
8973 /// # Example
8974 /// ```ignore,no_run
8975 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8976 /// let x = IntakeVlanAttachment::new().set_id("example");
8977 /// ```
8978 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8979 self.id = v.into();
8980 self
8981 }
8982
8983 /// Sets the value of [pairing_key][crate::model::network_config::IntakeVlanAttachment::pairing_key].
8984 ///
8985 /// # Example
8986 /// ```ignore,no_run
8987 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8988 /// let x = IntakeVlanAttachment::new().set_pairing_key("example");
8989 /// ```
8990 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8991 self.pairing_key = v.into();
8992 self
8993 }
8994 }
8995
8996 impl wkt::message::Message for IntakeVlanAttachment {
8997 fn typename() -> &'static str {
8998 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig.IntakeVlanAttachment"
8999 }
9000 }
9001
9002 /// Network type.
9003 ///
9004 /// # Working with unknown values
9005 ///
9006 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9007 /// additional enum variants at any time. Adding new variants is not considered
9008 /// a breaking change. Applications should write their code in anticipation of:
9009 ///
9010 /// - New values appearing in future releases of the client library, **and**
9011 /// - New values received dynamically, without application changes.
9012 ///
9013 /// Please consult the [Working with enums] section in the user guide for some
9014 /// guidelines.
9015 ///
9016 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9017 #[derive(Clone, Debug, PartialEq)]
9018 #[non_exhaustive]
9019 pub enum Type {
9020 /// Unspecified value.
9021 Unspecified,
9022 /// Client network, that is a network peered to a GCP VPC.
9023 Client,
9024 /// Private network, that is a network local to the BMS POD.
9025 Private,
9026 /// If set, the enum was initialized with an unknown value.
9027 ///
9028 /// Applications can examine the value using [Type::value] or
9029 /// [Type::name].
9030 UnknownValue(r#type::UnknownValue),
9031 }
9032
9033 #[doc(hidden)]
9034 pub mod r#type {
9035 #[allow(unused_imports)]
9036 use super::*;
9037 #[derive(Clone, Debug, PartialEq)]
9038 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9039 }
9040
9041 impl Type {
9042 /// Gets the enum value.
9043 ///
9044 /// Returns `None` if the enum contains an unknown value deserialized from
9045 /// the string representation of enums.
9046 pub fn value(&self) -> std::option::Option<i32> {
9047 match self {
9048 Self::Unspecified => std::option::Option::Some(0),
9049 Self::Client => std::option::Option::Some(1),
9050 Self::Private => std::option::Option::Some(2),
9051 Self::UnknownValue(u) => u.0.value(),
9052 }
9053 }
9054
9055 /// Gets the enum value as a string.
9056 ///
9057 /// Returns `None` if the enum contains an unknown value deserialized from
9058 /// the integer representation of enums.
9059 pub fn name(&self) -> std::option::Option<&str> {
9060 match self {
9061 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
9062 Self::Client => std::option::Option::Some("CLIENT"),
9063 Self::Private => std::option::Option::Some("PRIVATE"),
9064 Self::UnknownValue(u) => u.0.name(),
9065 }
9066 }
9067 }
9068
9069 impl std::default::Default for Type {
9070 fn default() -> Self {
9071 use std::convert::From;
9072 Self::from(0)
9073 }
9074 }
9075
9076 impl std::fmt::Display for Type {
9077 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9078 wkt::internal::display_enum(f, self.name(), self.value())
9079 }
9080 }
9081
9082 impl std::convert::From<i32> for Type {
9083 fn from(value: i32) -> Self {
9084 match value {
9085 0 => Self::Unspecified,
9086 1 => Self::Client,
9087 2 => Self::Private,
9088 _ => Self::UnknownValue(r#type::UnknownValue(
9089 wkt::internal::UnknownEnumValue::Integer(value),
9090 )),
9091 }
9092 }
9093 }
9094
9095 impl std::convert::From<&str> for Type {
9096 fn from(value: &str) -> Self {
9097 use std::string::ToString;
9098 match value {
9099 "TYPE_UNSPECIFIED" => Self::Unspecified,
9100 "CLIENT" => Self::Client,
9101 "PRIVATE" => Self::Private,
9102 _ => Self::UnknownValue(r#type::UnknownValue(
9103 wkt::internal::UnknownEnumValue::String(value.to_string()),
9104 )),
9105 }
9106 }
9107 }
9108
9109 impl serde::ser::Serialize for Type {
9110 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9111 where
9112 S: serde::Serializer,
9113 {
9114 match self {
9115 Self::Unspecified => serializer.serialize_i32(0),
9116 Self::Client => serializer.serialize_i32(1),
9117 Self::Private => serializer.serialize_i32(2),
9118 Self::UnknownValue(u) => u.0.serialize(serializer),
9119 }
9120 }
9121 }
9122
9123 impl<'de> serde::de::Deserialize<'de> for Type {
9124 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9125 where
9126 D: serde::Deserializer<'de>,
9127 {
9128 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
9129 ".google.cloud.baremetalsolution.v2.NetworkConfig.Type",
9130 ))
9131 }
9132 }
9133
9134 /// Interconnect bandwidth.
9135 ///
9136 /// # Working with unknown values
9137 ///
9138 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9139 /// additional enum variants at any time. Adding new variants is not considered
9140 /// a breaking change. Applications should write their code in anticipation of:
9141 ///
9142 /// - New values appearing in future releases of the client library, **and**
9143 /// - New values received dynamically, without application changes.
9144 ///
9145 /// Please consult the [Working with enums] section in the user guide for some
9146 /// guidelines.
9147 ///
9148 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9149 #[derive(Clone, Debug, PartialEq)]
9150 #[non_exhaustive]
9151 pub enum Bandwidth {
9152 /// Unspecified value.
9153 Unspecified,
9154 /// 1 Gbps.
9155 Bw1Gbps,
9156 /// 2 Gbps.
9157 Bw2Gbps,
9158 /// 5 Gbps.
9159 Bw5Gbps,
9160 /// 10 Gbps.
9161 Bw10Gbps,
9162 /// If set, the enum was initialized with an unknown value.
9163 ///
9164 /// Applications can examine the value using [Bandwidth::value] or
9165 /// [Bandwidth::name].
9166 UnknownValue(bandwidth::UnknownValue),
9167 }
9168
9169 #[doc(hidden)]
9170 pub mod bandwidth {
9171 #[allow(unused_imports)]
9172 use super::*;
9173 #[derive(Clone, Debug, PartialEq)]
9174 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9175 }
9176
9177 impl Bandwidth {
9178 /// Gets the enum value.
9179 ///
9180 /// Returns `None` if the enum contains an unknown value deserialized from
9181 /// the string representation of enums.
9182 pub fn value(&self) -> std::option::Option<i32> {
9183 match self {
9184 Self::Unspecified => std::option::Option::Some(0),
9185 Self::Bw1Gbps => std::option::Option::Some(1),
9186 Self::Bw2Gbps => std::option::Option::Some(2),
9187 Self::Bw5Gbps => std::option::Option::Some(3),
9188 Self::Bw10Gbps => std::option::Option::Some(4),
9189 Self::UnknownValue(u) => u.0.value(),
9190 }
9191 }
9192
9193 /// Gets the enum value as a string.
9194 ///
9195 /// Returns `None` if the enum contains an unknown value deserialized from
9196 /// the integer representation of enums.
9197 pub fn name(&self) -> std::option::Option<&str> {
9198 match self {
9199 Self::Unspecified => std::option::Option::Some("BANDWIDTH_UNSPECIFIED"),
9200 Self::Bw1Gbps => std::option::Option::Some("BW_1_GBPS"),
9201 Self::Bw2Gbps => std::option::Option::Some("BW_2_GBPS"),
9202 Self::Bw5Gbps => std::option::Option::Some("BW_5_GBPS"),
9203 Self::Bw10Gbps => std::option::Option::Some("BW_10_GBPS"),
9204 Self::UnknownValue(u) => u.0.name(),
9205 }
9206 }
9207 }
9208
9209 impl std::default::Default for Bandwidth {
9210 fn default() -> Self {
9211 use std::convert::From;
9212 Self::from(0)
9213 }
9214 }
9215
9216 impl std::fmt::Display for Bandwidth {
9217 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9218 wkt::internal::display_enum(f, self.name(), self.value())
9219 }
9220 }
9221
9222 impl std::convert::From<i32> for Bandwidth {
9223 fn from(value: i32) -> Self {
9224 match value {
9225 0 => Self::Unspecified,
9226 1 => Self::Bw1Gbps,
9227 2 => Self::Bw2Gbps,
9228 3 => Self::Bw5Gbps,
9229 4 => Self::Bw10Gbps,
9230 _ => Self::UnknownValue(bandwidth::UnknownValue(
9231 wkt::internal::UnknownEnumValue::Integer(value),
9232 )),
9233 }
9234 }
9235 }
9236
9237 impl std::convert::From<&str> for Bandwidth {
9238 fn from(value: &str) -> Self {
9239 use std::string::ToString;
9240 match value {
9241 "BANDWIDTH_UNSPECIFIED" => Self::Unspecified,
9242 "BW_1_GBPS" => Self::Bw1Gbps,
9243 "BW_2_GBPS" => Self::Bw2Gbps,
9244 "BW_5_GBPS" => Self::Bw5Gbps,
9245 "BW_10_GBPS" => Self::Bw10Gbps,
9246 _ => Self::UnknownValue(bandwidth::UnknownValue(
9247 wkt::internal::UnknownEnumValue::String(value.to_string()),
9248 )),
9249 }
9250 }
9251 }
9252
9253 impl serde::ser::Serialize for Bandwidth {
9254 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9255 where
9256 S: serde::Serializer,
9257 {
9258 match self {
9259 Self::Unspecified => serializer.serialize_i32(0),
9260 Self::Bw1Gbps => serializer.serialize_i32(1),
9261 Self::Bw2Gbps => serializer.serialize_i32(2),
9262 Self::Bw5Gbps => serializer.serialize_i32(3),
9263 Self::Bw10Gbps => serializer.serialize_i32(4),
9264 Self::UnknownValue(u) => u.0.serialize(serializer),
9265 }
9266 }
9267 }
9268
9269 impl<'de> serde::de::Deserialize<'de> for Bandwidth {
9270 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9271 where
9272 D: serde::Deserializer<'de>,
9273 {
9274 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Bandwidth>::new(
9275 ".google.cloud.baremetalsolution.v2.NetworkConfig.Bandwidth",
9276 ))
9277 }
9278 }
9279
9280 /// Service network block.
9281 ///
9282 /// # Working with unknown values
9283 ///
9284 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9285 /// additional enum variants at any time. Adding new variants is not considered
9286 /// a breaking change. Applications should write their code in anticipation of:
9287 ///
9288 /// - New values appearing in future releases of the client library, **and**
9289 /// - New values received dynamically, without application changes.
9290 ///
9291 /// Please consult the [Working with enums] section in the user guide for some
9292 /// guidelines.
9293 ///
9294 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9295 #[derive(Clone, Debug, PartialEq)]
9296 #[non_exhaustive]
9297 pub enum ServiceCidr {
9298 /// Unspecified value.
9299 Unspecified,
9300 /// Services are disabled for the given network.
9301 Disabled,
9302 /// Use the highest /26 block of the network to host services.
9303 High26,
9304 /// Use the highest /27 block of the network to host services.
9305 High27,
9306 /// Use the highest /28 block of the network to host services.
9307 High28,
9308 /// If set, the enum was initialized with an unknown value.
9309 ///
9310 /// Applications can examine the value using [ServiceCidr::value] or
9311 /// [ServiceCidr::name].
9312 UnknownValue(service_cidr::UnknownValue),
9313 }
9314
9315 #[doc(hidden)]
9316 pub mod service_cidr {
9317 #[allow(unused_imports)]
9318 use super::*;
9319 #[derive(Clone, Debug, PartialEq)]
9320 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9321 }
9322
9323 impl ServiceCidr {
9324 /// Gets the enum value.
9325 ///
9326 /// Returns `None` if the enum contains an unknown value deserialized from
9327 /// the string representation of enums.
9328 pub fn value(&self) -> std::option::Option<i32> {
9329 match self {
9330 Self::Unspecified => std::option::Option::Some(0),
9331 Self::Disabled => std::option::Option::Some(1),
9332 Self::High26 => std::option::Option::Some(2),
9333 Self::High27 => std::option::Option::Some(3),
9334 Self::High28 => std::option::Option::Some(4),
9335 Self::UnknownValue(u) => u.0.value(),
9336 }
9337 }
9338
9339 /// Gets the enum value as a string.
9340 ///
9341 /// Returns `None` if the enum contains an unknown value deserialized from
9342 /// the integer representation of enums.
9343 pub fn name(&self) -> std::option::Option<&str> {
9344 match self {
9345 Self::Unspecified => std::option::Option::Some("SERVICE_CIDR_UNSPECIFIED"),
9346 Self::Disabled => std::option::Option::Some("DISABLED"),
9347 Self::High26 => std::option::Option::Some("HIGH_26"),
9348 Self::High27 => std::option::Option::Some("HIGH_27"),
9349 Self::High28 => std::option::Option::Some("HIGH_28"),
9350 Self::UnknownValue(u) => u.0.name(),
9351 }
9352 }
9353 }
9354
9355 impl std::default::Default for ServiceCidr {
9356 fn default() -> Self {
9357 use std::convert::From;
9358 Self::from(0)
9359 }
9360 }
9361
9362 impl std::fmt::Display for ServiceCidr {
9363 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9364 wkt::internal::display_enum(f, self.name(), self.value())
9365 }
9366 }
9367
9368 impl std::convert::From<i32> for ServiceCidr {
9369 fn from(value: i32) -> Self {
9370 match value {
9371 0 => Self::Unspecified,
9372 1 => Self::Disabled,
9373 2 => Self::High26,
9374 3 => Self::High27,
9375 4 => Self::High28,
9376 _ => Self::UnknownValue(service_cidr::UnknownValue(
9377 wkt::internal::UnknownEnumValue::Integer(value),
9378 )),
9379 }
9380 }
9381 }
9382
9383 impl std::convert::From<&str> for ServiceCidr {
9384 fn from(value: &str) -> Self {
9385 use std::string::ToString;
9386 match value {
9387 "SERVICE_CIDR_UNSPECIFIED" => Self::Unspecified,
9388 "DISABLED" => Self::Disabled,
9389 "HIGH_26" => Self::High26,
9390 "HIGH_27" => Self::High27,
9391 "HIGH_28" => Self::High28,
9392 _ => Self::UnknownValue(service_cidr::UnknownValue(
9393 wkt::internal::UnknownEnumValue::String(value.to_string()),
9394 )),
9395 }
9396 }
9397 }
9398
9399 impl serde::ser::Serialize for ServiceCidr {
9400 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9401 where
9402 S: serde::Serializer,
9403 {
9404 match self {
9405 Self::Unspecified => serializer.serialize_i32(0),
9406 Self::Disabled => serializer.serialize_i32(1),
9407 Self::High26 => serializer.serialize_i32(2),
9408 Self::High27 => serializer.serialize_i32(3),
9409 Self::High28 => serializer.serialize_i32(4),
9410 Self::UnknownValue(u) => u.0.serialize(serializer),
9411 }
9412 }
9413 }
9414
9415 impl<'de> serde::de::Deserialize<'de> for ServiceCidr {
9416 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9417 where
9418 D: serde::Deserializer<'de>,
9419 {
9420 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceCidr>::new(
9421 ".google.cloud.baremetalsolution.v2.NetworkConfig.ServiceCidr",
9422 ))
9423 }
9424 }
9425}
9426
9427/// A resource budget.
9428#[derive(Clone, Default, PartialEq)]
9429#[non_exhaustive]
9430pub struct InstanceQuota {
9431 /// Output only. The name of the instance quota.
9432 pub name: std::string::String,
9433
9434 /// Instance type.
9435 /// Deprecated: use gcp_service.
9436 #[deprecated]
9437 pub instance_type: std::string::String,
9438
9439 /// The gcp service of the provisioning quota.
9440 pub gcp_service: std::string::String,
9441
9442 /// Location where the quota applies.
9443 pub location: std::string::String,
9444
9445 /// Number of machines than can be created for the given location and
9446 /// instance_type.
9447 pub available_machine_count: i32,
9448
9449 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9450}
9451
9452impl InstanceQuota {
9453 /// Creates a new default instance.
9454 pub fn new() -> Self {
9455 std::default::Default::default()
9456 }
9457
9458 /// Sets the value of [name][crate::model::InstanceQuota::name].
9459 ///
9460 /// # Example
9461 /// ```ignore,no_run
9462 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9463 /// let x = InstanceQuota::new().set_name("example");
9464 /// ```
9465 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9466 self.name = v.into();
9467 self
9468 }
9469
9470 /// Sets the value of [instance_type][crate::model::InstanceQuota::instance_type].
9471 ///
9472 /// # Example
9473 /// ```ignore,no_run
9474 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9475 /// let x = InstanceQuota::new().set_instance_type("example");
9476 /// ```
9477 #[deprecated]
9478 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9479 self.instance_type = v.into();
9480 self
9481 }
9482
9483 /// Sets the value of [gcp_service][crate::model::InstanceQuota::gcp_service].
9484 ///
9485 /// # Example
9486 /// ```ignore,no_run
9487 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9488 /// let x = InstanceQuota::new().set_gcp_service("example");
9489 /// ```
9490 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9491 self.gcp_service = v.into();
9492 self
9493 }
9494
9495 /// Sets the value of [location][crate::model::InstanceQuota::location].
9496 ///
9497 /// # Example
9498 /// ```ignore,no_run
9499 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9500 /// let x = InstanceQuota::new().set_location("example");
9501 /// ```
9502 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9503 self.location = v.into();
9504 self
9505 }
9506
9507 /// Sets the value of [available_machine_count][crate::model::InstanceQuota::available_machine_count].
9508 ///
9509 /// # Example
9510 /// ```ignore,no_run
9511 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9512 /// let x = InstanceQuota::new().set_available_machine_count(42);
9513 /// ```
9514 pub fn set_available_machine_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9515 self.available_machine_count = v.into();
9516 self
9517 }
9518}
9519
9520impl wkt::message::Message for InstanceQuota {
9521 fn typename() -> &'static str {
9522 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceQuota"
9523 }
9524}
9525
9526/// Request for GetProvisioningConfig.
9527#[derive(Clone, Default, PartialEq)]
9528#[non_exhaustive]
9529pub struct GetProvisioningConfigRequest {
9530 /// Required. Name of the ProvisioningConfig.
9531 pub name: std::string::String,
9532
9533 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9534}
9535
9536impl GetProvisioningConfigRequest {
9537 /// Creates a new default instance.
9538 pub fn new() -> Self {
9539 std::default::Default::default()
9540 }
9541
9542 /// Sets the value of [name][crate::model::GetProvisioningConfigRequest::name].
9543 ///
9544 /// # Example
9545 /// ```ignore,no_run
9546 /// # use google_cloud_baremetalsolution_v2::model::GetProvisioningConfigRequest;
9547 /// let x = GetProvisioningConfigRequest::new().set_name("example");
9548 /// ```
9549 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9550 self.name = v.into();
9551 self
9552 }
9553}
9554
9555impl wkt::message::Message for GetProvisioningConfigRequest {
9556 fn typename() -> &'static str {
9557 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetProvisioningConfigRequest"
9558 }
9559}
9560
9561/// Request for CreateProvisioningConfig.
9562#[derive(Clone, Default, PartialEq)]
9563#[non_exhaustive]
9564pub struct CreateProvisioningConfigRequest {
9565 /// Required. The parent project and location containing the
9566 /// ProvisioningConfig.
9567 pub parent: std::string::String,
9568
9569 /// Required. The ProvisioningConfig to create.
9570 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9571
9572 /// Optional. Email provided to send a confirmation with provisioning config
9573 /// to.
9574 pub email: std::string::String,
9575
9576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9577}
9578
9579impl CreateProvisioningConfigRequest {
9580 /// Creates a new default instance.
9581 pub fn new() -> Self {
9582 std::default::Default::default()
9583 }
9584
9585 /// Sets the value of [parent][crate::model::CreateProvisioningConfigRequest::parent].
9586 ///
9587 /// # Example
9588 /// ```ignore,no_run
9589 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9590 /// let x = CreateProvisioningConfigRequest::new().set_parent("example");
9591 /// ```
9592 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9593 self.parent = v.into();
9594 self
9595 }
9596
9597 /// Sets the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9598 ///
9599 /// # Example
9600 /// ```ignore,no_run
9601 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9602 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9603 /// let x = CreateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9604 /// ```
9605 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9606 where
9607 T: std::convert::Into<crate::model::ProvisioningConfig>,
9608 {
9609 self.provisioning_config = std::option::Option::Some(v.into());
9610 self
9611 }
9612
9613 /// Sets or clears the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9614 ///
9615 /// # Example
9616 /// ```ignore,no_run
9617 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9618 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9619 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9620 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9621 /// ```
9622 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9623 where
9624 T: std::convert::Into<crate::model::ProvisioningConfig>,
9625 {
9626 self.provisioning_config = v.map(|x| x.into());
9627 self
9628 }
9629
9630 /// Sets the value of [email][crate::model::CreateProvisioningConfigRequest::email].
9631 ///
9632 /// # Example
9633 /// ```ignore,no_run
9634 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9635 /// let x = CreateProvisioningConfigRequest::new().set_email("example");
9636 /// ```
9637 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9638 self.email = v.into();
9639 self
9640 }
9641}
9642
9643impl wkt::message::Message for CreateProvisioningConfigRequest {
9644 fn typename() -> &'static str {
9645 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateProvisioningConfigRequest"
9646 }
9647}
9648
9649/// Message for updating a ProvisioningConfig.
9650#[derive(Clone, Default, PartialEq)]
9651#[non_exhaustive]
9652pub struct UpdateProvisioningConfigRequest {
9653 /// Required. The ProvisioningConfig to update.
9654 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9655
9656 /// Required. The list of fields to update.
9657 pub update_mask: std::option::Option<wkt::FieldMask>,
9658
9659 /// Optional. Email provided to send a confirmation with provisioning config
9660 /// to.
9661 pub email: std::string::String,
9662
9663 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9664}
9665
9666impl UpdateProvisioningConfigRequest {
9667 /// Creates a new default instance.
9668 pub fn new() -> Self {
9669 std::default::Default::default()
9670 }
9671
9672 /// Sets the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9673 ///
9674 /// # Example
9675 /// ```ignore,no_run
9676 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9677 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9678 /// let x = UpdateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9679 /// ```
9680 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9681 where
9682 T: std::convert::Into<crate::model::ProvisioningConfig>,
9683 {
9684 self.provisioning_config = std::option::Option::Some(v.into());
9685 self
9686 }
9687
9688 /// Sets or clears the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9689 ///
9690 /// # Example
9691 /// ```ignore,no_run
9692 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9693 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9694 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9695 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9696 /// ```
9697 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9698 where
9699 T: std::convert::Into<crate::model::ProvisioningConfig>,
9700 {
9701 self.provisioning_config = v.map(|x| x.into());
9702 self
9703 }
9704
9705 /// Sets the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9706 ///
9707 /// # Example
9708 /// ```ignore,no_run
9709 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9710 /// use wkt::FieldMask;
9711 /// let x = UpdateProvisioningConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9712 /// ```
9713 pub fn set_update_mask<T>(mut self, v: T) -> Self
9714 where
9715 T: std::convert::Into<wkt::FieldMask>,
9716 {
9717 self.update_mask = std::option::Option::Some(v.into());
9718 self
9719 }
9720
9721 /// Sets or clears the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9722 ///
9723 /// # Example
9724 /// ```ignore,no_run
9725 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9726 /// use wkt::FieldMask;
9727 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9728 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9729 /// ```
9730 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9731 where
9732 T: std::convert::Into<wkt::FieldMask>,
9733 {
9734 self.update_mask = v.map(|x| x.into());
9735 self
9736 }
9737
9738 /// Sets the value of [email][crate::model::UpdateProvisioningConfigRequest::email].
9739 ///
9740 /// # Example
9741 /// ```ignore,no_run
9742 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9743 /// let x = UpdateProvisioningConfigRequest::new().set_email("example");
9744 /// ```
9745 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9746 self.email = v.into();
9747 self
9748 }
9749}
9750
9751impl wkt::message::Message for UpdateProvisioningConfigRequest {
9752 fn typename() -> &'static str {
9753 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateProvisioningConfigRequest"
9754 }
9755}
9756
9757/// An SSH key, used for authorizing with the interactive serial console feature.
9758#[derive(Clone, Default, PartialEq)]
9759#[non_exhaustive]
9760pub struct SSHKey {
9761 /// Output only. The name of this SSH key.
9762 /// Currently, the only valid value for the location is "global".
9763 pub name: std::string::String,
9764
9765 /// The public SSH key. This must be in OpenSSH .authorized_keys format.
9766 pub public_key: std::string::String,
9767
9768 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9769}
9770
9771impl SSHKey {
9772 /// Creates a new default instance.
9773 pub fn new() -> Self {
9774 std::default::Default::default()
9775 }
9776
9777 /// Sets the value of [name][crate::model::SSHKey::name].
9778 ///
9779 /// # Example
9780 /// ```ignore,no_run
9781 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9782 /// let x = SSHKey::new().set_name("example");
9783 /// ```
9784 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9785 self.name = v.into();
9786 self
9787 }
9788
9789 /// Sets the value of [public_key][crate::model::SSHKey::public_key].
9790 ///
9791 /// # Example
9792 /// ```ignore,no_run
9793 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9794 /// let x = SSHKey::new().set_public_key("example");
9795 /// ```
9796 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9797 self.public_key = v.into();
9798 self
9799 }
9800}
9801
9802impl wkt::message::Message for SSHKey {
9803 fn typename() -> &'static str {
9804 "type.googleapis.com/google.cloud.baremetalsolution.v2.SSHKey"
9805 }
9806}
9807
9808/// Message for listing the public SSH keys in a project.
9809#[derive(Clone, Default, PartialEq)]
9810#[non_exhaustive]
9811pub struct ListSSHKeysRequest {
9812 /// Required. The parent containing the SSH keys.
9813 /// Currently, the only valid value for the location is "global".
9814 pub parent: std::string::String,
9815
9816 /// The maximum number of items to return.
9817 pub page_size: i32,
9818
9819 /// The next_page_token value returned from a previous List request, if any.
9820 pub page_token: std::string::String,
9821
9822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9823}
9824
9825impl ListSSHKeysRequest {
9826 /// Creates a new default instance.
9827 pub fn new() -> Self {
9828 std::default::Default::default()
9829 }
9830
9831 /// Sets the value of [parent][crate::model::ListSSHKeysRequest::parent].
9832 ///
9833 /// # Example
9834 /// ```ignore,no_run
9835 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9836 /// let x = ListSSHKeysRequest::new().set_parent("example");
9837 /// ```
9838 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9839 self.parent = v.into();
9840 self
9841 }
9842
9843 /// Sets the value of [page_size][crate::model::ListSSHKeysRequest::page_size].
9844 ///
9845 /// # Example
9846 /// ```ignore,no_run
9847 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9848 /// let x = ListSSHKeysRequest::new().set_page_size(42);
9849 /// ```
9850 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9851 self.page_size = v.into();
9852 self
9853 }
9854
9855 /// Sets the value of [page_token][crate::model::ListSSHKeysRequest::page_token].
9856 ///
9857 /// # Example
9858 /// ```ignore,no_run
9859 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9860 /// let x = ListSSHKeysRequest::new().set_page_token("example");
9861 /// ```
9862 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9863 self.page_token = v.into();
9864 self
9865 }
9866}
9867
9868impl wkt::message::Message for ListSSHKeysRequest {
9869 fn typename() -> &'static str {
9870 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysRequest"
9871 }
9872}
9873
9874/// Message for response of ListSSHKeys.
9875#[derive(Clone, Default, PartialEq)]
9876#[non_exhaustive]
9877pub struct ListSSHKeysResponse {
9878 /// The SSH keys registered in the project.
9879 pub ssh_keys: std::vec::Vec<crate::model::SSHKey>,
9880
9881 /// Token to retrieve the next page of results, or empty if there are no more
9882 /// results in the list.
9883 pub next_page_token: std::string::String,
9884
9885 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9886}
9887
9888impl ListSSHKeysResponse {
9889 /// Creates a new default instance.
9890 pub fn new() -> Self {
9891 std::default::Default::default()
9892 }
9893
9894 /// Sets the value of [ssh_keys][crate::model::ListSSHKeysResponse::ssh_keys].
9895 ///
9896 /// # Example
9897 /// ```ignore,no_run
9898 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
9899 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9900 /// let x = ListSSHKeysResponse::new()
9901 /// .set_ssh_keys([
9902 /// SSHKey::default()/* use setters */,
9903 /// SSHKey::default()/* use (different) setters */,
9904 /// ]);
9905 /// ```
9906 pub fn set_ssh_keys<T, V>(mut self, v: T) -> Self
9907 where
9908 T: std::iter::IntoIterator<Item = V>,
9909 V: std::convert::Into<crate::model::SSHKey>,
9910 {
9911 use std::iter::Iterator;
9912 self.ssh_keys = v.into_iter().map(|i| i.into()).collect();
9913 self
9914 }
9915
9916 /// Sets the value of [next_page_token][crate::model::ListSSHKeysResponse::next_page_token].
9917 ///
9918 /// # Example
9919 /// ```ignore,no_run
9920 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
9921 /// let x = ListSSHKeysResponse::new().set_next_page_token("example");
9922 /// ```
9923 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9924 self.next_page_token = v.into();
9925 self
9926 }
9927}
9928
9929impl wkt::message::Message for ListSSHKeysResponse {
9930 fn typename() -> &'static str {
9931 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysResponse"
9932 }
9933}
9934
9935#[doc(hidden)]
9936impl google_cloud_gax::paginator::internal::PageableResponse for ListSSHKeysResponse {
9937 type PageItem = crate::model::SSHKey;
9938
9939 fn items(self) -> std::vec::Vec<Self::PageItem> {
9940 self.ssh_keys
9941 }
9942
9943 fn next_page_token(&self) -> std::string::String {
9944 use std::clone::Clone;
9945 self.next_page_token.clone()
9946 }
9947}
9948
9949/// Message for registering a public SSH key in a project.
9950#[derive(Clone, Default, PartialEq)]
9951#[non_exhaustive]
9952pub struct CreateSSHKeyRequest {
9953 /// Required. The parent containing the SSH keys.
9954 pub parent: std::string::String,
9955
9956 /// Required. The SSH key to register.
9957 pub ssh_key: std::option::Option<crate::model::SSHKey>,
9958
9959 /// Required. The ID to use for the key, which will become the final component
9960 /// of the key's resource name.
9961 ///
9962 /// This value must match the regex:
9963 /// [a-zA-Z0-9@.\-_]{1,64}
9964 pub ssh_key_id: std::string::String,
9965
9966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9967}
9968
9969impl CreateSSHKeyRequest {
9970 /// Creates a new default instance.
9971 pub fn new() -> Self {
9972 std::default::Default::default()
9973 }
9974
9975 /// Sets the value of [parent][crate::model::CreateSSHKeyRequest::parent].
9976 ///
9977 /// # Example
9978 /// ```ignore,no_run
9979 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9980 /// let x = CreateSSHKeyRequest::new().set_parent("example");
9981 /// ```
9982 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9983 self.parent = v.into();
9984 self
9985 }
9986
9987 /// Sets the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
9988 ///
9989 /// # Example
9990 /// ```ignore,no_run
9991 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
9992 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
9993 /// let x = CreateSSHKeyRequest::new().set_ssh_key(SSHKey::default()/* use setters */);
9994 /// ```
9995 pub fn set_ssh_key<T>(mut self, v: T) -> Self
9996 where
9997 T: std::convert::Into<crate::model::SSHKey>,
9998 {
9999 self.ssh_key = std::option::Option::Some(v.into());
10000 self
10001 }
10002
10003 /// Sets or clears the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
10004 ///
10005 /// # Example
10006 /// ```ignore,no_run
10007 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10008 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
10009 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(Some(SSHKey::default()/* use setters */));
10010 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(None::<SSHKey>);
10011 /// ```
10012 pub fn set_or_clear_ssh_key<T>(mut self, v: std::option::Option<T>) -> Self
10013 where
10014 T: std::convert::Into<crate::model::SSHKey>,
10015 {
10016 self.ssh_key = v.map(|x| x.into());
10017 self
10018 }
10019
10020 /// Sets the value of [ssh_key_id][crate::model::CreateSSHKeyRequest::ssh_key_id].
10021 ///
10022 /// # Example
10023 /// ```ignore,no_run
10024 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10025 /// let x = CreateSSHKeyRequest::new().set_ssh_key_id("example");
10026 /// ```
10027 pub fn set_ssh_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10028 self.ssh_key_id = v.into();
10029 self
10030 }
10031}
10032
10033impl wkt::message::Message for CreateSSHKeyRequest {
10034 fn typename() -> &'static str {
10035 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateSSHKeyRequest"
10036 }
10037}
10038
10039/// Message for deleting an SSH key from a project.
10040#[derive(Clone, Default, PartialEq)]
10041#[non_exhaustive]
10042pub struct DeleteSSHKeyRequest {
10043 /// Required. The name of the SSH key to delete.
10044 /// Currently, the only valid value for the location is "global".
10045 pub name: std::string::String,
10046
10047 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10048}
10049
10050impl DeleteSSHKeyRequest {
10051 /// Creates a new default instance.
10052 pub fn new() -> Self {
10053 std::default::Default::default()
10054 }
10055
10056 /// Sets the value of [name][crate::model::DeleteSSHKeyRequest::name].
10057 ///
10058 /// # Example
10059 /// ```ignore,no_run
10060 /// # use google_cloud_baremetalsolution_v2::model::DeleteSSHKeyRequest;
10061 /// let x = DeleteSSHKeyRequest::new().set_name("example");
10062 /// ```
10063 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10064 self.name = v.into();
10065 self
10066 }
10067}
10068
10069impl wkt::message::Message for DeleteSSHKeyRequest {
10070 fn typename() -> &'static str {
10071 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteSSHKeyRequest"
10072 }
10073}
10074
10075/// A storage volume.
10076#[derive(Clone, Default, PartialEq)]
10077#[non_exhaustive]
10078pub struct Volume {
10079 /// Output only. The resource name of this `Volume`.
10080 /// Resource names are schemeless URIs that follow the conventions in
10081 /// <https://cloud.google.com/apis/design/resource_names>.
10082 /// Format:
10083 /// `projects/{project}/locations/{location}/volumes/{volume}`
10084 pub name: std::string::String,
10085
10086 /// An identifier for the `Volume`, generated by the backend.
10087 pub id: std::string::String,
10088
10089 /// The storage type for this volume.
10090 pub storage_type: crate::model::volume::StorageType,
10091
10092 /// The state of this storage volume.
10093 pub state: crate::model::volume::State,
10094
10095 /// The requested size of this storage volume, in GiB.
10096 pub requested_size_gib: i64,
10097
10098 /// Originally requested size, in GiB.
10099 pub originally_requested_size_gib: i64,
10100
10101 /// The current size of this storage volume, in GiB, including space reserved
10102 /// for snapshots. This size might be different than the requested size if the
10103 /// storage volume has been configured with auto grow or auto shrink.
10104 pub current_size_gib: i64,
10105
10106 /// Additional emergency size that was requested for this Volume, in GiB.
10107 /// current_size_gib includes this value.
10108 pub emergency_size_gib: i64,
10109
10110 /// Maximum size volume can be expanded to in case of evergency, in GiB.
10111 pub max_size_gib: i64,
10112
10113 /// The size, in GiB, that this storage volume has expanded as a result of an
10114 /// auto grow policy. In the absence of auto-grow, the value is 0.
10115 pub auto_grown_size_gib: i64,
10116
10117 /// The space remaining in the storage volume for new LUNs, in GiB, excluding
10118 /// space reserved for snapshots.
10119 pub remaining_space_gib: i64,
10120
10121 /// Details about snapshot space reservation and usage on the storage volume.
10122 pub snapshot_reservation_detail:
10123 std::option::Option<crate::model::volume::SnapshotReservationDetail>,
10124
10125 /// The behavior to use when snapshot reserved space is full.
10126 pub snapshot_auto_delete_behavior: crate::model::volume::SnapshotAutoDeleteBehavior,
10127
10128 /// Labels as key value pairs.
10129 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10130
10131 /// Whether snapshots are enabled.
10132 pub snapshot_enabled: bool,
10133
10134 /// Immutable. Pod name.
10135 pub pod: std::string::String,
10136
10137 /// Output only. Storage protocol for the Volume.
10138 pub protocol: crate::model::volume::Protocol,
10139
10140 /// Output only. Whether this volume is a boot volume. A boot volume is one
10141 /// which contains a boot LUN.
10142 pub boot_volume: bool,
10143
10144 /// Immutable. Performance tier of the Volume.
10145 /// Default is SHARED.
10146 pub performance_tier: crate::model::VolumePerformanceTier,
10147
10148 /// Input only. User-specified notes for new Volume.
10149 /// Used to provision Volumes that require manual intervention.
10150 pub notes: std::string::String,
10151
10152 /// The workload profile for the volume.
10153 pub workload_profile: crate::model::volume::WorkloadProfile,
10154
10155 /// Output only. Time after which volume will be fully deleted.
10156 /// It is filled only for volumes in COOLOFF state.
10157 pub expire_time: std::option::Option<wkt::Timestamp>,
10158
10159 /// Output only. Instances this Volume is attached to.
10160 /// This field is set only in Get requests.
10161 pub instances: std::vec::Vec<std::string::String>,
10162
10163 /// Output only. Is the Volume attached at at least one instance.
10164 /// This field is a lightweight counterpart of `instances` field.
10165 /// It is filled in List responses as well.
10166 pub attached: bool,
10167
10168 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10169}
10170
10171impl Volume {
10172 /// Creates a new default instance.
10173 pub fn new() -> Self {
10174 std::default::Default::default()
10175 }
10176
10177 /// Sets the value of [name][crate::model::Volume::name].
10178 ///
10179 /// # Example
10180 /// ```ignore,no_run
10181 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10182 /// let x = Volume::new().set_name("example");
10183 /// ```
10184 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10185 self.name = v.into();
10186 self
10187 }
10188
10189 /// Sets the value of [id][crate::model::Volume::id].
10190 ///
10191 /// # Example
10192 /// ```ignore,no_run
10193 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10194 /// let x = Volume::new().set_id("example");
10195 /// ```
10196 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10197 self.id = v.into();
10198 self
10199 }
10200
10201 /// Sets the value of [storage_type][crate::model::Volume::storage_type].
10202 ///
10203 /// # Example
10204 /// ```ignore,no_run
10205 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10206 /// use google_cloud_baremetalsolution_v2::model::volume::StorageType;
10207 /// let x0 = Volume::new().set_storage_type(StorageType::Ssd);
10208 /// let x1 = Volume::new().set_storage_type(StorageType::Hdd);
10209 /// ```
10210 pub fn set_storage_type<T: std::convert::Into<crate::model::volume::StorageType>>(
10211 mut self,
10212 v: T,
10213 ) -> Self {
10214 self.storage_type = v.into();
10215 self
10216 }
10217
10218 /// Sets the value of [state][crate::model::Volume::state].
10219 ///
10220 /// # Example
10221 /// ```ignore,no_run
10222 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10223 /// use google_cloud_baremetalsolution_v2::model::volume::State;
10224 /// let x0 = Volume::new().set_state(State::Creating);
10225 /// let x1 = Volume::new().set_state(State::Ready);
10226 /// let x2 = Volume::new().set_state(State::Deleting);
10227 /// ```
10228 pub fn set_state<T: std::convert::Into<crate::model::volume::State>>(mut self, v: T) -> Self {
10229 self.state = v.into();
10230 self
10231 }
10232
10233 /// Sets the value of [requested_size_gib][crate::model::Volume::requested_size_gib].
10234 ///
10235 /// # Example
10236 /// ```ignore,no_run
10237 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10238 /// let x = Volume::new().set_requested_size_gib(42);
10239 /// ```
10240 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10241 self.requested_size_gib = v.into();
10242 self
10243 }
10244
10245 /// Sets the value of [originally_requested_size_gib][crate::model::Volume::originally_requested_size_gib].
10246 ///
10247 /// # Example
10248 /// ```ignore,no_run
10249 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10250 /// let x = Volume::new().set_originally_requested_size_gib(42);
10251 /// ```
10252 pub fn set_originally_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10253 self.originally_requested_size_gib = v.into();
10254 self
10255 }
10256
10257 /// Sets the value of [current_size_gib][crate::model::Volume::current_size_gib].
10258 ///
10259 /// # Example
10260 /// ```ignore,no_run
10261 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10262 /// let x = Volume::new().set_current_size_gib(42);
10263 /// ```
10264 pub fn set_current_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10265 self.current_size_gib = v.into();
10266 self
10267 }
10268
10269 /// Sets the value of [emergency_size_gib][crate::model::Volume::emergency_size_gib].
10270 ///
10271 /// # Example
10272 /// ```ignore,no_run
10273 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10274 /// let x = Volume::new().set_emergency_size_gib(42);
10275 /// ```
10276 pub fn set_emergency_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10277 self.emergency_size_gib = v.into();
10278 self
10279 }
10280
10281 /// Sets the value of [max_size_gib][crate::model::Volume::max_size_gib].
10282 ///
10283 /// # Example
10284 /// ```ignore,no_run
10285 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10286 /// let x = Volume::new().set_max_size_gib(42);
10287 /// ```
10288 pub fn set_max_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10289 self.max_size_gib = v.into();
10290 self
10291 }
10292
10293 /// Sets the value of [auto_grown_size_gib][crate::model::Volume::auto_grown_size_gib].
10294 ///
10295 /// # Example
10296 /// ```ignore,no_run
10297 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10298 /// let x = Volume::new().set_auto_grown_size_gib(42);
10299 /// ```
10300 pub fn set_auto_grown_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10301 self.auto_grown_size_gib = v.into();
10302 self
10303 }
10304
10305 /// Sets the value of [remaining_space_gib][crate::model::Volume::remaining_space_gib].
10306 ///
10307 /// # Example
10308 /// ```ignore,no_run
10309 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10310 /// let x = Volume::new().set_remaining_space_gib(42);
10311 /// ```
10312 pub fn set_remaining_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10313 self.remaining_space_gib = v.into();
10314 self
10315 }
10316
10317 /// Sets the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10318 ///
10319 /// # Example
10320 /// ```ignore,no_run
10321 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10322 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10323 /// let x = Volume::new().set_snapshot_reservation_detail(SnapshotReservationDetail::default()/* use setters */);
10324 /// ```
10325 pub fn set_snapshot_reservation_detail<T>(mut self, v: T) -> Self
10326 where
10327 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10328 {
10329 self.snapshot_reservation_detail = std::option::Option::Some(v.into());
10330 self
10331 }
10332
10333 /// Sets or clears the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10334 ///
10335 /// # Example
10336 /// ```ignore,no_run
10337 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10338 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10339 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(Some(SnapshotReservationDetail::default()/* use setters */));
10340 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(None::<SnapshotReservationDetail>);
10341 /// ```
10342 pub fn set_or_clear_snapshot_reservation_detail<T>(mut self, v: std::option::Option<T>) -> Self
10343 where
10344 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10345 {
10346 self.snapshot_reservation_detail = v.map(|x| x.into());
10347 self
10348 }
10349
10350 /// Sets the value of [snapshot_auto_delete_behavior][crate::model::Volume::snapshot_auto_delete_behavior].
10351 ///
10352 /// # Example
10353 /// ```ignore,no_run
10354 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10355 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotAutoDeleteBehavior;
10356 /// let x0 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::Disabled);
10357 /// let x1 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::OldestFirst);
10358 /// let x2 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::NewestFirst);
10359 /// ```
10360 pub fn set_snapshot_auto_delete_behavior<
10361 T: std::convert::Into<crate::model::volume::SnapshotAutoDeleteBehavior>,
10362 >(
10363 mut self,
10364 v: T,
10365 ) -> Self {
10366 self.snapshot_auto_delete_behavior = v.into();
10367 self
10368 }
10369
10370 /// Sets the value of [labels][crate::model::Volume::labels].
10371 ///
10372 /// # Example
10373 /// ```ignore,no_run
10374 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10375 /// let x = Volume::new().set_labels([
10376 /// ("key0", "abc"),
10377 /// ("key1", "xyz"),
10378 /// ]);
10379 /// ```
10380 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10381 where
10382 T: std::iter::IntoIterator<Item = (K, V)>,
10383 K: std::convert::Into<std::string::String>,
10384 V: std::convert::Into<std::string::String>,
10385 {
10386 use std::iter::Iterator;
10387 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10388 self
10389 }
10390
10391 /// Sets the value of [snapshot_enabled][crate::model::Volume::snapshot_enabled].
10392 ///
10393 /// # Example
10394 /// ```ignore,no_run
10395 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10396 /// let x = Volume::new().set_snapshot_enabled(true);
10397 /// ```
10398 pub fn set_snapshot_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10399 self.snapshot_enabled = v.into();
10400 self
10401 }
10402
10403 /// Sets the value of [pod][crate::model::Volume::pod].
10404 ///
10405 /// # Example
10406 /// ```ignore,no_run
10407 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10408 /// let x = Volume::new().set_pod("example");
10409 /// ```
10410 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10411 self.pod = v.into();
10412 self
10413 }
10414
10415 /// Sets the value of [protocol][crate::model::Volume::protocol].
10416 ///
10417 /// # Example
10418 /// ```ignore,no_run
10419 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10420 /// use google_cloud_baremetalsolution_v2::model::volume::Protocol;
10421 /// let x0 = Volume::new().set_protocol(Protocol::FibreChannel);
10422 /// let x1 = Volume::new().set_protocol(Protocol::Nfs);
10423 /// ```
10424 pub fn set_protocol<T: std::convert::Into<crate::model::volume::Protocol>>(
10425 mut self,
10426 v: T,
10427 ) -> Self {
10428 self.protocol = v.into();
10429 self
10430 }
10431
10432 /// Sets the value of [boot_volume][crate::model::Volume::boot_volume].
10433 ///
10434 /// # Example
10435 /// ```ignore,no_run
10436 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10437 /// let x = Volume::new().set_boot_volume(true);
10438 /// ```
10439 pub fn set_boot_volume<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10440 self.boot_volume = v.into();
10441 self
10442 }
10443
10444 /// Sets the value of [performance_tier][crate::model::Volume::performance_tier].
10445 ///
10446 /// # Example
10447 /// ```ignore,no_run
10448 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10449 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
10450 /// let x0 = Volume::new().set_performance_tier(VolumePerformanceTier::Shared);
10451 /// let x1 = Volume::new().set_performance_tier(VolumePerformanceTier::Assigned);
10452 /// let x2 = Volume::new().set_performance_tier(VolumePerformanceTier::Ht);
10453 /// ```
10454 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
10455 mut self,
10456 v: T,
10457 ) -> Self {
10458 self.performance_tier = v.into();
10459 self
10460 }
10461
10462 /// Sets the value of [notes][crate::model::Volume::notes].
10463 ///
10464 /// # Example
10465 /// ```ignore,no_run
10466 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10467 /// let x = Volume::new().set_notes("example");
10468 /// ```
10469 pub fn set_notes<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10470 self.notes = v.into();
10471 self
10472 }
10473
10474 /// Sets the value of [workload_profile][crate::model::Volume::workload_profile].
10475 ///
10476 /// # Example
10477 /// ```ignore,no_run
10478 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10479 /// use google_cloud_baremetalsolution_v2::model::volume::WorkloadProfile;
10480 /// let x0 = Volume::new().set_workload_profile(WorkloadProfile::Generic);
10481 /// let x1 = Volume::new().set_workload_profile(WorkloadProfile::Hana);
10482 /// ```
10483 pub fn set_workload_profile<T: std::convert::Into<crate::model::volume::WorkloadProfile>>(
10484 mut self,
10485 v: T,
10486 ) -> Self {
10487 self.workload_profile = v.into();
10488 self
10489 }
10490
10491 /// Sets the value of [expire_time][crate::model::Volume::expire_time].
10492 ///
10493 /// # Example
10494 /// ```ignore,no_run
10495 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10496 /// use wkt::Timestamp;
10497 /// let x = Volume::new().set_expire_time(Timestamp::default()/* use setters */);
10498 /// ```
10499 pub fn set_expire_time<T>(mut self, v: T) -> Self
10500 where
10501 T: std::convert::Into<wkt::Timestamp>,
10502 {
10503 self.expire_time = std::option::Option::Some(v.into());
10504 self
10505 }
10506
10507 /// Sets or clears the value of [expire_time][crate::model::Volume::expire_time].
10508 ///
10509 /// # Example
10510 /// ```ignore,no_run
10511 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10512 /// use wkt::Timestamp;
10513 /// let x = Volume::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10514 /// let x = Volume::new().set_or_clear_expire_time(None::<Timestamp>);
10515 /// ```
10516 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10517 where
10518 T: std::convert::Into<wkt::Timestamp>,
10519 {
10520 self.expire_time = v.map(|x| x.into());
10521 self
10522 }
10523
10524 /// Sets the value of [instances][crate::model::Volume::instances].
10525 ///
10526 /// # Example
10527 /// ```ignore,no_run
10528 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10529 /// let x = Volume::new().set_instances(["a", "b", "c"]);
10530 /// ```
10531 pub fn set_instances<T, V>(mut self, v: T) -> Self
10532 where
10533 T: std::iter::IntoIterator<Item = V>,
10534 V: std::convert::Into<std::string::String>,
10535 {
10536 use std::iter::Iterator;
10537 self.instances = v.into_iter().map(|i| i.into()).collect();
10538 self
10539 }
10540
10541 /// Sets the value of [attached][crate::model::Volume::attached].
10542 ///
10543 /// # Example
10544 /// ```ignore,no_run
10545 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10546 /// let x = Volume::new().set_attached(true);
10547 /// ```
10548 pub fn set_attached<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10549 self.attached = v.into();
10550 self
10551 }
10552}
10553
10554impl wkt::message::Message for Volume {
10555 fn typename() -> &'static str {
10556 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume"
10557 }
10558}
10559
10560/// Defines additional types related to [Volume].
10561pub mod volume {
10562 #[allow(unused_imports)]
10563 use super::*;
10564
10565 /// Details about snapshot space reservation and usage on the storage volume.
10566 #[derive(Clone, Default, PartialEq)]
10567 #[non_exhaustive]
10568 pub struct SnapshotReservationDetail {
10569 /// The space on this storage volume reserved for snapshots, shown in GiB.
10570 pub reserved_space_gib: i64,
10571
10572 /// The percent of snapshot space on this storage volume actually being used
10573 /// by the snapshot copies. This value might be higher than 100% if the
10574 /// snapshot copies have overflowed into the data portion of the storage
10575 /// volume.
10576 pub reserved_space_used_percent: i32,
10577
10578 /// The amount, in GiB, of available space in this storage volume's reserved
10579 /// snapshot space.
10580 pub reserved_space_remaining_gib: i64,
10581
10582 /// Percent of the total Volume size reserved for snapshot copies.
10583 /// Enabling snapshots requires reserving 20% or more of
10584 /// the storage volume space for snapshots. Maximum reserved space for
10585 /// snapshots is 40%.
10586 /// Setting this field will effectively set snapshot_enabled to true.
10587 pub reserved_space_percent: i32,
10588
10589 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10590 }
10591
10592 impl SnapshotReservationDetail {
10593 /// Creates a new default instance.
10594 pub fn new() -> Self {
10595 std::default::Default::default()
10596 }
10597
10598 /// Sets the value of [reserved_space_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_gib].
10599 ///
10600 /// # Example
10601 /// ```ignore,no_run
10602 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10603 /// let x = SnapshotReservationDetail::new().set_reserved_space_gib(42);
10604 /// ```
10605 pub fn set_reserved_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10606 self.reserved_space_gib = v.into();
10607 self
10608 }
10609
10610 /// Sets the value of [reserved_space_used_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_used_percent].
10611 ///
10612 /// # Example
10613 /// ```ignore,no_run
10614 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10615 /// let x = SnapshotReservationDetail::new().set_reserved_space_used_percent(42);
10616 /// ```
10617 pub fn set_reserved_space_used_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10618 self.reserved_space_used_percent = v.into();
10619 self
10620 }
10621
10622 /// Sets the value of [reserved_space_remaining_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_remaining_gib].
10623 ///
10624 /// # Example
10625 /// ```ignore,no_run
10626 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10627 /// let x = SnapshotReservationDetail::new().set_reserved_space_remaining_gib(42);
10628 /// ```
10629 pub fn set_reserved_space_remaining_gib<T: std::convert::Into<i64>>(
10630 mut self,
10631 v: T,
10632 ) -> Self {
10633 self.reserved_space_remaining_gib = v.into();
10634 self
10635 }
10636
10637 /// Sets the value of [reserved_space_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_percent].
10638 ///
10639 /// # Example
10640 /// ```ignore,no_run
10641 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10642 /// let x = SnapshotReservationDetail::new().set_reserved_space_percent(42);
10643 /// ```
10644 pub fn set_reserved_space_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10645 self.reserved_space_percent = v.into();
10646 self
10647 }
10648 }
10649
10650 impl wkt::message::Message for SnapshotReservationDetail {
10651 fn typename() -> &'static str {
10652 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume.SnapshotReservationDetail"
10653 }
10654 }
10655
10656 /// The storage type for a volume.
10657 ///
10658 /// # Working with unknown values
10659 ///
10660 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10661 /// additional enum variants at any time. Adding new variants is not considered
10662 /// a breaking change. Applications should write their code in anticipation of:
10663 ///
10664 /// - New values appearing in future releases of the client library, **and**
10665 /// - New values received dynamically, without application changes.
10666 ///
10667 /// Please consult the [Working with enums] section in the user guide for some
10668 /// guidelines.
10669 ///
10670 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10671 #[derive(Clone, Debug, PartialEq)]
10672 #[non_exhaustive]
10673 pub enum StorageType {
10674 /// The storage type for this volume is unknown.
10675 Unspecified,
10676 /// The storage type for this volume is SSD.
10677 Ssd,
10678 /// This storage type for this volume is HDD.
10679 Hdd,
10680 /// If set, the enum was initialized with an unknown value.
10681 ///
10682 /// Applications can examine the value using [StorageType::value] or
10683 /// [StorageType::name].
10684 UnknownValue(storage_type::UnknownValue),
10685 }
10686
10687 #[doc(hidden)]
10688 pub mod storage_type {
10689 #[allow(unused_imports)]
10690 use super::*;
10691 #[derive(Clone, Debug, PartialEq)]
10692 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10693 }
10694
10695 impl StorageType {
10696 /// Gets the enum value.
10697 ///
10698 /// Returns `None` if the enum contains an unknown value deserialized from
10699 /// the string representation of enums.
10700 pub fn value(&self) -> std::option::Option<i32> {
10701 match self {
10702 Self::Unspecified => std::option::Option::Some(0),
10703 Self::Ssd => std::option::Option::Some(1),
10704 Self::Hdd => std::option::Option::Some(2),
10705 Self::UnknownValue(u) => u.0.value(),
10706 }
10707 }
10708
10709 /// Gets the enum value as a string.
10710 ///
10711 /// Returns `None` if the enum contains an unknown value deserialized from
10712 /// the integer representation of enums.
10713 pub fn name(&self) -> std::option::Option<&str> {
10714 match self {
10715 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
10716 Self::Ssd => std::option::Option::Some("SSD"),
10717 Self::Hdd => std::option::Option::Some("HDD"),
10718 Self::UnknownValue(u) => u.0.name(),
10719 }
10720 }
10721 }
10722
10723 impl std::default::Default for StorageType {
10724 fn default() -> Self {
10725 use std::convert::From;
10726 Self::from(0)
10727 }
10728 }
10729
10730 impl std::fmt::Display for StorageType {
10731 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10732 wkt::internal::display_enum(f, self.name(), self.value())
10733 }
10734 }
10735
10736 impl std::convert::From<i32> for StorageType {
10737 fn from(value: i32) -> Self {
10738 match value {
10739 0 => Self::Unspecified,
10740 1 => Self::Ssd,
10741 2 => Self::Hdd,
10742 _ => Self::UnknownValue(storage_type::UnknownValue(
10743 wkt::internal::UnknownEnumValue::Integer(value),
10744 )),
10745 }
10746 }
10747 }
10748
10749 impl std::convert::From<&str> for StorageType {
10750 fn from(value: &str) -> Self {
10751 use std::string::ToString;
10752 match value {
10753 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
10754 "SSD" => Self::Ssd,
10755 "HDD" => Self::Hdd,
10756 _ => Self::UnknownValue(storage_type::UnknownValue(
10757 wkt::internal::UnknownEnumValue::String(value.to_string()),
10758 )),
10759 }
10760 }
10761 }
10762
10763 impl serde::ser::Serialize for StorageType {
10764 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10765 where
10766 S: serde::Serializer,
10767 {
10768 match self {
10769 Self::Unspecified => serializer.serialize_i32(0),
10770 Self::Ssd => serializer.serialize_i32(1),
10771 Self::Hdd => serializer.serialize_i32(2),
10772 Self::UnknownValue(u) => u.0.serialize(serializer),
10773 }
10774 }
10775 }
10776
10777 impl<'de> serde::de::Deserialize<'de> for StorageType {
10778 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10779 where
10780 D: serde::Deserializer<'de>,
10781 {
10782 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
10783 ".google.cloud.baremetalsolution.v2.Volume.StorageType",
10784 ))
10785 }
10786 }
10787
10788 /// The possible states for a storage volume.
10789 ///
10790 /// # Working with unknown values
10791 ///
10792 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10793 /// additional enum variants at any time. Adding new variants is not considered
10794 /// a breaking change. Applications should write their code in anticipation of:
10795 ///
10796 /// - New values appearing in future releases of the client library, **and**
10797 /// - New values received dynamically, without application changes.
10798 ///
10799 /// Please consult the [Working with enums] section in the user guide for some
10800 /// guidelines.
10801 ///
10802 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10803 #[derive(Clone, Debug, PartialEq)]
10804 #[non_exhaustive]
10805 pub enum State {
10806 /// The storage volume is in an unknown state.
10807 Unspecified,
10808 /// The storage volume is being created.
10809 Creating,
10810 /// The storage volume is ready for use.
10811 Ready,
10812 /// The storage volume has been requested to be deleted.
10813 Deleting,
10814 /// The storage volume is being updated.
10815 Updating,
10816 /// The storage volume is in cool off state. It will be deleted after
10817 /// `expire_time`.
10818 CoolOff,
10819 /// If set, the enum was initialized with an unknown value.
10820 ///
10821 /// Applications can examine the value using [State::value] or
10822 /// [State::name].
10823 UnknownValue(state::UnknownValue),
10824 }
10825
10826 #[doc(hidden)]
10827 pub mod state {
10828 #[allow(unused_imports)]
10829 use super::*;
10830 #[derive(Clone, Debug, PartialEq)]
10831 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10832 }
10833
10834 impl State {
10835 /// Gets the enum value.
10836 ///
10837 /// Returns `None` if the enum contains an unknown value deserialized from
10838 /// the string representation of enums.
10839 pub fn value(&self) -> std::option::Option<i32> {
10840 match self {
10841 Self::Unspecified => std::option::Option::Some(0),
10842 Self::Creating => std::option::Option::Some(1),
10843 Self::Ready => std::option::Option::Some(2),
10844 Self::Deleting => std::option::Option::Some(3),
10845 Self::Updating => std::option::Option::Some(4),
10846 Self::CoolOff => std::option::Option::Some(5),
10847 Self::UnknownValue(u) => u.0.value(),
10848 }
10849 }
10850
10851 /// Gets the enum value as a string.
10852 ///
10853 /// Returns `None` if the enum contains an unknown value deserialized from
10854 /// the integer representation of enums.
10855 pub fn name(&self) -> std::option::Option<&str> {
10856 match self {
10857 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10858 Self::Creating => std::option::Option::Some("CREATING"),
10859 Self::Ready => std::option::Option::Some("READY"),
10860 Self::Deleting => std::option::Option::Some("DELETING"),
10861 Self::Updating => std::option::Option::Some("UPDATING"),
10862 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
10863 Self::UnknownValue(u) => u.0.name(),
10864 }
10865 }
10866 }
10867
10868 impl std::default::Default for State {
10869 fn default() -> Self {
10870 use std::convert::From;
10871 Self::from(0)
10872 }
10873 }
10874
10875 impl std::fmt::Display for State {
10876 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10877 wkt::internal::display_enum(f, self.name(), self.value())
10878 }
10879 }
10880
10881 impl std::convert::From<i32> for State {
10882 fn from(value: i32) -> Self {
10883 match value {
10884 0 => Self::Unspecified,
10885 1 => Self::Creating,
10886 2 => Self::Ready,
10887 3 => Self::Deleting,
10888 4 => Self::Updating,
10889 5 => Self::CoolOff,
10890 _ => Self::UnknownValue(state::UnknownValue(
10891 wkt::internal::UnknownEnumValue::Integer(value),
10892 )),
10893 }
10894 }
10895 }
10896
10897 impl std::convert::From<&str> for State {
10898 fn from(value: &str) -> Self {
10899 use std::string::ToString;
10900 match value {
10901 "STATE_UNSPECIFIED" => Self::Unspecified,
10902 "CREATING" => Self::Creating,
10903 "READY" => Self::Ready,
10904 "DELETING" => Self::Deleting,
10905 "UPDATING" => Self::Updating,
10906 "COOL_OFF" => Self::CoolOff,
10907 _ => Self::UnknownValue(state::UnknownValue(
10908 wkt::internal::UnknownEnumValue::String(value.to_string()),
10909 )),
10910 }
10911 }
10912 }
10913
10914 impl serde::ser::Serialize for State {
10915 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10916 where
10917 S: serde::Serializer,
10918 {
10919 match self {
10920 Self::Unspecified => serializer.serialize_i32(0),
10921 Self::Creating => serializer.serialize_i32(1),
10922 Self::Ready => serializer.serialize_i32(2),
10923 Self::Deleting => serializer.serialize_i32(3),
10924 Self::Updating => serializer.serialize_i32(4),
10925 Self::CoolOff => serializer.serialize_i32(5),
10926 Self::UnknownValue(u) => u.0.serialize(serializer),
10927 }
10928 }
10929 }
10930
10931 impl<'de> serde::de::Deserialize<'de> for State {
10932 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10933 where
10934 D: serde::Deserializer<'de>,
10935 {
10936 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10937 ".google.cloud.baremetalsolution.v2.Volume.State",
10938 ))
10939 }
10940 }
10941
10942 /// The kinds of auto delete behavior to use when snapshot reserved space is
10943 /// full.
10944 ///
10945 /// # Working with unknown values
10946 ///
10947 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10948 /// additional enum variants at any time. Adding new variants is not considered
10949 /// a breaking change. Applications should write their code in anticipation of:
10950 ///
10951 /// - New values appearing in future releases of the client library, **and**
10952 /// - New values received dynamically, without application changes.
10953 ///
10954 /// Please consult the [Working with enums] section in the user guide for some
10955 /// guidelines.
10956 ///
10957 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10958 #[derive(Clone, Debug, PartialEq)]
10959 #[non_exhaustive]
10960 pub enum SnapshotAutoDeleteBehavior {
10961 /// The unspecified behavior.
10962 Unspecified,
10963 /// Don't delete any snapshots. This disables new snapshot creation, as
10964 /// long as the snapshot reserved space is full.
10965 Disabled,
10966 /// Delete the oldest snapshots first.
10967 OldestFirst,
10968 /// Delete the newest snapshots first.
10969 NewestFirst,
10970 /// If set, the enum was initialized with an unknown value.
10971 ///
10972 /// Applications can examine the value using [SnapshotAutoDeleteBehavior::value] or
10973 /// [SnapshotAutoDeleteBehavior::name].
10974 UnknownValue(snapshot_auto_delete_behavior::UnknownValue),
10975 }
10976
10977 #[doc(hidden)]
10978 pub mod snapshot_auto_delete_behavior {
10979 #[allow(unused_imports)]
10980 use super::*;
10981 #[derive(Clone, Debug, PartialEq)]
10982 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10983 }
10984
10985 impl SnapshotAutoDeleteBehavior {
10986 /// Gets the enum value.
10987 ///
10988 /// Returns `None` if the enum contains an unknown value deserialized from
10989 /// the string representation of enums.
10990 pub fn value(&self) -> std::option::Option<i32> {
10991 match self {
10992 Self::Unspecified => std::option::Option::Some(0),
10993 Self::Disabled => std::option::Option::Some(1),
10994 Self::OldestFirst => std::option::Option::Some(2),
10995 Self::NewestFirst => std::option::Option::Some(3),
10996 Self::UnknownValue(u) => u.0.value(),
10997 }
10998 }
10999
11000 /// Gets the enum value as a string.
11001 ///
11002 /// Returns `None` if the enum contains an unknown value deserialized from
11003 /// the integer representation of enums.
11004 pub fn name(&self) -> std::option::Option<&str> {
11005 match self {
11006 Self::Unspecified => {
11007 std::option::Option::Some("SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED")
11008 }
11009 Self::Disabled => std::option::Option::Some("DISABLED"),
11010 Self::OldestFirst => std::option::Option::Some("OLDEST_FIRST"),
11011 Self::NewestFirst => std::option::Option::Some("NEWEST_FIRST"),
11012 Self::UnknownValue(u) => u.0.name(),
11013 }
11014 }
11015 }
11016
11017 impl std::default::Default for SnapshotAutoDeleteBehavior {
11018 fn default() -> Self {
11019 use std::convert::From;
11020 Self::from(0)
11021 }
11022 }
11023
11024 impl std::fmt::Display for SnapshotAutoDeleteBehavior {
11025 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11026 wkt::internal::display_enum(f, self.name(), self.value())
11027 }
11028 }
11029
11030 impl std::convert::From<i32> for SnapshotAutoDeleteBehavior {
11031 fn from(value: i32) -> Self {
11032 match value {
11033 0 => Self::Unspecified,
11034 1 => Self::Disabled,
11035 2 => Self::OldestFirst,
11036 3 => Self::NewestFirst,
11037 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
11038 wkt::internal::UnknownEnumValue::Integer(value),
11039 )),
11040 }
11041 }
11042 }
11043
11044 impl std::convert::From<&str> for SnapshotAutoDeleteBehavior {
11045 fn from(value: &str) -> Self {
11046 use std::string::ToString;
11047 match value {
11048 "SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11049 "DISABLED" => Self::Disabled,
11050 "OLDEST_FIRST" => Self::OldestFirst,
11051 "NEWEST_FIRST" => Self::NewestFirst,
11052 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
11053 wkt::internal::UnknownEnumValue::String(value.to_string()),
11054 )),
11055 }
11056 }
11057 }
11058
11059 impl serde::ser::Serialize for SnapshotAutoDeleteBehavior {
11060 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11061 where
11062 S: serde::Serializer,
11063 {
11064 match self {
11065 Self::Unspecified => serializer.serialize_i32(0),
11066 Self::Disabled => serializer.serialize_i32(1),
11067 Self::OldestFirst => serializer.serialize_i32(2),
11068 Self::NewestFirst => serializer.serialize_i32(3),
11069 Self::UnknownValue(u) => u.0.serialize(serializer),
11070 }
11071 }
11072 }
11073
11074 impl<'de> serde::de::Deserialize<'de> for SnapshotAutoDeleteBehavior {
11075 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11076 where
11077 D: serde::Deserializer<'de>,
11078 {
11079 deserializer.deserialize_any(
11080 wkt::internal::EnumVisitor::<SnapshotAutoDeleteBehavior>::new(
11081 ".google.cloud.baremetalsolution.v2.Volume.SnapshotAutoDeleteBehavior",
11082 ),
11083 )
11084 }
11085 }
11086
11087 /// Storage protocol.
11088 ///
11089 /// # Working with unknown values
11090 ///
11091 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11092 /// additional enum variants at any time. Adding new variants is not considered
11093 /// a breaking change. Applications should write their code in anticipation of:
11094 ///
11095 /// - New values appearing in future releases of the client library, **and**
11096 /// - New values received dynamically, without application changes.
11097 ///
11098 /// Please consult the [Working with enums] section in the user guide for some
11099 /// guidelines.
11100 ///
11101 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11102 #[derive(Clone, Debug, PartialEq)]
11103 #[non_exhaustive]
11104 pub enum Protocol {
11105 /// Value is not specified.
11106 Unspecified,
11107 /// Fibre Channel protocol.
11108 FibreChannel,
11109 /// NFS protocol means Volume is a NFS Share volume.
11110 /// Such volumes cannot be manipulated via Volumes API.
11111 Nfs,
11112 /// If set, the enum was initialized with an unknown value.
11113 ///
11114 /// Applications can examine the value using [Protocol::value] or
11115 /// [Protocol::name].
11116 UnknownValue(protocol::UnknownValue),
11117 }
11118
11119 #[doc(hidden)]
11120 pub mod protocol {
11121 #[allow(unused_imports)]
11122 use super::*;
11123 #[derive(Clone, Debug, PartialEq)]
11124 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11125 }
11126
11127 impl Protocol {
11128 /// Gets the enum value.
11129 ///
11130 /// Returns `None` if the enum contains an unknown value deserialized from
11131 /// the string representation of enums.
11132 pub fn value(&self) -> std::option::Option<i32> {
11133 match self {
11134 Self::Unspecified => std::option::Option::Some(0),
11135 Self::FibreChannel => std::option::Option::Some(1),
11136 Self::Nfs => std::option::Option::Some(2),
11137 Self::UnknownValue(u) => u.0.value(),
11138 }
11139 }
11140
11141 /// Gets the enum value as a string.
11142 ///
11143 /// Returns `None` if the enum contains an unknown value deserialized from
11144 /// the integer representation of enums.
11145 pub fn name(&self) -> std::option::Option<&str> {
11146 match self {
11147 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
11148 Self::FibreChannel => std::option::Option::Some("FIBRE_CHANNEL"),
11149 Self::Nfs => std::option::Option::Some("NFS"),
11150 Self::UnknownValue(u) => u.0.name(),
11151 }
11152 }
11153 }
11154
11155 impl std::default::Default for Protocol {
11156 fn default() -> Self {
11157 use std::convert::From;
11158 Self::from(0)
11159 }
11160 }
11161
11162 impl std::fmt::Display for Protocol {
11163 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11164 wkt::internal::display_enum(f, self.name(), self.value())
11165 }
11166 }
11167
11168 impl std::convert::From<i32> for Protocol {
11169 fn from(value: i32) -> Self {
11170 match value {
11171 0 => Self::Unspecified,
11172 1 => Self::FibreChannel,
11173 2 => Self::Nfs,
11174 _ => Self::UnknownValue(protocol::UnknownValue(
11175 wkt::internal::UnknownEnumValue::Integer(value),
11176 )),
11177 }
11178 }
11179 }
11180
11181 impl std::convert::From<&str> for Protocol {
11182 fn from(value: &str) -> Self {
11183 use std::string::ToString;
11184 match value {
11185 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
11186 "FIBRE_CHANNEL" => Self::FibreChannel,
11187 "NFS" => Self::Nfs,
11188 _ => Self::UnknownValue(protocol::UnknownValue(
11189 wkt::internal::UnknownEnumValue::String(value.to_string()),
11190 )),
11191 }
11192 }
11193 }
11194
11195 impl serde::ser::Serialize for Protocol {
11196 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11197 where
11198 S: serde::Serializer,
11199 {
11200 match self {
11201 Self::Unspecified => serializer.serialize_i32(0),
11202 Self::FibreChannel => serializer.serialize_i32(1),
11203 Self::Nfs => serializer.serialize_i32(2),
11204 Self::UnknownValue(u) => u.0.serialize(serializer),
11205 }
11206 }
11207 }
11208
11209 impl<'de> serde::de::Deserialize<'de> for Protocol {
11210 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11211 where
11212 D: serde::Deserializer<'de>,
11213 {
11214 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
11215 ".google.cloud.baremetalsolution.v2.Volume.Protocol",
11216 ))
11217 }
11218 }
11219
11220 /// The possible values for a workload profile.
11221 ///
11222 /// # Working with unknown values
11223 ///
11224 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11225 /// additional enum variants at any time. Adding new variants is not considered
11226 /// a breaking change. Applications should write their code in anticipation of:
11227 ///
11228 /// - New values appearing in future releases of the client library, **and**
11229 /// - New values received dynamically, without application changes.
11230 ///
11231 /// Please consult the [Working with enums] section in the user guide for some
11232 /// guidelines.
11233 ///
11234 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11235 #[derive(Clone, Debug, PartialEq)]
11236 #[non_exhaustive]
11237 pub enum WorkloadProfile {
11238 /// The workload profile is in an unknown state.
11239 Unspecified,
11240 /// The workload profile is generic.
11241 Generic,
11242 /// The workload profile is hana.
11243 Hana,
11244 /// If set, the enum was initialized with an unknown value.
11245 ///
11246 /// Applications can examine the value using [WorkloadProfile::value] or
11247 /// [WorkloadProfile::name].
11248 UnknownValue(workload_profile::UnknownValue),
11249 }
11250
11251 #[doc(hidden)]
11252 pub mod workload_profile {
11253 #[allow(unused_imports)]
11254 use super::*;
11255 #[derive(Clone, Debug, PartialEq)]
11256 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11257 }
11258
11259 impl WorkloadProfile {
11260 /// Gets the enum value.
11261 ///
11262 /// Returns `None` if the enum contains an unknown value deserialized from
11263 /// the string representation of enums.
11264 pub fn value(&self) -> std::option::Option<i32> {
11265 match self {
11266 Self::Unspecified => std::option::Option::Some(0),
11267 Self::Generic => std::option::Option::Some(1),
11268 Self::Hana => std::option::Option::Some(2),
11269 Self::UnknownValue(u) => u.0.value(),
11270 }
11271 }
11272
11273 /// Gets the enum value as a string.
11274 ///
11275 /// Returns `None` if the enum contains an unknown value deserialized from
11276 /// the integer representation of enums.
11277 pub fn name(&self) -> std::option::Option<&str> {
11278 match self {
11279 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
11280 Self::Generic => std::option::Option::Some("GENERIC"),
11281 Self::Hana => std::option::Option::Some("HANA"),
11282 Self::UnknownValue(u) => u.0.name(),
11283 }
11284 }
11285 }
11286
11287 impl std::default::Default for WorkloadProfile {
11288 fn default() -> Self {
11289 use std::convert::From;
11290 Self::from(0)
11291 }
11292 }
11293
11294 impl std::fmt::Display for WorkloadProfile {
11295 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11296 wkt::internal::display_enum(f, self.name(), self.value())
11297 }
11298 }
11299
11300 impl std::convert::From<i32> for WorkloadProfile {
11301 fn from(value: i32) -> Self {
11302 match value {
11303 0 => Self::Unspecified,
11304 1 => Self::Generic,
11305 2 => Self::Hana,
11306 _ => Self::UnknownValue(workload_profile::UnknownValue(
11307 wkt::internal::UnknownEnumValue::Integer(value),
11308 )),
11309 }
11310 }
11311 }
11312
11313 impl std::convert::From<&str> for WorkloadProfile {
11314 fn from(value: &str) -> Self {
11315 use std::string::ToString;
11316 match value {
11317 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
11318 "GENERIC" => Self::Generic,
11319 "HANA" => Self::Hana,
11320 _ => Self::UnknownValue(workload_profile::UnknownValue(
11321 wkt::internal::UnknownEnumValue::String(value.to_string()),
11322 )),
11323 }
11324 }
11325 }
11326
11327 impl serde::ser::Serialize for WorkloadProfile {
11328 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11329 where
11330 S: serde::Serializer,
11331 {
11332 match self {
11333 Self::Unspecified => serializer.serialize_i32(0),
11334 Self::Generic => serializer.serialize_i32(1),
11335 Self::Hana => serializer.serialize_i32(2),
11336 Self::UnknownValue(u) => u.0.serialize(serializer),
11337 }
11338 }
11339 }
11340
11341 impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
11342 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11343 where
11344 D: serde::Deserializer<'de>,
11345 {
11346 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
11347 ".google.cloud.baremetalsolution.v2.Volume.WorkloadProfile",
11348 ))
11349 }
11350 }
11351}
11352
11353/// Message for requesting storage volume information.
11354#[derive(Clone, Default, PartialEq)]
11355#[non_exhaustive]
11356pub struct GetVolumeRequest {
11357 /// Required. Name of the resource.
11358 pub name: std::string::String,
11359
11360 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11361}
11362
11363impl GetVolumeRequest {
11364 /// Creates a new default instance.
11365 pub fn new() -> Self {
11366 std::default::Default::default()
11367 }
11368
11369 /// Sets the value of [name][crate::model::GetVolumeRequest::name].
11370 ///
11371 /// # Example
11372 /// ```ignore,no_run
11373 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeRequest;
11374 /// let x = GetVolumeRequest::new().set_name("example");
11375 /// ```
11376 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11377 self.name = v.into();
11378 self
11379 }
11380}
11381
11382impl wkt::message::Message for GetVolumeRequest {
11383 fn typename() -> &'static str {
11384 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeRequest"
11385 }
11386}
11387
11388/// Message for requesting a list of storage volumes.
11389#[derive(Clone, Default, PartialEq)]
11390#[non_exhaustive]
11391pub struct ListVolumesRequest {
11392 /// Required. Parent value for ListVolumesRequest.
11393 pub parent: std::string::String,
11394
11395 /// Requested page size. The server might return fewer items than requested.
11396 /// If unspecified, server will pick an appropriate default.
11397 pub page_size: i32,
11398
11399 /// A token identifying a page of results from the server.
11400 pub page_token: std::string::String,
11401
11402 /// List filter.
11403 pub filter: std::string::String,
11404
11405 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11406}
11407
11408impl ListVolumesRequest {
11409 /// Creates a new default instance.
11410 pub fn new() -> Self {
11411 std::default::Default::default()
11412 }
11413
11414 /// Sets the value of [parent][crate::model::ListVolumesRequest::parent].
11415 ///
11416 /// # Example
11417 /// ```ignore,no_run
11418 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11419 /// let x = ListVolumesRequest::new().set_parent("example");
11420 /// ```
11421 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11422 self.parent = v.into();
11423 self
11424 }
11425
11426 /// Sets the value of [page_size][crate::model::ListVolumesRequest::page_size].
11427 ///
11428 /// # Example
11429 /// ```ignore,no_run
11430 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11431 /// let x = ListVolumesRequest::new().set_page_size(42);
11432 /// ```
11433 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11434 self.page_size = v.into();
11435 self
11436 }
11437
11438 /// Sets the value of [page_token][crate::model::ListVolumesRequest::page_token].
11439 ///
11440 /// # Example
11441 /// ```ignore,no_run
11442 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11443 /// let x = ListVolumesRequest::new().set_page_token("example");
11444 /// ```
11445 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11446 self.page_token = v.into();
11447 self
11448 }
11449
11450 /// Sets the value of [filter][crate::model::ListVolumesRequest::filter].
11451 ///
11452 /// # Example
11453 /// ```ignore,no_run
11454 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11455 /// let x = ListVolumesRequest::new().set_filter("example");
11456 /// ```
11457 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11458 self.filter = v.into();
11459 self
11460 }
11461}
11462
11463impl wkt::message::Message for ListVolumesRequest {
11464 fn typename() -> &'static str {
11465 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesRequest"
11466 }
11467}
11468
11469/// Response message containing the list of storage volumes.
11470#[derive(Clone, Default, PartialEq)]
11471#[non_exhaustive]
11472pub struct ListVolumesResponse {
11473 /// The list of storage volumes.
11474 pub volumes: std::vec::Vec<crate::model::Volume>,
11475
11476 /// A token identifying a page of results from the server.
11477 pub next_page_token: std::string::String,
11478
11479 /// Locations that could not be reached.
11480 pub unreachable: std::vec::Vec<std::string::String>,
11481
11482 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11483}
11484
11485impl ListVolumesResponse {
11486 /// Creates a new default instance.
11487 pub fn new() -> Self {
11488 std::default::Default::default()
11489 }
11490
11491 /// Sets the value of [volumes][crate::model::ListVolumesResponse::volumes].
11492 ///
11493 /// # Example
11494 /// ```ignore,no_run
11495 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11496 /// use google_cloud_baremetalsolution_v2::model::Volume;
11497 /// let x = ListVolumesResponse::new()
11498 /// .set_volumes([
11499 /// Volume::default()/* use setters */,
11500 /// Volume::default()/* use (different) setters */,
11501 /// ]);
11502 /// ```
11503 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11504 where
11505 T: std::iter::IntoIterator<Item = V>,
11506 V: std::convert::Into<crate::model::Volume>,
11507 {
11508 use std::iter::Iterator;
11509 self.volumes = v.into_iter().map(|i| i.into()).collect();
11510 self
11511 }
11512
11513 /// Sets the value of [next_page_token][crate::model::ListVolumesResponse::next_page_token].
11514 ///
11515 /// # Example
11516 /// ```ignore,no_run
11517 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11518 /// let x = ListVolumesResponse::new().set_next_page_token("example");
11519 /// ```
11520 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11521 self.next_page_token = v.into();
11522 self
11523 }
11524
11525 /// Sets the value of [unreachable][crate::model::ListVolumesResponse::unreachable].
11526 ///
11527 /// # Example
11528 /// ```ignore,no_run
11529 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11530 /// let x = ListVolumesResponse::new().set_unreachable(["a", "b", "c"]);
11531 /// ```
11532 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
11533 where
11534 T: std::iter::IntoIterator<Item = V>,
11535 V: std::convert::Into<std::string::String>,
11536 {
11537 use std::iter::Iterator;
11538 self.unreachable = v.into_iter().map(|i| i.into()).collect();
11539 self
11540 }
11541}
11542
11543impl wkt::message::Message for ListVolumesResponse {
11544 fn typename() -> &'static str {
11545 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesResponse"
11546 }
11547}
11548
11549#[doc(hidden)]
11550impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumesResponse {
11551 type PageItem = crate::model::Volume;
11552
11553 fn items(self) -> std::vec::Vec<Self::PageItem> {
11554 self.volumes
11555 }
11556
11557 fn next_page_token(&self) -> std::string::String {
11558 use std::clone::Clone;
11559 self.next_page_token.clone()
11560 }
11561}
11562
11563/// Message for updating a volume.
11564#[derive(Clone, Default, PartialEq)]
11565#[non_exhaustive]
11566pub struct UpdateVolumeRequest {
11567 /// Required. The volume to update.
11568 ///
11569 /// The `name` field is used to identify the volume to update.
11570 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11571 pub volume: std::option::Option<crate::model::Volume>,
11572
11573 /// The list of fields to update.
11574 /// The only currently supported fields are:
11575 /// 'labels'
11576 pub update_mask: std::option::Option<wkt::FieldMask>,
11577
11578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11579}
11580
11581impl UpdateVolumeRequest {
11582 /// Creates a new default instance.
11583 pub fn new() -> Self {
11584 std::default::Default::default()
11585 }
11586
11587 /// Sets the value of [volume][crate::model::UpdateVolumeRequest::volume].
11588 ///
11589 /// # Example
11590 /// ```ignore,no_run
11591 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11592 /// use google_cloud_baremetalsolution_v2::model::Volume;
11593 /// let x = UpdateVolumeRequest::new().set_volume(Volume::default()/* use setters */);
11594 /// ```
11595 pub fn set_volume<T>(mut self, v: T) -> Self
11596 where
11597 T: std::convert::Into<crate::model::Volume>,
11598 {
11599 self.volume = std::option::Option::Some(v.into());
11600 self
11601 }
11602
11603 /// Sets or clears the value of [volume][crate::model::UpdateVolumeRequest::volume].
11604 ///
11605 /// # Example
11606 /// ```ignore,no_run
11607 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11608 /// use google_cloud_baremetalsolution_v2::model::Volume;
11609 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(Some(Volume::default()/* use setters */));
11610 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(None::<Volume>);
11611 /// ```
11612 pub fn set_or_clear_volume<T>(mut self, v: std::option::Option<T>) -> Self
11613 where
11614 T: std::convert::Into<crate::model::Volume>,
11615 {
11616 self.volume = v.map(|x| x.into());
11617 self
11618 }
11619
11620 /// Sets the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11621 ///
11622 /// # Example
11623 /// ```ignore,no_run
11624 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11625 /// use wkt::FieldMask;
11626 /// let x = UpdateVolumeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11627 /// ```
11628 pub fn set_update_mask<T>(mut self, v: T) -> Self
11629 where
11630 T: std::convert::Into<wkt::FieldMask>,
11631 {
11632 self.update_mask = std::option::Option::Some(v.into());
11633 self
11634 }
11635
11636 /// Sets or clears the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11637 ///
11638 /// # Example
11639 /// ```ignore,no_run
11640 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11641 /// use wkt::FieldMask;
11642 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11643 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11644 /// ```
11645 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11646 where
11647 T: std::convert::Into<wkt::FieldMask>,
11648 {
11649 self.update_mask = v.map(|x| x.into());
11650 self
11651 }
11652}
11653
11654impl wkt::message::Message for UpdateVolumeRequest {
11655 fn typename() -> &'static str {
11656 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateVolumeRequest"
11657 }
11658}
11659
11660/// Message requesting rename of a server.
11661#[derive(Clone, Default, PartialEq)]
11662#[non_exhaustive]
11663pub struct RenameVolumeRequest {
11664 /// Required. The `name` field is used to identify the volume.
11665 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11666 pub name: std::string::String,
11667
11668 /// Required. The new `id` of the volume.
11669 pub new_volume_id: std::string::String,
11670
11671 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11672}
11673
11674impl RenameVolumeRequest {
11675 /// Creates a new default instance.
11676 pub fn new() -> Self {
11677 std::default::Default::default()
11678 }
11679
11680 /// Sets the value of [name][crate::model::RenameVolumeRequest::name].
11681 ///
11682 /// # Example
11683 /// ```ignore,no_run
11684 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11685 /// let x = RenameVolumeRequest::new().set_name("example");
11686 /// ```
11687 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11688 self.name = v.into();
11689 self
11690 }
11691
11692 /// Sets the value of [new_volume_id][crate::model::RenameVolumeRequest::new_volume_id].
11693 ///
11694 /// # Example
11695 /// ```ignore,no_run
11696 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11697 /// let x = RenameVolumeRequest::new().set_new_volume_id("example");
11698 /// ```
11699 pub fn set_new_volume_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11700 self.new_volume_id = v.into();
11701 self
11702 }
11703}
11704
11705impl wkt::message::Message for RenameVolumeRequest {
11706 fn typename() -> &'static str {
11707 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameVolumeRequest"
11708 }
11709}
11710
11711/// Request for skip volume cooloff and delete it.
11712#[derive(Clone, Default, PartialEq)]
11713#[non_exhaustive]
11714pub struct EvictVolumeRequest {
11715 /// Required. The name of the Volume.
11716 pub name: std::string::String,
11717
11718 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11719}
11720
11721impl EvictVolumeRequest {
11722 /// Creates a new default instance.
11723 pub fn new() -> Self {
11724 std::default::Default::default()
11725 }
11726
11727 /// Sets the value of [name][crate::model::EvictVolumeRequest::name].
11728 ///
11729 /// # Example
11730 /// ```ignore,no_run
11731 /// # use google_cloud_baremetalsolution_v2::model::EvictVolumeRequest;
11732 /// let x = EvictVolumeRequest::new().set_name("example");
11733 /// ```
11734 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11735 self.name = v.into();
11736 self
11737 }
11738}
11739
11740impl wkt::message::Message for EvictVolumeRequest {
11741 fn typename() -> &'static str {
11742 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictVolumeRequest"
11743 }
11744}
11745
11746/// Request for emergency resize Volume.
11747#[derive(Clone, Default, PartialEq)]
11748#[non_exhaustive]
11749pub struct ResizeVolumeRequest {
11750 /// Required. Volume to resize.
11751 pub volume: std::string::String,
11752
11753 /// New Volume size, in GiB.
11754 pub size_gib: i64,
11755
11756 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11757}
11758
11759impl ResizeVolumeRequest {
11760 /// Creates a new default instance.
11761 pub fn new() -> Self {
11762 std::default::Default::default()
11763 }
11764
11765 /// Sets the value of [volume][crate::model::ResizeVolumeRequest::volume].
11766 ///
11767 /// # Example
11768 /// ```ignore,no_run
11769 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11770 /// let x = ResizeVolumeRequest::new().set_volume("example");
11771 /// ```
11772 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11773 self.volume = v.into();
11774 self
11775 }
11776
11777 /// Sets the value of [size_gib][crate::model::ResizeVolumeRequest::size_gib].
11778 ///
11779 /// # Example
11780 /// ```ignore,no_run
11781 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11782 /// let x = ResizeVolumeRequest::new().set_size_gib(42);
11783 /// ```
11784 pub fn set_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11785 self.size_gib = v.into();
11786 self
11787 }
11788}
11789
11790impl wkt::message::Message for ResizeVolumeRequest {
11791 fn typename() -> &'static str {
11792 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResizeVolumeRequest"
11793 }
11794}
11795
11796/// A snapshot of a volume. Only boot volumes can have snapshots.
11797#[derive(Clone, Default, PartialEq)]
11798#[non_exhaustive]
11799pub struct VolumeSnapshot {
11800 /// The name of the snapshot.
11801 pub name: std::string::String,
11802
11803 /// Output only. An identifier for the snapshot, generated by the backend.
11804 pub id: std::string::String,
11805
11806 /// The description of the snapshot.
11807 pub description: std::string::String,
11808
11809 /// Output only. The creation time of the snapshot.
11810 pub create_time: std::option::Option<wkt::Timestamp>,
11811
11812 /// Output only. The name of the volume which this snapshot belongs to.
11813 pub storage_volume: std::string::String,
11814
11815 /// Output only. The type of the snapshot which indicates whether it was
11816 /// scheduled or manual/ad-hoc.
11817 pub r#type: crate::model::volume_snapshot::SnapshotType,
11818
11819 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11820}
11821
11822impl VolumeSnapshot {
11823 /// Creates a new default instance.
11824 pub fn new() -> Self {
11825 std::default::Default::default()
11826 }
11827
11828 /// Sets the value of [name][crate::model::VolumeSnapshot::name].
11829 ///
11830 /// # Example
11831 /// ```ignore,no_run
11832 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11833 /// let x = VolumeSnapshot::new().set_name("example");
11834 /// ```
11835 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11836 self.name = v.into();
11837 self
11838 }
11839
11840 /// Sets the value of [id][crate::model::VolumeSnapshot::id].
11841 ///
11842 /// # Example
11843 /// ```ignore,no_run
11844 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11845 /// let x = VolumeSnapshot::new().set_id("example");
11846 /// ```
11847 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11848 self.id = v.into();
11849 self
11850 }
11851
11852 /// Sets the value of [description][crate::model::VolumeSnapshot::description].
11853 ///
11854 /// # Example
11855 /// ```ignore,no_run
11856 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11857 /// let x = VolumeSnapshot::new().set_description("example");
11858 /// ```
11859 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11860 self.description = v.into();
11861 self
11862 }
11863
11864 /// Sets the value of [create_time][crate::model::VolumeSnapshot::create_time].
11865 ///
11866 /// # Example
11867 /// ```ignore,no_run
11868 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11869 /// use wkt::Timestamp;
11870 /// let x = VolumeSnapshot::new().set_create_time(Timestamp::default()/* use setters */);
11871 /// ```
11872 pub fn set_create_time<T>(mut self, v: T) -> Self
11873 where
11874 T: std::convert::Into<wkt::Timestamp>,
11875 {
11876 self.create_time = std::option::Option::Some(v.into());
11877 self
11878 }
11879
11880 /// Sets or clears the value of [create_time][crate::model::VolumeSnapshot::create_time].
11881 ///
11882 /// # Example
11883 /// ```ignore,no_run
11884 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11885 /// use wkt::Timestamp;
11886 /// let x = VolumeSnapshot::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11887 /// let x = VolumeSnapshot::new().set_or_clear_create_time(None::<Timestamp>);
11888 /// ```
11889 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11890 where
11891 T: std::convert::Into<wkt::Timestamp>,
11892 {
11893 self.create_time = v.map(|x| x.into());
11894 self
11895 }
11896
11897 /// Sets the value of [storage_volume][crate::model::VolumeSnapshot::storage_volume].
11898 ///
11899 /// # Example
11900 /// ```ignore,no_run
11901 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11902 /// let x = VolumeSnapshot::new().set_storage_volume("example");
11903 /// ```
11904 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11905 self.storage_volume = v.into();
11906 self
11907 }
11908
11909 /// Sets the value of [r#type][crate::model::VolumeSnapshot::type].
11910 ///
11911 /// # Example
11912 /// ```ignore,no_run
11913 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11914 /// use google_cloud_baremetalsolution_v2::model::volume_snapshot::SnapshotType;
11915 /// let x0 = VolumeSnapshot::new().set_type(SnapshotType::AdHoc);
11916 /// let x1 = VolumeSnapshot::new().set_type(SnapshotType::Scheduled);
11917 /// ```
11918 pub fn set_type<T: std::convert::Into<crate::model::volume_snapshot::SnapshotType>>(
11919 mut self,
11920 v: T,
11921 ) -> Self {
11922 self.r#type = v.into();
11923 self
11924 }
11925}
11926
11927impl wkt::message::Message for VolumeSnapshot {
11928 fn typename() -> &'static str {
11929 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeSnapshot"
11930 }
11931}
11932
11933/// Defines additional types related to [VolumeSnapshot].
11934pub mod volume_snapshot {
11935 #[allow(unused_imports)]
11936 use super::*;
11937
11938 /// Represents the type of a snapshot.
11939 ///
11940 /// # Working with unknown values
11941 ///
11942 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11943 /// additional enum variants at any time. Adding new variants is not considered
11944 /// a breaking change. Applications should write their code in anticipation of:
11945 ///
11946 /// - New values appearing in future releases of the client library, **and**
11947 /// - New values received dynamically, without application changes.
11948 ///
11949 /// Please consult the [Working with enums] section in the user guide for some
11950 /// guidelines.
11951 ///
11952 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11953 #[derive(Clone, Debug, PartialEq)]
11954 #[non_exhaustive]
11955 pub enum SnapshotType {
11956 /// Type is not specified.
11957 Unspecified,
11958 /// Snapshot was taken manually by user.
11959 AdHoc,
11960 /// Snapshot was taken automatically as a part of a snapshot schedule.
11961 Scheduled,
11962 /// If set, the enum was initialized with an unknown value.
11963 ///
11964 /// Applications can examine the value using [SnapshotType::value] or
11965 /// [SnapshotType::name].
11966 UnknownValue(snapshot_type::UnknownValue),
11967 }
11968
11969 #[doc(hidden)]
11970 pub mod snapshot_type {
11971 #[allow(unused_imports)]
11972 use super::*;
11973 #[derive(Clone, Debug, PartialEq)]
11974 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11975 }
11976
11977 impl SnapshotType {
11978 /// Gets the enum value.
11979 ///
11980 /// Returns `None` if the enum contains an unknown value deserialized from
11981 /// the string representation of enums.
11982 pub fn value(&self) -> std::option::Option<i32> {
11983 match self {
11984 Self::Unspecified => std::option::Option::Some(0),
11985 Self::AdHoc => std::option::Option::Some(1),
11986 Self::Scheduled => std::option::Option::Some(2),
11987 Self::UnknownValue(u) => u.0.value(),
11988 }
11989 }
11990
11991 /// Gets the enum value as a string.
11992 ///
11993 /// Returns `None` if the enum contains an unknown value deserialized from
11994 /// the integer representation of enums.
11995 pub fn name(&self) -> std::option::Option<&str> {
11996 match self {
11997 Self::Unspecified => std::option::Option::Some("SNAPSHOT_TYPE_UNSPECIFIED"),
11998 Self::AdHoc => std::option::Option::Some("AD_HOC"),
11999 Self::Scheduled => std::option::Option::Some("SCHEDULED"),
12000 Self::UnknownValue(u) => u.0.name(),
12001 }
12002 }
12003 }
12004
12005 impl std::default::Default for SnapshotType {
12006 fn default() -> Self {
12007 use std::convert::From;
12008 Self::from(0)
12009 }
12010 }
12011
12012 impl std::fmt::Display for SnapshotType {
12013 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12014 wkt::internal::display_enum(f, self.name(), self.value())
12015 }
12016 }
12017
12018 impl std::convert::From<i32> for SnapshotType {
12019 fn from(value: i32) -> Self {
12020 match value {
12021 0 => Self::Unspecified,
12022 1 => Self::AdHoc,
12023 2 => Self::Scheduled,
12024 _ => Self::UnknownValue(snapshot_type::UnknownValue(
12025 wkt::internal::UnknownEnumValue::Integer(value),
12026 )),
12027 }
12028 }
12029 }
12030
12031 impl std::convert::From<&str> for SnapshotType {
12032 fn from(value: &str) -> Self {
12033 use std::string::ToString;
12034 match value {
12035 "SNAPSHOT_TYPE_UNSPECIFIED" => Self::Unspecified,
12036 "AD_HOC" => Self::AdHoc,
12037 "SCHEDULED" => Self::Scheduled,
12038 _ => Self::UnknownValue(snapshot_type::UnknownValue(
12039 wkt::internal::UnknownEnumValue::String(value.to_string()),
12040 )),
12041 }
12042 }
12043 }
12044
12045 impl serde::ser::Serialize for SnapshotType {
12046 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12047 where
12048 S: serde::Serializer,
12049 {
12050 match self {
12051 Self::Unspecified => serializer.serialize_i32(0),
12052 Self::AdHoc => serializer.serialize_i32(1),
12053 Self::Scheduled => serializer.serialize_i32(2),
12054 Self::UnknownValue(u) => u.0.serialize(serializer),
12055 }
12056 }
12057 }
12058
12059 impl<'de> serde::de::Deserialize<'de> for SnapshotType {
12060 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12061 where
12062 D: serde::Deserializer<'de>,
12063 {
12064 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotType>::new(
12065 ".google.cloud.baremetalsolution.v2.VolumeSnapshot.SnapshotType",
12066 ))
12067 }
12068 }
12069}
12070
12071/// Message for requesting volume snapshot information.
12072#[derive(Clone, Default, PartialEq)]
12073#[non_exhaustive]
12074pub struct GetVolumeSnapshotRequest {
12075 /// Required. The name of the snapshot.
12076 pub name: std::string::String,
12077
12078 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12079}
12080
12081impl GetVolumeSnapshotRequest {
12082 /// Creates a new default instance.
12083 pub fn new() -> Self {
12084 std::default::Default::default()
12085 }
12086
12087 /// Sets the value of [name][crate::model::GetVolumeSnapshotRequest::name].
12088 ///
12089 /// # Example
12090 /// ```ignore,no_run
12091 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeSnapshotRequest;
12092 /// let x = GetVolumeSnapshotRequest::new().set_name("example");
12093 /// ```
12094 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12095 self.name = v.into();
12096 self
12097 }
12098}
12099
12100impl wkt::message::Message for GetVolumeSnapshotRequest {
12101 fn typename() -> &'static str {
12102 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeSnapshotRequest"
12103 }
12104}
12105
12106/// Message for requesting a list of volume snapshots.
12107#[derive(Clone, Default, PartialEq)]
12108#[non_exhaustive]
12109pub struct ListVolumeSnapshotsRequest {
12110 /// Required. Parent value for ListVolumesRequest.
12111 pub parent: std::string::String,
12112
12113 /// Requested page size. The server might return fewer items than requested.
12114 /// If unspecified, server will pick an appropriate default.
12115 pub page_size: i32,
12116
12117 /// A token identifying a page of results from the server.
12118 pub page_token: std::string::String,
12119
12120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12121}
12122
12123impl ListVolumeSnapshotsRequest {
12124 /// Creates a new default instance.
12125 pub fn new() -> Self {
12126 std::default::Default::default()
12127 }
12128
12129 /// Sets the value of [parent][crate::model::ListVolumeSnapshotsRequest::parent].
12130 ///
12131 /// # Example
12132 /// ```ignore,no_run
12133 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12134 /// let x = ListVolumeSnapshotsRequest::new().set_parent("example");
12135 /// ```
12136 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12137 self.parent = v.into();
12138 self
12139 }
12140
12141 /// Sets the value of [page_size][crate::model::ListVolumeSnapshotsRequest::page_size].
12142 ///
12143 /// # Example
12144 /// ```ignore,no_run
12145 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12146 /// let x = ListVolumeSnapshotsRequest::new().set_page_size(42);
12147 /// ```
12148 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12149 self.page_size = v.into();
12150 self
12151 }
12152
12153 /// Sets the value of [page_token][crate::model::ListVolumeSnapshotsRequest::page_token].
12154 ///
12155 /// # Example
12156 /// ```ignore,no_run
12157 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12158 /// let x = ListVolumeSnapshotsRequest::new().set_page_token("example");
12159 /// ```
12160 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12161 self.page_token = v.into();
12162 self
12163 }
12164}
12165
12166impl wkt::message::Message for ListVolumeSnapshotsRequest {
12167 fn typename() -> &'static str {
12168 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsRequest"
12169 }
12170}
12171
12172/// Response message containing the list of volume snapshots.
12173#[derive(Clone, Default, PartialEq)]
12174#[non_exhaustive]
12175pub struct ListVolumeSnapshotsResponse {
12176 /// The list of snapshots.
12177 pub volume_snapshots: std::vec::Vec<crate::model::VolumeSnapshot>,
12178
12179 /// A token identifying a page of results from the server.
12180 pub next_page_token: std::string::String,
12181
12182 /// Locations that could not be reached.
12183 pub unreachable: std::vec::Vec<std::string::String>,
12184
12185 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12186}
12187
12188impl ListVolumeSnapshotsResponse {
12189 /// Creates a new default instance.
12190 pub fn new() -> Self {
12191 std::default::Default::default()
12192 }
12193
12194 /// Sets the value of [volume_snapshots][crate::model::ListVolumeSnapshotsResponse::volume_snapshots].
12195 ///
12196 /// # Example
12197 /// ```ignore,no_run
12198 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12199 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12200 /// let x = ListVolumeSnapshotsResponse::new()
12201 /// .set_volume_snapshots([
12202 /// VolumeSnapshot::default()/* use setters */,
12203 /// VolumeSnapshot::default()/* use (different) setters */,
12204 /// ]);
12205 /// ```
12206 pub fn set_volume_snapshots<T, V>(mut self, v: T) -> Self
12207 where
12208 T: std::iter::IntoIterator<Item = V>,
12209 V: std::convert::Into<crate::model::VolumeSnapshot>,
12210 {
12211 use std::iter::Iterator;
12212 self.volume_snapshots = v.into_iter().map(|i| i.into()).collect();
12213 self
12214 }
12215
12216 /// Sets the value of [next_page_token][crate::model::ListVolumeSnapshotsResponse::next_page_token].
12217 ///
12218 /// # Example
12219 /// ```ignore,no_run
12220 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12221 /// let x = ListVolumeSnapshotsResponse::new().set_next_page_token("example");
12222 /// ```
12223 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12224 self.next_page_token = v.into();
12225 self
12226 }
12227
12228 /// Sets the value of [unreachable][crate::model::ListVolumeSnapshotsResponse::unreachable].
12229 ///
12230 /// # Example
12231 /// ```ignore,no_run
12232 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12233 /// let x = ListVolumeSnapshotsResponse::new().set_unreachable(["a", "b", "c"]);
12234 /// ```
12235 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
12236 where
12237 T: std::iter::IntoIterator<Item = V>,
12238 V: std::convert::Into<std::string::String>,
12239 {
12240 use std::iter::Iterator;
12241 self.unreachable = v.into_iter().map(|i| i.into()).collect();
12242 self
12243 }
12244}
12245
12246impl wkt::message::Message for ListVolumeSnapshotsResponse {
12247 fn typename() -> &'static str {
12248 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsResponse"
12249 }
12250}
12251
12252#[doc(hidden)]
12253impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumeSnapshotsResponse {
12254 type PageItem = crate::model::VolumeSnapshot;
12255
12256 fn items(self) -> std::vec::Vec<Self::PageItem> {
12257 self.volume_snapshots
12258 }
12259
12260 fn next_page_token(&self) -> std::string::String {
12261 use std::clone::Clone;
12262 self.next_page_token.clone()
12263 }
12264}
12265
12266/// Message for deleting named Volume snapshot.
12267#[derive(Clone, Default, PartialEq)]
12268#[non_exhaustive]
12269pub struct DeleteVolumeSnapshotRequest {
12270 /// Required. The name of the snapshot to delete.
12271 pub name: std::string::String,
12272
12273 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12274}
12275
12276impl DeleteVolumeSnapshotRequest {
12277 /// Creates a new default instance.
12278 pub fn new() -> Self {
12279 std::default::Default::default()
12280 }
12281
12282 /// Sets the value of [name][crate::model::DeleteVolumeSnapshotRequest::name].
12283 ///
12284 /// # Example
12285 /// ```ignore,no_run
12286 /// # use google_cloud_baremetalsolution_v2::model::DeleteVolumeSnapshotRequest;
12287 /// let x = DeleteVolumeSnapshotRequest::new().set_name("example");
12288 /// ```
12289 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12290 self.name = v.into();
12291 self
12292 }
12293}
12294
12295impl wkt::message::Message for DeleteVolumeSnapshotRequest {
12296 fn typename() -> &'static str {
12297 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteVolumeSnapshotRequest"
12298 }
12299}
12300
12301/// Message for creating a volume snapshot.
12302#[derive(Clone, Default, PartialEq)]
12303#[non_exhaustive]
12304pub struct CreateVolumeSnapshotRequest {
12305 /// Required. The volume to snapshot.
12306 pub parent: std::string::String,
12307
12308 /// Required. The snapshot to create.
12309 pub volume_snapshot: std::option::Option<crate::model::VolumeSnapshot>,
12310
12311 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12312}
12313
12314impl CreateVolumeSnapshotRequest {
12315 /// Creates a new default instance.
12316 pub fn new() -> Self {
12317 std::default::Default::default()
12318 }
12319
12320 /// Sets the value of [parent][crate::model::CreateVolumeSnapshotRequest::parent].
12321 ///
12322 /// # Example
12323 /// ```ignore,no_run
12324 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12325 /// let x = CreateVolumeSnapshotRequest::new().set_parent("example");
12326 /// ```
12327 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12328 self.parent = v.into();
12329 self
12330 }
12331
12332 /// Sets the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12333 ///
12334 /// # Example
12335 /// ```ignore,no_run
12336 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12337 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12338 /// let x = CreateVolumeSnapshotRequest::new().set_volume_snapshot(VolumeSnapshot::default()/* use setters */);
12339 /// ```
12340 pub fn set_volume_snapshot<T>(mut self, v: T) -> Self
12341 where
12342 T: std::convert::Into<crate::model::VolumeSnapshot>,
12343 {
12344 self.volume_snapshot = std::option::Option::Some(v.into());
12345 self
12346 }
12347
12348 /// Sets or clears the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12349 ///
12350 /// # Example
12351 /// ```ignore,no_run
12352 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12353 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12354 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(Some(VolumeSnapshot::default()/* use setters */));
12355 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(None::<VolumeSnapshot>);
12356 /// ```
12357 pub fn set_or_clear_volume_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
12358 where
12359 T: std::convert::Into<crate::model::VolumeSnapshot>,
12360 {
12361 self.volume_snapshot = v.map(|x| x.into());
12362 self
12363 }
12364}
12365
12366impl wkt::message::Message for CreateVolumeSnapshotRequest {
12367 fn typename() -> &'static str {
12368 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateVolumeSnapshotRequest"
12369 }
12370}
12371
12372/// Message for restoring a volume snapshot.
12373#[derive(Clone, Default, PartialEq)]
12374#[non_exhaustive]
12375pub struct RestoreVolumeSnapshotRequest {
12376 /// Required. Name of the snapshot which will be used to restore its parent
12377 /// volume.
12378 pub volume_snapshot: std::string::String,
12379
12380 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12381}
12382
12383impl RestoreVolumeSnapshotRequest {
12384 /// Creates a new default instance.
12385 pub fn new() -> Self {
12386 std::default::Default::default()
12387 }
12388
12389 /// Sets the value of [volume_snapshot][crate::model::RestoreVolumeSnapshotRequest::volume_snapshot].
12390 ///
12391 /// # Example
12392 /// ```ignore,no_run
12393 /// # use google_cloud_baremetalsolution_v2::model::RestoreVolumeSnapshotRequest;
12394 /// let x = RestoreVolumeSnapshotRequest::new().set_volume_snapshot("example");
12395 /// ```
12396 pub fn set_volume_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12397 self.volume_snapshot = v.into();
12398 self
12399 }
12400}
12401
12402impl wkt::message::Message for RestoreVolumeSnapshotRequest {
12403 fn typename() -> &'static str {
12404 "type.googleapis.com/google.cloud.baremetalsolution.v2.RestoreVolumeSnapshotRequest"
12405 }
12406}
12407
12408/// Performance tier of the Volume.
12409///
12410/// # Working with unknown values
12411///
12412/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12413/// additional enum variants at any time. Adding new variants is not considered
12414/// a breaking change. Applications should write their code in anticipation of:
12415///
12416/// - New values appearing in future releases of the client library, **and**
12417/// - New values received dynamically, without application changes.
12418///
12419/// Please consult the [Working with enums] section in the user guide for some
12420/// guidelines.
12421///
12422/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12423#[derive(Clone, Debug, PartialEq)]
12424#[non_exhaustive]
12425pub enum VolumePerformanceTier {
12426 /// Value is not specified.
12427 Unspecified,
12428 /// Regular volumes, shared aggregates.
12429 Shared,
12430 /// Assigned aggregates.
12431 Assigned,
12432 /// High throughput aggregates.
12433 Ht,
12434 /// If set, the enum was initialized with an unknown value.
12435 ///
12436 /// Applications can examine the value using [VolumePerformanceTier::value] or
12437 /// [VolumePerformanceTier::name].
12438 UnknownValue(volume_performance_tier::UnknownValue),
12439}
12440
12441#[doc(hidden)]
12442pub mod volume_performance_tier {
12443 #[allow(unused_imports)]
12444 use super::*;
12445 #[derive(Clone, Debug, PartialEq)]
12446 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12447}
12448
12449impl VolumePerformanceTier {
12450 /// Gets the enum value.
12451 ///
12452 /// Returns `None` if the enum contains an unknown value deserialized from
12453 /// the string representation of enums.
12454 pub fn value(&self) -> std::option::Option<i32> {
12455 match self {
12456 Self::Unspecified => std::option::Option::Some(0),
12457 Self::Shared => std::option::Option::Some(1),
12458 Self::Assigned => std::option::Option::Some(2),
12459 Self::Ht => std::option::Option::Some(3),
12460 Self::UnknownValue(u) => u.0.value(),
12461 }
12462 }
12463
12464 /// Gets the enum value as a string.
12465 ///
12466 /// Returns `None` if the enum contains an unknown value deserialized from
12467 /// the integer representation of enums.
12468 pub fn name(&self) -> std::option::Option<&str> {
12469 match self {
12470 Self::Unspecified => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_UNSPECIFIED"),
12471 Self::Shared => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_SHARED"),
12472 Self::Assigned => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_ASSIGNED"),
12473 Self::Ht => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_HT"),
12474 Self::UnknownValue(u) => u.0.name(),
12475 }
12476 }
12477}
12478
12479impl std::default::Default for VolumePerformanceTier {
12480 fn default() -> Self {
12481 use std::convert::From;
12482 Self::from(0)
12483 }
12484}
12485
12486impl std::fmt::Display for VolumePerformanceTier {
12487 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12488 wkt::internal::display_enum(f, self.name(), self.value())
12489 }
12490}
12491
12492impl std::convert::From<i32> for VolumePerformanceTier {
12493 fn from(value: i32) -> Self {
12494 match value {
12495 0 => Self::Unspecified,
12496 1 => Self::Shared,
12497 2 => Self::Assigned,
12498 3 => Self::Ht,
12499 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12500 wkt::internal::UnknownEnumValue::Integer(value),
12501 )),
12502 }
12503 }
12504}
12505
12506impl std::convert::From<&str> for VolumePerformanceTier {
12507 fn from(value: &str) -> Self {
12508 use std::string::ToString;
12509 match value {
12510 "VOLUME_PERFORMANCE_TIER_UNSPECIFIED" => Self::Unspecified,
12511 "VOLUME_PERFORMANCE_TIER_SHARED" => Self::Shared,
12512 "VOLUME_PERFORMANCE_TIER_ASSIGNED" => Self::Assigned,
12513 "VOLUME_PERFORMANCE_TIER_HT" => Self::Ht,
12514 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12515 wkt::internal::UnknownEnumValue::String(value.to_string()),
12516 )),
12517 }
12518 }
12519}
12520
12521impl serde::ser::Serialize for VolumePerformanceTier {
12522 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12523 where
12524 S: serde::Serializer,
12525 {
12526 match self {
12527 Self::Unspecified => serializer.serialize_i32(0),
12528 Self::Shared => serializer.serialize_i32(1),
12529 Self::Assigned => serializer.serialize_i32(2),
12530 Self::Ht => serializer.serialize_i32(3),
12531 Self::UnknownValue(u) => u.0.serialize(serializer),
12532 }
12533 }
12534}
12535
12536impl<'de> serde::de::Deserialize<'de> for VolumePerformanceTier {
12537 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12538 where
12539 D: serde::Deserializer<'de>,
12540 {
12541 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumePerformanceTier>::new(
12542 ".google.cloud.baremetalsolution.v2.VolumePerformanceTier",
12543 ))
12544 }
12545}
12546
12547/// The possible values for a workload profile.
12548///
12549/// # Working with unknown values
12550///
12551/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12552/// additional enum variants at any time. Adding new variants is not considered
12553/// a breaking change. Applications should write their code in anticipation of:
12554///
12555/// - New values appearing in future releases of the client library, **and**
12556/// - New values received dynamically, without application changes.
12557///
12558/// Please consult the [Working with enums] section in the user guide for some
12559/// guidelines.
12560///
12561/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12562#[derive(Clone, Debug, PartialEq)]
12563#[non_exhaustive]
12564pub enum WorkloadProfile {
12565 /// The workload profile is in an unknown state.
12566 Unspecified,
12567 /// The workload profile is generic.
12568 Generic,
12569 /// The workload profile is hana.
12570 Hana,
12571 /// If set, the enum was initialized with an unknown value.
12572 ///
12573 /// Applications can examine the value using [WorkloadProfile::value] or
12574 /// [WorkloadProfile::name].
12575 UnknownValue(workload_profile::UnknownValue),
12576}
12577
12578#[doc(hidden)]
12579pub mod workload_profile {
12580 #[allow(unused_imports)]
12581 use super::*;
12582 #[derive(Clone, Debug, PartialEq)]
12583 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12584}
12585
12586impl WorkloadProfile {
12587 /// Gets the enum value.
12588 ///
12589 /// Returns `None` if the enum contains an unknown value deserialized from
12590 /// the string representation of enums.
12591 pub fn value(&self) -> std::option::Option<i32> {
12592 match self {
12593 Self::Unspecified => std::option::Option::Some(0),
12594 Self::Generic => std::option::Option::Some(1),
12595 Self::Hana => std::option::Option::Some(2),
12596 Self::UnknownValue(u) => u.0.value(),
12597 }
12598 }
12599
12600 /// Gets the enum value as a string.
12601 ///
12602 /// Returns `None` if the enum contains an unknown value deserialized from
12603 /// the integer representation of enums.
12604 pub fn name(&self) -> std::option::Option<&str> {
12605 match self {
12606 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
12607 Self::Generic => std::option::Option::Some("WORKLOAD_PROFILE_GENERIC"),
12608 Self::Hana => std::option::Option::Some("WORKLOAD_PROFILE_HANA"),
12609 Self::UnknownValue(u) => u.0.name(),
12610 }
12611 }
12612}
12613
12614impl std::default::Default for WorkloadProfile {
12615 fn default() -> Self {
12616 use std::convert::From;
12617 Self::from(0)
12618 }
12619}
12620
12621impl std::fmt::Display for WorkloadProfile {
12622 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12623 wkt::internal::display_enum(f, self.name(), self.value())
12624 }
12625}
12626
12627impl std::convert::From<i32> for WorkloadProfile {
12628 fn from(value: i32) -> Self {
12629 match value {
12630 0 => Self::Unspecified,
12631 1 => Self::Generic,
12632 2 => Self::Hana,
12633 _ => Self::UnknownValue(workload_profile::UnknownValue(
12634 wkt::internal::UnknownEnumValue::Integer(value),
12635 )),
12636 }
12637 }
12638}
12639
12640impl std::convert::From<&str> for WorkloadProfile {
12641 fn from(value: &str) -> Self {
12642 use std::string::ToString;
12643 match value {
12644 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
12645 "WORKLOAD_PROFILE_GENERIC" => Self::Generic,
12646 "WORKLOAD_PROFILE_HANA" => Self::Hana,
12647 _ => Self::UnknownValue(workload_profile::UnknownValue(
12648 wkt::internal::UnknownEnumValue::String(value.to_string()),
12649 )),
12650 }
12651 }
12652}
12653
12654impl serde::ser::Serialize for WorkloadProfile {
12655 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12656 where
12657 S: serde::Serializer,
12658 {
12659 match self {
12660 Self::Unspecified => serializer.serialize_i32(0),
12661 Self::Generic => serializer.serialize_i32(1),
12662 Self::Hana => serializer.serialize_i32(2),
12663 Self::UnknownValue(u) => u.0.serialize(serializer),
12664 }
12665 }
12666}
12667
12668impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
12669 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12670 where
12671 D: serde::Deserializer<'de>,
12672 {
12673 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
12674 ".google.cloud.baremetalsolution.v2.WorkloadProfile",
12675 ))
12676 }
12677}