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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_location;
27extern crate google_cloud_longrunning;
28extern crate google_cloud_lro;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Represents the metadata from a long-running operation.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct OperationMetadata {
44 /// Output only. The time the operation was created.
45 pub create_time: std::option::Option<wkt::Timestamp>,
46
47 /// Output only. The time the operation finished running.
48 pub end_time: std::option::Option<wkt::Timestamp>,
49
50 /// Output only. Server-defined resource path for the target of the operation.
51 pub target: std::string::String,
52
53 /// Output only. Name of the action executed by the operation.
54 pub verb: std::string::String,
55
56 /// Output only. Human-readable status of the operation, if any.
57 pub status_message: std::string::String,
58
59 /// Output only. Identifies whether the user requested the cancellation
60 /// of the operation. Operations that have been successfully cancelled
61 /// have [Operation.error][] value with a
62 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
63 /// `Code.CANCELLED`.
64 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 project_id = "project_id";
327 /// # let location_id = "location_id";
328 /// # let instance_id = "instance_id";
329 /// let x = Instance::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
330 /// ```
331 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
332 self.name = v.into();
333 self
334 }
335
336 /// Sets the value of [id][crate::model::Instance::id].
337 ///
338 /// # Example
339 /// ```ignore,no_run
340 /// # use google_cloud_baremetalsolution_v2::model::Instance;
341 /// let x = Instance::new().set_id("example");
342 /// ```
343 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
344 self.id = v.into();
345 self
346 }
347
348 /// Sets the value of [create_time][crate::model::Instance::create_time].
349 ///
350 /// # Example
351 /// ```ignore,no_run
352 /// # use google_cloud_baremetalsolution_v2::model::Instance;
353 /// use wkt::Timestamp;
354 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
355 /// ```
356 pub fn set_create_time<T>(mut self, v: T) -> Self
357 where
358 T: std::convert::Into<wkt::Timestamp>,
359 {
360 self.create_time = std::option::Option::Some(v.into());
361 self
362 }
363
364 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
365 ///
366 /// # Example
367 /// ```ignore,no_run
368 /// # use google_cloud_baremetalsolution_v2::model::Instance;
369 /// use wkt::Timestamp;
370 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
371 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
372 /// ```
373 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
374 where
375 T: std::convert::Into<wkt::Timestamp>,
376 {
377 self.create_time = v.map(|x| x.into());
378 self
379 }
380
381 /// Sets the value of [update_time][crate::model::Instance::update_time].
382 ///
383 /// # Example
384 /// ```ignore,no_run
385 /// # use google_cloud_baremetalsolution_v2::model::Instance;
386 /// use wkt::Timestamp;
387 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
388 /// ```
389 pub fn set_update_time<T>(mut self, v: T) -> Self
390 where
391 T: std::convert::Into<wkt::Timestamp>,
392 {
393 self.update_time = std::option::Option::Some(v.into());
394 self
395 }
396
397 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
398 ///
399 /// # Example
400 /// ```ignore,no_run
401 /// # use google_cloud_baremetalsolution_v2::model::Instance;
402 /// use wkt::Timestamp;
403 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
404 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
405 /// ```
406 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
407 where
408 T: std::convert::Into<wkt::Timestamp>,
409 {
410 self.update_time = v.map(|x| x.into());
411 self
412 }
413
414 /// Sets the value of [machine_type][crate::model::Instance::machine_type].
415 ///
416 /// # Example
417 /// ```ignore,no_run
418 /// # use google_cloud_baremetalsolution_v2::model::Instance;
419 /// let x = Instance::new().set_machine_type("example");
420 /// ```
421 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
422 self.machine_type = v.into();
423 self
424 }
425
426 /// Sets the value of [state][crate::model::Instance::state].
427 ///
428 /// # Example
429 /// ```ignore,no_run
430 /// # use google_cloud_baremetalsolution_v2::model::Instance;
431 /// use google_cloud_baremetalsolution_v2::model::instance::State;
432 /// let x0 = Instance::new().set_state(State::Provisioning);
433 /// let x1 = Instance::new().set_state(State::Running);
434 /// let x2 = Instance::new().set_state(State::Deleted);
435 /// ```
436 pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
437 self.state = v.into();
438 self
439 }
440
441 /// Sets the value of [hyperthreading_enabled][crate::model::Instance::hyperthreading_enabled].
442 ///
443 /// # Example
444 /// ```ignore,no_run
445 /// # use google_cloud_baremetalsolution_v2::model::Instance;
446 /// let x = Instance::new().set_hyperthreading_enabled(true);
447 /// ```
448 pub fn set_hyperthreading_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
449 self.hyperthreading_enabled = v.into();
450 self
451 }
452
453 /// Sets the value of [labels][crate::model::Instance::labels].
454 ///
455 /// # Example
456 /// ```ignore,no_run
457 /// # use google_cloud_baremetalsolution_v2::model::Instance;
458 /// let x = Instance::new().set_labels([
459 /// ("key0", "abc"),
460 /// ("key1", "xyz"),
461 /// ]);
462 /// ```
463 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
464 where
465 T: std::iter::IntoIterator<Item = (K, V)>,
466 K: std::convert::Into<std::string::String>,
467 V: std::convert::Into<std::string::String>,
468 {
469 use std::iter::Iterator;
470 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
471 self
472 }
473
474 /// Sets the value of [luns][crate::model::Instance::luns].
475 ///
476 /// # Example
477 /// ```ignore,no_run
478 /// # use google_cloud_baremetalsolution_v2::model::Instance;
479 /// use google_cloud_baremetalsolution_v2::model::Lun;
480 /// let x = Instance::new()
481 /// .set_luns([
482 /// Lun::default()/* use setters */,
483 /// Lun::default()/* use (different) setters */,
484 /// ]);
485 /// ```
486 pub fn set_luns<T, V>(mut self, v: T) -> Self
487 where
488 T: std::iter::IntoIterator<Item = V>,
489 V: std::convert::Into<crate::model::Lun>,
490 {
491 use std::iter::Iterator;
492 self.luns = v.into_iter().map(|i| i.into()).collect();
493 self
494 }
495
496 /// Sets the value of [volumes][crate::model::Instance::volumes].
497 ///
498 /// # Example
499 /// ```ignore,no_run
500 /// # use google_cloud_baremetalsolution_v2::model::Instance;
501 /// use google_cloud_baremetalsolution_v2::model::Volume;
502 /// let x = Instance::new()
503 /// .set_volumes([
504 /// Volume::default()/* use setters */,
505 /// Volume::default()/* use (different) setters */,
506 /// ]);
507 /// ```
508 pub fn set_volumes<T, V>(mut self, v: T) -> Self
509 where
510 T: std::iter::IntoIterator<Item = V>,
511 V: std::convert::Into<crate::model::Volume>,
512 {
513 use std::iter::Iterator;
514 self.volumes = v.into_iter().map(|i| i.into()).collect();
515 self
516 }
517
518 /// Sets the value of [networks][crate::model::Instance::networks].
519 ///
520 /// # Example
521 /// ```ignore,no_run
522 /// # use google_cloud_baremetalsolution_v2::model::Instance;
523 /// use google_cloud_baremetalsolution_v2::model::Network;
524 /// let x = Instance::new()
525 /// .set_networks([
526 /// Network::default()/* use setters */,
527 /// Network::default()/* use (different) setters */,
528 /// ]);
529 /// ```
530 pub fn set_networks<T, V>(mut self, v: T) -> Self
531 where
532 T: std::iter::IntoIterator<Item = V>,
533 V: std::convert::Into<crate::model::Network>,
534 {
535 use std::iter::Iterator;
536 self.networks = v.into_iter().map(|i| i.into()).collect();
537 self
538 }
539
540 /// Sets the value of [interactive_serial_console_enabled][crate::model::Instance::interactive_serial_console_enabled].
541 ///
542 /// # Example
543 /// ```ignore,no_run
544 /// # use google_cloud_baremetalsolution_v2::model::Instance;
545 /// let x = Instance::new().set_interactive_serial_console_enabled(true);
546 /// ```
547 pub fn set_interactive_serial_console_enabled<T: std::convert::Into<bool>>(
548 mut self,
549 v: T,
550 ) -> Self {
551 self.interactive_serial_console_enabled = v.into();
552 self
553 }
554
555 /// Sets the value of [os_image][crate::model::Instance::os_image].
556 ///
557 /// # Example
558 /// ```ignore,no_run
559 /// # use google_cloud_baremetalsolution_v2::model::Instance;
560 /// let x = Instance::new().set_os_image("example");
561 /// ```
562 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
563 self.os_image = v.into();
564 self
565 }
566
567 /// Sets the value of [pod][crate::model::Instance::pod].
568 ///
569 /// # Example
570 /// ```ignore,no_run
571 /// # use google_cloud_baremetalsolution_v2::model::Instance;
572 /// let x = Instance::new().set_pod("example");
573 /// ```
574 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
575 self.pod = v.into();
576 self
577 }
578
579 /// Sets the value of [network_template][crate::model::Instance::network_template].
580 ///
581 /// # Example
582 /// ```ignore,no_run
583 /// # use google_cloud_baremetalsolution_v2::model::Instance;
584 /// # let project_id = "project_id";
585 /// # let location_id = "location_id";
586 /// # let server_network_template_id = "server_network_template_id";
587 /// let x = Instance::new().set_network_template(format!("projects/{project_id}/locations/{location_id}/serverNetworkTemplate/{server_network_template_id}"));
588 /// ```
589 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
590 mut self,
591 v: T,
592 ) -> Self {
593 self.network_template = v.into();
594 self
595 }
596
597 /// Sets the value of [logical_interfaces][crate::model::Instance::logical_interfaces].
598 ///
599 /// # Example
600 /// ```ignore,no_run
601 /// # use google_cloud_baremetalsolution_v2::model::Instance;
602 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
603 /// let x = Instance::new()
604 /// .set_logical_interfaces([
605 /// LogicalInterface::default()/* use setters */,
606 /// LogicalInterface::default()/* use (different) setters */,
607 /// ]);
608 /// ```
609 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
610 where
611 T: std::iter::IntoIterator<Item = V>,
612 V: std::convert::Into<crate::model::LogicalInterface>,
613 {
614 use std::iter::Iterator;
615 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
616 self
617 }
618
619 /// Sets the value of [login_info][crate::model::Instance::login_info].
620 ///
621 /// # Example
622 /// ```ignore,no_run
623 /// # use google_cloud_baremetalsolution_v2::model::Instance;
624 /// let x = Instance::new().set_login_info("example");
625 /// ```
626 pub fn set_login_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
627 self.login_info = v.into();
628 self
629 }
630
631 /// Sets the value of [workload_profile][crate::model::Instance::workload_profile].
632 ///
633 /// # Example
634 /// ```ignore,no_run
635 /// # use google_cloud_baremetalsolution_v2::model::Instance;
636 /// use google_cloud_baremetalsolution_v2::model::WorkloadProfile;
637 /// let x0 = Instance::new().set_workload_profile(WorkloadProfile::Generic);
638 /// let x1 = Instance::new().set_workload_profile(WorkloadProfile::Hana);
639 /// ```
640 pub fn set_workload_profile<T: std::convert::Into<crate::model::WorkloadProfile>>(
641 mut self,
642 v: T,
643 ) -> Self {
644 self.workload_profile = v.into();
645 self
646 }
647
648 /// Sets the value of [firmware_version][crate::model::Instance::firmware_version].
649 ///
650 /// # Example
651 /// ```ignore,no_run
652 /// # use google_cloud_baremetalsolution_v2::model::Instance;
653 /// let x = Instance::new().set_firmware_version("example");
654 /// ```
655 pub fn set_firmware_version<T: std::convert::Into<std::string::String>>(
656 mut self,
657 v: T,
658 ) -> Self {
659 self.firmware_version = v.into();
660 self
661 }
662}
663
664impl wkt::message::Message for Instance {
665 fn typename() -> &'static str {
666 "type.googleapis.com/google.cloud.baremetalsolution.v2.Instance"
667 }
668}
669
670/// Defines additional types related to [Instance].
671pub mod instance {
672 #[allow(unused_imports)]
673 use super::*;
674
675 /// The possible states for this server.
676 ///
677 /// # Working with unknown values
678 ///
679 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
680 /// additional enum variants at any time. Adding new variants is not considered
681 /// a breaking change. Applications should write their code in anticipation of:
682 ///
683 /// - New values appearing in future releases of the client library, **and**
684 /// - New values received dynamically, without application changes.
685 ///
686 /// Please consult the [Working with enums] section in the user guide for some
687 /// guidelines.
688 ///
689 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
690 #[derive(Clone, Debug, PartialEq)]
691 #[non_exhaustive]
692 pub enum State {
693 /// The server is in an unknown state.
694 Unspecified,
695 /// The server is being provisioned.
696 Provisioning,
697 /// The server is running.
698 Running,
699 /// The server has been deleted.
700 Deleted,
701 /// The server is being updated.
702 Updating,
703 /// The server is starting.
704 Starting,
705 /// The server is stopping.
706 Stopping,
707 /// The server is shutdown.
708 Shutdown,
709 /// If set, the enum was initialized with an unknown value.
710 ///
711 /// Applications can examine the value using [State::value] or
712 /// [State::name].
713 UnknownValue(state::UnknownValue),
714 }
715
716 #[doc(hidden)]
717 pub mod state {
718 #[allow(unused_imports)]
719 use super::*;
720 #[derive(Clone, Debug, PartialEq)]
721 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
722 }
723
724 impl State {
725 /// Gets the enum value.
726 ///
727 /// Returns `None` if the enum contains an unknown value deserialized from
728 /// the string representation of enums.
729 pub fn value(&self) -> std::option::Option<i32> {
730 match self {
731 Self::Unspecified => std::option::Option::Some(0),
732 Self::Provisioning => std::option::Option::Some(1),
733 Self::Running => std::option::Option::Some(2),
734 Self::Deleted => std::option::Option::Some(3),
735 Self::Updating => std::option::Option::Some(4),
736 Self::Starting => std::option::Option::Some(5),
737 Self::Stopping => std::option::Option::Some(6),
738 Self::Shutdown => std::option::Option::Some(7),
739 Self::UnknownValue(u) => u.0.value(),
740 }
741 }
742
743 /// Gets the enum value as a string.
744 ///
745 /// Returns `None` if the enum contains an unknown value deserialized from
746 /// the integer representation of enums.
747 pub fn name(&self) -> std::option::Option<&str> {
748 match self {
749 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
750 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
751 Self::Running => std::option::Option::Some("RUNNING"),
752 Self::Deleted => std::option::Option::Some("DELETED"),
753 Self::Updating => std::option::Option::Some("UPDATING"),
754 Self::Starting => std::option::Option::Some("STARTING"),
755 Self::Stopping => std::option::Option::Some("STOPPING"),
756 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
757 Self::UnknownValue(u) => u.0.name(),
758 }
759 }
760 }
761
762 impl std::default::Default for State {
763 fn default() -> Self {
764 use std::convert::From;
765 Self::from(0)
766 }
767 }
768
769 impl std::fmt::Display for State {
770 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
771 wkt::internal::display_enum(f, self.name(), self.value())
772 }
773 }
774
775 impl std::convert::From<i32> for State {
776 fn from(value: i32) -> Self {
777 match value {
778 0 => Self::Unspecified,
779 1 => Self::Provisioning,
780 2 => Self::Running,
781 3 => Self::Deleted,
782 4 => Self::Updating,
783 5 => Self::Starting,
784 6 => Self::Stopping,
785 7 => Self::Shutdown,
786 _ => Self::UnknownValue(state::UnknownValue(
787 wkt::internal::UnknownEnumValue::Integer(value),
788 )),
789 }
790 }
791 }
792
793 impl std::convert::From<&str> for State {
794 fn from(value: &str) -> Self {
795 use std::string::ToString;
796 match value {
797 "STATE_UNSPECIFIED" => Self::Unspecified,
798 "PROVISIONING" => Self::Provisioning,
799 "RUNNING" => Self::Running,
800 "DELETED" => Self::Deleted,
801 "UPDATING" => Self::Updating,
802 "STARTING" => Self::Starting,
803 "STOPPING" => Self::Stopping,
804 "SHUTDOWN" => Self::Shutdown,
805 _ => Self::UnknownValue(state::UnknownValue(
806 wkt::internal::UnknownEnumValue::String(value.to_string()),
807 )),
808 }
809 }
810 }
811
812 impl serde::ser::Serialize for State {
813 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
814 where
815 S: serde::Serializer,
816 {
817 match self {
818 Self::Unspecified => serializer.serialize_i32(0),
819 Self::Provisioning => serializer.serialize_i32(1),
820 Self::Running => serializer.serialize_i32(2),
821 Self::Deleted => serializer.serialize_i32(3),
822 Self::Updating => serializer.serialize_i32(4),
823 Self::Starting => serializer.serialize_i32(5),
824 Self::Stopping => serializer.serialize_i32(6),
825 Self::Shutdown => serializer.serialize_i32(7),
826 Self::UnknownValue(u) => u.0.serialize(serializer),
827 }
828 }
829 }
830
831 impl<'de> serde::de::Deserialize<'de> for State {
832 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
833 where
834 D: serde::Deserializer<'de>,
835 {
836 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
837 ".google.cloud.baremetalsolution.v2.Instance.State",
838 ))
839 }
840 }
841}
842
843/// Message for requesting server information.
844#[derive(Clone, Default, PartialEq)]
845#[non_exhaustive]
846pub struct GetInstanceRequest {
847 /// Required. Name of the resource.
848 pub name: std::string::String,
849
850 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
851}
852
853impl GetInstanceRequest {
854 /// Creates a new default instance.
855 pub fn new() -> Self {
856 std::default::Default::default()
857 }
858
859 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
860 ///
861 /// # Example
862 /// ```ignore,no_run
863 /// # use google_cloud_baremetalsolution_v2::model::GetInstanceRequest;
864 /// # let project_id = "project_id";
865 /// # let location_id = "location_id";
866 /// # let instance_id = "instance_id";
867 /// let x = GetInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
868 /// ```
869 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
870 self.name = v.into();
871 self
872 }
873}
874
875impl wkt::message::Message for GetInstanceRequest {
876 fn typename() -> &'static str {
877 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetInstanceRequest"
878 }
879}
880
881/// Message for requesting the list of servers.
882#[derive(Clone, Default, PartialEq)]
883#[non_exhaustive]
884pub struct ListInstancesRequest {
885 /// Required. Parent value for ListInstancesRequest.
886 pub parent: std::string::String,
887
888 /// Requested page size. Server may return fewer items than requested.
889 /// If unspecified, the server will pick an appropriate default.
890 pub page_size: i32,
891
892 /// A token identifying a page of results from the server.
893 pub page_token: std::string::String,
894
895 /// List filter.
896 pub filter: std::string::String,
897
898 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
899}
900
901impl ListInstancesRequest {
902 /// Creates a new default instance.
903 pub fn new() -> Self {
904 std::default::Default::default()
905 }
906
907 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
908 ///
909 /// # Example
910 /// ```ignore,no_run
911 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
912 /// let x = ListInstancesRequest::new().set_parent("example");
913 /// ```
914 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
915 self.parent = v.into();
916 self
917 }
918
919 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
920 ///
921 /// # Example
922 /// ```ignore,no_run
923 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
924 /// let x = ListInstancesRequest::new().set_page_size(42);
925 /// ```
926 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
927 self.page_size = v.into();
928 self
929 }
930
931 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
932 ///
933 /// # Example
934 /// ```ignore,no_run
935 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
936 /// let x = ListInstancesRequest::new().set_page_token("example");
937 /// ```
938 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
939 self.page_token = v.into();
940 self
941 }
942
943 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
944 ///
945 /// # Example
946 /// ```ignore,no_run
947 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
948 /// let x = ListInstancesRequest::new().set_filter("example");
949 /// ```
950 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
951 self.filter = v.into();
952 self
953 }
954}
955
956impl wkt::message::Message for ListInstancesRequest {
957 fn typename() -> &'static str {
958 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesRequest"
959 }
960}
961
962/// Response message for the list of servers.
963#[derive(Clone, Default, PartialEq)]
964#[non_exhaustive]
965pub struct ListInstancesResponse {
966 /// The list of servers.
967 pub instances: std::vec::Vec<crate::model::Instance>,
968
969 /// A token identifying a page of results from the server.
970 pub next_page_token: std::string::String,
971
972 /// Locations that could not be reached.
973 pub unreachable: std::vec::Vec<std::string::String>,
974
975 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
976}
977
978impl ListInstancesResponse {
979 /// Creates a new default instance.
980 pub fn new() -> Self {
981 std::default::Default::default()
982 }
983
984 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
985 ///
986 /// # Example
987 /// ```ignore,no_run
988 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
989 /// use google_cloud_baremetalsolution_v2::model::Instance;
990 /// let x = ListInstancesResponse::new()
991 /// .set_instances([
992 /// Instance::default()/* use setters */,
993 /// Instance::default()/* use (different) setters */,
994 /// ]);
995 /// ```
996 pub fn set_instances<T, V>(mut self, v: T) -> Self
997 where
998 T: std::iter::IntoIterator<Item = V>,
999 V: std::convert::Into<crate::model::Instance>,
1000 {
1001 use std::iter::Iterator;
1002 self.instances = v.into_iter().map(|i| i.into()).collect();
1003 self
1004 }
1005
1006 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
1007 ///
1008 /// # Example
1009 /// ```ignore,no_run
1010 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
1011 /// let x = ListInstancesResponse::new().set_next_page_token("example");
1012 /// ```
1013 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1014 self.next_page_token = v.into();
1015 self
1016 }
1017
1018 /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
1019 ///
1020 /// # Example
1021 /// ```ignore,no_run
1022 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
1023 /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
1024 /// ```
1025 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1026 where
1027 T: std::iter::IntoIterator<Item = V>,
1028 V: std::convert::Into<std::string::String>,
1029 {
1030 use std::iter::Iterator;
1031 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1032 self
1033 }
1034}
1035
1036impl wkt::message::Message for ListInstancesResponse {
1037 fn typename() -> &'static str {
1038 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesResponse"
1039 }
1040}
1041
1042#[doc(hidden)]
1043impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
1044 type PageItem = crate::model::Instance;
1045
1046 fn items(self) -> std::vec::Vec<Self::PageItem> {
1047 self.instances
1048 }
1049
1050 fn next_page_token(&self) -> std::string::String {
1051 use std::clone::Clone;
1052 self.next_page_token.clone()
1053 }
1054}
1055
1056/// Message requesting to updating a server.
1057#[derive(Clone, Default, PartialEq)]
1058#[non_exhaustive]
1059pub struct UpdateInstanceRequest {
1060 /// Required. The server to update.
1061 ///
1062 /// The `name` field is used to identify the instance to update.
1063 /// Format: projects/{project}/locations/{location}/instances/{instance}
1064 pub instance: std::option::Option<crate::model::Instance>,
1065
1066 /// The list of fields to update.
1067 /// The currently supported fields are:
1068 /// `labels`
1069 /// `hyperthreading_enabled`
1070 /// `os_image`
1071 pub update_mask: std::option::Option<wkt::FieldMask>,
1072
1073 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1074}
1075
1076impl UpdateInstanceRequest {
1077 /// Creates a new default instance.
1078 pub fn new() -> Self {
1079 std::default::Default::default()
1080 }
1081
1082 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
1083 ///
1084 /// # Example
1085 /// ```ignore,no_run
1086 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1087 /// use google_cloud_baremetalsolution_v2::model::Instance;
1088 /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
1089 /// ```
1090 pub fn set_instance<T>(mut self, v: T) -> Self
1091 where
1092 T: std::convert::Into<crate::model::Instance>,
1093 {
1094 self.instance = std::option::Option::Some(v.into());
1095 self
1096 }
1097
1098 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
1099 ///
1100 /// # Example
1101 /// ```ignore,no_run
1102 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1103 /// use google_cloud_baremetalsolution_v2::model::Instance;
1104 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
1105 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
1106 /// ```
1107 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1108 where
1109 T: std::convert::Into<crate::model::Instance>,
1110 {
1111 self.instance = v.map(|x| x.into());
1112 self
1113 }
1114
1115 /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1116 ///
1117 /// # Example
1118 /// ```ignore,no_run
1119 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1120 /// use wkt::FieldMask;
1121 /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1122 /// ```
1123 pub fn set_update_mask<T>(mut self, v: T) -> Self
1124 where
1125 T: std::convert::Into<wkt::FieldMask>,
1126 {
1127 self.update_mask = std::option::Option::Some(v.into());
1128 self
1129 }
1130
1131 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1132 ///
1133 /// # Example
1134 /// ```ignore,no_run
1135 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1136 /// use wkt::FieldMask;
1137 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1138 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1139 /// ```
1140 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1141 where
1142 T: std::convert::Into<wkt::FieldMask>,
1143 {
1144 self.update_mask = v.map(|x| x.into());
1145 self
1146 }
1147}
1148
1149impl wkt::message::Message for UpdateInstanceRequest {
1150 fn typename() -> &'static str {
1151 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateInstanceRequest"
1152 }
1153}
1154
1155/// Message requesting rename of a server.
1156#[derive(Clone, Default, PartialEq)]
1157#[non_exhaustive]
1158pub struct RenameInstanceRequest {
1159 /// Required. The `name` field is used to identify the instance.
1160 /// Format: projects/{project}/locations/{location}/instances/{instance}
1161 pub name: std::string::String,
1162
1163 /// Required. The new `id` of the instance.
1164 pub new_instance_id: std::string::String,
1165
1166 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1167}
1168
1169impl RenameInstanceRequest {
1170 /// Creates a new default instance.
1171 pub fn new() -> Self {
1172 std::default::Default::default()
1173 }
1174
1175 /// Sets the value of [name][crate::model::RenameInstanceRequest::name].
1176 ///
1177 /// # Example
1178 /// ```ignore,no_run
1179 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1180 /// # let project_id = "project_id";
1181 /// # let location_id = "location_id";
1182 /// # let instance_id = "instance_id";
1183 /// let x = RenameInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1184 /// ```
1185 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1186 self.name = v.into();
1187 self
1188 }
1189
1190 /// Sets the value of [new_instance_id][crate::model::RenameInstanceRequest::new_instance_id].
1191 ///
1192 /// # Example
1193 /// ```ignore,no_run
1194 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1195 /// let x = RenameInstanceRequest::new().set_new_instance_id("example");
1196 /// ```
1197 pub fn set_new_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1198 self.new_instance_id = v.into();
1199 self
1200 }
1201}
1202
1203impl wkt::message::Message for RenameInstanceRequest {
1204 fn typename() -> &'static str {
1205 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameInstanceRequest"
1206 }
1207}
1208
1209/// Message requesting to reset a server.
1210#[derive(Clone, Default, PartialEq)]
1211#[non_exhaustive]
1212pub struct ResetInstanceRequest {
1213 /// Required. Name of the resource.
1214 pub name: std::string::String,
1215
1216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1217}
1218
1219impl ResetInstanceRequest {
1220 /// Creates a new default instance.
1221 pub fn new() -> Self {
1222 std::default::Default::default()
1223 }
1224
1225 /// Sets the value of [name][crate::model::ResetInstanceRequest::name].
1226 ///
1227 /// # Example
1228 /// ```ignore,no_run
1229 /// # use google_cloud_baremetalsolution_v2::model::ResetInstanceRequest;
1230 /// # let project_id = "project_id";
1231 /// # let location_id = "location_id";
1232 /// # let instance_id = "instance_id";
1233 /// let x = ResetInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1234 /// ```
1235 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1236 self.name = v.into();
1237 self
1238 }
1239}
1240
1241impl wkt::message::Message for ResetInstanceRequest {
1242 fn typename() -> &'static str {
1243 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceRequest"
1244 }
1245}
1246
1247/// Message requesting to start a server.
1248#[derive(Clone, Default, PartialEq)]
1249#[non_exhaustive]
1250pub struct StartInstanceRequest {
1251 /// Required. Name of the resource.
1252 pub name: std::string::String,
1253
1254 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1255}
1256
1257impl StartInstanceRequest {
1258 /// Creates a new default instance.
1259 pub fn new() -> Self {
1260 std::default::Default::default()
1261 }
1262
1263 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
1264 ///
1265 /// # Example
1266 /// ```ignore,no_run
1267 /// # use google_cloud_baremetalsolution_v2::model::StartInstanceRequest;
1268 /// # let project_id = "project_id";
1269 /// # let location_id = "location_id";
1270 /// # let instance_id = "instance_id";
1271 /// let x = StartInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1272 /// ```
1273 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1274 self.name = v.into();
1275 self
1276 }
1277}
1278
1279impl wkt::message::Message for StartInstanceRequest {
1280 fn typename() -> &'static str {
1281 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceRequest"
1282 }
1283}
1284
1285/// Response message from starting a server.
1286#[derive(Clone, Default, PartialEq)]
1287#[non_exhaustive]
1288pub struct StartInstanceResponse {
1289 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1290}
1291
1292impl StartInstanceResponse {
1293 /// Creates a new default instance.
1294 pub fn new() -> Self {
1295 std::default::Default::default()
1296 }
1297}
1298
1299impl wkt::message::Message for StartInstanceResponse {
1300 fn typename() -> &'static str {
1301 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceResponse"
1302 }
1303}
1304
1305/// Message requesting to stop a server.
1306#[derive(Clone, Default, PartialEq)]
1307#[non_exhaustive]
1308pub struct StopInstanceRequest {
1309 /// Required. Name of the resource.
1310 pub name: std::string::String,
1311
1312 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1313}
1314
1315impl StopInstanceRequest {
1316 /// Creates a new default instance.
1317 pub fn new() -> Self {
1318 std::default::Default::default()
1319 }
1320
1321 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
1322 ///
1323 /// # Example
1324 /// ```ignore,no_run
1325 /// # use google_cloud_baremetalsolution_v2::model::StopInstanceRequest;
1326 /// # let project_id = "project_id";
1327 /// # let location_id = "location_id";
1328 /// # let instance_id = "instance_id";
1329 /// let x = StopInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1330 /// ```
1331 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1332 self.name = v.into();
1333 self
1334 }
1335}
1336
1337impl wkt::message::Message for StopInstanceRequest {
1338 fn typename() -> &'static str {
1339 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceRequest"
1340 }
1341}
1342
1343/// Response message from stopping a server.
1344#[derive(Clone, Default, PartialEq)]
1345#[non_exhaustive]
1346pub struct StopInstanceResponse {
1347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1348}
1349
1350impl StopInstanceResponse {
1351 /// Creates a new default instance.
1352 pub fn new() -> Self {
1353 std::default::Default::default()
1354 }
1355}
1356
1357impl wkt::message::Message for StopInstanceResponse {
1358 fn typename() -> &'static str {
1359 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceResponse"
1360 }
1361}
1362
1363/// Message for enabling the interactive serial console on an instance.
1364#[derive(Clone, Default, PartialEq)]
1365#[non_exhaustive]
1366pub struct EnableInteractiveSerialConsoleRequest {
1367 /// Required. Name of the resource.
1368 pub name: std::string::String,
1369
1370 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1371}
1372
1373impl EnableInteractiveSerialConsoleRequest {
1374 /// Creates a new default instance.
1375 pub fn new() -> Self {
1376 std::default::Default::default()
1377 }
1378
1379 /// Sets the value of [name][crate::model::EnableInteractiveSerialConsoleRequest::name].
1380 ///
1381 /// # Example
1382 /// ```ignore,no_run
1383 /// # use google_cloud_baremetalsolution_v2::model::EnableInteractiveSerialConsoleRequest;
1384 /// # let project_id = "project_id";
1385 /// # let location_id = "location_id";
1386 /// # let instance_id = "instance_id";
1387 /// let x = EnableInteractiveSerialConsoleRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1388 /// ```
1389 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1390 self.name = v.into();
1391 self
1392 }
1393}
1394
1395impl wkt::message::Message for EnableInteractiveSerialConsoleRequest {
1396 fn typename() -> &'static str {
1397 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleRequest"
1398 }
1399}
1400
1401/// Message for response of EnableInteractiveSerialConsole.
1402#[derive(Clone, Default, PartialEq)]
1403#[non_exhaustive]
1404pub struct EnableInteractiveSerialConsoleResponse {
1405 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1406}
1407
1408impl EnableInteractiveSerialConsoleResponse {
1409 /// Creates a new default instance.
1410 pub fn new() -> Self {
1411 std::default::Default::default()
1412 }
1413}
1414
1415impl wkt::message::Message for EnableInteractiveSerialConsoleResponse {
1416 fn typename() -> &'static str {
1417 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleResponse"
1418 }
1419}
1420
1421/// Message for disabling the interactive serial console on an instance.
1422#[derive(Clone, Default, PartialEq)]
1423#[non_exhaustive]
1424pub struct DisableInteractiveSerialConsoleRequest {
1425 /// Required. Name of the resource.
1426 pub name: std::string::String,
1427
1428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1429}
1430
1431impl DisableInteractiveSerialConsoleRequest {
1432 /// Creates a new default instance.
1433 pub fn new() -> Self {
1434 std::default::Default::default()
1435 }
1436
1437 /// Sets the value of [name][crate::model::DisableInteractiveSerialConsoleRequest::name].
1438 ///
1439 /// # Example
1440 /// ```ignore,no_run
1441 /// # use google_cloud_baremetalsolution_v2::model::DisableInteractiveSerialConsoleRequest;
1442 /// # let project_id = "project_id";
1443 /// # let location_id = "location_id";
1444 /// # let instance_id = "instance_id";
1445 /// let x = DisableInteractiveSerialConsoleRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1446 /// ```
1447 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1448 self.name = v.into();
1449 self
1450 }
1451}
1452
1453impl wkt::message::Message for DisableInteractiveSerialConsoleRequest {
1454 fn typename() -> &'static str {
1455 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleRequest"
1456 }
1457}
1458
1459/// Message for response of DisableInteractiveSerialConsole.
1460#[derive(Clone, Default, PartialEq)]
1461#[non_exhaustive]
1462pub struct DisableInteractiveSerialConsoleResponse {
1463 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1464}
1465
1466impl DisableInteractiveSerialConsoleResponse {
1467 /// Creates a new default instance.
1468 pub fn new() -> Self {
1469 std::default::Default::default()
1470 }
1471}
1472
1473impl wkt::message::Message for DisableInteractiveSerialConsoleResponse {
1474 fn typename() -> &'static str {
1475 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleResponse"
1476 }
1477}
1478
1479/// Message for detach specific LUN from an Instance.
1480#[derive(Clone, Default, PartialEq)]
1481#[non_exhaustive]
1482pub struct DetachLunRequest {
1483 /// Required. Name of the instance.
1484 pub instance: std::string::String,
1485
1486 /// Required. Name of the Lun to detach.
1487 pub lun: std::string::String,
1488
1489 /// If true, performs lun unmapping without instance reboot.
1490 pub skip_reboot: bool,
1491
1492 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1493}
1494
1495impl DetachLunRequest {
1496 /// Creates a new default instance.
1497 pub fn new() -> Self {
1498 std::default::Default::default()
1499 }
1500
1501 /// Sets the value of [instance][crate::model::DetachLunRequest::instance].
1502 ///
1503 /// # Example
1504 /// ```ignore,no_run
1505 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1506 /// # let project_id = "project_id";
1507 /// # let location_id = "location_id";
1508 /// # let instance_id = "instance_id";
1509 /// let x = DetachLunRequest::new().set_instance(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1510 /// ```
1511 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1512 self.instance = v.into();
1513 self
1514 }
1515
1516 /// Sets the value of [lun][crate::model::DetachLunRequest::lun].
1517 ///
1518 /// # Example
1519 /// ```ignore,no_run
1520 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1521 /// # let project_id = "project_id";
1522 /// # let location_id = "location_id";
1523 /// # let volume_id = "volume_id";
1524 /// # let lun_id = "lun_id";
1525 /// let x = DetachLunRequest::new().set_lun(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/luns/{lun_id}"));
1526 /// ```
1527 pub fn set_lun<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1528 self.lun = v.into();
1529 self
1530 }
1531
1532 /// Sets the value of [skip_reboot][crate::model::DetachLunRequest::skip_reboot].
1533 ///
1534 /// # Example
1535 /// ```ignore,no_run
1536 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1537 /// let x = DetachLunRequest::new().set_skip_reboot(true);
1538 /// ```
1539 pub fn set_skip_reboot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1540 self.skip_reboot = v.into();
1541 self
1542 }
1543}
1544
1545impl wkt::message::Message for DetachLunRequest {
1546 fn typename() -> &'static str {
1547 "type.googleapis.com/google.cloud.baremetalsolution.v2.DetachLunRequest"
1548 }
1549}
1550
1551/// Network template.
1552#[derive(Clone, Default, PartialEq)]
1553#[non_exhaustive]
1554pub struct ServerNetworkTemplate {
1555 /// Output only. Template's unique name. The full resource name follows the
1556 /// pattern:
1557 /// `projects/{project}/locations/{location}/serverNetworkTemplate/{server_network_template}`
1558 /// Generally, the {server_network_template} follows the syntax of
1559 /// "bond<interface_type_index><bond_mode>" or "nic<interface_type_index>".
1560 pub name: std::string::String,
1561
1562 /// Instance types this template is applicable to.
1563 pub applicable_instance_types: std::vec::Vec<std::string::String>,
1564
1565 /// Logical interfaces.
1566 pub logical_interfaces: std::vec::Vec<crate::model::server_network_template::LogicalInterface>,
1567
1568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1569}
1570
1571impl ServerNetworkTemplate {
1572 /// Creates a new default instance.
1573 pub fn new() -> Self {
1574 std::default::Default::default()
1575 }
1576
1577 /// Sets the value of [name][crate::model::ServerNetworkTemplate::name].
1578 ///
1579 /// # Example
1580 /// ```ignore,no_run
1581 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1582 /// # let project_id = "project_id";
1583 /// # let location_id = "location_id";
1584 /// # let server_network_template_id = "server_network_template_id";
1585 /// let x = ServerNetworkTemplate::new().set_name(format!("projects/{project_id}/locations/{location_id}/serverNetworkTemplate/{server_network_template_id}"));
1586 /// ```
1587 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1588 self.name = v.into();
1589 self
1590 }
1591
1592 /// Sets the value of [applicable_instance_types][crate::model::ServerNetworkTemplate::applicable_instance_types].
1593 ///
1594 /// # Example
1595 /// ```ignore,no_run
1596 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1597 /// let x = ServerNetworkTemplate::new().set_applicable_instance_types(["a", "b", "c"]);
1598 /// ```
1599 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
1600 where
1601 T: std::iter::IntoIterator<Item = V>,
1602 V: std::convert::Into<std::string::String>,
1603 {
1604 use std::iter::Iterator;
1605 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
1606 self
1607 }
1608
1609 /// Sets the value of [logical_interfaces][crate::model::ServerNetworkTemplate::logical_interfaces].
1610 ///
1611 /// # Example
1612 /// ```ignore,no_run
1613 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1614 /// use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1615 /// let x = ServerNetworkTemplate::new()
1616 /// .set_logical_interfaces([
1617 /// LogicalInterface::default()/* use setters */,
1618 /// LogicalInterface::default()/* use (different) setters */,
1619 /// ]);
1620 /// ```
1621 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
1622 where
1623 T: std::iter::IntoIterator<Item = V>,
1624 V: std::convert::Into<crate::model::server_network_template::LogicalInterface>,
1625 {
1626 use std::iter::Iterator;
1627 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
1628 self
1629 }
1630}
1631
1632impl wkt::message::Message for ServerNetworkTemplate {
1633 fn typename() -> &'static str {
1634 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate"
1635 }
1636}
1637
1638/// Defines additional types related to [ServerNetworkTemplate].
1639pub mod server_network_template {
1640 #[allow(unused_imports)]
1641 use super::*;
1642
1643 /// Logical interface.
1644 #[derive(Clone, Default, PartialEq)]
1645 #[non_exhaustive]
1646 pub struct LogicalInterface {
1647 /// Interface name.
1648 /// This is not a globally unique identifier.
1649 /// Name is unique only inside the ServerNetworkTemplate. This is of syntax
1650 /// \<bond\><interface_type_index><bond_mode> or \<nic\><interface_type_index>
1651 /// and forms part of the network template name.
1652 pub name: std::string::String,
1653
1654 /// Interface type.
1655 pub r#type: crate::model::server_network_template::logical_interface::InterfaceType,
1656
1657 /// If true, interface must have network connected.
1658 pub required: bool,
1659
1660 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1661 }
1662
1663 impl LogicalInterface {
1664 /// Creates a new default instance.
1665 pub fn new() -> Self {
1666 std::default::Default::default()
1667 }
1668
1669 /// Sets the value of [name][crate::model::server_network_template::LogicalInterface::name].
1670 ///
1671 /// # Example
1672 /// ```ignore,no_run
1673 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1674 /// let x = LogicalInterface::new().set_name("example");
1675 /// ```
1676 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1677 self.name = v.into();
1678 self
1679 }
1680
1681 /// Sets the value of [r#type][crate::model::server_network_template::LogicalInterface::type].
1682 ///
1683 /// # Example
1684 /// ```ignore,no_run
1685 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1686 /// use google_cloud_baremetalsolution_v2::model::server_network_template::logical_interface::InterfaceType;
1687 /// let x0 = LogicalInterface::new().set_type(InterfaceType::Bond);
1688 /// let x1 = LogicalInterface::new().set_type(InterfaceType::Nic);
1689 /// ```
1690 pub fn set_type<
1691 T: std::convert::Into<
1692 crate::model::server_network_template::logical_interface::InterfaceType,
1693 >,
1694 >(
1695 mut self,
1696 v: T,
1697 ) -> Self {
1698 self.r#type = v.into();
1699 self
1700 }
1701
1702 /// Sets the value of [required][crate::model::server_network_template::LogicalInterface::required].
1703 ///
1704 /// # Example
1705 /// ```ignore,no_run
1706 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1707 /// let x = LogicalInterface::new().set_required(true);
1708 /// ```
1709 pub fn set_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1710 self.required = v.into();
1711 self
1712 }
1713 }
1714
1715 impl wkt::message::Message for LogicalInterface {
1716 fn typename() -> &'static str {
1717 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface"
1718 }
1719 }
1720
1721 /// Defines additional types related to [LogicalInterface].
1722 pub mod logical_interface {
1723 #[allow(unused_imports)]
1724 use super::*;
1725
1726 /// Interface type.
1727 ///
1728 /// # Working with unknown values
1729 ///
1730 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1731 /// additional enum variants at any time. Adding new variants is not considered
1732 /// a breaking change. Applications should write their code in anticipation of:
1733 ///
1734 /// - New values appearing in future releases of the client library, **and**
1735 /// - New values received dynamically, without application changes.
1736 ///
1737 /// Please consult the [Working with enums] section in the user guide for some
1738 /// guidelines.
1739 ///
1740 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1741 #[derive(Clone, Debug, PartialEq)]
1742 #[non_exhaustive]
1743 pub enum InterfaceType {
1744 /// Unspecified value.
1745 Unspecified,
1746 /// Bond interface type.
1747 Bond,
1748 /// NIC interface type.
1749 Nic,
1750 /// If set, the enum was initialized with an unknown value.
1751 ///
1752 /// Applications can examine the value using [InterfaceType::value] or
1753 /// [InterfaceType::name].
1754 UnknownValue(interface_type::UnknownValue),
1755 }
1756
1757 #[doc(hidden)]
1758 pub mod interface_type {
1759 #[allow(unused_imports)]
1760 use super::*;
1761 #[derive(Clone, Debug, PartialEq)]
1762 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1763 }
1764
1765 impl InterfaceType {
1766 /// Gets the enum value.
1767 ///
1768 /// Returns `None` if the enum contains an unknown value deserialized from
1769 /// the string representation of enums.
1770 pub fn value(&self) -> std::option::Option<i32> {
1771 match self {
1772 Self::Unspecified => std::option::Option::Some(0),
1773 Self::Bond => std::option::Option::Some(1),
1774 Self::Nic => std::option::Option::Some(2),
1775 Self::UnknownValue(u) => u.0.value(),
1776 }
1777 }
1778
1779 /// Gets the enum value as a string.
1780 ///
1781 /// Returns `None` if the enum contains an unknown value deserialized from
1782 /// the integer representation of enums.
1783 pub fn name(&self) -> std::option::Option<&str> {
1784 match self {
1785 Self::Unspecified => std::option::Option::Some("INTERFACE_TYPE_UNSPECIFIED"),
1786 Self::Bond => std::option::Option::Some("BOND"),
1787 Self::Nic => std::option::Option::Some("NIC"),
1788 Self::UnknownValue(u) => u.0.name(),
1789 }
1790 }
1791 }
1792
1793 impl std::default::Default for InterfaceType {
1794 fn default() -> Self {
1795 use std::convert::From;
1796 Self::from(0)
1797 }
1798 }
1799
1800 impl std::fmt::Display for InterfaceType {
1801 fn fmt(
1802 &self,
1803 f: &mut std::fmt::Formatter<'_>,
1804 ) -> std::result::Result<(), std::fmt::Error> {
1805 wkt::internal::display_enum(f, self.name(), self.value())
1806 }
1807 }
1808
1809 impl std::convert::From<i32> for InterfaceType {
1810 fn from(value: i32) -> Self {
1811 match value {
1812 0 => Self::Unspecified,
1813 1 => Self::Bond,
1814 2 => Self::Nic,
1815 _ => Self::UnknownValue(interface_type::UnknownValue(
1816 wkt::internal::UnknownEnumValue::Integer(value),
1817 )),
1818 }
1819 }
1820 }
1821
1822 impl std::convert::From<&str> for InterfaceType {
1823 fn from(value: &str) -> Self {
1824 use std::string::ToString;
1825 match value {
1826 "INTERFACE_TYPE_UNSPECIFIED" => Self::Unspecified,
1827 "BOND" => Self::Bond,
1828 "NIC" => Self::Nic,
1829 _ => Self::UnknownValue(interface_type::UnknownValue(
1830 wkt::internal::UnknownEnumValue::String(value.to_string()),
1831 )),
1832 }
1833 }
1834 }
1835
1836 impl serde::ser::Serialize for InterfaceType {
1837 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1838 where
1839 S: serde::Serializer,
1840 {
1841 match self {
1842 Self::Unspecified => serializer.serialize_i32(0),
1843 Self::Bond => serializer.serialize_i32(1),
1844 Self::Nic => serializer.serialize_i32(2),
1845 Self::UnknownValue(u) => u.0.serialize(serializer),
1846 }
1847 }
1848 }
1849
1850 impl<'de> serde::de::Deserialize<'de> for InterfaceType {
1851 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1852 where
1853 D: serde::Deserializer<'de>,
1854 {
1855 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InterfaceType>::new(
1856 ".google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface.InterfaceType"))
1857 }
1858 }
1859 }
1860}
1861
1862/// A storage volume logical unit number (LUN).
1863#[derive(Clone, Default, PartialEq)]
1864#[non_exhaustive]
1865pub struct Lun {
1866 /// Output only. The name of the LUN.
1867 pub name: std::string::String,
1868
1869 /// An identifier for the LUN, generated by the backend.
1870 pub id: std::string::String,
1871
1872 /// The state of this storage volume.
1873 pub state: crate::model::lun::State,
1874
1875 /// The size of this LUN, in gigabytes.
1876 pub size_gb: i64,
1877
1878 /// The LUN multiprotocol type ensures the characteristics of the LUN are
1879 /// optimized for each operating system.
1880 pub multiprotocol_type: crate::model::lun::MultiprotocolType,
1881
1882 /// Display the storage volume for this LUN.
1883 pub storage_volume: std::string::String,
1884
1885 /// Display if this LUN can be shared between multiple physical servers.
1886 pub shareable: bool,
1887
1888 /// Display if this LUN is a boot LUN.
1889 pub boot_lun: bool,
1890
1891 /// The storage type for this LUN.
1892 pub storage_type: crate::model::lun::StorageType,
1893
1894 /// The WWID for this LUN.
1895 pub wwid: std::string::String,
1896
1897 /// Output only. Time after which LUN will be fully deleted.
1898 /// It is filled only for LUNs in COOL_OFF state.
1899 pub expire_time: std::option::Option<wkt::Timestamp>,
1900
1901 /// Output only. Instances this Lun is attached to.
1902 pub instances: std::vec::Vec<std::string::String>,
1903
1904 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1905}
1906
1907impl Lun {
1908 /// Creates a new default instance.
1909 pub fn new() -> Self {
1910 std::default::Default::default()
1911 }
1912
1913 /// Sets the value of [name][crate::model::Lun::name].
1914 ///
1915 /// # Example
1916 /// ```ignore,no_run
1917 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1918 /// # let project_id = "project_id";
1919 /// # let location_id = "location_id";
1920 /// # let volume_id = "volume_id";
1921 /// # let lun_id = "lun_id";
1922 /// let x = Lun::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/luns/{lun_id}"));
1923 /// ```
1924 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1925 self.name = v.into();
1926 self
1927 }
1928
1929 /// Sets the value of [id][crate::model::Lun::id].
1930 ///
1931 /// # Example
1932 /// ```ignore,no_run
1933 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1934 /// let x = Lun::new().set_id("example");
1935 /// ```
1936 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1937 self.id = v.into();
1938 self
1939 }
1940
1941 /// Sets the value of [state][crate::model::Lun::state].
1942 ///
1943 /// # Example
1944 /// ```ignore,no_run
1945 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1946 /// use google_cloud_baremetalsolution_v2::model::lun::State;
1947 /// let x0 = Lun::new().set_state(State::Creating);
1948 /// let x1 = Lun::new().set_state(State::Updating);
1949 /// let x2 = Lun::new().set_state(State::Ready);
1950 /// ```
1951 pub fn set_state<T: std::convert::Into<crate::model::lun::State>>(mut self, v: T) -> Self {
1952 self.state = v.into();
1953 self
1954 }
1955
1956 /// Sets the value of [size_gb][crate::model::Lun::size_gb].
1957 ///
1958 /// # Example
1959 /// ```ignore,no_run
1960 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1961 /// let x = Lun::new().set_size_gb(42);
1962 /// ```
1963 pub fn set_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1964 self.size_gb = v.into();
1965 self
1966 }
1967
1968 /// Sets the value of [multiprotocol_type][crate::model::Lun::multiprotocol_type].
1969 ///
1970 /// # Example
1971 /// ```ignore,no_run
1972 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1973 /// use google_cloud_baremetalsolution_v2::model::lun::MultiprotocolType;
1974 /// let x0 = Lun::new().set_multiprotocol_type(MultiprotocolType::Linux);
1975 /// ```
1976 pub fn set_multiprotocol_type<T: std::convert::Into<crate::model::lun::MultiprotocolType>>(
1977 mut self,
1978 v: T,
1979 ) -> Self {
1980 self.multiprotocol_type = v.into();
1981 self
1982 }
1983
1984 /// Sets the value of [storage_volume][crate::model::Lun::storage_volume].
1985 ///
1986 /// # Example
1987 /// ```ignore,no_run
1988 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1989 /// # let project_id = "project_id";
1990 /// # let location_id = "location_id";
1991 /// # let volume_id = "volume_id";
1992 /// let x = Lun::new().set_storage_volume(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
1993 /// ```
1994 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1995 self.storage_volume = v.into();
1996 self
1997 }
1998
1999 /// Sets the value of [shareable][crate::model::Lun::shareable].
2000 ///
2001 /// # Example
2002 /// ```ignore,no_run
2003 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2004 /// let x = Lun::new().set_shareable(true);
2005 /// ```
2006 pub fn set_shareable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2007 self.shareable = v.into();
2008 self
2009 }
2010
2011 /// Sets the value of [boot_lun][crate::model::Lun::boot_lun].
2012 ///
2013 /// # Example
2014 /// ```ignore,no_run
2015 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2016 /// let x = Lun::new().set_boot_lun(true);
2017 /// ```
2018 pub fn set_boot_lun<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2019 self.boot_lun = v.into();
2020 self
2021 }
2022
2023 /// Sets the value of [storage_type][crate::model::Lun::storage_type].
2024 ///
2025 /// # Example
2026 /// ```ignore,no_run
2027 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2028 /// use google_cloud_baremetalsolution_v2::model::lun::StorageType;
2029 /// let x0 = Lun::new().set_storage_type(StorageType::Ssd);
2030 /// let x1 = Lun::new().set_storage_type(StorageType::Hdd);
2031 /// ```
2032 pub fn set_storage_type<T: std::convert::Into<crate::model::lun::StorageType>>(
2033 mut self,
2034 v: T,
2035 ) -> Self {
2036 self.storage_type = v.into();
2037 self
2038 }
2039
2040 /// Sets the value of [wwid][crate::model::Lun::wwid].
2041 ///
2042 /// # Example
2043 /// ```ignore,no_run
2044 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2045 /// let x = Lun::new().set_wwid("example");
2046 /// ```
2047 pub fn set_wwid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2048 self.wwid = v.into();
2049 self
2050 }
2051
2052 /// Sets the value of [expire_time][crate::model::Lun::expire_time].
2053 ///
2054 /// # Example
2055 /// ```ignore,no_run
2056 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2057 /// use wkt::Timestamp;
2058 /// let x = Lun::new().set_expire_time(Timestamp::default()/* use setters */);
2059 /// ```
2060 pub fn set_expire_time<T>(mut self, v: T) -> Self
2061 where
2062 T: std::convert::Into<wkt::Timestamp>,
2063 {
2064 self.expire_time = std::option::Option::Some(v.into());
2065 self
2066 }
2067
2068 /// Sets or clears the value of [expire_time][crate::model::Lun::expire_time].
2069 ///
2070 /// # Example
2071 /// ```ignore,no_run
2072 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2073 /// use wkt::Timestamp;
2074 /// let x = Lun::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2075 /// let x = Lun::new().set_or_clear_expire_time(None::<Timestamp>);
2076 /// ```
2077 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2078 where
2079 T: std::convert::Into<wkt::Timestamp>,
2080 {
2081 self.expire_time = v.map(|x| x.into());
2082 self
2083 }
2084
2085 /// Sets the value of [instances][crate::model::Lun::instances].
2086 ///
2087 /// # Example
2088 /// ```ignore,no_run
2089 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2090 /// let x = Lun::new().set_instances(["a", "b", "c"]);
2091 /// ```
2092 pub fn set_instances<T, V>(mut self, v: T) -> Self
2093 where
2094 T: std::iter::IntoIterator<Item = V>,
2095 V: std::convert::Into<std::string::String>,
2096 {
2097 use std::iter::Iterator;
2098 self.instances = v.into_iter().map(|i| i.into()).collect();
2099 self
2100 }
2101}
2102
2103impl wkt::message::Message for Lun {
2104 fn typename() -> &'static str {
2105 "type.googleapis.com/google.cloud.baremetalsolution.v2.Lun"
2106 }
2107}
2108
2109/// Defines additional types related to [Lun].
2110pub mod lun {
2111 #[allow(unused_imports)]
2112 use super::*;
2113
2114 /// The possible states for the LUN.
2115 ///
2116 /// # Working with unknown values
2117 ///
2118 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2119 /// additional enum variants at any time. Adding new variants is not considered
2120 /// a breaking change. Applications should write their code in anticipation of:
2121 ///
2122 /// - New values appearing in future releases of the client library, **and**
2123 /// - New values received dynamically, without application changes.
2124 ///
2125 /// Please consult the [Working with enums] section in the user guide for some
2126 /// guidelines.
2127 ///
2128 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2129 #[derive(Clone, Debug, PartialEq)]
2130 #[non_exhaustive]
2131 pub enum State {
2132 /// The LUN is in an unknown state.
2133 Unspecified,
2134 /// The LUN is being created.
2135 Creating,
2136 /// The LUN is being updated.
2137 Updating,
2138 /// The LUN is ready for use.
2139 Ready,
2140 /// The LUN has been requested to be deleted.
2141 Deleting,
2142 /// The LUN is in cool off state. It will be deleted after `expire_time`.
2143 CoolOff,
2144 /// If set, the enum was initialized with an unknown value.
2145 ///
2146 /// Applications can examine the value using [State::value] or
2147 /// [State::name].
2148 UnknownValue(state::UnknownValue),
2149 }
2150
2151 #[doc(hidden)]
2152 pub mod state {
2153 #[allow(unused_imports)]
2154 use super::*;
2155 #[derive(Clone, Debug, PartialEq)]
2156 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2157 }
2158
2159 impl State {
2160 /// Gets the enum value.
2161 ///
2162 /// Returns `None` if the enum contains an unknown value deserialized from
2163 /// the string representation of enums.
2164 pub fn value(&self) -> std::option::Option<i32> {
2165 match self {
2166 Self::Unspecified => std::option::Option::Some(0),
2167 Self::Creating => std::option::Option::Some(1),
2168 Self::Updating => std::option::Option::Some(2),
2169 Self::Ready => std::option::Option::Some(3),
2170 Self::Deleting => std::option::Option::Some(4),
2171 Self::CoolOff => std::option::Option::Some(5),
2172 Self::UnknownValue(u) => u.0.value(),
2173 }
2174 }
2175
2176 /// Gets the enum value as a string.
2177 ///
2178 /// Returns `None` if the enum contains an unknown value deserialized from
2179 /// the integer representation of enums.
2180 pub fn name(&self) -> std::option::Option<&str> {
2181 match self {
2182 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2183 Self::Creating => std::option::Option::Some("CREATING"),
2184 Self::Updating => std::option::Option::Some("UPDATING"),
2185 Self::Ready => std::option::Option::Some("READY"),
2186 Self::Deleting => std::option::Option::Some("DELETING"),
2187 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
2188 Self::UnknownValue(u) => u.0.name(),
2189 }
2190 }
2191 }
2192
2193 impl std::default::Default for State {
2194 fn default() -> Self {
2195 use std::convert::From;
2196 Self::from(0)
2197 }
2198 }
2199
2200 impl std::fmt::Display for State {
2201 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2202 wkt::internal::display_enum(f, self.name(), self.value())
2203 }
2204 }
2205
2206 impl std::convert::From<i32> for State {
2207 fn from(value: i32) -> Self {
2208 match value {
2209 0 => Self::Unspecified,
2210 1 => Self::Creating,
2211 2 => Self::Updating,
2212 3 => Self::Ready,
2213 4 => Self::Deleting,
2214 5 => Self::CoolOff,
2215 _ => Self::UnknownValue(state::UnknownValue(
2216 wkt::internal::UnknownEnumValue::Integer(value),
2217 )),
2218 }
2219 }
2220 }
2221
2222 impl std::convert::From<&str> for State {
2223 fn from(value: &str) -> Self {
2224 use std::string::ToString;
2225 match value {
2226 "STATE_UNSPECIFIED" => Self::Unspecified,
2227 "CREATING" => Self::Creating,
2228 "UPDATING" => Self::Updating,
2229 "READY" => Self::Ready,
2230 "DELETING" => Self::Deleting,
2231 "COOL_OFF" => Self::CoolOff,
2232 _ => Self::UnknownValue(state::UnknownValue(
2233 wkt::internal::UnknownEnumValue::String(value.to_string()),
2234 )),
2235 }
2236 }
2237 }
2238
2239 impl serde::ser::Serialize for State {
2240 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2241 where
2242 S: serde::Serializer,
2243 {
2244 match self {
2245 Self::Unspecified => serializer.serialize_i32(0),
2246 Self::Creating => serializer.serialize_i32(1),
2247 Self::Updating => serializer.serialize_i32(2),
2248 Self::Ready => serializer.serialize_i32(3),
2249 Self::Deleting => serializer.serialize_i32(4),
2250 Self::CoolOff => serializer.serialize_i32(5),
2251 Self::UnknownValue(u) => u.0.serialize(serializer),
2252 }
2253 }
2254 }
2255
2256 impl<'de> serde::de::Deserialize<'de> for State {
2257 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2258 where
2259 D: serde::Deserializer<'de>,
2260 {
2261 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2262 ".google.cloud.baremetalsolution.v2.Lun.State",
2263 ))
2264 }
2265 }
2266
2267 /// Display the operating systems present for the LUN multiprotocol type.
2268 ///
2269 /// # Working with unknown values
2270 ///
2271 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2272 /// additional enum variants at any time. Adding new variants is not considered
2273 /// a breaking change. Applications should write their code in anticipation of:
2274 ///
2275 /// - New values appearing in future releases of the client library, **and**
2276 /// - New values received dynamically, without application changes.
2277 ///
2278 /// Please consult the [Working with enums] section in the user guide for some
2279 /// guidelines.
2280 ///
2281 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2282 #[derive(Clone, Debug, PartialEq)]
2283 #[non_exhaustive]
2284 pub enum MultiprotocolType {
2285 /// Server has no OS specified.
2286 Unspecified,
2287 /// Server with Linux OS.
2288 Linux,
2289 /// If set, the enum was initialized with an unknown value.
2290 ///
2291 /// Applications can examine the value using [MultiprotocolType::value] or
2292 /// [MultiprotocolType::name].
2293 UnknownValue(multiprotocol_type::UnknownValue),
2294 }
2295
2296 #[doc(hidden)]
2297 pub mod multiprotocol_type {
2298 #[allow(unused_imports)]
2299 use super::*;
2300 #[derive(Clone, Debug, PartialEq)]
2301 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2302 }
2303
2304 impl MultiprotocolType {
2305 /// Gets the enum value.
2306 ///
2307 /// Returns `None` if the enum contains an unknown value deserialized from
2308 /// the string representation of enums.
2309 pub fn value(&self) -> std::option::Option<i32> {
2310 match self {
2311 Self::Unspecified => std::option::Option::Some(0),
2312 Self::Linux => std::option::Option::Some(1),
2313 Self::UnknownValue(u) => u.0.value(),
2314 }
2315 }
2316
2317 /// Gets the enum value as a string.
2318 ///
2319 /// Returns `None` if the enum contains an unknown value deserialized from
2320 /// the integer representation of enums.
2321 pub fn name(&self) -> std::option::Option<&str> {
2322 match self {
2323 Self::Unspecified => std::option::Option::Some("MULTIPROTOCOL_TYPE_UNSPECIFIED"),
2324 Self::Linux => std::option::Option::Some("LINUX"),
2325 Self::UnknownValue(u) => u.0.name(),
2326 }
2327 }
2328 }
2329
2330 impl std::default::Default for MultiprotocolType {
2331 fn default() -> Self {
2332 use std::convert::From;
2333 Self::from(0)
2334 }
2335 }
2336
2337 impl std::fmt::Display for MultiprotocolType {
2338 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2339 wkt::internal::display_enum(f, self.name(), self.value())
2340 }
2341 }
2342
2343 impl std::convert::From<i32> for MultiprotocolType {
2344 fn from(value: i32) -> Self {
2345 match value {
2346 0 => Self::Unspecified,
2347 1 => Self::Linux,
2348 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2349 wkt::internal::UnknownEnumValue::Integer(value),
2350 )),
2351 }
2352 }
2353 }
2354
2355 impl std::convert::From<&str> for MultiprotocolType {
2356 fn from(value: &str) -> Self {
2357 use std::string::ToString;
2358 match value {
2359 "MULTIPROTOCOL_TYPE_UNSPECIFIED" => Self::Unspecified,
2360 "LINUX" => Self::Linux,
2361 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2362 wkt::internal::UnknownEnumValue::String(value.to_string()),
2363 )),
2364 }
2365 }
2366 }
2367
2368 impl serde::ser::Serialize for MultiprotocolType {
2369 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2370 where
2371 S: serde::Serializer,
2372 {
2373 match self {
2374 Self::Unspecified => serializer.serialize_i32(0),
2375 Self::Linux => serializer.serialize_i32(1),
2376 Self::UnknownValue(u) => u.0.serialize(serializer),
2377 }
2378 }
2379 }
2380
2381 impl<'de> serde::de::Deserialize<'de> for MultiprotocolType {
2382 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2383 where
2384 D: serde::Deserializer<'de>,
2385 {
2386 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MultiprotocolType>::new(
2387 ".google.cloud.baremetalsolution.v2.Lun.MultiprotocolType",
2388 ))
2389 }
2390 }
2391
2392 /// The storage types for a LUN.
2393 ///
2394 /// # Working with unknown values
2395 ///
2396 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2397 /// additional enum variants at any time. Adding new variants is not considered
2398 /// a breaking change. Applications should write their code in anticipation of:
2399 ///
2400 /// - New values appearing in future releases of the client library, **and**
2401 /// - New values received dynamically, without application changes.
2402 ///
2403 /// Please consult the [Working with enums] section in the user guide for some
2404 /// guidelines.
2405 ///
2406 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2407 #[derive(Clone, Debug, PartialEq)]
2408 #[non_exhaustive]
2409 pub enum StorageType {
2410 /// The storage type for this LUN is unknown.
2411 Unspecified,
2412 /// This storage type for this LUN is SSD.
2413 Ssd,
2414 /// This storage type for this LUN is HDD.
2415 Hdd,
2416 /// If set, the enum was initialized with an unknown value.
2417 ///
2418 /// Applications can examine the value using [StorageType::value] or
2419 /// [StorageType::name].
2420 UnknownValue(storage_type::UnknownValue),
2421 }
2422
2423 #[doc(hidden)]
2424 pub mod storage_type {
2425 #[allow(unused_imports)]
2426 use super::*;
2427 #[derive(Clone, Debug, PartialEq)]
2428 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2429 }
2430
2431 impl StorageType {
2432 /// Gets the enum value.
2433 ///
2434 /// Returns `None` if the enum contains an unknown value deserialized from
2435 /// the string representation of enums.
2436 pub fn value(&self) -> std::option::Option<i32> {
2437 match self {
2438 Self::Unspecified => std::option::Option::Some(0),
2439 Self::Ssd => std::option::Option::Some(1),
2440 Self::Hdd => std::option::Option::Some(2),
2441 Self::UnknownValue(u) => u.0.value(),
2442 }
2443 }
2444
2445 /// Gets the enum value as a string.
2446 ///
2447 /// Returns `None` if the enum contains an unknown value deserialized from
2448 /// the integer representation of enums.
2449 pub fn name(&self) -> std::option::Option<&str> {
2450 match self {
2451 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
2452 Self::Ssd => std::option::Option::Some("SSD"),
2453 Self::Hdd => std::option::Option::Some("HDD"),
2454 Self::UnknownValue(u) => u.0.name(),
2455 }
2456 }
2457 }
2458
2459 impl std::default::Default for StorageType {
2460 fn default() -> Self {
2461 use std::convert::From;
2462 Self::from(0)
2463 }
2464 }
2465
2466 impl std::fmt::Display for StorageType {
2467 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2468 wkt::internal::display_enum(f, self.name(), self.value())
2469 }
2470 }
2471
2472 impl std::convert::From<i32> for StorageType {
2473 fn from(value: i32) -> Self {
2474 match value {
2475 0 => Self::Unspecified,
2476 1 => Self::Ssd,
2477 2 => Self::Hdd,
2478 _ => Self::UnknownValue(storage_type::UnknownValue(
2479 wkt::internal::UnknownEnumValue::Integer(value),
2480 )),
2481 }
2482 }
2483 }
2484
2485 impl std::convert::From<&str> for StorageType {
2486 fn from(value: &str) -> Self {
2487 use std::string::ToString;
2488 match value {
2489 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
2490 "SSD" => Self::Ssd,
2491 "HDD" => Self::Hdd,
2492 _ => Self::UnknownValue(storage_type::UnknownValue(
2493 wkt::internal::UnknownEnumValue::String(value.to_string()),
2494 )),
2495 }
2496 }
2497 }
2498
2499 impl serde::ser::Serialize for StorageType {
2500 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2501 where
2502 S: serde::Serializer,
2503 {
2504 match self {
2505 Self::Unspecified => serializer.serialize_i32(0),
2506 Self::Ssd => serializer.serialize_i32(1),
2507 Self::Hdd => serializer.serialize_i32(2),
2508 Self::UnknownValue(u) => u.0.serialize(serializer),
2509 }
2510 }
2511 }
2512
2513 impl<'de> serde::de::Deserialize<'de> for StorageType {
2514 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2515 where
2516 D: serde::Deserializer<'de>,
2517 {
2518 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
2519 ".google.cloud.baremetalsolution.v2.Lun.StorageType",
2520 ))
2521 }
2522 }
2523}
2524
2525/// Message for requesting storage lun information.
2526#[derive(Clone, Default, PartialEq)]
2527#[non_exhaustive]
2528pub struct GetLunRequest {
2529 /// Required. Name of the resource.
2530 pub name: std::string::String,
2531
2532 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2533}
2534
2535impl GetLunRequest {
2536 /// Creates a new default instance.
2537 pub fn new() -> Self {
2538 std::default::Default::default()
2539 }
2540
2541 /// Sets the value of [name][crate::model::GetLunRequest::name].
2542 ///
2543 /// # Example
2544 /// ```ignore,no_run
2545 /// # use google_cloud_baremetalsolution_v2::model::GetLunRequest;
2546 /// # let project_id = "project_id";
2547 /// # let location_id = "location_id";
2548 /// # let volume_id = "volume_id";
2549 /// # let lun_id = "lun_id";
2550 /// let x = GetLunRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/luns/{lun_id}"));
2551 /// ```
2552 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2553 self.name = v.into();
2554 self
2555 }
2556}
2557
2558impl wkt::message::Message for GetLunRequest {
2559 fn typename() -> &'static str {
2560 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetLunRequest"
2561 }
2562}
2563
2564/// Message for requesting a list of storage volume luns.
2565#[derive(Clone, Default, PartialEq)]
2566#[non_exhaustive]
2567pub struct ListLunsRequest {
2568 /// Required. Parent value for ListLunsRequest.
2569 pub parent: std::string::String,
2570
2571 /// Requested page size. The server might return fewer items than requested.
2572 /// If unspecified, server will pick an appropriate default.
2573 pub page_size: i32,
2574
2575 /// A token identifying a page of results from the server.
2576 pub page_token: std::string::String,
2577
2578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2579}
2580
2581impl ListLunsRequest {
2582 /// Creates a new default instance.
2583 pub fn new() -> Self {
2584 std::default::Default::default()
2585 }
2586
2587 /// Sets the value of [parent][crate::model::ListLunsRequest::parent].
2588 ///
2589 /// # Example
2590 /// ```ignore,no_run
2591 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2592 /// # let project_id = "project_id";
2593 /// # let location_id = "location_id";
2594 /// # let volume_id = "volume_id";
2595 /// let x = ListLunsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
2596 /// ```
2597 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2598 self.parent = v.into();
2599 self
2600 }
2601
2602 /// Sets the value of [page_size][crate::model::ListLunsRequest::page_size].
2603 ///
2604 /// # Example
2605 /// ```ignore,no_run
2606 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2607 /// let x = ListLunsRequest::new().set_page_size(42);
2608 /// ```
2609 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2610 self.page_size = v.into();
2611 self
2612 }
2613
2614 /// Sets the value of [page_token][crate::model::ListLunsRequest::page_token].
2615 ///
2616 /// # Example
2617 /// ```ignore,no_run
2618 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2619 /// let x = ListLunsRequest::new().set_page_token("example");
2620 /// ```
2621 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2622 self.page_token = v.into();
2623 self
2624 }
2625}
2626
2627impl wkt::message::Message for ListLunsRequest {
2628 fn typename() -> &'static str {
2629 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsRequest"
2630 }
2631}
2632
2633/// Response message containing the list of storage volume luns.
2634#[derive(Clone, Default, PartialEq)]
2635#[non_exhaustive]
2636pub struct ListLunsResponse {
2637 /// The list of luns.
2638 pub luns: std::vec::Vec<crate::model::Lun>,
2639
2640 /// A token identifying a page of results from the server.
2641 pub next_page_token: std::string::String,
2642
2643 /// Locations that could not be reached.
2644 pub unreachable: std::vec::Vec<std::string::String>,
2645
2646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2647}
2648
2649impl ListLunsResponse {
2650 /// Creates a new default instance.
2651 pub fn new() -> Self {
2652 std::default::Default::default()
2653 }
2654
2655 /// Sets the value of [luns][crate::model::ListLunsResponse::luns].
2656 ///
2657 /// # Example
2658 /// ```ignore,no_run
2659 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2660 /// use google_cloud_baremetalsolution_v2::model::Lun;
2661 /// let x = ListLunsResponse::new()
2662 /// .set_luns([
2663 /// Lun::default()/* use setters */,
2664 /// Lun::default()/* use (different) setters */,
2665 /// ]);
2666 /// ```
2667 pub fn set_luns<T, V>(mut self, v: T) -> Self
2668 where
2669 T: std::iter::IntoIterator<Item = V>,
2670 V: std::convert::Into<crate::model::Lun>,
2671 {
2672 use std::iter::Iterator;
2673 self.luns = v.into_iter().map(|i| i.into()).collect();
2674 self
2675 }
2676
2677 /// Sets the value of [next_page_token][crate::model::ListLunsResponse::next_page_token].
2678 ///
2679 /// # Example
2680 /// ```ignore,no_run
2681 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2682 /// let x = ListLunsResponse::new().set_next_page_token("example");
2683 /// ```
2684 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2685 self.next_page_token = v.into();
2686 self
2687 }
2688
2689 /// Sets the value of [unreachable][crate::model::ListLunsResponse::unreachable].
2690 ///
2691 /// # Example
2692 /// ```ignore,no_run
2693 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2694 /// let x = ListLunsResponse::new().set_unreachable(["a", "b", "c"]);
2695 /// ```
2696 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2697 where
2698 T: std::iter::IntoIterator<Item = V>,
2699 V: std::convert::Into<std::string::String>,
2700 {
2701 use std::iter::Iterator;
2702 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2703 self
2704 }
2705}
2706
2707impl wkt::message::Message for ListLunsResponse {
2708 fn typename() -> &'static str {
2709 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsResponse"
2710 }
2711}
2712
2713#[doc(hidden)]
2714impl google_cloud_gax::paginator::internal::PageableResponse for ListLunsResponse {
2715 type PageItem = crate::model::Lun;
2716
2717 fn items(self) -> std::vec::Vec<Self::PageItem> {
2718 self.luns
2719 }
2720
2721 fn next_page_token(&self) -> std::string::String {
2722 use std::clone::Clone;
2723 self.next_page_token.clone()
2724 }
2725}
2726
2727/// Request for skip lun cooloff and delete it.
2728#[derive(Clone, Default, PartialEq)]
2729#[non_exhaustive]
2730pub struct EvictLunRequest {
2731 /// Required. The name of the lun.
2732 pub name: std::string::String,
2733
2734 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2735}
2736
2737impl EvictLunRequest {
2738 /// Creates a new default instance.
2739 pub fn new() -> Self {
2740 std::default::Default::default()
2741 }
2742
2743 /// Sets the value of [name][crate::model::EvictLunRequest::name].
2744 ///
2745 /// # Example
2746 /// ```ignore,no_run
2747 /// # use google_cloud_baremetalsolution_v2::model::EvictLunRequest;
2748 /// # let project_id = "project_id";
2749 /// # let location_id = "location_id";
2750 /// # let volume_id = "volume_id";
2751 /// # let lun_id = "lun_id";
2752 /// let x = EvictLunRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/luns/{lun_id}"));
2753 /// ```
2754 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2755 self.name = v.into();
2756 self
2757 }
2758}
2759
2760impl wkt::message::Message for EvictLunRequest {
2761 fn typename() -> &'static str {
2762 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictLunRequest"
2763 }
2764}
2765
2766/// A Network.
2767#[derive(Clone, Default, PartialEq)]
2768#[non_exhaustive]
2769pub struct Network {
2770 /// Output only. The resource name of this `Network`.
2771 /// Resource names are schemeless URIs that follow the conventions in
2772 /// <https://cloud.google.com/apis/design/resource_names>.
2773 /// Format:
2774 /// `projects/{project}/locations/{location}/networks/{network}`
2775 pub name: std::string::String,
2776
2777 /// An identifier for the `Network`, generated by the backend.
2778 pub id: std::string::String,
2779
2780 /// The type of this network.
2781 pub r#type: crate::model::network::Type,
2782
2783 /// IP address configured.
2784 pub ip_address: std::string::String,
2785
2786 /// List of physical interfaces.
2787 pub mac_address: std::vec::Vec<std::string::String>,
2788
2789 /// The Network state.
2790 pub state: crate::model::network::State,
2791
2792 /// The vlan id of the Network.
2793 pub vlan_id: std::string::String,
2794
2795 /// The cidr of the Network.
2796 pub cidr: std::string::String,
2797
2798 /// The vrf for the Network.
2799 pub vrf: std::option::Option<crate::model::Vrf>,
2800
2801 /// Labels as key value pairs.
2802 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2803
2804 /// IP range for reserved for services (e.g. NFS).
2805 pub services_cidr: std::string::String,
2806
2807 /// List of IP address reservations in this network.
2808 /// When updating this field, an error will be generated if a reservation
2809 /// conflicts with an IP address already allocated to a physical server.
2810 pub reservations: std::vec::Vec<crate::model::NetworkAddressReservation>,
2811
2812 /// Output only. Pod name.
2813 pub pod: std::string::String,
2814
2815 /// Input only. List of mount points to attach the network to.
2816 pub mount_points: std::vec::Vec<crate::model::NetworkMountPoint>,
2817
2818 /// Whether network uses standard frames or jumbo ones.
2819 pub jumbo_frames_enabled: bool,
2820
2821 /// Output only. Gateway ip address.
2822 pub gateway_ip: std::string::String,
2823
2824 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2825}
2826
2827impl Network {
2828 /// Creates a new default instance.
2829 pub fn new() -> Self {
2830 std::default::Default::default()
2831 }
2832
2833 /// Sets the value of [name][crate::model::Network::name].
2834 ///
2835 /// # Example
2836 /// ```ignore,no_run
2837 /// # use google_cloud_baremetalsolution_v2::model::Network;
2838 /// # let project_id = "project_id";
2839 /// # let location_id = "location_id";
2840 /// # let network_id = "network_id";
2841 /// let x = Network::new().set_name(format!("projects/{project_id}/locations/{location_id}/networks/{network_id}"));
2842 /// ```
2843 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2844 self.name = v.into();
2845 self
2846 }
2847
2848 /// Sets the value of [id][crate::model::Network::id].
2849 ///
2850 /// # Example
2851 /// ```ignore,no_run
2852 /// # use google_cloud_baremetalsolution_v2::model::Network;
2853 /// let x = Network::new().set_id("example");
2854 /// ```
2855 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2856 self.id = v.into();
2857 self
2858 }
2859
2860 /// Sets the value of [r#type][crate::model::Network::type].
2861 ///
2862 /// # Example
2863 /// ```ignore,no_run
2864 /// # use google_cloud_baremetalsolution_v2::model::Network;
2865 /// use google_cloud_baremetalsolution_v2::model::network::Type;
2866 /// let x0 = Network::new().set_type(Type::Client);
2867 /// let x1 = Network::new().set_type(Type::Private);
2868 /// ```
2869 pub fn set_type<T: std::convert::Into<crate::model::network::Type>>(mut self, v: T) -> Self {
2870 self.r#type = v.into();
2871 self
2872 }
2873
2874 /// Sets the value of [ip_address][crate::model::Network::ip_address].
2875 ///
2876 /// # Example
2877 /// ```ignore,no_run
2878 /// # use google_cloud_baremetalsolution_v2::model::Network;
2879 /// let x = Network::new().set_ip_address("example");
2880 /// ```
2881 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2882 self.ip_address = v.into();
2883 self
2884 }
2885
2886 /// Sets the value of [mac_address][crate::model::Network::mac_address].
2887 ///
2888 /// # Example
2889 /// ```ignore,no_run
2890 /// # use google_cloud_baremetalsolution_v2::model::Network;
2891 /// let x = Network::new().set_mac_address(["a", "b", "c"]);
2892 /// ```
2893 pub fn set_mac_address<T, V>(mut self, v: T) -> Self
2894 where
2895 T: std::iter::IntoIterator<Item = V>,
2896 V: std::convert::Into<std::string::String>,
2897 {
2898 use std::iter::Iterator;
2899 self.mac_address = v.into_iter().map(|i| i.into()).collect();
2900 self
2901 }
2902
2903 /// Sets the value of [state][crate::model::Network::state].
2904 ///
2905 /// # Example
2906 /// ```ignore,no_run
2907 /// # use google_cloud_baremetalsolution_v2::model::Network;
2908 /// use google_cloud_baremetalsolution_v2::model::network::State;
2909 /// let x0 = Network::new().set_state(State::Provisioning);
2910 /// let x1 = Network::new().set_state(State::Provisioned);
2911 /// let x2 = Network::new().set_state(State::Deprovisioning);
2912 /// ```
2913 pub fn set_state<T: std::convert::Into<crate::model::network::State>>(mut self, v: T) -> Self {
2914 self.state = v.into();
2915 self
2916 }
2917
2918 /// Sets the value of [vlan_id][crate::model::Network::vlan_id].
2919 ///
2920 /// # Example
2921 /// ```ignore,no_run
2922 /// # use google_cloud_baremetalsolution_v2::model::Network;
2923 /// let x = Network::new().set_vlan_id("example");
2924 /// ```
2925 pub fn set_vlan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2926 self.vlan_id = v.into();
2927 self
2928 }
2929
2930 /// Sets the value of [cidr][crate::model::Network::cidr].
2931 ///
2932 /// # Example
2933 /// ```ignore,no_run
2934 /// # use google_cloud_baremetalsolution_v2::model::Network;
2935 /// let x = Network::new().set_cidr("example");
2936 /// ```
2937 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2938 self.cidr = v.into();
2939 self
2940 }
2941
2942 /// Sets the value of [vrf][crate::model::Network::vrf].
2943 ///
2944 /// # Example
2945 /// ```ignore,no_run
2946 /// # use google_cloud_baremetalsolution_v2::model::Network;
2947 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2948 /// let x = Network::new().set_vrf(Vrf::default()/* use setters */);
2949 /// ```
2950 pub fn set_vrf<T>(mut self, v: T) -> Self
2951 where
2952 T: std::convert::Into<crate::model::Vrf>,
2953 {
2954 self.vrf = std::option::Option::Some(v.into());
2955 self
2956 }
2957
2958 /// Sets or clears the value of [vrf][crate::model::Network::vrf].
2959 ///
2960 /// # Example
2961 /// ```ignore,no_run
2962 /// # use google_cloud_baremetalsolution_v2::model::Network;
2963 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2964 /// let x = Network::new().set_or_clear_vrf(Some(Vrf::default()/* use setters */));
2965 /// let x = Network::new().set_or_clear_vrf(None::<Vrf>);
2966 /// ```
2967 pub fn set_or_clear_vrf<T>(mut self, v: std::option::Option<T>) -> Self
2968 where
2969 T: std::convert::Into<crate::model::Vrf>,
2970 {
2971 self.vrf = v.map(|x| x.into());
2972 self
2973 }
2974
2975 /// Sets the value of [labels][crate::model::Network::labels].
2976 ///
2977 /// # Example
2978 /// ```ignore,no_run
2979 /// # use google_cloud_baremetalsolution_v2::model::Network;
2980 /// let x = Network::new().set_labels([
2981 /// ("key0", "abc"),
2982 /// ("key1", "xyz"),
2983 /// ]);
2984 /// ```
2985 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2986 where
2987 T: std::iter::IntoIterator<Item = (K, V)>,
2988 K: std::convert::Into<std::string::String>,
2989 V: std::convert::Into<std::string::String>,
2990 {
2991 use std::iter::Iterator;
2992 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2993 self
2994 }
2995
2996 /// Sets the value of [services_cidr][crate::model::Network::services_cidr].
2997 ///
2998 /// # Example
2999 /// ```ignore,no_run
3000 /// # use google_cloud_baremetalsolution_v2::model::Network;
3001 /// let x = Network::new().set_services_cidr("example");
3002 /// ```
3003 pub fn set_services_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3004 self.services_cidr = v.into();
3005 self
3006 }
3007
3008 /// Sets the value of [reservations][crate::model::Network::reservations].
3009 ///
3010 /// # Example
3011 /// ```ignore,no_run
3012 /// # use google_cloud_baremetalsolution_v2::model::Network;
3013 /// use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3014 /// let x = Network::new()
3015 /// .set_reservations([
3016 /// NetworkAddressReservation::default()/* use setters */,
3017 /// NetworkAddressReservation::default()/* use (different) setters */,
3018 /// ]);
3019 /// ```
3020 pub fn set_reservations<T, V>(mut self, v: T) -> Self
3021 where
3022 T: std::iter::IntoIterator<Item = V>,
3023 V: std::convert::Into<crate::model::NetworkAddressReservation>,
3024 {
3025 use std::iter::Iterator;
3026 self.reservations = v.into_iter().map(|i| i.into()).collect();
3027 self
3028 }
3029
3030 /// Sets the value of [pod][crate::model::Network::pod].
3031 ///
3032 /// # Example
3033 /// ```ignore,no_run
3034 /// # use google_cloud_baremetalsolution_v2::model::Network;
3035 /// let x = Network::new().set_pod("example");
3036 /// ```
3037 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3038 self.pod = v.into();
3039 self
3040 }
3041
3042 /// Sets the value of [mount_points][crate::model::Network::mount_points].
3043 ///
3044 /// # Example
3045 /// ```ignore,no_run
3046 /// # use google_cloud_baremetalsolution_v2::model::Network;
3047 /// use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
3048 /// let x = Network::new()
3049 /// .set_mount_points([
3050 /// NetworkMountPoint::default()/* use setters */,
3051 /// NetworkMountPoint::default()/* use (different) setters */,
3052 /// ]);
3053 /// ```
3054 pub fn set_mount_points<T, V>(mut self, v: T) -> Self
3055 where
3056 T: std::iter::IntoIterator<Item = V>,
3057 V: std::convert::Into<crate::model::NetworkMountPoint>,
3058 {
3059 use std::iter::Iterator;
3060 self.mount_points = v.into_iter().map(|i| i.into()).collect();
3061 self
3062 }
3063
3064 /// Sets the value of [jumbo_frames_enabled][crate::model::Network::jumbo_frames_enabled].
3065 ///
3066 /// # Example
3067 /// ```ignore,no_run
3068 /// # use google_cloud_baremetalsolution_v2::model::Network;
3069 /// let x = Network::new().set_jumbo_frames_enabled(true);
3070 /// ```
3071 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3072 self.jumbo_frames_enabled = v.into();
3073 self
3074 }
3075
3076 /// Sets the value of [gateway_ip][crate::model::Network::gateway_ip].
3077 ///
3078 /// # Example
3079 /// ```ignore,no_run
3080 /// # use google_cloud_baremetalsolution_v2::model::Network;
3081 /// let x = Network::new().set_gateway_ip("example");
3082 /// ```
3083 pub fn set_gateway_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3084 self.gateway_ip = v.into();
3085 self
3086 }
3087}
3088
3089impl wkt::message::Message for Network {
3090 fn typename() -> &'static str {
3091 "type.googleapis.com/google.cloud.baremetalsolution.v2.Network"
3092 }
3093}
3094
3095/// Defines additional types related to [Network].
3096pub mod network {
3097 #[allow(unused_imports)]
3098 use super::*;
3099
3100 /// Network type.
3101 ///
3102 /// # Working with unknown values
3103 ///
3104 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3105 /// additional enum variants at any time. Adding new variants is not considered
3106 /// a breaking change. Applications should write their code in anticipation of:
3107 ///
3108 /// - New values appearing in future releases of the client library, **and**
3109 /// - New values received dynamically, without application changes.
3110 ///
3111 /// Please consult the [Working with enums] section in the user guide for some
3112 /// guidelines.
3113 ///
3114 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3115 #[derive(Clone, Debug, PartialEq)]
3116 #[non_exhaustive]
3117 pub enum Type {
3118 /// Unspecified value.
3119 Unspecified,
3120 /// Client network, a network peered to a Google Cloud VPC.
3121 Client,
3122 /// Private network, a network local to the Bare Metal Solution environment.
3123 Private,
3124 /// If set, the enum was initialized with an unknown value.
3125 ///
3126 /// Applications can examine the value using [Type::value] or
3127 /// [Type::name].
3128 UnknownValue(r#type::UnknownValue),
3129 }
3130
3131 #[doc(hidden)]
3132 pub mod r#type {
3133 #[allow(unused_imports)]
3134 use super::*;
3135 #[derive(Clone, Debug, PartialEq)]
3136 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3137 }
3138
3139 impl Type {
3140 /// Gets the enum value.
3141 ///
3142 /// Returns `None` if the enum contains an unknown value deserialized from
3143 /// the string representation of enums.
3144 pub fn value(&self) -> std::option::Option<i32> {
3145 match self {
3146 Self::Unspecified => std::option::Option::Some(0),
3147 Self::Client => std::option::Option::Some(1),
3148 Self::Private => std::option::Option::Some(2),
3149 Self::UnknownValue(u) => u.0.value(),
3150 }
3151 }
3152
3153 /// Gets the enum value as a string.
3154 ///
3155 /// Returns `None` if the enum contains an unknown value deserialized from
3156 /// the integer representation of enums.
3157 pub fn name(&self) -> std::option::Option<&str> {
3158 match self {
3159 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
3160 Self::Client => std::option::Option::Some("CLIENT"),
3161 Self::Private => std::option::Option::Some("PRIVATE"),
3162 Self::UnknownValue(u) => u.0.name(),
3163 }
3164 }
3165 }
3166
3167 impl std::default::Default for Type {
3168 fn default() -> Self {
3169 use std::convert::From;
3170 Self::from(0)
3171 }
3172 }
3173
3174 impl std::fmt::Display for Type {
3175 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3176 wkt::internal::display_enum(f, self.name(), self.value())
3177 }
3178 }
3179
3180 impl std::convert::From<i32> for Type {
3181 fn from(value: i32) -> Self {
3182 match value {
3183 0 => Self::Unspecified,
3184 1 => Self::Client,
3185 2 => Self::Private,
3186 _ => Self::UnknownValue(r#type::UnknownValue(
3187 wkt::internal::UnknownEnumValue::Integer(value),
3188 )),
3189 }
3190 }
3191 }
3192
3193 impl std::convert::From<&str> for Type {
3194 fn from(value: &str) -> Self {
3195 use std::string::ToString;
3196 match value {
3197 "TYPE_UNSPECIFIED" => Self::Unspecified,
3198 "CLIENT" => Self::Client,
3199 "PRIVATE" => Self::Private,
3200 _ => Self::UnknownValue(r#type::UnknownValue(
3201 wkt::internal::UnknownEnumValue::String(value.to_string()),
3202 )),
3203 }
3204 }
3205 }
3206
3207 impl serde::ser::Serialize for Type {
3208 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3209 where
3210 S: serde::Serializer,
3211 {
3212 match self {
3213 Self::Unspecified => serializer.serialize_i32(0),
3214 Self::Client => serializer.serialize_i32(1),
3215 Self::Private => serializer.serialize_i32(2),
3216 Self::UnknownValue(u) => u.0.serialize(serializer),
3217 }
3218 }
3219 }
3220
3221 impl<'de> serde::de::Deserialize<'de> for Type {
3222 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3223 where
3224 D: serde::Deserializer<'de>,
3225 {
3226 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
3227 ".google.cloud.baremetalsolution.v2.Network.Type",
3228 ))
3229 }
3230 }
3231
3232 /// The possible states for this Network.
3233 ///
3234 /// # Working with unknown values
3235 ///
3236 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3237 /// additional enum variants at any time. Adding new variants is not considered
3238 /// a breaking change. Applications should write their code in anticipation of:
3239 ///
3240 /// - New values appearing in future releases of the client library, **and**
3241 /// - New values received dynamically, without application changes.
3242 ///
3243 /// Please consult the [Working with enums] section in the user guide for some
3244 /// guidelines.
3245 ///
3246 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3247 #[derive(Clone, Debug, PartialEq)]
3248 #[non_exhaustive]
3249 pub enum State {
3250 /// The Network is in an unknown state.
3251 Unspecified,
3252 /// The Network is provisioning.
3253 Provisioning,
3254 /// The Network has been provisioned.
3255 Provisioned,
3256 /// The Network is being deprovisioned.
3257 Deprovisioning,
3258 /// The Network is being updated.
3259 Updating,
3260 /// If set, the enum was initialized with an unknown value.
3261 ///
3262 /// Applications can examine the value using [State::value] or
3263 /// [State::name].
3264 UnknownValue(state::UnknownValue),
3265 }
3266
3267 #[doc(hidden)]
3268 pub mod state {
3269 #[allow(unused_imports)]
3270 use super::*;
3271 #[derive(Clone, Debug, PartialEq)]
3272 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3273 }
3274
3275 impl State {
3276 /// Gets the enum value.
3277 ///
3278 /// Returns `None` if the enum contains an unknown value deserialized from
3279 /// the string representation of enums.
3280 pub fn value(&self) -> std::option::Option<i32> {
3281 match self {
3282 Self::Unspecified => std::option::Option::Some(0),
3283 Self::Provisioning => std::option::Option::Some(1),
3284 Self::Provisioned => std::option::Option::Some(2),
3285 Self::Deprovisioning => std::option::Option::Some(3),
3286 Self::Updating => std::option::Option::Some(4),
3287 Self::UnknownValue(u) => u.0.value(),
3288 }
3289 }
3290
3291 /// Gets the enum value as a string.
3292 ///
3293 /// Returns `None` if the enum contains an unknown value deserialized from
3294 /// the integer representation of enums.
3295 pub fn name(&self) -> std::option::Option<&str> {
3296 match self {
3297 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3298 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3299 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3300 Self::Deprovisioning => std::option::Option::Some("DEPROVISIONING"),
3301 Self::Updating => std::option::Option::Some("UPDATING"),
3302 Self::UnknownValue(u) => u.0.name(),
3303 }
3304 }
3305 }
3306
3307 impl std::default::Default for State {
3308 fn default() -> Self {
3309 use std::convert::From;
3310 Self::from(0)
3311 }
3312 }
3313
3314 impl std::fmt::Display for State {
3315 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3316 wkt::internal::display_enum(f, self.name(), self.value())
3317 }
3318 }
3319
3320 impl std::convert::From<i32> for State {
3321 fn from(value: i32) -> Self {
3322 match value {
3323 0 => Self::Unspecified,
3324 1 => Self::Provisioning,
3325 2 => Self::Provisioned,
3326 3 => Self::Deprovisioning,
3327 4 => Self::Updating,
3328 _ => Self::UnknownValue(state::UnknownValue(
3329 wkt::internal::UnknownEnumValue::Integer(value),
3330 )),
3331 }
3332 }
3333 }
3334
3335 impl std::convert::From<&str> for State {
3336 fn from(value: &str) -> Self {
3337 use std::string::ToString;
3338 match value {
3339 "STATE_UNSPECIFIED" => Self::Unspecified,
3340 "PROVISIONING" => Self::Provisioning,
3341 "PROVISIONED" => Self::Provisioned,
3342 "DEPROVISIONING" => Self::Deprovisioning,
3343 "UPDATING" => Self::Updating,
3344 _ => Self::UnknownValue(state::UnknownValue(
3345 wkt::internal::UnknownEnumValue::String(value.to_string()),
3346 )),
3347 }
3348 }
3349 }
3350
3351 impl serde::ser::Serialize for State {
3352 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3353 where
3354 S: serde::Serializer,
3355 {
3356 match self {
3357 Self::Unspecified => serializer.serialize_i32(0),
3358 Self::Provisioning => serializer.serialize_i32(1),
3359 Self::Provisioned => serializer.serialize_i32(2),
3360 Self::Deprovisioning => serializer.serialize_i32(3),
3361 Self::Updating => serializer.serialize_i32(4),
3362 Self::UnknownValue(u) => u.0.serialize(serializer),
3363 }
3364 }
3365 }
3366
3367 impl<'de> serde::de::Deserialize<'de> for State {
3368 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3369 where
3370 D: serde::Deserializer<'de>,
3371 {
3372 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3373 ".google.cloud.baremetalsolution.v2.Network.State",
3374 ))
3375 }
3376 }
3377}
3378
3379/// A reservation of one or more addresses in a network.
3380#[derive(Clone, Default, PartialEq)]
3381#[non_exhaustive]
3382pub struct NetworkAddressReservation {
3383 /// The first address of this reservation block.
3384 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3385 pub start_address: std::string::String,
3386
3387 /// The last address of this reservation block, inclusive. I.e., for cases when
3388 /// reservations are only single addresses, end_address and start_address will
3389 /// be the same.
3390 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3391 pub end_address: std::string::String,
3392
3393 /// A note about this reservation, intended for human consumption.
3394 pub note: std::string::String,
3395
3396 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3397}
3398
3399impl NetworkAddressReservation {
3400 /// Creates a new default instance.
3401 pub fn new() -> Self {
3402 std::default::Default::default()
3403 }
3404
3405 /// Sets the value of [start_address][crate::model::NetworkAddressReservation::start_address].
3406 ///
3407 /// # Example
3408 /// ```ignore,no_run
3409 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3410 /// let x = NetworkAddressReservation::new().set_start_address("example");
3411 /// ```
3412 pub fn set_start_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3413 self.start_address = v.into();
3414 self
3415 }
3416
3417 /// Sets the value of [end_address][crate::model::NetworkAddressReservation::end_address].
3418 ///
3419 /// # Example
3420 /// ```ignore,no_run
3421 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3422 /// let x = NetworkAddressReservation::new().set_end_address("example");
3423 /// ```
3424 pub fn set_end_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3425 self.end_address = v.into();
3426 self
3427 }
3428
3429 /// Sets the value of [note][crate::model::NetworkAddressReservation::note].
3430 ///
3431 /// # Example
3432 /// ```ignore,no_run
3433 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3434 /// let x = NetworkAddressReservation::new().set_note("example");
3435 /// ```
3436 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3437 self.note = v.into();
3438 self
3439 }
3440}
3441
3442impl wkt::message::Message for NetworkAddressReservation {
3443 fn typename() -> &'static str {
3444 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkAddressReservation"
3445 }
3446}
3447
3448/// A network VRF.
3449#[derive(Clone, Default, PartialEq)]
3450#[non_exhaustive]
3451pub struct Vrf {
3452 /// The name of the VRF.
3453 pub name: std::string::String,
3454
3455 /// The possible state of VRF.
3456 pub state: crate::model::vrf::State,
3457
3458 /// The QOS policy applied to this VRF.
3459 /// The value is only meaningful when all the vlan attachments have the same
3460 /// QoS. This field should not be used for new integrations, use vlan
3461 /// attachment level qos instead. The field is left for backward-compatibility.
3462 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3463
3464 /// The list of VLAN attachments for the VRF.
3465 pub vlan_attachments: std::vec::Vec<crate::model::vrf::VlanAttachment>,
3466
3467 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3468}
3469
3470impl Vrf {
3471 /// Creates a new default instance.
3472 pub fn new() -> Self {
3473 std::default::Default::default()
3474 }
3475
3476 /// Sets the value of [name][crate::model::Vrf::name].
3477 ///
3478 /// # Example
3479 /// ```ignore,no_run
3480 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3481 /// let x = Vrf::new().set_name("example");
3482 /// ```
3483 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3484 self.name = v.into();
3485 self
3486 }
3487
3488 /// Sets the value of [state][crate::model::Vrf::state].
3489 ///
3490 /// # Example
3491 /// ```ignore,no_run
3492 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3493 /// use google_cloud_baremetalsolution_v2::model::vrf::State;
3494 /// let x0 = Vrf::new().set_state(State::Provisioning);
3495 /// let x1 = Vrf::new().set_state(State::Provisioned);
3496 /// ```
3497 pub fn set_state<T: std::convert::Into<crate::model::vrf::State>>(mut self, v: T) -> Self {
3498 self.state = v.into();
3499 self
3500 }
3501
3502 /// Sets the value of [qos_policy][crate::model::Vrf::qos_policy].
3503 ///
3504 /// # Example
3505 /// ```ignore,no_run
3506 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3507 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3508 /// let x = Vrf::new().set_qos_policy(QosPolicy::default()/* use setters */);
3509 /// ```
3510 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3511 where
3512 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3513 {
3514 self.qos_policy = std::option::Option::Some(v.into());
3515 self
3516 }
3517
3518 /// Sets or clears the value of [qos_policy][crate::model::Vrf::qos_policy].
3519 ///
3520 /// # Example
3521 /// ```ignore,no_run
3522 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3523 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3524 /// let x = Vrf::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3525 /// let x = Vrf::new().set_or_clear_qos_policy(None::<QosPolicy>);
3526 /// ```
3527 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3528 where
3529 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3530 {
3531 self.qos_policy = v.map(|x| x.into());
3532 self
3533 }
3534
3535 /// Sets the value of [vlan_attachments][crate::model::Vrf::vlan_attachments].
3536 ///
3537 /// # Example
3538 /// ```ignore,no_run
3539 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3540 /// use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3541 /// let x = Vrf::new()
3542 /// .set_vlan_attachments([
3543 /// VlanAttachment::default()/* use setters */,
3544 /// VlanAttachment::default()/* use (different) setters */,
3545 /// ]);
3546 /// ```
3547 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
3548 where
3549 T: std::iter::IntoIterator<Item = V>,
3550 V: std::convert::Into<crate::model::vrf::VlanAttachment>,
3551 {
3552 use std::iter::Iterator;
3553 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
3554 self
3555 }
3556}
3557
3558impl wkt::message::Message for Vrf {
3559 fn typename() -> &'static str {
3560 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF"
3561 }
3562}
3563
3564/// Defines additional types related to [Vrf].
3565pub mod vrf {
3566 #[allow(unused_imports)]
3567 use super::*;
3568
3569 /// QOS policy parameters.
3570 #[derive(Clone, Default, PartialEq)]
3571 #[non_exhaustive]
3572 pub struct QosPolicy {
3573 /// The bandwidth permitted by the QOS policy, in gbps.
3574 pub bandwidth_gbps: f64,
3575
3576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3577 }
3578
3579 impl QosPolicy {
3580 /// Creates a new default instance.
3581 pub fn new() -> Self {
3582 std::default::Default::default()
3583 }
3584
3585 /// Sets the value of [bandwidth_gbps][crate::model::vrf::QosPolicy::bandwidth_gbps].
3586 ///
3587 /// # Example
3588 /// ```ignore,no_run
3589 /// # use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3590 /// let x = QosPolicy::new().set_bandwidth_gbps(42.0);
3591 /// ```
3592 pub fn set_bandwidth_gbps<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3593 self.bandwidth_gbps = v.into();
3594 self
3595 }
3596 }
3597
3598 impl wkt::message::Message for QosPolicy {
3599 fn typename() -> &'static str {
3600 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.QosPolicy"
3601 }
3602 }
3603
3604 /// VLAN attachment details.
3605 #[derive(Clone, Default, PartialEq)]
3606 #[non_exhaustive]
3607 pub struct VlanAttachment {
3608 /// The peer vlan ID of the attachment.
3609 pub peer_vlan_id: i64,
3610
3611 /// The peer IP of the attachment.
3612 pub peer_ip: std::string::String,
3613
3614 /// The router IP of the attachment.
3615 pub router_ip: std::string::String,
3616
3617 /// Input only. Pairing key.
3618 pub pairing_key: std::string::String,
3619
3620 /// The QOS policy applied to this VLAN attachment.
3621 /// This value should be preferred to using qos at vrf level.
3622 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3623
3624 /// Immutable. The identifier of the attachment within vrf.
3625 pub id: std::string::String,
3626
3627 /// Optional. The name of the vlan attachment within vrf. This is of the form
3628 /// projects/{project_number}/regions/{region}/interconnectAttachments/{interconnect_attachment}
3629 pub interconnect_attachment: std::string::String,
3630
3631 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3632 }
3633
3634 impl VlanAttachment {
3635 /// Creates a new default instance.
3636 pub fn new() -> Self {
3637 std::default::Default::default()
3638 }
3639
3640 /// Sets the value of [peer_vlan_id][crate::model::vrf::VlanAttachment::peer_vlan_id].
3641 ///
3642 /// # Example
3643 /// ```ignore,no_run
3644 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3645 /// let x = VlanAttachment::new().set_peer_vlan_id(42);
3646 /// ```
3647 pub fn set_peer_vlan_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3648 self.peer_vlan_id = v.into();
3649 self
3650 }
3651
3652 /// Sets the value of [peer_ip][crate::model::vrf::VlanAttachment::peer_ip].
3653 ///
3654 /// # Example
3655 /// ```ignore,no_run
3656 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3657 /// let x = VlanAttachment::new().set_peer_ip("example");
3658 /// ```
3659 pub fn set_peer_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3660 self.peer_ip = v.into();
3661 self
3662 }
3663
3664 /// Sets the value of [router_ip][crate::model::vrf::VlanAttachment::router_ip].
3665 ///
3666 /// # Example
3667 /// ```ignore,no_run
3668 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3669 /// let x = VlanAttachment::new().set_router_ip("example");
3670 /// ```
3671 pub fn set_router_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3672 self.router_ip = v.into();
3673 self
3674 }
3675
3676 /// Sets the value of [pairing_key][crate::model::vrf::VlanAttachment::pairing_key].
3677 ///
3678 /// # Example
3679 /// ```ignore,no_run
3680 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3681 /// let x = VlanAttachment::new().set_pairing_key("example");
3682 /// ```
3683 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3684 self.pairing_key = v.into();
3685 self
3686 }
3687
3688 /// Sets the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3689 ///
3690 /// # Example
3691 /// ```ignore,no_run
3692 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3693 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3694 /// let x = VlanAttachment::new().set_qos_policy(QosPolicy::default()/* use setters */);
3695 /// ```
3696 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3697 where
3698 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3699 {
3700 self.qos_policy = std::option::Option::Some(v.into());
3701 self
3702 }
3703
3704 /// Sets or clears the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3705 ///
3706 /// # Example
3707 /// ```ignore,no_run
3708 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3709 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3710 /// let x = VlanAttachment::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3711 /// let x = VlanAttachment::new().set_or_clear_qos_policy(None::<QosPolicy>);
3712 /// ```
3713 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3714 where
3715 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3716 {
3717 self.qos_policy = v.map(|x| x.into());
3718 self
3719 }
3720
3721 /// Sets the value of [id][crate::model::vrf::VlanAttachment::id].
3722 ///
3723 /// # Example
3724 /// ```ignore,no_run
3725 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3726 /// let x = VlanAttachment::new().set_id("example");
3727 /// ```
3728 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3729 self.id = v.into();
3730 self
3731 }
3732
3733 /// Sets the value of [interconnect_attachment][crate::model::vrf::VlanAttachment::interconnect_attachment].
3734 ///
3735 /// # Example
3736 /// ```ignore,no_run
3737 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3738 /// let x = VlanAttachment::new().set_interconnect_attachment("example");
3739 /// ```
3740 pub fn set_interconnect_attachment<T: std::convert::Into<std::string::String>>(
3741 mut self,
3742 v: T,
3743 ) -> Self {
3744 self.interconnect_attachment = v.into();
3745 self
3746 }
3747 }
3748
3749 impl wkt::message::Message for VlanAttachment {
3750 fn typename() -> &'static str {
3751 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.VlanAttachment"
3752 }
3753 }
3754
3755 /// The possible states for this VRF.
3756 ///
3757 /// # Working with unknown values
3758 ///
3759 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3760 /// additional enum variants at any time. Adding new variants is not considered
3761 /// a breaking change. Applications should write their code in anticipation of:
3762 ///
3763 /// - New values appearing in future releases of the client library, **and**
3764 /// - New values received dynamically, without application changes.
3765 ///
3766 /// Please consult the [Working with enums] section in the user guide for some
3767 /// guidelines.
3768 ///
3769 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3770 #[derive(Clone, Debug, PartialEq)]
3771 #[non_exhaustive]
3772 pub enum State {
3773 /// The unspecified state.
3774 Unspecified,
3775 /// The vrf is provisioning.
3776 Provisioning,
3777 /// The vrf is provisioned.
3778 Provisioned,
3779 /// If set, the enum was initialized with an unknown value.
3780 ///
3781 /// Applications can examine the value using [State::value] or
3782 /// [State::name].
3783 UnknownValue(state::UnknownValue),
3784 }
3785
3786 #[doc(hidden)]
3787 pub mod state {
3788 #[allow(unused_imports)]
3789 use super::*;
3790 #[derive(Clone, Debug, PartialEq)]
3791 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3792 }
3793
3794 impl State {
3795 /// Gets the enum value.
3796 ///
3797 /// Returns `None` if the enum contains an unknown value deserialized from
3798 /// the string representation of enums.
3799 pub fn value(&self) -> std::option::Option<i32> {
3800 match self {
3801 Self::Unspecified => std::option::Option::Some(0),
3802 Self::Provisioning => std::option::Option::Some(1),
3803 Self::Provisioned => std::option::Option::Some(2),
3804 Self::UnknownValue(u) => u.0.value(),
3805 }
3806 }
3807
3808 /// Gets the enum value as a string.
3809 ///
3810 /// Returns `None` if the enum contains an unknown value deserialized from
3811 /// the integer representation of enums.
3812 pub fn name(&self) -> std::option::Option<&str> {
3813 match self {
3814 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3815 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3816 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3817 Self::UnknownValue(u) => u.0.name(),
3818 }
3819 }
3820 }
3821
3822 impl std::default::Default for State {
3823 fn default() -> Self {
3824 use std::convert::From;
3825 Self::from(0)
3826 }
3827 }
3828
3829 impl std::fmt::Display for State {
3830 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3831 wkt::internal::display_enum(f, self.name(), self.value())
3832 }
3833 }
3834
3835 impl std::convert::From<i32> for State {
3836 fn from(value: i32) -> Self {
3837 match value {
3838 0 => Self::Unspecified,
3839 1 => Self::Provisioning,
3840 2 => Self::Provisioned,
3841 _ => Self::UnknownValue(state::UnknownValue(
3842 wkt::internal::UnknownEnumValue::Integer(value),
3843 )),
3844 }
3845 }
3846 }
3847
3848 impl std::convert::From<&str> for State {
3849 fn from(value: &str) -> Self {
3850 use std::string::ToString;
3851 match value {
3852 "STATE_UNSPECIFIED" => Self::Unspecified,
3853 "PROVISIONING" => Self::Provisioning,
3854 "PROVISIONED" => Self::Provisioned,
3855 _ => Self::UnknownValue(state::UnknownValue(
3856 wkt::internal::UnknownEnumValue::String(value.to_string()),
3857 )),
3858 }
3859 }
3860 }
3861
3862 impl serde::ser::Serialize for State {
3863 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3864 where
3865 S: serde::Serializer,
3866 {
3867 match self {
3868 Self::Unspecified => serializer.serialize_i32(0),
3869 Self::Provisioning => serializer.serialize_i32(1),
3870 Self::Provisioned => serializer.serialize_i32(2),
3871 Self::UnknownValue(u) => u.0.serialize(serializer),
3872 }
3873 }
3874 }
3875
3876 impl<'de> serde::de::Deserialize<'de> for State {
3877 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3878 where
3879 D: serde::Deserializer<'de>,
3880 {
3881 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3882 ".google.cloud.baremetalsolution.v2.VRF.State",
3883 ))
3884 }
3885 }
3886}
3887
3888/// Each logical interface represents a logical abstraction of the underlying
3889/// physical interface (for eg. bond, nic) of the instance. Each logical
3890/// interface can effectively map to multiple network-IP pairs and still be
3891/// mapped to one underlying physical interface.
3892#[derive(Clone, Default, PartialEq)]
3893#[non_exhaustive]
3894pub struct LogicalInterface {
3895 /// List of logical network interfaces within a logical interface.
3896 pub logical_network_interfaces:
3897 std::vec::Vec<crate::model::logical_interface::LogicalNetworkInterface>,
3898
3899 /// Interface name. This is of syntax \<bond\><bond_mode> or \<nic\> and
3900 /// forms part of the network template name.
3901 pub name: std::string::String,
3902
3903 /// The index of the logical interface mapping to the index of the hardware
3904 /// bond or nic on the chosen network template. This field is deprecated.
3905 #[deprecated]
3906 pub interface_index: i32,
3907
3908 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3909}
3910
3911impl LogicalInterface {
3912 /// Creates a new default instance.
3913 pub fn new() -> Self {
3914 std::default::Default::default()
3915 }
3916
3917 /// Sets the value of [logical_network_interfaces][crate::model::LogicalInterface::logical_network_interfaces].
3918 ///
3919 /// # Example
3920 /// ```ignore,no_run
3921 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3922 /// use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3923 /// let x = LogicalInterface::new()
3924 /// .set_logical_network_interfaces([
3925 /// LogicalNetworkInterface::default()/* use setters */,
3926 /// LogicalNetworkInterface::default()/* use (different) setters */,
3927 /// ]);
3928 /// ```
3929 pub fn set_logical_network_interfaces<T, V>(mut self, v: T) -> Self
3930 where
3931 T: std::iter::IntoIterator<Item = V>,
3932 V: std::convert::Into<crate::model::logical_interface::LogicalNetworkInterface>,
3933 {
3934 use std::iter::Iterator;
3935 self.logical_network_interfaces = v.into_iter().map(|i| i.into()).collect();
3936 self
3937 }
3938
3939 /// Sets the value of [name][crate::model::LogicalInterface::name].
3940 ///
3941 /// # Example
3942 /// ```ignore,no_run
3943 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3944 /// let x = LogicalInterface::new().set_name("example");
3945 /// ```
3946 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3947 self.name = v.into();
3948 self
3949 }
3950
3951 /// Sets the value of [interface_index][crate::model::LogicalInterface::interface_index].
3952 ///
3953 /// # Example
3954 /// ```ignore,no_run
3955 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3956 /// let x = LogicalInterface::new().set_interface_index(42);
3957 /// ```
3958 #[deprecated]
3959 pub fn set_interface_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3960 self.interface_index = v.into();
3961 self
3962 }
3963}
3964
3965impl wkt::message::Message for LogicalInterface {
3966 fn typename() -> &'static str {
3967 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface"
3968 }
3969}
3970
3971/// Defines additional types related to [LogicalInterface].
3972pub mod logical_interface {
3973 #[allow(unused_imports)]
3974 use super::*;
3975
3976 /// Each logical network interface is effectively a network and IP pair.
3977 #[derive(Clone, Default, PartialEq)]
3978 #[non_exhaustive]
3979 pub struct LogicalNetworkInterface {
3980 /// Name of the network
3981 pub network: std::string::String,
3982
3983 /// IP address in the network
3984 pub ip_address: std::string::String,
3985
3986 /// Whether this interface is the default gateway for the instance. Only
3987 /// one interface can be the default gateway for the instance.
3988 pub default_gateway: bool,
3989
3990 /// Type of network.
3991 pub network_type: crate::model::network::Type,
3992
3993 /// An identifier for the `Network`, generated by the backend.
3994 pub id: std::string::String,
3995
3996 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3997 }
3998
3999 impl LogicalNetworkInterface {
4000 /// Creates a new default instance.
4001 pub fn new() -> Self {
4002 std::default::Default::default()
4003 }
4004
4005 /// Sets the value of [network][crate::model::logical_interface::LogicalNetworkInterface::network].
4006 ///
4007 /// # Example
4008 /// ```ignore,no_run
4009 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4010 /// let x = LogicalNetworkInterface::new().set_network("example");
4011 /// ```
4012 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4013 self.network = v.into();
4014 self
4015 }
4016
4017 /// Sets the value of [ip_address][crate::model::logical_interface::LogicalNetworkInterface::ip_address].
4018 ///
4019 /// # Example
4020 /// ```ignore,no_run
4021 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4022 /// let x = LogicalNetworkInterface::new().set_ip_address("example");
4023 /// ```
4024 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4025 self.ip_address = v.into();
4026 self
4027 }
4028
4029 /// Sets the value of [default_gateway][crate::model::logical_interface::LogicalNetworkInterface::default_gateway].
4030 ///
4031 /// # Example
4032 /// ```ignore,no_run
4033 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4034 /// let x = LogicalNetworkInterface::new().set_default_gateway(true);
4035 /// ```
4036 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4037 self.default_gateway = v.into();
4038 self
4039 }
4040
4041 /// Sets the value of [network_type][crate::model::logical_interface::LogicalNetworkInterface::network_type].
4042 ///
4043 /// # Example
4044 /// ```ignore,no_run
4045 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4046 /// use google_cloud_baremetalsolution_v2::model::network::Type;
4047 /// let x0 = LogicalNetworkInterface::new().set_network_type(Type::Client);
4048 /// let x1 = LogicalNetworkInterface::new().set_network_type(Type::Private);
4049 /// ```
4050 pub fn set_network_type<T: std::convert::Into<crate::model::network::Type>>(
4051 mut self,
4052 v: T,
4053 ) -> Self {
4054 self.network_type = v.into();
4055 self
4056 }
4057
4058 /// Sets the value of [id][crate::model::logical_interface::LogicalNetworkInterface::id].
4059 ///
4060 /// # Example
4061 /// ```ignore,no_run
4062 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4063 /// let x = LogicalNetworkInterface::new().set_id("example");
4064 /// ```
4065 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4066 self.id = v.into();
4067 self
4068 }
4069 }
4070
4071 impl wkt::message::Message for LogicalNetworkInterface {
4072 fn typename() -> &'static str {
4073 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface.LogicalNetworkInterface"
4074 }
4075 }
4076}
4077
4078/// Message for requesting network information.
4079#[derive(Clone, Default, PartialEq)]
4080#[non_exhaustive]
4081pub struct GetNetworkRequest {
4082 /// Required. Name of the resource.
4083 pub name: std::string::String,
4084
4085 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4086}
4087
4088impl GetNetworkRequest {
4089 /// Creates a new default instance.
4090 pub fn new() -> Self {
4091 std::default::Default::default()
4092 }
4093
4094 /// Sets the value of [name][crate::model::GetNetworkRequest::name].
4095 ///
4096 /// # Example
4097 /// ```ignore,no_run
4098 /// # use google_cloud_baremetalsolution_v2::model::GetNetworkRequest;
4099 /// # let project_id = "project_id";
4100 /// # let location_id = "location_id";
4101 /// # let network_id = "network_id";
4102 /// let x = GetNetworkRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/networks/{network_id}"));
4103 /// ```
4104 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4105 self.name = v.into();
4106 self
4107 }
4108}
4109
4110impl wkt::message::Message for GetNetworkRequest {
4111 fn typename() -> &'static str {
4112 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNetworkRequest"
4113 }
4114}
4115
4116/// Message for requesting a list of networks.
4117#[derive(Clone, Default, PartialEq)]
4118#[non_exhaustive]
4119pub struct ListNetworksRequest {
4120 /// Required. Parent value for ListNetworksRequest.
4121 pub parent: std::string::String,
4122
4123 /// Requested page size. The server might return fewer items than requested.
4124 /// If unspecified, server will pick an appropriate default.
4125 pub page_size: i32,
4126
4127 /// A token identifying a page of results from the server.
4128 pub page_token: std::string::String,
4129
4130 /// List filter.
4131 pub filter: std::string::String,
4132
4133 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4134}
4135
4136impl ListNetworksRequest {
4137 /// Creates a new default instance.
4138 pub fn new() -> Self {
4139 std::default::Default::default()
4140 }
4141
4142 /// Sets the value of [parent][crate::model::ListNetworksRequest::parent].
4143 ///
4144 /// # Example
4145 /// ```ignore,no_run
4146 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4147 /// let x = ListNetworksRequest::new().set_parent("example");
4148 /// ```
4149 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4150 self.parent = v.into();
4151 self
4152 }
4153
4154 /// Sets the value of [page_size][crate::model::ListNetworksRequest::page_size].
4155 ///
4156 /// # Example
4157 /// ```ignore,no_run
4158 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4159 /// let x = ListNetworksRequest::new().set_page_size(42);
4160 /// ```
4161 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4162 self.page_size = v.into();
4163 self
4164 }
4165
4166 /// Sets the value of [page_token][crate::model::ListNetworksRequest::page_token].
4167 ///
4168 /// # Example
4169 /// ```ignore,no_run
4170 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4171 /// let x = ListNetworksRequest::new().set_page_token("example");
4172 /// ```
4173 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4174 self.page_token = v.into();
4175 self
4176 }
4177
4178 /// Sets the value of [filter][crate::model::ListNetworksRequest::filter].
4179 ///
4180 /// # Example
4181 /// ```ignore,no_run
4182 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4183 /// let x = ListNetworksRequest::new().set_filter("example");
4184 /// ```
4185 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4186 self.filter = v.into();
4187 self
4188 }
4189}
4190
4191impl wkt::message::Message for ListNetworksRequest {
4192 fn typename() -> &'static str {
4193 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksRequest"
4194 }
4195}
4196
4197/// Response message containing the list of networks.
4198#[derive(Clone, Default, PartialEq)]
4199#[non_exhaustive]
4200pub struct ListNetworksResponse {
4201 /// The list of networks.
4202 pub networks: std::vec::Vec<crate::model::Network>,
4203
4204 /// A token identifying a page of results from the server.
4205 pub next_page_token: std::string::String,
4206
4207 /// Locations that could not be reached.
4208 pub unreachable: std::vec::Vec<std::string::String>,
4209
4210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4211}
4212
4213impl ListNetworksResponse {
4214 /// Creates a new default instance.
4215 pub fn new() -> Self {
4216 std::default::Default::default()
4217 }
4218
4219 /// Sets the value of [networks][crate::model::ListNetworksResponse::networks].
4220 ///
4221 /// # Example
4222 /// ```ignore,no_run
4223 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4224 /// use google_cloud_baremetalsolution_v2::model::Network;
4225 /// let x = ListNetworksResponse::new()
4226 /// .set_networks([
4227 /// Network::default()/* use setters */,
4228 /// Network::default()/* use (different) setters */,
4229 /// ]);
4230 /// ```
4231 pub fn set_networks<T, V>(mut self, v: T) -> Self
4232 where
4233 T: std::iter::IntoIterator<Item = V>,
4234 V: std::convert::Into<crate::model::Network>,
4235 {
4236 use std::iter::Iterator;
4237 self.networks = v.into_iter().map(|i| i.into()).collect();
4238 self
4239 }
4240
4241 /// Sets the value of [next_page_token][crate::model::ListNetworksResponse::next_page_token].
4242 ///
4243 /// # Example
4244 /// ```ignore,no_run
4245 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4246 /// let x = ListNetworksResponse::new().set_next_page_token("example");
4247 /// ```
4248 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4249 self.next_page_token = v.into();
4250 self
4251 }
4252
4253 /// Sets the value of [unreachable][crate::model::ListNetworksResponse::unreachable].
4254 ///
4255 /// # Example
4256 /// ```ignore,no_run
4257 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4258 /// let x = ListNetworksResponse::new().set_unreachable(["a", "b", "c"]);
4259 /// ```
4260 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4261 where
4262 T: std::iter::IntoIterator<Item = V>,
4263 V: std::convert::Into<std::string::String>,
4264 {
4265 use std::iter::Iterator;
4266 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4267 self
4268 }
4269}
4270
4271impl wkt::message::Message for ListNetworksResponse {
4272 fn typename() -> &'static str {
4273 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksResponse"
4274 }
4275}
4276
4277#[doc(hidden)]
4278impl google_cloud_gax::paginator::internal::PageableResponse for ListNetworksResponse {
4279 type PageItem = crate::model::Network;
4280
4281 fn items(self) -> std::vec::Vec<Self::PageItem> {
4282 self.networks
4283 }
4284
4285 fn next_page_token(&self) -> std::string::String {
4286 use std::clone::Clone;
4287 self.next_page_token.clone()
4288 }
4289}
4290
4291/// Message requesting to updating a network.
4292#[derive(Clone, Default, PartialEq)]
4293#[non_exhaustive]
4294pub struct UpdateNetworkRequest {
4295 /// Required. The network to update.
4296 ///
4297 /// The `name` field is used to identify the instance to update.
4298 /// Format: projects/{project}/locations/{location}/networks/{network}
4299 pub network: std::option::Option<crate::model::Network>,
4300
4301 /// The list of fields to update.
4302 /// The only currently supported fields are:
4303 /// `labels`, `reservations`, `vrf.vlan_attachments`
4304 pub update_mask: std::option::Option<wkt::FieldMask>,
4305
4306 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4307}
4308
4309impl UpdateNetworkRequest {
4310 /// Creates a new default instance.
4311 pub fn new() -> Self {
4312 std::default::Default::default()
4313 }
4314
4315 /// Sets the value of [network][crate::model::UpdateNetworkRequest::network].
4316 ///
4317 /// # Example
4318 /// ```ignore,no_run
4319 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4320 /// use google_cloud_baremetalsolution_v2::model::Network;
4321 /// let x = UpdateNetworkRequest::new().set_network(Network::default()/* use setters */);
4322 /// ```
4323 pub fn set_network<T>(mut self, v: T) -> Self
4324 where
4325 T: std::convert::Into<crate::model::Network>,
4326 {
4327 self.network = std::option::Option::Some(v.into());
4328 self
4329 }
4330
4331 /// Sets or clears the value of [network][crate::model::UpdateNetworkRequest::network].
4332 ///
4333 /// # Example
4334 /// ```ignore,no_run
4335 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4336 /// use google_cloud_baremetalsolution_v2::model::Network;
4337 /// let x = UpdateNetworkRequest::new().set_or_clear_network(Some(Network::default()/* use setters */));
4338 /// let x = UpdateNetworkRequest::new().set_or_clear_network(None::<Network>);
4339 /// ```
4340 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4341 where
4342 T: std::convert::Into<crate::model::Network>,
4343 {
4344 self.network = v.map(|x| x.into());
4345 self
4346 }
4347
4348 /// Sets the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4349 ///
4350 /// # Example
4351 /// ```ignore,no_run
4352 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4353 /// use wkt::FieldMask;
4354 /// let x = UpdateNetworkRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4355 /// ```
4356 pub fn set_update_mask<T>(mut self, v: T) -> Self
4357 where
4358 T: std::convert::Into<wkt::FieldMask>,
4359 {
4360 self.update_mask = std::option::Option::Some(v.into());
4361 self
4362 }
4363
4364 /// Sets or clears the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4365 ///
4366 /// # Example
4367 /// ```ignore,no_run
4368 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4369 /// use wkt::FieldMask;
4370 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4371 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4372 /// ```
4373 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4374 where
4375 T: std::convert::Into<wkt::FieldMask>,
4376 {
4377 self.update_mask = v.map(|x| x.into());
4378 self
4379 }
4380}
4381
4382impl wkt::message::Message for UpdateNetworkRequest {
4383 fn typename() -> &'static str {
4384 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNetworkRequest"
4385 }
4386}
4387
4388/// Network with all used IP addresses.
4389#[derive(Clone, Default, PartialEq)]
4390#[non_exhaustive]
4391pub struct NetworkUsage {
4392 /// Network.
4393 pub network: std::option::Option<crate::model::Network>,
4394
4395 /// All used IP addresses in this network.
4396 pub used_ips: std::vec::Vec<std::string::String>,
4397
4398 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4399}
4400
4401impl NetworkUsage {
4402 /// Creates a new default instance.
4403 pub fn new() -> Self {
4404 std::default::Default::default()
4405 }
4406
4407 /// Sets the value of [network][crate::model::NetworkUsage::network].
4408 ///
4409 /// # Example
4410 /// ```ignore,no_run
4411 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4412 /// use google_cloud_baremetalsolution_v2::model::Network;
4413 /// let x = NetworkUsage::new().set_network(Network::default()/* use setters */);
4414 /// ```
4415 pub fn set_network<T>(mut self, v: T) -> Self
4416 where
4417 T: std::convert::Into<crate::model::Network>,
4418 {
4419 self.network = std::option::Option::Some(v.into());
4420 self
4421 }
4422
4423 /// Sets or clears the value of [network][crate::model::NetworkUsage::network].
4424 ///
4425 /// # Example
4426 /// ```ignore,no_run
4427 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4428 /// use google_cloud_baremetalsolution_v2::model::Network;
4429 /// let x = NetworkUsage::new().set_or_clear_network(Some(Network::default()/* use setters */));
4430 /// let x = NetworkUsage::new().set_or_clear_network(None::<Network>);
4431 /// ```
4432 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4433 where
4434 T: std::convert::Into<crate::model::Network>,
4435 {
4436 self.network = v.map(|x| x.into());
4437 self
4438 }
4439
4440 /// Sets the value of [used_ips][crate::model::NetworkUsage::used_ips].
4441 ///
4442 /// # Example
4443 /// ```ignore,no_run
4444 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4445 /// let x = NetworkUsage::new().set_used_ips(["a", "b", "c"]);
4446 /// ```
4447 pub fn set_used_ips<T, V>(mut self, v: T) -> Self
4448 where
4449 T: std::iter::IntoIterator<Item = V>,
4450 V: std::convert::Into<std::string::String>,
4451 {
4452 use std::iter::Iterator;
4453 self.used_ips = v.into_iter().map(|i| i.into()).collect();
4454 self
4455 }
4456}
4457
4458impl wkt::message::Message for NetworkUsage {
4459 fn typename() -> &'static str {
4460 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkUsage"
4461 }
4462}
4463
4464/// Request to get networks with IPs.
4465#[derive(Clone, Default, PartialEq)]
4466#[non_exhaustive]
4467pub struct ListNetworkUsageRequest {
4468 /// Required. Parent value (project and location).
4469 pub location: std::string::String,
4470
4471 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4472}
4473
4474impl ListNetworkUsageRequest {
4475 /// Creates a new default instance.
4476 pub fn new() -> Self {
4477 std::default::Default::default()
4478 }
4479
4480 /// Sets the value of [location][crate::model::ListNetworkUsageRequest::location].
4481 ///
4482 /// # Example
4483 /// ```ignore,no_run
4484 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageRequest;
4485 /// let x = ListNetworkUsageRequest::new().set_location("example");
4486 /// ```
4487 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4488 self.location = v.into();
4489 self
4490 }
4491}
4492
4493impl wkt::message::Message for ListNetworkUsageRequest {
4494 fn typename() -> &'static str {
4495 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageRequest"
4496 }
4497}
4498
4499/// Response with Networks with IPs
4500#[derive(Clone, Default, PartialEq)]
4501#[non_exhaustive]
4502pub struct ListNetworkUsageResponse {
4503 /// Networks with IPs.
4504 pub networks: std::vec::Vec<crate::model::NetworkUsage>,
4505
4506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4507}
4508
4509impl ListNetworkUsageResponse {
4510 /// Creates a new default instance.
4511 pub fn new() -> Self {
4512 std::default::Default::default()
4513 }
4514
4515 /// Sets the value of [networks][crate::model::ListNetworkUsageResponse::networks].
4516 ///
4517 /// # Example
4518 /// ```ignore,no_run
4519 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageResponse;
4520 /// use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4521 /// let x = ListNetworkUsageResponse::new()
4522 /// .set_networks([
4523 /// NetworkUsage::default()/* use setters */,
4524 /// NetworkUsage::default()/* use (different) setters */,
4525 /// ]);
4526 /// ```
4527 pub fn set_networks<T, V>(mut self, v: T) -> Self
4528 where
4529 T: std::iter::IntoIterator<Item = V>,
4530 V: std::convert::Into<crate::model::NetworkUsage>,
4531 {
4532 use std::iter::Iterator;
4533 self.networks = v.into_iter().map(|i| i.into()).collect();
4534 self
4535 }
4536}
4537
4538impl wkt::message::Message for ListNetworkUsageResponse {
4539 fn typename() -> &'static str {
4540 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageResponse"
4541 }
4542}
4543
4544/// Mount point for a network.
4545#[derive(Clone, Default, PartialEq)]
4546#[non_exhaustive]
4547pub struct NetworkMountPoint {
4548 /// Instance to attach network to.
4549 pub instance: std::string::String,
4550
4551 /// Logical interface to detach from.
4552 pub logical_interface: std::string::String,
4553
4554 /// Network should be a default gateway.
4555 pub default_gateway: bool,
4556
4557 /// Ip address of the server.
4558 pub ip_address: std::string::String,
4559
4560 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4561}
4562
4563impl NetworkMountPoint {
4564 /// Creates a new default instance.
4565 pub fn new() -> Self {
4566 std::default::Default::default()
4567 }
4568
4569 /// Sets the value of [instance][crate::model::NetworkMountPoint::instance].
4570 ///
4571 /// # Example
4572 /// ```ignore,no_run
4573 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4574 /// # let project_id = "project_id";
4575 /// # let location_id = "location_id";
4576 /// # let instance_id = "instance_id";
4577 /// let x = NetworkMountPoint::new().set_instance(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
4578 /// ```
4579 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4580 self.instance = v.into();
4581 self
4582 }
4583
4584 /// Sets the value of [logical_interface][crate::model::NetworkMountPoint::logical_interface].
4585 ///
4586 /// # Example
4587 /// ```ignore,no_run
4588 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4589 /// let x = NetworkMountPoint::new().set_logical_interface("example");
4590 /// ```
4591 pub fn set_logical_interface<T: std::convert::Into<std::string::String>>(
4592 mut self,
4593 v: T,
4594 ) -> Self {
4595 self.logical_interface = v.into();
4596 self
4597 }
4598
4599 /// Sets the value of [default_gateway][crate::model::NetworkMountPoint::default_gateway].
4600 ///
4601 /// # Example
4602 /// ```ignore,no_run
4603 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4604 /// let x = NetworkMountPoint::new().set_default_gateway(true);
4605 /// ```
4606 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4607 self.default_gateway = v.into();
4608 self
4609 }
4610
4611 /// Sets the value of [ip_address][crate::model::NetworkMountPoint::ip_address].
4612 ///
4613 /// # Example
4614 /// ```ignore,no_run
4615 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4616 /// let x = NetworkMountPoint::new().set_ip_address("example");
4617 /// ```
4618 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4619 self.ip_address = v.into();
4620 self
4621 }
4622}
4623
4624impl wkt::message::Message for NetworkMountPoint {
4625 fn typename() -> &'static str {
4626 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkMountPoint"
4627 }
4628}
4629
4630/// Message requesting rename of a server.
4631#[derive(Clone, Default, PartialEq)]
4632#[non_exhaustive]
4633pub struct RenameNetworkRequest {
4634 /// Required. The `name` field is used to identify the network.
4635 /// Format: projects/{project}/locations/{location}/networks/{network}
4636 pub name: std::string::String,
4637
4638 /// Required. The new `id` of the network.
4639 pub new_network_id: std::string::String,
4640
4641 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4642}
4643
4644impl RenameNetworkRequest {
4645 /// Creates a new default instance.
4646 pub fn new() -> Self {
4647 std::default::Default::default()
4648 }
4649
4650 /// Sets the value of [name][crate::model::RenameNetworkRequest::name].
4651 ///
4652 /// # Example
4653 /// ```ignore,no_run
4654 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4655 /// # let project_id = "project_id";
4656 /// # let location_id = "location_id";
4657 /// # let network_id = "network_id";
4658 /// let x = RenameNetworkRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/networks/{network_id}"));
4659 /// ```
4660 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4661 self.name = v.into();
4662 self
4663 }
4664
4665 /// Sets the value of [new_network_id][crate::model::RenameNetworkRequest::new_network_id].
4666 ///
4667 /// # Example
4668 /// ```ignore,no_run
4669 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4670 /// let x = RenameNetworkRequest::new().set_new_network_id("example");
4671 /// ```
4672 pub fn set_new_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4673 self.new_network_id = v.into();
4674 self
4675 }
4676}
4677
4678impl wkt::message::Message for RenameNetworkRequest {
4679 fn typename() -> &'static str {
4680 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNetworkRequest"
4681 }
4682}
4683
4684/// An NFS share.
4685#[derive(Clone, Default, PartialEq)]
4686#[non_exhaustive]
4687pub struct NfsShare {
4688 /// Immutable. The name of the NFS share.
4689 pub name: std::string::String,
4690
4691 /// Output only. An identifier for the NFS share, generated by the backend.
4692 /// This field will be deprecated in the future, use `id` instead.
4693 pub nfs_share_id: std::string::String,
4694
4695 /// Output only. An identifier for the NFS share, generated by the backend.
4696 /// This is the same value as nfs_share_id and will replace it in the future.
4697 pub id: std::string::String,
4698
4699 /// Output only. The state of the NFS share.
4700 pub state: crate::model::nfs_share::State,
4701
4702 /// Output only. The underlying volume of the share. Created automatically
4703 /// during provisioning.
4704 pub volume: std::string::String,
4705
4706 /// List of allowed access points.
4707 pub allowed_clients: std::vec::Vec<crate::model::nfs_share::AllowedClient>,
4708
4709 /// Labels as key value pairs.
4710 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4711
4712 /// The requested size, in GiB.
4713 pub requested_size_gib: i64,
4714
4715 /// Immutable. The storage type of the underlying volume.
4716 pub storage_type: crate::model::nfs_share::StorageType,
4717
4718 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4719}
4720
4721impl NfsShare {
4722 /// Creates a new default instance.
4723 pub fn new() -> Self {
4724 std::default::Default::default()
4725 }
4726
4727 /// Sets the value of [name][crate::model::NfsShare::name].
4728 ///
4729 /// # Example
4730 /// ```ignore,no_run
4731 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4732 /// # let project_id = "project_id";
4733 /// # let location_id = "location_id";
4734 /// # let nfs_share_id = "nfs_share_id";
4735 /// let x = NfsShare::new().set_name(format!("projects/{project_id}/locations/{location_id}/nfsShares/{nfs_share_id}"));
4736 /// ```
4737 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4738 self.name = v.into();
4739 self
4740 }
4741
4742 /// Sets the value of [nfs_share_id][crate::model::NfsShare::nfs_share_id].
4743 ///
4744 /// # Example
4745 /// ```ignore,no_run
4746 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4747 /// let x = NfsShare::new().set_nfs_share_id("example");
4748 /// ```
4749 pub fn set_nfs_share_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4750 self.nfs_share_id = v.into();
4751 self
4752 }
4753
4754 /// Sets the value of [id][crate::model::NfsShare::id].
4755 ///
4756 /// # Example
4757 /// ```ignore,no_run
4758 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4759 /// let x = NfsShare::new().set_id("example");
4760 /// ```
4761 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4762 self.id = v.into();
4763 self
4764 }
4765
4766 /// Sets the value of [state][crate::model::NfsShare::state].
4767 ///
4768 /// # Example
4769 /// ```ignore,no_run
4770 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4771 /// use google_cloud_baremetalsolution_v2::model::nfs_share::State;
4772 /// let x0 = NfsShare::new().set_state(State::Provisioned);
4773 /// let x1 = NfsShare::new().set_state(State::Creating);
4774 /// let x2 = NfsShare::new().set_state(State::Updating);
4775 /// ```
4776 pub fn set_state<T: std::convert::Into<crate::model::nfs_share::State>>(
4777 mut self,
4778 v: T,
4779 ) -> Self {
4780 self.state = v.into();
4781 self
4782 }
4783
4784 /// Sets the value of [volume][crate::model::NfsShare::volume].
4785 ///
4786 /// # Example
4787 /// ```ignore,no_run
4788 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4789 /// # let project_id = "project_id";
4790 /// # let location_id = "location_id";
4791 /// # let volume_id = "volume_id";
4792 /// let x = NfsShare::new().set_volume(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
4793 /// ```
4794 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4795 self.volume = v.into();
4796 self
4797 }
4798
4799 /// Sets the value of [allowed_clients][crate::model::NfsShare::allowed_clients].
4800 ///
4801 /// # Example
4802 /// ```ignore,no_run
4803 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4804 /// use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4805 /// let x = NfsShare::new()
4806 /// .set_allowed_clients([
4807 /// AllowedClient::default()/* use setters */,
4808 /// AllowedClient::default()/* use (different) setters */,
4809 /// ]);
4810 /// ```
4811 pub fn set_allowed_clients<T, V>(mut self, v: T) -> Self
4812 where
4813 T: std::iter::IntoIterator<Item = V>,
4814 V: std::convert::Into<crate::model::nfs_share::AllowedClient>,
4815 {
4816 use std::iter::Iterator;
4817 self.allowed_clients = v.into_iter().map(|i| i.into()).collect();
4818 self
4819 }
4820
4821 /// Sets the value of [labels][crate::model::NfsShare::labels].
4822 ///
4823 /// # Example
4824 /// ```ignore,no_run
4825 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4826 /// let x = NfsShare::new().set_labels([
4827 /// ("key0", "abc"),
4828 /// ("key1", "xyz"),
4829 /// ]);
4830 /// ```
4831 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4832 where
4833 T: std::iter::IntoIterator<Item = (K, V)>,
4834 K: std::convert::Into<std::string::String>,
4835 V: std::convert::Into<std::string::String>,
4836 {
4837 use std::iter::Iterator;
4838 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4839 self
4840 }
4841
4842 /// Sets the value of [requested_size_gib][crate::model::NfsShare::requested_size_gib].
4843 ///
4844 /// # Example
4845 /// ```ignore,no_run
4846 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4847 /// let x = NfsShare::new().set_requested_size_gib(42);
4848 /// ```
4849 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4850 self.requested_size_gib = v.into();
4851 self
4852 }
4853
4854 /// Sets the value of [storage_type][crate::model::NfsShare::storage_type].
4855 ///
4856 /// # Example
4857 /// ```ignore,no_run
4858 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4859 /// use google_cloud_baremetalsolution_v2::model::nfs_share::StorageType;
4860 /// let x0 = NfsShare::new().set_storage_type(StorageType::Ssd);
4861 /// let x1 = NfsShare::new().set_storage_type(StorageType::Hdd);
4862 /// ```
4863 pub fn set_storage_type<T: std::convert::Into<crate::model::nfs_share::StorageType>>(
4864 mut self,
4865 v: T,
4866 ) -> Self {
4867 self.storage_type = v.into();
4868 self
4869 }
4870}
4871
4872impl wkt::message::Message for NfsShare {
4873 fn typename() -> &'static str {
4874 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare"
4875 }
4876}
4877
4878/// Defines additional types related to [NfsShare].
4879pub mod nfs_share {
4880 #[allow(unused_imports)]
4881 use super::*;
4882
4883 /// Represents an 'access point' for the share.
4884 #[derive(Clone, Default, PartialEq)]
4885 #[non_exhaustive]
4886 pub struct AllowedClient {
4887 /// The network the access point sits on.
4888 pub network: std::string::String,
4889
4890 /// Output only. The IP address of the share on this network. Assigned
4891 /// automatically during provisioning based on the network's services_cidr.
4892 pub share_ip: std::string::String,
4893
4894 /// The subnet of IP addresses permitted to access the share.
4895 pub allowed_clients_cidr: std::string::String,
4896
4897 /// Mount permissions.
4898 pub mount_permissions: crate::model::nfs_share::MountPermissions,
4899
4900 /// Allow dev flag. Which controls whether to allow creation of devices.
4901 pub allow_dev: bool,
4902
4903 /// Allow the setuid flag.
4904 pub allow_suid: bool,
4905
4906 /// Disable root squashing, which is a feature of NFS.
4907 /// Root squash is a special mapping of the remote superuser (root) identity
4908 /// when using identity authentication.
4909 pub no_root_squash: bool,
4910
4911 /// Output only. The path to access NFS, in format shareIP:/InstanceID
4912 /// InstanceID is the generated ID instead of customer provided name.
4913 /// example like "10.0.0.0:/g123456789-nfs001"
4914 pub nfs_path: std::string::String,
4915
4916 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4917 }
4918
4919 impl AllowedClient {
4920 /// Creates a new default instance.
4921 pub fn new() -> Self {
4922 std::default::Default::default()
4923 }
4924
4925 /// Sets the value of [network][crate::model::nfs_share::AllowedClient::network].
4926 ///
4927 /// # Example
4928 /// ```ignore,no_run
4929 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4930 /// # let project_id = "project_id";
4931 /// # let location_id = "location_id";
4932 /// # let network_id = "network_id";
4933 /// let x = AllowedClient::new().set_network(format!("projects/{project_id}/locations/{location_id}/networks/{network_id}"));
4934 /// ```
4935 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4936 self.network = v.into();
4937 self
4938 }
4939
4940 /// Sets the value of [share_ip][crate::model::nfs_share::AllowedClient::share_ip].
4941 ///
4942 /// # Example
4943 /// ```ignore,no_run
4944 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4945 /// let x = AllowedClient::new().set_share_ip("example");
4946 /// ```
4947 pub fn set_share_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4948 self.share_ip = v.into();
4949 self
4950 }
4951
4952 /// Sets the value of [allowed_clients_cidr][crate::model::nfs_share::AllowedClient::allowed_clients_cidr].
4953 ///
4954 /// # Example
4955 /// ```ignore,no_run
4956 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4957 /// let x = AllowedClient::new().set_allowed_clients_cidr("example");
4958 /// ```
4959 pub fn set_allowed_clients_cidr<T: std::convert::Into<std::string::String>>(
4960 mut self,
4961 v: T,
4962 ) -> Self {
4963 self.allowed_clients_cidr = v.into();
4964 self
4965 }
4966
4967 /// Sets the value of [mount_permissions][crate::model::nfs_share::AllowedClient::mount_permissions].
4968 ///
4969 /// # Example
4970 /// ```ignore,no_run
4971 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4972 /// use google_cloud_baremetalsolution_v2::model::nfs_share::MountPermissions;
4973 /// let x0 = AllowedClient::new().set_mount_permissions(MountPermissions::Read);
4974 /// let x1 = AllowedClient::new().set_mount_permissions(MountPermissions::ReadWrite);
4975 /// ```
4976 pub fn set_mount_permissions<
4977 T: std::convert::Into<crate::model::nfs_share::MountPermissions>,
4978 >(
4979 mut self,
4980 v: T,
4981 ) -> Self {
4982 self.mount_permissions = v.into();
4983 self
4984 }
4985
4986 /// Sets the value of [allow_dev][crate::model::nfs_share::AllowedClient::allow_dev].
4987 ///
4988 /// # Example
4989 /// ```ignore,no_run
4990 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4991 /// let x = AllowedClient::new().set_allow_dev(true);
4992 /// ```
4993 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4994 self.allow_dev = v.into();
4995 self
4996 }
4997
4998 /// Sets the value of [allow_suid][crate::model::nfs_share::AllowedClient::allow_suid].
4999 ///
5000 /// # Example
5001 /// ```ignore,no_run
5002 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
5003 /// let x = AllowedClient::new().set_allow_suid(true);
5004 /// ```
5005 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5006 self.allow_suid = v.into();
5007 self
5008 }
5009
5010 /// Sets the value of [no_root_squash][crate::model::nfs_share::AllowedClient::no_root_squash].
5011 ///
5012 /// # Example
5013 /// ```ignore,no_run
5014 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
5015 /// let x = AllowedClient::new().set_no_root_squash(true);
5016 /// ```
5017 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5018 self.no_root_squash = v.into();
5019 self
5020 }
5021
5022 /// Sets the value of [nfs_path][crate::model::nfs_share::AllowedClient::nfs_path].
5023 ///
5024 /// # Example
5025 /// ```ignore,no_run
5026 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
5027 /// let x = AllowedClient::new().set_nfs_path("example");
5028 /// ```
5029 pub fn set_nfs_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5030 self.nfs_path = v.into();
5031 self
5032 }
5033 }
5034
5035 impl wkt::message::Message for AllowedClient {
5036 fn typename() -> &'static str {
5037 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare.AllowedClient"
5038 }
5039 }
5040
5041 /// The possible states for this NFS share.
5042 ///
5043 /// # Working with unknown values
5044 ///
5045 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5046 /// additional enum variants at any time. Adding new variants is not considered
5047 /// a breaking change. Applications should write their code in anticipation of:
5048 ///
5049 /// - New values appearing in future releases of the client library, **and**
5050 /// - New values received dynamically, without application changes.
5051 ///
5052 /// Please consult the [Working with enums] section in the user guide for some
5053 /// guidelines.
5054 ///
5055 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5056 #[derive(Clone, Debug, PartialEq)]
5057 #[non_exhaustive]
5058 pub enum State {
5059 /// The share is in an unknown state.
5060 Unspecified,
5061 /// The share has been provisioned.
5062 Provisioned,
5063 /// The NFS Share is being created.
5064 Creating,
5065 /// The NFS Share is being updated.
5066 Updating,
5067 /// The NFS Share has been requested to be deleted.
5068 Deleting,
5069 /// If set, the enum was initialized with an unknown value.
5070 ///
5071 /// Applications can examine the value using [State::value] or
5072 /// [State::name].
5073 UnknownValue(state::UnknownValue),
5074 }
5075
5076 #[doc(hidden)]
5077 pub mod state {
5078 #[allow(unused_imports)]
5079 use super::*;
5080 #[derive(Clone, Debug, PartialEq)]
5081 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5082 }
5083
5084 impl State {
5085 /// Gets the enum value.
5086 ///
5087 /// Returns `None` if the enum contains an unknown value deserialized from
5088 /// the string representation of enums.
5089 pub fn value(&self) -> std::option::Option<i32> {
5090 match self {
5091 Self::Unspecified => std::option::Option::Some(0),
5092 Self::Provisioned => std::option::Option::Some(1),
5093 Self::Creating => std::option::Option::Some(2),
5094 Self::Updating => std::option::Option::Some(3),
5095 Self::Deleting => std::option::Option::Some(4),
5096 Self::UnknownValue(u) => u.0.value(),
5097 }
5098 }
5099
5100 /// Gets the enum value as a string.
5101 ///
5102 /// Returns `None` if the enum contains an unknown value deserialized from
5103 /// the integer representation of enums.
5104 pub fn name(&self) -> std::option::Option<&str> {
5105 match self {
5106 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5107 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
5108 Self::Creating => std::option::Option::Some("CREATING"),
5109 Self::Updating => std::option::Option::Some("UPDATING"),
5110 Self::Deleting => std::option::Option::Some("DELETING"),
5111 Self::UnknownValue(u) => u.0.name(),
5112 }
5113 }
5114 }
5115
5116 impl std::default::Default for State {
5117 fn default() -> Self {
5118 use std::convert::From;
5119 Self::from(0)
5120 }
5121 }
5122
5123 impl std::fmt::Display for State {
5124 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5125 wkt::internal::display_enum(f, self.name(), self.value())
5126 }
5127 }
5128
5129 impl std::convert::From<i32> for State {
5130 fn from(value: i32) -> Self {
5131 match value {
5132 0 => Self::Unspecified,
5133 1 => Self::Provisioned,
5134 2 => Self::Creating,
5135 3 => Self::Updating,
5136 4 => Self::Deleting,
5137 _ => Self::UnknownValue(state::UnknownValue(
5138 wkt::internal::UnknownEnumValue::Integer(value),
5139 )),
5140 }
5141 }
5142 }
5143
5144 impl std::convert::From<&str> for State {
5145 fn from(value: &str) -> Self {
5146 use std::string::ToString;
5147 match value {
5148 "STATE_UNSPECIFIED" => Self::Unspecified,
5149 "PROVISIONED" => Self::Provisioned,
5150 "CREATING" => Self::Creating,
5151 "UPDATING" => Self::Updating,
5152 "DELETING" => Self::Deleting,
5153 _ => Self::UnknownValue(state::UnknownValue(
5154 wkt::internal::UnknownEnumValue::String(value.to_string()),
5155 )),
5156 }
5157 }
5158 }
5159
5160 impl serde::ser::Serialize for State {
5161 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5162 where
5163 S: serde::Serializer,
5164 {
5165 match self {
5166 Self::Unspecified => serializer.serialize_i32(0),
5167 Self::Provisioned => serializer.serialize_i32(1),
5168 Self::Creating => serializer.serialize_i32(2),
5169 Self::Updating => serializer.serialize_i32(3),
5170 Self::Deleting => serializer.serialize_i32(4),
5171 Self::UnknownValue(u) => u.0.serialize(serializer),
5172 }
5173 }
5174 }
5175
5176 impl<'de> serde::de::Deserialize<'de> for State {
5177 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5178 where
5179 D: serde::Deserializer<'de>,
5180 {
5181 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5182 ".google.cloud.baremetalsolution.v2.NfsShare.State",
5183 ))
5184 }
5185 }
5186
5187 /// The possible mount permissions.
5188 ///
5189 /// # Working with unknown values
5190 ///
5191 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5192 /// additional enum variants at any time. Adding new variants is not considered
5193 /// a breaking change. Applications should write their code in anticipation of:
5194 ///
5195 /// - New values appearing in future releases of the client library, **and**
5196 /// - New values received dynamically, without application changes.
5197 ///
5198 /// Please consult the [Working with enums] section in the user guide for some
5199 /// guidelines.
5200 ///
5201 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5202 #[derive(Clone, Debug, PartialEq)]
5203 #[non_exhaustive]
5204 pub enum MountPermissions {
5205 /// Permissions were not specified.
5206 Unspecified,
5207 /// NFS share can be mount with read-only permissions.
5208 Read,
5209 /// NFS share can be mount with read-write permissions.
5210 ReadWrite,
5211 /// If set, the enum was initialized with an unknown value.
5212 ///
5213 /// Applications can examine the value using [MountPermissions::value] or
5214 /// [MountPermissions::name].
5215 UnknownValue(mount_permissions::UnknownValue),
5216 }
5217
5218 #[doc(hidden)]
5219 pub mod mount_permissions {
5220 #[allow(unused_imports)]
5221 use super::*;
5222 #[derive(Clone, Debug, PartialEq)]
5223 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5224 }
5225
5226 impl MountPermissions {
5227 /// Gets the enum value.
5228 ///
5229 /// Returns `None` if the enum contains an unknown value deserialized from
5230 /// the string representation of enums.
5231 pub fn value(&self) -> std::option::Option<i32> {
5232 match self {
5233 Self::Unspecified => std::option::Option::Some(0),
5234 Self::Read => std::option::Option::Some(1),
5235 Self::ReadWrite => std::option::Option::Some(2),
5236 Self::UnknownValue(u) => u.0.value(),
5237 }
5238 }
5239
5240 /// Gets the enum value as a string.
5241 ///
5242 /// Returns `None` if the enum contains an unknown value deserialized from
5243 /// the integer representation of enums.
5244 pub fn name(&self) -> std::option::Option<&str> {
5245 match self {
5246 Self::Unspecified => std::option::Option::Some("MOUNT_PERMISSIONS_UNSPECIFIED"),
5247 Self::Read => std::option::Option::Some("READ"),
5248 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
5249 Self::UnknownValue(u) => u.0.name(),
5250 }
5251 }
5252 }
5253
5254 impl std::default::Default for MountPermissions {
5255 fn default() -> Self {
5256 use std::convert::From;
5257 Self::from(0)
5258 }
5259 }
5260
5261 impl std::fmt::Display for MountPermissions {
5262 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5263 wkt::internal::display_enum(f, self.name(), self.value())
5264 }
5265 }
5266
5267 impl std::convert::From<i32> for MountPermissions {
5268 fn from(value: i32) -> Self {
5269 match value {
5270 0 => Self::Unspecified,
5271 1 => Self::Read,
5272 2 => Self::ReadWrite,
5273 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5274 wkt::internal::UnknownEnumValue::Integer(value),
5275 )),
5276 }
5277 }
5278 }
5279
5280 impl std::convert::From<&str> for MountPermissions {
5281 fn from(value: &str) -> Self {
5282 use std::string::ToString;
5283 match value {
5284 "MOUNT_PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
5285 "READ" => Self::Read,
5286 "READ_WRITE" => Self::ReadWrite,
5287 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5288 wkt::internal::UnknownEnumValue::String(value.to_string()),
5289 )),
5290 }
5291 }
5292 }
5293
5294 impl serde::ser::Serialize for MountPermissions {
5295 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5296 where
5297 S: serde::Serializer,
5298 {
5299 match self {
5300 Self::Unspecified => serializer.serialize_i32(0),
5301 Self::Read => serializer.serialize_i32(1),
5302 Self::ReadWrite => serializer.serialize_i32(2),
5303 Self::UnknownValue(u) => u.0.serialize(serializer),
5304 }
5305 }
5306 }
5307
5308 impl<'de> serde::de::Deserialize<'de> for MountPermissions {
5309 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5310 where
5311 D: serde::Deserializer<'de>,
5312 {
5313 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MountPermissions>::new(
5314 ".google.cloud.baremetalsolution.v2.NfsShare.MountPermissions",
5315 ))
5316 }
5317 }
5318
5319 /// The storage type for a volume.
5320 ///
5321 /// # Working with unknown values
5322 ///
5323 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5324 /// additional enum variants at any time. Adding new variants is not considered
5325 /// a breaking change. Applications should write their code in anticipation of:
5326 ///
5327 /// - New values appearing in future releases of the client library, **and**
5328 /// - New values received dynamically, without application changes.
5329 ///
5330 /// Please consult the [Working with enums] section in the user guide for some
5331 /// guidelines.
5332 ///
5333 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5334 #[derive(Clone, Debug, PartialEq)]
5335 #[non_exhaustive]
5336 pub enum StorageType {
5337 /// The storage type for this volume is unknown.
5338 Unspecified,
5339 /// The storage type for this volume is SSD.
5340 Ssd,
5341 /// This storage type for this volume is HDD.
5342 Hdd,
5343 /// If set, the enum was initialized with an unknown value.
5344 ///
5345 /// Applications can examine the value using [StorageType::value] or
5346 /// [StorageType::name].
5347 UnknownValue(storage_type::UnknownValue),
5348 }
5349
5350 #[doc(hidden)]
5351 pub mod storage_type {
5352 #[allow(unused_imports)]
5353 use super::*;
5354 #[derive(Clone, Debug, PartialEq)]
5355 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5356 }
5357
5358 impl StorageType {
5359 /// Gets the enum value.
5360 ///
5361 /// Returns `None` if the enum contains an unknown value deserialized from
5362 /// the string representation of enums.
5363 pub fn value(&self) -> std::option::Option<i32> {
5364 match self {
5365 Self::Unspecified => std::option::Option::Some(0),
5366 Self::Ssd => std::option::Option::Some(1),
5367 Self::Hdd => std::option::Option::Some(2),
5368 Self::UnknownValue(u) => u.0.value(),
5369 }
5370 }
5371
5372 /// Gets the enum value as a string.
5373 ///
5374 /// Returns `None` if the enum contains an unknown value deserialized from
5375 /// the integer representation of enums.
5376 pub fn name(&self) -> std::option::Option<&str> {
5377 match self {
5378 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
5379 Self::Ssd => std::option::Option::Some("SSD"),
5380 Self::Hdd => std::option::Option::Some("HDD"),
5381 Self::UnknownValue(u) => u.0.name(),
5382 }
5383 }
5384 }
5385
5386 impl std::default::Default for StorageType {
5387 fn default() -> Self {
5388 use std::convert::From;
5389 Self::from(0)
5390 }
5391 }
5392
5393 impl std::fmt::Display for StorageType {
5394 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5395 wkt::internal::display_enum(f, self.name(), self.value())
5396 }
5397 }
5398
5399 impl std::convert::From<i32> for StorageType {
5400 fn from(value: i32) -> Self {
5401 match value {
5402 0 => Self::Unspecified,
5403 1 => Self::Ssd,
5404 2 => Self::Hdd,
5405 _ => Self::UnknownValue(storage_type::UnknownValue(
5406 wkt::internal::UnknownEnumValue::Integer(value),
5407 )),
5408 }
5409 }
5410 }
5411
5412 impl std::convert::From<&str> for StorageType {
5413 fn from(value: &str) -> Self {
5414 use std::string::ToString;
5415 match value {
5416 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
5417 "SSD" => Self::Ssd,
5418 "HDD" => Self::Hdd,
5419 _ => Self::UnknownValue(storage_type::UnknownValue(
5420 wkt::internal::UnknownEnumValue::String(value.to_string()),
5421 )),
5422 }
5423 }
5424 }
5425
5426 impl serde::ser::Serialize for StorageType {
5427 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5428 where
5429 S: serde::Serializer,
5430 {
5431 match self {
5432 Self::Unspecified => serializer.serialize_i32(0),
5433 Self::Ssd => serializer.serialize_i32(1),
5434 Self::Hdd => serializer.serialize_i32(2),
5435 Self::UnknownValue(u) => u.0.serialize(serializer),
5436 }
5437 }
5438 }
5439
5440 impl<'de> serde::de::Deserialize<'de> for StorageType {
5441 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5442 where
5443 D: serde::Deserializer<'de>,
5444 {
5445 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
5446 ".google.cloud.baremetalsolution.v2.NfsShare.StorageType",
5447 ))
5448 }
5449 }
5450}
5451
5452/// Message for requesting NFS share information.
5453#[derive(Clone, Default, PartialEq)]
5454#[non_exhaustive]
5455pub struct GetNfsShareRequest {
5456 /// Required. Name of the resource.
5457 pub name: std::string::String,
5458
5459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5460}
5461
5462impl GetNfsShareRequest {
5463 /// Creates a new default instance.
5464 pub fn new() -> Self {
5465 std::default::Default::default()
5466 }
5467
5468 /// Sets the value of [name][crate::model::GetNfsShareRequest::name].
5469 ///
5470 /// # Example
5471 /// ```ignore,no_run
5472 /// # use google_cloud_baremetalsolution_v2::model::GetNfsShareRequest;
5473 /// # let project_id = "project_id";
5474 /// # let location_id = "location_id";
5475 /// # let nfs_share_id = "nfs_share_id";
5476 /// let x = GetNfsShareRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/nfsShares/{nfs_share_id}"));
5477 /// ```
5478 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5479 self.name = v.into();
5480 self
5481 }
5482}
5483
5484impl wkt::message::Message for GetNfsShareRequest {
5485 fn typename() -> &'static str {
5486 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNfsShareRequest"
5487 }
5488}
5489
5490/// Message for requesting a list of NFS shares.
5491#[derive(Clone, Default, PartialEq)]
5492#[non_exhaustive]
5493pub struct ListNfsSharesRequest {
5494 /// Required. Parent value for ListNfsSharesRequest.
5495 pub parent: std::string::String,
5496
5497 /// Requested page size. The server might return fewer items than requested.
5498 /// If unspecified, server will pick an appropriate default.
5499 pub page_size: i32,
5500
5501 /// A token identifying a page of results from the server.
5502 pub page_token: std::string::String,
5503
5504 /// List filter.
5505 pub filter: std::string::String,
5506
5507 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5508}
5509
5510impl ListNfsSharesRequest {
5511 /// Creates a new default instance.
5512 pub fn new() -> Self {
5513 std::default::Default::default()
5514 }
5515
5516 /// Sets the value of [parent][crate::model::ListNfsSharesRequest::parent].
5517 ///
5518 /// # Example
5519 /// ```ignore,no_run
5520 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5521 /// let x = ListNfsSharesRequest::new().set_parent("example");
5522 /// ```
5523 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5524 self.parent = v.into();
5525 self
5526 }
5527
5528 /// Sets the value of [page_size][crate::model::ListNfsSharesRequest::page_size].
5529 ///
5530 /// # Example
5531 /// ```ignore,no_run
5532 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5533 /// let x = ListNfsSharesRequest::new().set_page_size(42);
5534 /// ```
5535 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5536 self.page_size = v.into();
5537 self
5538 }
5539
5540 /// Sets the value of [page_token][crate::model::ListNfsSharesRequest::page_token].
5541 ///
5542 /// # Example
5543 /// ```ignore,no_run
5544 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5545 /// let x = ListNfsSharesRequest::new().set_page_token("example");
5546 /// ```
5547 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5548 self.page_token = v.into();
5549 self
5550 }
5551
5552 /// Sets the value of [filter][crate::model::ListNfsSharesRequest::filter].
5553 ///
5554 /// # Example
5555 /// ```ignore,no_run
5556 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5557 /// let x = ListNfsSharesRequest::new().set_filter("example");
5558 /// ```
5559 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5560 self.filter = v.into();
5561 self
5562 }
5563}
5564
5565impl wkt::message::Message for ListNfsSharesRequest {
5566 fn typename() -> &'static str {
5567 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesRequest"
5568 }
5569}
5570
5571/// Response message containing the list of NFS shares.
5572#[derive(Clone, Default, PartialEq)]
5573#[non_exhaustive]
5574pub struct ListNfsSharesResponse {
5575 /// The list of NFS shares.
5576 pub nfs_shares: std::vec::Vec<crate::model::NfsShare>,
5577
5578 /// A token identifying a page of results from the server.
5579 pub next_page_token: std::string::String,
5580
5581 /// Locations that could not be reached.
5582 pub unreachable: std::vec::Vec<std::string::String>,
5583
5584 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5585}
5586
5587impl ListNfsSharesResponse {
5588 /// Creates a new default instance.
5589 pub fn new() -> Self {
5590 std::default::Default::default()
5591 }
5592
5593 /// Sets the value of [nfs_shares][crate::model::ListNfsSharesResponse::nfs_shares].
5594 ///
5595 /// # Example
5596 /// ```ignore,no_run
5597 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5598 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5599 /// let x = ListNfsSharesResponse::new()
5600 /// .set_nfs_shares([
5601 /// NfsShare::default()/* use setters */,
5602 /// NfsShare::default()/* use (different) setters */,
5603 /// ]);
5604 /// ```
5605 pub fn set_nfs_shares<T, V>(mut self, v: T) -> Self
5606 where
5607 T: std::iter::IntoIterator<Item = V>,
5608 V: std::convert::Into<crate::model::NfsShare>,
5609 {
5610 use std::iter::Iterator;
5611 self.nfs_shares = v.into_iter().map(|i| i.into()).collect();
5612 self
5613 }
5614
5615 /// Sets the value of [next_page_token][crate::model::ListNfsSharesResponse::next_page_token].
5616 ///
5617 /// # Example
5618 /// ```ignore,no_run
5619 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5620 /// let x = ListNfsSharesResponse::new().set_next_page_token("example");
5621 /// ```
5622 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5623 self.next_page_token = v.into();
5624 self
5625 }
5626
5627 /// Sets the value of [unreachable][crate::model::ListNfsSharesResponse::unreachable].
5628 ///
5629 /// # Example
5630 /// ```ignore,no_run
5631 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5632 /// let x = ListNfsSharesResponse::new().set_unreachable(["a", "b", "c"]);
5633 /// ```
5634 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5635 where
5636 T: std::iter::IntoIterator<Item = V>,
5637 V: std::convert::Into<std::string::String>,
5638 {
5639 use std::iter::Iterator;
5640 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5641 self
5642 }
5643}
5644
5645impl wkt::message::Message for ListNfsSharesResponse {
5646 fn typename() -> &'static str {
5647 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesResponse"
5648 }
5649}
5650
5651#[doc(hidden)]
5652impl google_cloud_gax::paginator::internal::PageableResponse for ListNfsSharesResponse {
5653 type PageItem = crate::model::NfsShare;
5654
5655 fn items(self) -> std::vec::Vec<Self::PageItem> {
5656 self.nfs_shares
5657 }
5658
5659 fn next_page_token(&self) -> std::string::String {
5660 use std::clone::Clone;
5661 self.next_page_token.clone()
5662 }
5663}
5664
5665/// Message requesting to updating an NFS share.
5666#[derive(Clone, Default, PartialEq)]
5667#[non_exhaustive]
5668pub struct UpdateNfsShareRequest {
5669 /// Required. The NFS share to update.
5670 ///
5671 /// The `name` field is used to identify the NFS share to update.
5672 /// Format: projects/{project}/locations/{location}/nfsShares/{nfs_share}
5673 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5674
5675 /// The list of fields to update.
5676 /// The only currently supported fields are:
5677 /// `labels`
5678 /// `allowed_clients`
5679 pub update_mask: std::option::Option<wkt::FieldMask>,
5680
5681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5682}
5683
5684impl UpdateNfsShareRequest {
5685 /// Creates a new default instance.
5686 pub fn new() -> Self {
5687 std::default::Default::default()
5688 }
5689
5690 /// Sets the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5691 ///
5692 /// # Example
5693 /// ```ignore,no_run
5694 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5695 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5696 /// let x = UpdateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5697 /// ```
5698 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5699 where
5700 T: std::convert::Into<crate::model::NfsShare>,
5701 {
5702 self.nfs_share = std::option::Option::Some(v.into());
5703 self
5704 }
5705
5706 /// Sets or clears the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5707 ///
5708 /// # Example
5709 /// ```ignore,no_run
5710 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5711 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5712 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5713 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5714 /// ```
5715 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5716 where
5717 T: std::convert::Into<crate::model::NfsShare>,
5718 {
5719 self.nfs_share = v.map(|x| x.into());
5720 self
5721 }
5722
5723 /// Sets the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5724 ///
5725 /// # Example
5726 /// ```ignore,no_run
5727 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5728 /// use wkt::FieldMask;
5729 /// let x = UpdateNfsShareRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5730 /// ```
5731 pub fn set_update_mask<T>(mut self, v: T) -> Self
5732 where
5733 T: std::convert::Into<wkt::FieldMask>,
5734 {
5735 self.update_mask = std::option::Option::Some(v.into());
5736 self
5737 }
5738
5739 /// Sets or clears the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5740 ///
5741 /// # Example
5742 /// ```ignore,no_run
5743 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5744 /// use wkt::FieldMask;
5745 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5746 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5747 /// ```
5748 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5749 where
5750 T: std::convert::Into<wkt::FieldMask>,
5751 {
5752 self.update_mask = v.map(|x| x.into());
5753 self
5754 }
5755}
5756
5757impl wkt::message::Message for UpdateNfsShareRequest {
5758 fn typename() -> &'static str {
5759 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNfsShareRequest"
5760 }
5761}
5762
5763/// Message requesting rename of a server.
5764#[derive(Clone, Default, PartialEq)]
5765#[non_exhaustive]
5766pub struct RenameNfsShareRequest {
5767 /// Required. The `name` field is used to identify the nfsshare.
5768 /// Format: projects/{project}/locations/{location}/nfsshares/{nfsshare}
5769 pub name: std::string::String,
5770
5771 /// Required. The new `id` of the nfsshare.
5772 pub new_nfsshare_id: std::string::String,
5773
5774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5775}
5776
5777impl RenameNfsShareRequest {
5778 /// Creates a new default instance.
5779 pub fn new() -> Self {
5780 std::default::Default::default()
5781 }
5782
5783 /// Sets the value of [name][crate::model::RenameNfsShareRequest::name].
5784 ///
5785 /// # Example
5786 /// ```ignore,no_run
5787 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5788 /// # let project_id = "project_id";
5789 /// # let location_id = "location_id";
5790 /// # let nfs_share_id = "nfs_share_id";
5791 /// let x = RenameNfsShareRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/nfsShares/{nfs_share_id}"));
5792 /// ```
5793 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5794 self.name = v.into();
5795 self
5796 }
5797
5798 /// Sets the value of [new_nfsshare_id][crate::model::RenameNfsShareRequest::new_nfsshare_id].
5799 ///
5800 /// # Example
5801 /// ```ignore,no_run
5802 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5803 /// let x = RenameNfsShareRequest::new().set_new_nfsshare_id("example");
5804 /// ```
5805 pub fn set_new_nfsshare_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5806 self.new_nfsshare_id = v.into();
5807 self
5808 }
5809}
5810
5811impl wkt::message::Message for RenameNfsShareRequest {
5812 fn typename() -> &'static str {
5813 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNfsShareRequest"
5814 }
5815}
5816
5817/// Message for creating an NFS share.
5818#[derive(Clone, Default, PartialEq)]
5819#[non_exhaustive]
5820pub struct CreateNfsShareRequest {
5821 /// Required. The parent project and location.
5822 pub parent: std::string::String,
5823
5824 /// Required. The NfsShare to create.
5825 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5826
5827 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5828}
5829
5830impl CreateNfsShareRequest {
5831 /// Creates a new default instance.
5832 pub fn new() -> Self {
5833 std::default::Default::default()
5834 }
5835
5836 /// Sets the value of [parent][crate::model::CreateNfsShareRequest::parent].
5837 ///
5838 /// # Example
5839 /// ```ignore,no_run
5840 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5841 /// let x = CreateNfsShareRequest::new().set_parent("example");
5842 /// ```
5843 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5844 self.parent = v.into();
5845 self
5846 }
5847
5848 /// Sets the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5849 ///
5850 /// # Example
5851 /// ```ignore,no_run
5852 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5853 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5854 /// let x = CreateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5855 /// ```
5856 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5857 where
5858 T: std::convert::Into<crate::model::NfsShare>,
5859 {
5860 self.nfs_share = std::option::Option::Some(v.into());
5861 self
5862 }
5863
5864 /// Sets or clears the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5865 ///
5866 /// # Example
5867 /// ```ignore,no_run
5868 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5869 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5870 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5871 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5872 /// ```
5873 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5874 where
5875 T: std::convert::Into<crate::model::NfsShare>,
5876 {
5877 self.nfs_share = v.map(|x| x.into());
5878 self
5879 }
5880}
5881
5882impl wkt::message::Message for CreateNfsShareRequest {
5883 fn typename() -> &'static str {
5884 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateNfsShareRequest"
5885 }
5886}
5887
5888/// Message for deleting an NFS share.
5889#[derive(Clone, Default, PartialEq)]
5890#[non_exhaustive]
5891pub struct DeleteNfsShareRequest {
5892 /// Required. The name of the NFS share to delete.
5893 pub name: std::string::String,
5894
5895 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5896}
5897
5898impl DeleteNfsShareRequest {
5899 /// Creates a new default instance.
5900 pub fn new() -> Self {
5901 std::default::Default::default()
5902 }
5903
5904 /// Sets the value of [name][crate::model::DeleteNfsShareRequest::name].
5905 ///
5906 /// # Example
5907 /// ```ignore,no_run
5908 /// # use google_cloud_baremetalsolution_v2::model::DeleteNfsShareRequest;
5909 /// # let project_id = "project_id";
5910 /// # let location_id = "location_id";
5911 /// # let nfs_share_id = "nfs_share_id";
5912 /// let x = DeleteNfsShareRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/nfsShares/{nfs_share_id}"));
5913 /// ```
5914 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5915 self.name = v.into();
5916 self
5917 }
5918}
5919
5920impl wkt::message::Message for DeleteNfsShareRequest {
5921 fn typename() -> &'static str {
5922 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteNfsShareRequest"
5923 }
5924}
5925
5926/// Operation System image.
5927#[derive(Clone, Default, PartialEq)]
5928#[non_exhaustive]
5929pub struct OSImage {
5930 /// Output only. OS Image's unique name.
5931 pub name: std::string::String,
5932
5933 /// OS Image code.
5934 pub code: std::string::String,
5935
5936 /// OS Image description.
5937 pub description: std::string::String,
5938
5939 /// Instance types this image is applicable to.
5940 /// [Available
5941 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
5942 pub applicable_instance_types: std::vec::Vec<std::string::String>,
5943
5944 /// Network templates that can be used with this OS Image.
5945 pub supported_network_templates: std::vec::Vec<std::string::String>,
5946
5947 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5948}
5949
5950impl OSImage {
5951 /// Creates a new default instance.
5952 pub fn new() -> Self {
5953 std::default::Default::default()
5954 }
5955
5956 /// Sets the value of [name][crate::model::OSImage::name].
5957 ///
5958 /// # Example
5959 /// ```ignore,no_run
5960 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5961 /// # let project_id = "project_id";
5962 /// # let location_id = "location_id";
5963 /// # let os_image_id = "os_image_id";
5964 /// let x = OSImage::new().set_name(format!("projects/{project_id}/locations/{location_id}/osImages/{os_image_id}"));
5965 /// ```
5966 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5967 self.name = v.into();
5968 self
5969 }
5970
5971 /// Sets the value of [code][crate::model::OSImage::code].
5972 ///
5973 /// # Example
5974 /// ```ignore,no_run
5975 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5976 /// let x = OSImage::new().set_code("example");
5977 /// ```
5978 pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5979 self.code = v.into();
5980 self
5981 }
5982
5983 /// Sets the value of [description][crate::model::OSImage::description].
5984 ///
5985 /// # Example
5986 /// ```ignore,no_run
5987 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5988 /// let x = OSImage::new().set_description("example");
5989 /// ```
5990 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5991 self.description = v.into();
5992 self
5993 }
5994
5995 /// Sets the value of [applicable_instance_types][crate::model::OSImage::applicable_instance_types].
5996 ///
5997 /// # Example
5998 /// ```ignore,no_run
5999 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
6000 /// let x = OSImage::new().set_applicable_instance_types(["a", "b", "c"]);
6001 /// ```
6002 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
6003 where
6004 T: std::iter::IntoIterator<Item = V>,
6005 V: std::convert::Into<std::string::String>,
6006 {
6007 use std::iter::Iterator;
6008 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
6009 self
6010 }
6011
6012 /// Sets the value of [supported_network_templates][crate::model::OSImage::supported_network_templates].
6013 ///
6014 /// # Example
6015 /// ```ignore,no_run
6016 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
6017 /// let x = OSImage::new().set_supported_network_templates(["a", "b", "c"]);
6018 /// ```
6019 pub fn set_supported_network_templates<T, V>(mut self, v: T) -> Self
6020 where
6021 T: std::iter::IntoIterator<Item = V>,
6022 V: std::convert::Into<std::string::String>,
6023 {
6024 use std::iter::Iterator;
6025 self.supported_network_templates = v.into_iter().map(|i| i.into()).collect();
6026 self
6027 }
6028}
6029
6030impl wkt::message::Message for OSImage {
6031 fn typename() -> &'static str {
6032 "type.googleapis.com/google.cloud.baremetalsolution.v2.OSImage"
6033 }
6034}
6035
6036/// Request for getting all available OS images.
6037#[derive(Clone, Default, PartialEq)]
6038#[non_exhaustive]
6039pub struct ListOSImagesRequest {
6040 /// Required. Parent value for ListProvisioningQuotasRequest.
6041 pub parent: std::string::String,
6042
6043 /// Requested page size. The server might return fewer items than requested.
6044 /// If unspecified, server will pick an appropriate default.
6045 /// Notice that page_size field is not supported and won't be respected in
6046 /// the API request for now, will be updated when pagination is supported.
6047 pub page_size: i32,
6048
6049 /// A token identifying a page of results from the server.
6050 pub page_token: std::string::String,
6051
6052 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6053}
6054
6055impl ListOSImagesRequest {
6056 /// Creates a new default instance.
6057 pub fn new() -> Self {
6058 std::default::Default::default()
6059 }
6060
6061 /// Sets the value of [parent][crate::model::ListOSImagesRequest::parent].
6062 ///
6063 /// # Example
6064 /// ```ignore,no_run
6065 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
6066 /// let x = ListOSImagesRequest::new().set_parent("example");
6067 /// ```
6068 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6069 self.parent = v.into();
6070 self
6071 }
6072
6073 /// Sets the value of [page_size][crate::model::ListOSImagesRequest::page_size].
6074 ///
6075 /// # Example
6076 /// ```ignore,no_run
6077 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
6078 /// let x = ListOSImagesRequest::new().set_page_size(42);
6079 /// ```
6080 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6081 self.page_size = v.into();
6082 self
6083 }
6084
6085 /// Sets the value of [page_token][crate::model::ListOSImagesRequest::page_token].
6086 ///
6087 /// # Example
6088 /// ```ignore,no_run
6089 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
6090 /// let x = ListOSImagesRequest::new().set_page_token("example");
6091 /// ```
6092 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6093 self.page_token = v.into();
6094 self
6095 }
6096}
6097
6098impl wkt::message::Message for ListOSImagesRequest {
6099 fn typename() -> &'static str {
6100 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesRequest"
6101 }
6102}
6103
6104/// Request for getting all available OS images.
6105#[derive(Clone, Default, PartialEq)]
6106#[non_exhaustive]
6107pub struct ListOSImagesResponse {
6108 /// The OS images available.
6109 pub os_images: std::vec::Vec<crate::model::OSImage>,
6110
6111 /// Token to retrieve the next page of results, or empty if there are no more
6112 /// results in the list.
6113 pub next_page_token: std::string::String,
6114
6115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6116}
6117
6118impl ListOSImagesResponse {
6119 /// Creates a new default instance.
6120 pub fn new() -> Self {
6121 std::default::Default::default()
6122 }
6123
6124 /// Sets the value of [os_images][crate::model::ListOSImagesResponse::os_images].
6125 ///
6126 /// # Example
6127 /// ```ignore,no_run
6128 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
6129 /// use google_cloud_baremetalsolution_v2::model::OSImage;
6130 /// let x = ListOSImagesResponse::new()
6131 /// .set_os_images([
6132 /// OSImage::default()/* use setters */,
6133 /// OSImage::default()/* use (different) setters */,
6134 /// ]);
6135 /// ```
6136 pub fn set_os_images<T, V>(mut self, v: T) -> Self
6137 where
6138 T: std::iter::IntoIterator<Item = V>,
6139 V: std::convert::Into<crate::model::OSImage>,
6140 {
6141 use std::iter::Iterator;
6142 self.os_images = v.into_iter().map(|i| i.into()).collect();
6143 self
6144 }
6145
6146 /// Sets the value of [next_page_token][crate::model::ListOSImagesResponse::next_page_token].
6147 ///
6148 /// # Example
6149 /// ```ignore,no_run
6150 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
6151 /// let x = ListOSImagesResponse::new().set_next_page_token("example");
6152 /// ```
6153 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6154 self.next_page_token = v.into();
6155 self
6156 }
6157}
6158
6159impl wkt::message::Message for ListOSImagesResponse {
6160 fn typename() -> &'static str {
6161 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesResponse"
6162 }
6163}
6164
6165#[doc(hidden)]
6166impl google_cloud_gax::paginator::internal::PageableResponse for ListOSImagesResponse {
6167 type PageItem = crate::model::OSImage;
6168
6169 fn items(self) -> std::vec::Vec<Self::PageItem> {
6170 self.os_images
6171 }
6172
6173 fn next_page_token(&self) -> std::string::String {
6174 use std::clone::Clone;
6175 self.next_page_token.clone()
6176 }
6177}
6178
6179/// A provisioning configuration.
6180#[derive(Clone, Default, PartialEq)]
6181#[non_exhaustive]
6182pub struct ProvisioningConfig {
6183 /// Output only. The system-generated name of the provisioning config. This
6184 /// follows the UUID format.
6185 pub name: std::string::String,
6186
6187 /// Instances to be created.
6188 pub instances: std::vec::Vec<crate::model::InstanceConfig>,
6189
6190 /// Networks to be created.
6191 pub networks: std::vec::Vec<crate::model::NetworkConfig>,
6192
6193 /// Volumes to be created.
6194 pub volumes: std::vec::Vec<crate::model::VolumeConfig>,
6195
6196 /// A generated ticket id to track provisioning request.
6197 pub ticket_id: std::string::String,
6198
6199 /// A service account to enable customers to access instance credentials upon
6200 /// handover.
6201 pub handover_service_account: std::string::String,
6202
6203 /// Email provided to send a confirmation with provisioning config to.
6204 /// Deprecated in favour of email field in request messages.
6205 #[deprecated]
6206 pub email: std::string::String,
6207
6208 /// Output only. State of ProvisioningConfig.
6209 pub state: crate::model::provisioning_config::State,
6210
6211 /// Optional. Location name of this ProvisioningConfig.
6212 /// It is optional only for Intake UI transition period.
6213 pub location: std::string::String,
6214
6215 /// Output only. Last update timestamp.
6216 pub update_time: std::option::Option<wkt::Timestamp>,
6217
6218 /// Output only. URI to Cloud Console UI view of this provisioning config.
6219 pub cloud_console_uri: std::string::String,
6220
6221 /// If true, VPC SC is enabled for the cluster.
6222 pub vpc_sc_enabled: bool,
6223
6224 /// Optional status messages associated with the FAILED state.
6225 pub status_message: std::string::String,
6226
6227 /// Optional. The user-defined identifier of the provisioning config.
6228 pub custom_id: std::string::String,
6229
6230 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6231}
6232
6233impl ProvisioningConfig {
6234 /// Creates a new default instance.
6235 pub fn new() -> Self {
6236 std::default::Default::default()
6237 }
6238
6239 /// Sets the value of [name][crate::model::ProvisioningConfig::name].
6240 ///
6241 /// # Example
6242 /// ```ignore,no_run
6243 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6244 /// # let project_id = "project_id";
6245 /// # let location_id = "location_id";
6246 /// # let provisioning_config_id = "provisioning_config_id";
6247 /// let x = ProvisioningConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/provisioningConfigs/{provisioning_config_id}"));
6248 /// ```
6249 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6250 self.name = v.into();
6251 self
6252 }
6253
6254 /// Sets the value of [instances][crate::model::ProvisioningConfig::instances].
6255 ///
6256 /// # Example
6257 /// ```ignore,no_run
6258 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6259 /// use google_cloud_baremetalsolution_v2::model::InstanceConfig;
6260 /// let x = ProvisioningConfig::new()
6261 /// .set_instances([
6262 /// InstanceConfig::default()/* use setters */,
6263 /// InstanceConfig::default()/* use (different) setters */,
6264 /// ]);
6265 /// ```
6266 pub fn set_instances<T, V>(mut self, v: T) -> Self
6267 where
6268 T: std::iter::IntoIterator<Item = V>,
6269 V: std::convert::Into<crate::model::InstanceConfig>,
6270 {
6271 use std::iter::Iterator;
6272 self.instances = v.into_iter().map(|i| i.into()).collect();
6273 self
6274 }
6275
6276 /// Sets the value of [networks][crate::model::ProvisioningConfig::networks].
6277 ///
6278 /// # Example
6279 /// ```ignore,no_run
6280 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6281 /// use google_cloud_baremetalsolution_v2::model::NetworkConfig;
6282 /// let x = ProvisioningConfig::new()
6283 /// .set_networks([
6284 /// NetworkConfig::default()/* use setters */,
6285 /// NetworkConfig::default()/* use (different) setters */,
6286 /// ]);
6287 /// ```
6288 pub fn set_networks<T, V>(mut self, v: T) -> Self
6289 where
6290 T: std::iter::IntoIterator<Item = V>,
6291 V: std::convert::Into<crate::model::NetworkConfig>,
6292 {
6293 use std::iter::Iterator;
6294 self.networks = v.into_iter().map(|i| i.into()).collect();
6295 self
6296 }
6297
6298 /// Sets the value of [volumes][crate::model::ProvisioningConfig::volumes].
6299 ///
6300 /// # Example
6301 /// ```ignore,no_run
6302 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6303 /// use google_cloud_baremetalsolution_v2::model::VolumeConfig;
6304 /// let x = ProvisioningConfig::new()
6305 /// .set_volumes([
6306 /// VolumeConfig::default()/* use setters */,
6307 /// VolumeConfig::default()/* use (different) setters */,
6308 /// ]);
6309 /// ```
6310 pub fn set_volumes<T, V>(mut self, v: T) -> Self
6311 where
6312 T: std::iter::IntoIterator<Item = V>,
6313 V: std::convert::Into<crate::model::VolumeConfig>,
6314 {
6315 use std::iter::Iterator;
6316 self.volumes = v.into_iter().map(|i| i.into()).collect();
6317 self
6318 }
6319
6320 /// Sets the value of [ticket_id][crate::model::ProvisioningConfig::ticket_id].
6321 ///
6322 /// # Example
6323 /// ```ignore,no_run
6324 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6325 /// let x = ProvisioningConfig::new().set_ticket_id("example");
6326 /// ```
6327 pub fn set_ticket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6328 self.ticket_id = v.into();
6329 self
6330 }
6331
6332 /// Sets the value of [handover_service_account][crate::model::ProvisioningConfig::handover_service_account].
6333 ///
6334 /// # Example
6335 /// ```ignore,no_run
6336 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6337 /// let x = ProvisioningConfig::new().set_handover_service_account("example");
6338 /// ```
6339 pub fn set_handover_service_account<T: std::convert::Into<std::string::String>>(
6340 mut self,
6341 v: T,
6342 ) -> Self {
6343 self.handover_service_account = v.into();
6344 self
6345 }
6346
6347 /// Sets the value of [email][crate::model::ProvisioningConfig::email].
6348 ///
6349 /// # Example
6350 /// ```ignore,no_run
6351 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6352 /// let x = ProvisioningConfig::new().set_email("example");
6353 /// ```
6354 #[deprecated]
6355 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6356 self.email = v.into();
6357 self
6358 }
6359
6360 /// Sets the value of [state][crate::model::ProvisioningConfig::state].
6361 ///
6362 /// # Example
6363 /// ```ignore,no_run
6364 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6365 /// use google_cloud_baremetalsolution_v2::model::provisioning_config::State;
6366 /// let x0 = ProvisioningConfig::new().set_state(State::Draft);
6367 /// let x1 = ProvisioningConfig::new().set_state(State::Submitted);
6368 /// let x2 = ProvisioningConfig::new().set_state(State::Provisioning);
6369 /// ```
6370 pub fn set_state<T: std::convert::Into<crate::model::provisioning_config::State>>(
6371 mut self,
6372 v: T,
6373 ) -> Self {
6374 self.state = v.into();
6375 self
6376 }
6377
6378 /// Sets the value of [location][crate::model::ProvisioningConfig::location].
6379 ///
6380 /// # Example
6381 /// ```ignore,no_run
6382 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6383 /// let x = ProvisioningConfig::new().set_location("example");
6384 /// ```
6385 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6386 self.location = v.into();
6387 self
6388 }
6389
6390 /// Sets the value of [update_time][crate::model::ProvisioningConfig::update_time].
6391 ///
6392 /// # Example
6393 /// ```ignore,no_run
6394 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6395 /// use wkt::Timestamp;
6396 /// let x = ProvisioningConfig::new().set_update_time(Timestamp::default()/* use setters */);
6397 /// ```
6398 pub fn set_update_time<T>(mut self, v: T) -> Self
6399 where
6400 T: std::convert::Into<wkt::Timestamp>,
6401 {
6402 self.update_time = std::option::Option::Some(v.into());
6403 self
6404 }
6405
6406 /// Sets or clears the value of [update_time][crate::model::ProvisioningConfig::update_time].
6407 ///
6408 /// # Example
6409 /// ```ignore,no_run
6410 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6411 /// use wkt::Timestamp;
6412 /// let x = ProvisioningConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6413 /// let x = ProvisioningConfig::new().set_or_clear_update_time(None::<Timestamp>);
6414 /// ```
6415 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6416 where
6417 T: std::convert::Into<wkt::Timestamp>,
6418 {
6419 self.update_time = v.map(|x| x.into());
6420 self
6421 }
6422
6423 /// Sets the value of [cloud_console_uri][crate::model::ProvisioningConfig::cloud_console_uri].
6424 ///
6425 /// # Example
6426 /// ```ignore,no_run
6427 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6428 /// let x = ProvisioningConfig::new().set_cloud_console_uri("example");
6429 /// ```
6430 pub fn set_cloud_console_uri<T: std::convert::Into<std::string::String>>(
6431 mut self,
6432 v: T,
6433 ) -> Self {
6434 self.cloud_console_uri = v.into();
6435 self
6436 }
6437
6438 /// Sets the value of [vpc_sc_enabled][crate::model::ProvisioningConfig::vpc_sc_enabled].
6439 ///
6440 /// # Example
6441 /// ```ignore,no_run
6442 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6443 /// let x = ProvisioningConfig::new().set_vpc_sc_enabled(true);
6444 /// ```
6445 pub fn set_vpc_sc_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6446 self.vpc_sc_enabled = v.into();
6447 self
6448 }
6449
6450 /// Sets the value of [status_message][crate::model::ProvisioningConfig::status_message].
6451 ///
6452 /// # Example
6453 /// ```ignore,no_run
6454 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6455 /// let x = ProvisioningConfig::new().set_status_message("example");
6456 /// ```
6457 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6458 self.status_message = v.into();
6459 self
6460 }
6461
6462 /// Sets the value of [custom_id][crate::model::ProvisioningConfig::custom_id].
6463 ///
6464 /// # Example
6465 /// ```ignore,no_run
6466 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6467 /// let x = ProvisioningConfig::new().set_custom_id("example");
6468 /// ```
6469 pub fn set_custom_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6470 self.custom_id = v.into();
6471 self
6472 }
6473}
6474
6475impl wkt::message::Message for ProvisioningConfig {
6476 fn typename() -> &'static str {
6477 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningConfig"
6478 }
6479}
6480
6481/// Defines additional types related to [ProvisioningConfig].
6482pub mod provisioning_config {
6483 #[allow(unused_imports)]
6484 use super::*;
6485
6486 /// The possible states for this ProvisioningConfig.
6487 ///
6488 /// # Working with unknown values
6489 ///
6490 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6491 /// additional enum variants at any time. Adding new variants is not considered
6492 /// a breaking change. Applications should write their code in anticipation of:
6493 ///
6494 /// - New values appearing in future releases of the client library, **and**
6495 /// - New values received dynamically, without application changes.
6496 ///
6497 /// Please consult the [Working with enums] section in the user guide for some
6498 /// guidelines.
6499 ///
6500 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6501 #[derive(Clone, Debug, PartialEq)]
6502 #[non_exhaustive]
6503 pub enum State {
6504 /// State wasn't specified.
6505 Unspecified,
6506 /// ProvisioningConfig is a draft and can be freely modified.
6507 Draft,
6508 /// ProvisioningConfig was already submitted and cannot be modified.
6509 Submitted,
6510 /// ProvisioningConfig was in the provisioning state. Initially this state
6511 /// comes from the work order table in big query when SNOW is used. Later
6512 /// this field can be set by the work order API.
6513 Provisioning,
6514 /// ProvisioningConfig was provisioned, meaning the resources exist.
6515 Provisioned,
6516 /// ProvisioningConfig was validated. A validation tool will be run to
6517 /// set this state.
6518 Validated,
6519 /// ProvisioningConfig was canceled.
6520 Cancelled,
6521 /// The request is submitted for provisioning, with error return.
6522 Failed,
6523 /// If set, the enum was initialized with an unknown value.
6524 ///
6525 /// Applications can examine the value using [State::value] or
6526 /// [State::name].
6527 UnknownValue(state::UnknownValue),
6528 }
6529
6530 #[doc(hidden)]
6531 pub mod state {
6532 #[allow(unused_imports)]
6533 use super::*;
6534 #[derive(Clone, Debug, PartialEq)]
6535 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6536 }
6537
6538 impl State {
6539 /// Gets the enum value.
6540 ///
6541 /// Returns `None` if the enum contains an unknown value deserialized from
6542 /// the string representation of enums.
6543 pub fn value(&self) -> std::option::Option<i32> {
6544 match self {
6545 Self::Unspecified => std::option::Option::Some(0),
6546 Self::Draft => std::option::Option::Some(1),
6547 Self::Submitted => std::option::Option::Some(2),
6548 Self::Provisioning => std::option::Option::Some(3),
6549 Self::Provisioned => std::option::Option::Some(4),
6550 Self::Validated => std::option::Option::Some(5),
6551 Self::Cancelled => std::option::Option::Some(6),
6552 Self::Failed => std::option::Option::Some(7),
6553 Self::UnknownValue(u) => u.0.value(),
6554 }
6555 }
6556
6557 /// Gets the enum value as a string.
6558 ///
6559 /// Returns `None` if the enum contains an unknown value deserialized from
6560 /// the integer representation of enums.
6561 pub fn name(&self) -> std::option::Option<&str> {
6562 match self {
6563 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6564 Self::Draft => std::option::Option::Some("DRAFT"),
6565 Self::Submitted => std::option::Option::Some("SUBMITTED"),
6566 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
6567 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
6568 Self::Validated => std::option::Option::Some("VALIDATED"),
6569 Self::Cancelled => std::option::Option::Some("CANCELLED"),
6570 Self::Failed => std::option::Option::Some("FAILED"),
6571 Self::UnknownValue(u) => u.0.name(),
6572 }
6573 }
6574 }
6575
6576 impl std::default::Default for State {
6577 fn default() -> Self {
6578 use std::convert::From;
6579 Self::from(0)
6580 }
6581 }
6582
6583 impl std::fmt::Display for State {
6584 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6585 wkt::internal::display_enum(f, self.name(), self.value())
6586 }
6587 }
6588
6589 impl std::convert::From<i32> for State {
6590 fn from(value: i32) -> Self {
6591 match value {
6592 0 => Self::Unspecified,
6593 1 => Self::Draft,
6594 2 => Self::Submitted,
6595 3 => Self::Provisioning,
6596 4 => Self::Provisioned,
6597 5 => Self::Validated,
6598 6 => Self::Cancelled,
6599 7 => Self::Failed,
6600 _ => Self::UnknownValue(state::UnknownValue(
6601 wkt::internal::UnknownEnumValue::Integer(value),
6602 )),
6603 }
6604 }
6605 }
6606
6607 impl std::convert::From<&str> for State {
6608 fn from(value: &str) -> Self {
6609 use std::string::ToString;
6610 match value {
6611 "STATE_UNSPECIFIED" => Self::Unspecified,
6612 "DRAFT" => Self::Draft,
6613 "SUBMITTED" => Self::Submitted,
6614 "PROVISIONING" => Self::Provisioning,
6615 "PROVISIONED" => Self::Provisioned,
6616 "VALIDATED" => Self::Validated,
6617 "CANCELLED" => Self::Cancelled,
6618 "FAILED" => Self::Failed,
6619 _ => Self::UnknownValue(state::UnknownValue(
6620 wkt::internal::UnknownEnumValue::String(value.to_string()),
6621 )),
6622 }
6623 }
6624 }
6625
6626 impl serde::ser::Serialize for State {
6627 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6628 where
6629 S: serde::Serializer,
6630 {
6631 match self {
6632 Self::Unspecified => serializer.serialize_i32(0),
6633 Self::Draft => serializer.serialize_i32(1),
6634 Self::Submitted => serializer.serialize_i32(2),
6635 Self::Provisioning => serializer.serialize_i32(3),
6636 Self::Provisioned => serializer.serialize_i32(4),
6637 Self::Validated => serializer.serialize_i32(5),
6638 Self::Cancelled => serializer.serialize_i32(6),
6639 Self::Failed => serializer.serialize_i32(7),
6640 Self::UnknownValue(u) => u.0.serialize(serializer),
6641 }
6642 }
6643 }
6644
6645 impl<'de> serde::de::Deserialize<'de> for State {
6646 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6647 where
6648 D: serde::Deserializer<'de>,
6649 {
6650 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6651 ".google.cloud.baremetalsolution.v2.ProvisioningConfig.State",
6652 ))
6653 }
6654 }
6655}
6656
6657/// Request for SubmitProvisioningConfig.
6658#[derive(Clone, Default, PartialEq)]
6659#[non_exhaustive]
6660pub struct SubmitProvisioningConfigRequest {
6661 /// Required. The parent project and location containing the
6662 /// ProvisioningConfig.
6663 pub parent: std::string::String,
6664
6665 /// Required. The ProvisioningConfig to create.
6666 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6667
6668 /// Optional. Email provided to send a confirmation with provisioning config
6669 /// to.
6670 pub email: std::string::String,
6671
6672 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6673}
6674
6675impl SubmitProvisioningConfigRequest {
6676 /// Creates a new default instance.
6677 pub fn new() -> Self {
6678 std::default::Default::default()
6679 }
6680
6681 /// Sets the value of [parent][crate::model::SubmitProvisioningConfigRequest::parent].
6682 ///
6683 /// # Example
6684 /// ```ignore,no_run
6685 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6686 /// let x = SubmitProvisioningConfigRequest::new().set_parent("example");
6687 /// ```
6688 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6689 self.parent = v.into();
6690 self
6691 }
6692
6693 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6694 ///
6695 /// # Example
6696 /// ```ignore,no_run
6697 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6698 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6699 /// let x = SubmitProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6700 /// ```
6701 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6702 where
6703 T: std::convert::Into<crate::model::ProvisioningConfig>,
6704 {
6705 self.provisioning_config = std::option::Option::Some(v.into());
6706 self
6707 }
6708
6709 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6710 ///
6711 /// # Example
6712 /// ```ignore,no_run
6713 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6714 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6715 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6716 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6717 /// ```
6718 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6719 where
6720 T: std::convert::Into<crate::model::ProvisioningConfig>,
6721 {
6722 self.provisioning_config = v.map(|x| x.into());
6723 self
6724 }
6725
6726 /// Sets the value of [email][crate::model::SubmitProvisioningConfigRequest::email].
6727 ///
6728 /// # Example
6729 /// ```ignore,no_run
6730 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6731 /// let x = SubmitProvisioningConfigRequest::new().set_email("example");
6732 /// ```
6733 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6734 self.email = v.into();
6735 self
6736 }
6737}
6738
6739impl wkt::message::Message for SubmitProvisioningConfigRequest {
6740 fn typename() -> &'static str {
6741 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigRequest"
6742 }
6743}
6744
6745/// Response for SubmitProvisioningConfig.
6746#[derive(Clone, Default, PartialEq)]
6747#[non_exhaustive]
6748pub struct SubmitProvisioningConfigResponse {
6749 /// The submitted provisioning config.
6750 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6751
6752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6753}
6754
6755impl SubmitProvisioningConfigResponse {
6756 /// Creates a new default instance.
6757 pub fn new() -> Self {
6758 std::default::Default::default()
6759 }
6760
6761 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6762 ///
6763 /// # Example
6764 /// ```ignore,no_run
6765 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6766 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6767 /// let x = SubmitProvisioningConfigResponse::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6768 /// ```
6769 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6770 where
6771 T: std::convert::Into<crate::model::ProvisioningConfig>,
6772 {
6773 self.provisioning_config = std::option::Option::Some(v.into());
6774 self
6775 }
6776
6777 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6778 ///
6779 /// # Example
6780 /// ```ignore,no_run
6781 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6782 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6783 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6784 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6785 /// ```
6786 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6787 where
6788 T: std::convert::Into<crate::model::ProvisioningConfig>,
6789 {
6790 self.provisioning_config = v.map(|x| x.into());
6791 self
6792 }
6793}
6794
6795impl wkt::message::Message for SubmitProvisioningConfigResponse {
6796 fn typename() -> &'static str {
6797 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigResponse"
6798 }
6799}
6800
6801/// A provisioning quota for a given project.
6802#[derive(Clone, Default, PartialEq)]
6803#[non_exhaustive]
6804pub struct ProvisioningQuota {
6805 /// Output only. The name of the provisioning quota.
6806 pub name: std::string::String,
6807
6808 /// The asset type of this provisioning quota.
6809 pub asset_type: crate::model::provisioning_quota::AssetType,
6810
6811 /// The gcp service of the provisioning quota.
6812 pub gcp_service: std::string::String,
6813
6814 /// The specific location of the provisioining quota.
6815 pub location: std::string::String,
6816
6817 /// The available count of the provisioning quota.
6818 pub available_count: i32,
6819
6820 /// The quota of one asset type.
6821 pub quota: std::option::Option<crate::model::provisioning_quota::Quota>,
6822
6823 /// Available quantity based on asset type.
6824 pub availability: std::option::Option<crate::model::provisioning_quota::Availability>,
6825
6826 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6827}
6828
6829impl ProvisioningQuota {
6830 /// Creates a new default instance.
6831 pub fn new() -> Self {
6832 std::default::Default::default()
6833 }
6834
6835 /// Sets the value of [name][crate::model::ProvisioningQuota::name].
6836 ///
6837 /// # Example
6838 /// ```ignore,no_run
6839 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6840 /// # let project_id = "project_id";
6841 /// # let location_id = "location_id";
6842 /// # let provisioning_quota_id = "provisioning_quota_id";
6843 /// let x = ProvisioningQuota::new().set_name(format!("projects/{project_id}/locations/{location_id}/provisioningQuotas/{provisioning_quota_id}"));
6844 /// ```
6845 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6846 self.name = v.into();
6847 self
6848 }
6849
6850 /// Sets the value of [asset_type][crate::model::ProvisioningQuota::asset_type].
6851 ///
6852 /// # Example
6853 /// ```ignore,no_run
6854 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6855 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::AssetType;
6856 /// let x0 = ProvisioningQuota::new().set_asset_type(AssetType::Server);
6857 /// let x1 = ProvisioningQuota::new().set_asset_type(AssetType::Storage);
6858 /// let x2 = ProvisioningQuota::new().set_asset_type(AssetType::Network);
6859 /// ```
6860 pub fn set_asset_type<T: std::convert::Into<crate::model::provisioning_quota::AssetType>>(
6861 mut self,
6862 v: T,
6863 ) -> Self {
6864 self.asset_type = v.into();
6865 self
6866 }
6867
6868 /// Sets the value of [gcp_service][crate::model::ProvisioningQuota::gcp_service].
6869 ///
6870 /// # Example
6871 /// ```ignore,no_run
6872 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6873 /// let x = ProvisioningQuota::new().set_gcp_service("example");
6874 /// ```
6875 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6876 self.gcp_service = v.into();
6877 self
6878 }
6879
6880 /// Sets the value of [location][crate::model::ProvisioningQuota::location].
6881 ///
6882 /// # Example
6883 /// ```ignore,no_run
6884 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6885 /// let x = ProvisioningQuota::new().set_location("example");
6886 /// ```
6887 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6888 self.location = v.into();
6889 self
6890 }
6891
6892 /// Sets the value of [available_count][crate::model::ProvisioningQuota::available_count].
6893 ///
6894 /// # Example
6895 /// ```ignore,no_run
6896 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6897 /// let x = ProvisioningQuota::new().set_available_count(42);
6898 /// ```
6899 pub fn set_available_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6900 self.available_count = v.into();
6901 self
6902 }
6903
6904 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota].
6905 ///
6906 /// Note that all the setters affecting `quota` are mutually
6907 /// exclusive.
6908 ///
6909 /// # Example
6910 /// ```ignore,no_run
6911 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6912 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6913 /// let x = ProvisioningQuota::new().set_quota(Some(
6914 /// google_cloud_baremetalsolution_v2::model::provisioning_quota::Quota::InstanceQuota(InstanceQuota::default().into())));
6915 /// ```
6916 pub fn set_quota<
6917 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Quota>>,
6918 >(
6919 mut self,
6920 v: T,
6921 ) -> Self {
6922 self.quota = v.into();
6923 self
6924 }
6925
6926 /// The value of [quota][crate::model::ProvisioningQuota::quota]
6927 /// if it holds a `InstanceQuota`, `None` if the field is not set or
6928 /// holds a different branch.
6929 pub fn instance_quota(
6930 &self,
6931 ) -> std::option::Option<&std::boxed::Box<crate::model::InstanceQuota>> {
6932 #[allow(unreachable_patterns)]
6933 self.quota.as_ref().and_then(|v| match v {
6934 crate::model::provisioning_quota::Quota::InstanceQuota(v) => {
6935 std::option::Option::Some(v)
6936 }
6937 _ => std::option::Option::None,
6938 })
6939 }
6940
6941 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota]
6942 /// to hold a `InstanceQuota`.
6943 ///
6944 /// Note that all the setters affecting `quota` are
6945 /// mutually exclusive.
6946 ///
6947 /// # Example
6948 /// ```ignore,no_run
6949 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6950 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6951 /// let x = ProvisioningQuota::new().set_instance_quota(InstanceQuota::default()/* use setters */);
6952 /// assert!(x.instance_quota().is_some());
6953 /// ```
6954 pub fn set_instance_quota<
6955 T: std::convert::Into<std::boxed::Box<crate::model::InstanceQuota>>,
6956 >(
6957 mut self,
6958 v: T,
6959 ) -> Self {
6960 self.quota = std::option::Option::Some(
6961 crate::model::provisioning_quota::Quota::InstanceQuota(v.into()),
6962 );
6963 self
6964 }
6965
6966 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability].
6967 ///
6968 /// Note that all the setters affecting `availability` are mutually
6969 /// exclusive.
6970 ///
6971 /// # Example
6972 /// ```ignore,no_run
6973 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6974 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::Availability;
6975 /// let x = ProvisioningQuota::new().set_availability(Some(Availability::ServerCount(42)));
6976 /// ```
6977 pub fn set_availability<
6978 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Availability>>,
6979 >(
6980 mut self,
6981 v: T,
6982 ) -> Self {
6983 self.availability = v.into();
6984 self
6985 }
6986
6987 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6988 /// if it holds a `ServerCount`, `None` if the field is not set or
6989 /// holds a different branch.
6990 pub fn server_count(&self) -> std::option::Option<&i64> {
6991 #[allow(unreachable_patterns)]
6992 self.availability.as_ref().and_then(|v| match v {
6993 crate::model::provisioning_quota::Availability::ServerCount(v) => {
6994 std::option::Option::Some(v)
6995 }
6996 _ => std::option::Option::None,
6997 })
6998 }
6999
7000 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
7001 /// to hold a `ServerCount`.
7002 ///
7003 /// Note that all the setters affecting `availability` are
7004 /// mutually exclusive.
7005 ///
7006 /// # Example
7007 /// ```ignore,no_run
7008 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7009 /// let x = ProvisioningQuota::new().set_server_count(42);
7010 /// assert!(x.server_count().is_some());
7011 /// assert!(x.network_bandwidth().is_none());
7012 /// assert!(x.storage_gib().is_none());
7013 /// ```
7014 pub fn set_server_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7015 self.availability = std::option::Option::Some(
7016 crate::model::provisioning_quota::Availability::ServerCount(v.into()),
7017 );
7018 self
7019 }
7020
7021 /// The value of [availability][crate::model::ProvisioningQuota::availability]
7022 /// if it holds a `NetworkBandwidth`, `None` if the field is not set or
7023 /// holds a different branch.
7024 pub fn network_bandwidth(&self) -> std::option::Option<&i64> {
7025 #[allow(unreachable_patterns)]
7026 self.availability.as_ref().and_then(|v| match v {
7027 crate::model::provisioning_quota::Availability::NetworkBandwidth(v) => {
7028 std::option::Option::Some(v)
7029 }
7030 _ => std::option::Option::None,
7031 })
7032 }
7033
7034 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
7035 /// to hold a `NetworkBandwidth`.
7036 ///
7037 /// Note that all the setters affecting `availability` are
7038 /// mutually exclusive.
7039 ///
7040 /// # Example
7041 /// ```ignore,no_run
7042 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7043 /// let x = ProvisioningQuota::new().set_network_bandwidth(42);
7044 /// assert!(x.network_bandwidth().is_some());
7045 /// assert!(x.server_count().is_none());
7046 /// assert!(x.storage_gib().is_none());
7047 /// ```
7048 pub fn set_network_bandwidth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7049 self.availability = std::option::Option::Some(
7050 crate::model::provisioning_quota::Availability::NetworkBandwidth(v.into()),
7051 );
7052 self
7053 }
7054
7055 /// The value of [availability][crate::model::ProvisioningQuota::availability]
7056 /// if it holds a `StorageGib`, `None` if the field is not set or
7057 /// holds a different branch.
7058 pub fn storage_gib(&self) -> std::option::Option<&i64> {
7059 #[allow(unreachable_patterns)]
7060 self.availability.as_ref().and_then(|v| match v {
7061 crate::model::provisioning_quota::Availability::StorageGib(v) => {
7062 std::option::Option::Some(v)
7063 }
7064 _ => std::option::Option::None,
7065 })
7066 }
7067
7068 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
7069 /// to hold a `StorageGib`.
7070 ///
7071 /// Note that all the setters affecting `availability` are
7072 /// mutually exclusive.
7073 ///
7074 /// # Example
7075 /// ```ignore,no_run
7076 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7077 /// let x = ProvisioningQuota::new().set_storage_gib(42);
7078 /// assert!(x.storage_gib().is_some());
7079 /// assert!(x.server_count().is_none());
7080 /// assert!(x.network_bandwidth().is_none());
7081 /// ```
7082 pub fn set_storage_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7083 self.availability = std::option::Option::Some(
7084 crate::model::provisioning_quota::Availability::StorageGib(v.into()),
7085 );
7086 self
7087 }
7088}
7089
7090impl wkt::message::Message for ProvisioningQuota {
7091 fn typename() -> &'static str {
7092 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningQuota"
7093 }
7094}
7095
7096/// Defines additional types related to [ProvisioningQuota].
7097pub mod provisioning_quota {
7098 #[allow(unused_imports)]
7099 use super::*;
7100
7101 /// The available asset types for intake.
7102 ///
7103 /// # Working with unknown values
7104 ///
7105 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7106 /// additional enum variants at any time. Adding new variants is not considered
7107 /// a breaking change. Applications should write their code in anticipation of:
7108 ///
7109 /// - New values appearing in future releases of the client library, **and**
7110 /// - New values received dynamically, without application changes.
7111 ///
7112 /// Please consult the [Working with enums] section in the user guide for some
7113 /// guidelines.
7114 ///
7115 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7116 #[derive(Clone, Debug, PartialEq)]
7117 #[non_exhaustive]
7118 pub enum AssetType {
7119 /// The unspecified type.
7120 Unspecified,
7121 /// The server asset type.
7122 Server,
7123 /// The storage asset type.
7124 Storage,
7125 /// The network asset type.
7126 Network,
7127 /// If set, the enum was initialized with an unknown value.
7128 ///
7129 /// Applications can examine the value using [AssetType::value] or
7130 /// [AssetType::name].
7131 UnknownValue(asset_type::UnknownValue),
7132 }
7133
7134 #[doc(hidden)]
7135 pub mod asset_type {
7136 #[allow(unused_imports)]
7137 use super::*;
7138 #[derive(Clone, Debug, PartialEq)]
7139 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7140 }
7141
7142 impl AssetType {
7143 /// Gets the enum value.
7144 ///
7145 /// Returns `None` if the enum contains an unknown value deserialized from
7146 /// the string representation of enums.
7147 pub fn value(&self) -> std::option::Option<i32> {
7148 match self {
7149 Self::Unspecified => std::option::Option::Some(0),
7150 Self::Server => std::option::Option::Some(1),
7151 Self::Storage => std::option::Option::Some(2),
7152 Self::Network => std::option::Option::Some(3),
7153 Self::UnknownValue(u) => u.0.value(),
7154 }
7155 }
7156
7157 /// Gets the enum value as a string.
7158 ///
7159 /// Returns `None` if the enum contains an unknown value deserialized from
7160 /// the integer representation of enums.
7161 pub fn name(&self) -> std::option::Option<&str> {
7162 match self {
7163 Self::Unspecified => std::option::Option::Some("ASSET_TYPE_UNSPECIFIED"),
7164 Self::Server => std::option::Option::Some("ASSET_TYPE_SERVER"),
7165 Self::Storage => std::option::Option::Some("ASSET_TYPE_STORAGE"),
7166 Self::Network => std::option::Option::Some("ASSET_TYPE_NETWORK"),
7167 Self::UnknownValue(u) => u.0.name(),
7168 }
7169 }
7170 }
7171
7172 impl std::default::Default for AssetType {
7173 fn default() -> Self {
7174 use std::convert::From;
7175 Self::from(0)
7176 }
7177 }
7178
7179 impl std::fmt::Display for AssetType {
7180 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7181 wkt::internal::display_enum(f, self.name(), self.value())
7182 }
7183 }
7184
7185 impl std::convert::From<i32> for AssetType {
7186 fn from(value: i32) -> Self {
7187 match value {
7188 0 => Self::Unspecified,
7189 1 => Self::Server,
7190 2 => Self::Storage,
7191 3 => Self::Network,
7192 _ => Self::UnknownValue(asset_type::UnknownValue(
7193 wkt::internal::UnknownEnumValue::Integer(value),
7194 )),
7195 }
7196 }
7197 }
7198
7199 impl std::convert::From<&str> for AssetType {
7200 fn from(value: &str) -> Self {
7201 use std::string::ToString;
7202 match value {
7203 "ASSET_TYPE_UNSPECIFIED" => Self::Unspecified,
7204 "ASSET_TYPE_SERVER" => Self::Server,
7205 "ASSET_TYPE_STORAGE" => Self::Storage,
7206 "ASSET_TYPE_NETWORK" => Self::Network,
7207 _ => Self::UnknownValue(asset_type::UnknownValue(
7208 wkt::internal::UnknownEnumValue::String(value.to_string()),
7209 )),
7210 }
7211 }
7212 }
7213
7214 impl serde::ser::Serialize for AssetType {
7215 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7216 where
7217 S: serde::Serializer,
7218 {
7219 match self {
7220 Self::Unspecified => serializer.serialize_i32(0),
7221 Self::Server => serializer.serialize_i32(1),
7222 Self::Storage => serializer.serialize_i32(2),
7223 Self::Network => serializer.serialize_i32(3),
7224 Self::UnknownValue(u) => u.0.serialize(serializer),
7225 }
7226 }
7227 }
7228
7229 impl<'de> serde::de::Deserialize<'de> for AssetType {
7230 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7231 where
7232 D: serde::Deserializer<'de>,
7233 {
7234 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AssetType>::new(
7235 ".google.cloud.baremetalsolution.v2.ProvisioningQuota.AssetType",
7236 ))
7237 }
7238 }
7239
7240 /// The quota of one asset type.
7241 #[derive(Clone, Debug, PartialEq)]
7242 #[non_exhaustive]
7243 pub enum Quota {
7244 /// Instance quota.
7245 InstanceQuota(std::boxed::Box<crate::model::InstanceQuota>),
7246 }
7247
7248 /// Available quantity based on asset type.
7249 #[derive(Clone, Debug, PartialEq)]
7250 #[non_exhaustive]
7251 pub enum Availability {
7252 /// Server count.
7253 ServerCount(i64),
7254 /// Network bandwidth, Gbps
7255 NetworkBandwidth(i64),
7256 /// Storage size (GB).
7257 StorageGib(i64),
7258 }
7259}
7260
7261/// Message for requesting the list of provisioning quotas.
7262#[derive(Clone, Default, PartialEq)]
7263#[non_exhaustive]
7264pub struct ListProvisioningQuotasRequest {
7265 /// Required. Parent value for ListProvisioningQuotasRequest.
7266 pub parent: std::string::String,
7267
7268 /// Requested page size. The server might return fewer items than requested.
7269 /// If unspecified, server will pick an appropriate default.
7270 /// Notice that page_size field is not supported and won't be respected in
7271 /// the API request for now, will be updated when pagination is supported.
7272 pub page_size: i32,
7273
7274 /// A token identifying a page of results from the server.
7275 pub page_token: std::string::String,
7276
7277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7278}
7279
7280impl ListProvisioningQuotasRequest {
7281 /// Creates a new default instance.
7282 pub fn new() -> Self {
7283 std::default::Default::default()
7284 }
7285
7286 /// Sets the value of [parent][crate::model::ListProvisioningQuotasRequest::parent].
7287 ///
7288 /// # Example
7289 /// ```ignore,no_run
7290 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7291 /// let x = ListProvisioningQuotasRequest::new().set_parent("example");
7292 /// ```
7293 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7294 self.parent = v.into();
7295 self
7296 }
7297
7298 /// Sets the value of [page_size][crate::model::ListProvisioningQuotasRequest::page_size].
7299 ///
7300 /// # Example
7301 /// ```ignore,no_run
7302 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7303 /// let x = ListProvisioningQuotasRequest::new().set_page_size(42);
7304 /// ```
7305 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7306 self.page_size = v.into();
7307 self
7308 }
7309
7310 /// Sets the value of [page_token][crate::model::ListProvisioningQuotasRequest::page_token].
7311 ///
7312 /// # Example
7313 /// ```ignore,no_run
7314 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7315 /// let x = ListProvisioningQuotasRequest::new().set_page_token("example");
7316 /// ```
7317 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7318 self.page_token = v.into();
7319 self
7320 }
7321}
7322
7323impl wkt::message::Message for ListProvisioningQuotasRequest {
7324 fn typename() -> &'static str {
7325 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasRequest"
7326 }
7327}
7328
7329/// Response message for the list of provisioning quotas.
7330#[derive(Clone, Default, PartialEq)]
7331#[non_exhaustive]
7332pub struct ListProvisioningQuotasResponse {
7333 /// The provisioning quotas registered in this project.
7334 pub provisioning_quotas: std::vec::Vec<crate::model::ProvisioningQuota>,
7335
7336 /// Token to retrieve the next page of results, or empty if there are no more
7337 /// results in the list.
7338 pub next_page_token: std::string::String,
7339
7340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7341}
7342
7343impl ListProvisioningQuotasResponse {
7344 /// Creates a new default instance.
7345 pub fn new() -> Self {
7346 std::default::Default::default()
7347 }
7348
7349 /// Sets the value of [provisioning_quotas][crate::model::ListProvisioningQuotasResponse::provisioning_quotas].
7350 ///
7351 /// # Example
7352 /// ```ignore,no_run
7353 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7354 /// use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7355 /// let x = ListProvisioningQuotasResponse::new()
7356 /// .set_provisioning_quotas([
7357 /// ProvisioningQuota::default()/* use setters */,
7358 /// ProvisioningQuota::default()/* use (different) setters */,
7359 /// ]);
7360 /// ```
7361 pub fn set_provisioning_quotas<T, V>(mut self, v: T) -> Self
7362 where
7363 T: std::iter::IntoIterator<Item = V>,
7364 V: std::convert::Into<crate::model::ProvisioningQuota>,
7365 {
7366 use std::iter::Iterator;
7367 self.provisioning_quotas = v.into_iter().map(|i| i.into()).collect();
7368 self
7369 }
7370
7371 /// Sets the value of [next_page_token][crate::model::ListProvisioningQuotasResponse::next_page_token].
7372 ///
7373 /// # Example
7374 /// ```ignore,no_run
7375 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7376 /// let x = ListProvisioningQuotasResponse::new().set_next_page_token("example");
7377 /// ```
7378 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7379 self.next_page_token = v.into();
7380 self
7381 }
7382}
7383
7384impl wkt::message::Message for ListProvisioningQuotasResponse {
7385 fn typename() -> &'static str {
7386 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasResponse"
7387 }
7388}
7389
7390#[doc(hidden)]
7391impl google_cloud_gax::paginator::internal::PageableResponse for ListProvisioningQuotasResponse {
7392 type PageItem = crate::model::ProvisioningQuota;
7393
7394 fn items(self) -> std::vec::Vec<Self::PageItem> {
7395 self.provisioning_quotas
7396 }
7397
7398 fn next_page_token(&self) -> std::string::String {
7399 use std::clone::Clone;
7400 self.next_page_token.clone()
7401 }
7402}
7403
7404/// Configuration parameters for a new instance.
7405#[derive(Clone, Default, PartialEq)]
7406#[non_exhaustive]
7407pub struct InstanceConfig {
7408 /// Output only. The name of the instance config.
7409 pub name: std::string::String,
7410
7411 /// A transient unique identifier to idenfity an instance within an
7412 /// ProvisioningConfig request.
7413 pub id: std::string::String,
7414
7415 /// Instance type.
7416 /// [Available
7417 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7418 pub instance_type: std::string::String,
7419
7420 /// Whether the instance should be provisioned with Hyperthreading enabled.
7421 pub hyperthreading: bool,
7422
7423 /// OS image to initialize the instance.
7424 /// [Available
7425 /// images](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7426 pub os_image: std::string::String,
7427
7428 /// Client network address. Filled if InstanceConfig.multivlan_config is false.
7429 #[deprecated]
7430 pub client_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7431
7432 /// Private network address, if any. Filled if InstanceConfig.multivlan_config
7433 /// is false.
7434 #[deprecated]
7435 pub private_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7436
7437 /// User note field, it can be used by customers to add additional information
7438 /// for the BMS Ops team .
7439 pub user_note: std::string::String,
7440
7441 /// If true networks can be from different projects of the same vendor account.
7442 pub account_networks_enabled: bool,
7443
7444 /// The type of network configuration on the instance.
7445 pub network_config: crate::model::instance_config::NetworkConfig,
7446
7447 /// Server network template name. Filled if InstanceConfig.multivlan_config is
7448 /// true.
7449 pub network_template: std::string::String,
7450
7451 /// List of logical interfaces for the instance. The number of logical
7452 /// interfaces will be the same as number of hardware bond/nic on the chosen
7453 /// network template. Filled if InstanceConfig.multivlan_config is true.
7454 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
7455
7456 /// List of names of ssh keys used to provision the instance.
7457 pub ssh_key_names: std::vec::Vec<std::string::String>,
7458
7459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7460}
7461
7462impl InstanceConfig {
7463 /// Creates a new default instance.
7464 pub fn new() -> Self {
7465 std::default::Default::default()
7466 }
7467
7468 /// Sets the value of [name][crate::model::InstanceConfig::name].
7469 ///
7470 /// # Example
7471 /// ```ignore,no_run
7472 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7473 /// # let project_id = "project_id";
7474 /// # let location_id = "location_id";
7475 /// # let instance_config_id = "instance_config_id";
7476 /// let x = InstanceConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/instanceConfigs/{instance_config_id}"));
7477 /// ```
7478 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7479 self.name = v.into();
7480 self
7481 }
7482
7483 /// Sets the value of [id][crate::model::InstanceConfig::id].
7484 ///
7485 /// # Example
7486 /// ```ignore,no_run
7487 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7488 /// let x = InstanceConfig::new().set_id("example");
7489 /// ```
7490 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7491 self.id = v.into();
7492 self
7493 }
7494
7495 /// Sets the value of [instance_type][crate::model::InstanceConfig::instance_type].
7496 ///
7497 /// # Example
7498 /// ```ignore,no_run
7499 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7500 /// let x = InstanceConfig::new().set_instance_type("example");
7501 /// ```
7502 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7503 self.instance_type = v.into();
7504 self
7505 }
7506
7507 /// Sets the value of [hyperthreading][crate::model::InstanceConfig::hyperthreading].
7508 ///
7509 /// # Example
7510 /// ```ignore,no_run
7511 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7512 /// let x = InstanceConfig::new().set_hyperthreading(true);
7513 /// ```
7514 pub fn set_hyperthreading<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7515 self.hyperthreading = v.into();
7516 self
7517 }
7518
7519 /// Sets the value of [os_image][crate::model::InstanceConfig::os_image].
7520 ///
7521 /// # Example
7522 /// ```ignore,no_run
7523 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7524 /// let x = InstanceConfig::new().set_os_image("example");
7525 /// ```
7526 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7527 self.os_image = v.into();
7528 self
7529 }
7530
7531 /// Sets the value of [client_network][crate::model::InstanceConfig::client_network].
7532 ///
7533 /// # Example
7534 /// ```ignore,no_run
7535 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7536 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7537 /// let x = InstanceConfig::new().set_client_network(NetworkAddress::default()/* use setters */);
7538 /// ```
7539 #[deprecated]
7540 pub fn set_client_network<T>(mut self, v: T) -> Self
7541 where
7542 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7543 {
7544 self.client_network = std::option::Option::Some(v.into());
7545 self
7546 }
7547
7548 /// Sets or clears the value of [client_network][crate::model::InstanceConfig::client_network].
7549 ///
7550 /// # Example
7551 /// ```ignore,no_run
7552 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7553 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7554 /// let x = InstanceConfig::new().set_or_clear_client_network(Some(NetworkAddress::default()/* use setters */));
7555 /// let x = InstanceConfig::new().set_or_clear_client_network(None::<NetworkAddress>);
7556 /// ```
7557 #[deprecated]
7558 pub fn set_or_clear_client_network<T>(mut self, v: std::option::Option<T>) -> Self
7559 where
7560 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7561 {
7562 self.client_network = v.map(|x| x.into());
7563 self
7564 }
7565
7566 /// Sets the value of [private_network][crate::model::InstanceConfig::private_network].
7567 ///
7568 /// # Example
7569 /// ```ignore,no_run
7570 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7571 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7572 /// let x = InstanceConfig::new().set_private_network(NetworkAddress::default()/* use setters */);
7573 /// ```
7574 #[deprecated]
7575 pub fn set_private_network<T>(mut self, v: T) -> Self
7576 where
7577 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7578 {
7579 self.private_network = std::option::Option::Some(v.into());
7580 self
7581 }
7582
7583 /// Sets or clears the value of [private_network][crate::model::InstanceConfig::private_network].
7584 ///
7585 /// # Example
7586 /// ```ignore,no_run
7587 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7588 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7589 /// let x = InstanceConfig::new().set_or_clear_private_network(Some(NetworkAddress::default()/* use setters */));
7590 /// let x = InstanceConfig::new().set_or_clear_private_network(None::<NetworkAddress>);
7591 /// ```
7592 #[deprecated]
7593 pub fn set_or_clear_private_network<T>(mut self, v: std::option::Option<T>) -> Self
7594 where
7595 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7596 {
7597 self.private_network = v.map(|x| x.into());
7598 self
7599 }
7600
7601 /// Sets the value of [user_note][crate::model::InstanceConfig::user_note].
7602 ///
7603 /// # Example
7604 /// ```ignore,no_run
7605 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7606 /// let x = InstanceConfig::new().set_user_note("example");
7607 /// ```
7608 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7609 self.user_note = v.into();
7610 self
7611 }
7612
7613 /// Sets the value of [account_networks_enabled][crate::model::InstanceConfig::account_networks_enabled].
7614 ///
7615 /// # Example
7616 /// ```ignore,no_run
7617 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7618 /// let x = InstanceConfig::new().set_account_networks_enabled(true);
7619 /// ```
7620 pub fn set_account_networks_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7621 self.account_networks_enabled = v.into();
7622 self
7623 }
7624
7625 /// Sets the value of [network_config][crate::model::InstanceConfig::network_config].
7626 ///
7627 /// # Example
7628 /// ```ignore,no_run
7629 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7630 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkConfig;
7631 /// let x0 = InstanceConfig::new().set_network_config(NetworkConfig::SingleVlan);
7632 /// let x1 = InstanceConfig::new().set_network_config(NetworkConfig::MultiVlan);
7633 /// ```
7634 pub fn set_network_config<
7635 T: std::convert::Into<crate::model::instance_config::NetworkConfig>,
7636 >(
7637 mut self,
7638 v: T,
7639 ) -> Self {
7640 self.network_config = v.into();
7641 self
7642 }
7643
7644 /// Sets the value of [network_template][crate::model::InstanceConfig::network_template].
7645 ///
7646 /// # Example
7647 /// ```ignore,no_run
7648 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7649 /// let x = InstanceConfig::new().set_network_template("example");
7650 /// ```
7651 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
7652 mut self,
7653 v: T,
7654 ) -> Self {
7655 self.network_template = v.into();
7656 self
7657 }
7658
7659 /// Sets the value of [logical_interfaces][crate::model::InstanceConfig::logical_interfaces].
7660 ///
7661 /// # Example
7662 /// ```ignore,no_run
7663 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7664 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
7665 /// let x = InstanceConfig::new()
7666 /// .set_logical_interfaces([
7667 /// LogicalInterface::default()/* use setters */,
7668 /// LogicalInterface::default()/* use (different) setters */,
7669 /// ]);
7670 /// ```
7671 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
7672 where
7673 T: std::iter::IntoIterator<Item = V>,
7674 V: std::convert::Into<crate::model::LogicalInterface>,
7675 {
7676 use std::iter::Iterator;
7677 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
7678 self
7679 }
7680
7681 /// Sets the value of [ssh_key_names][crate::model::InstanceConfig::ssh_key_names].
7682 ///
7683 /// # Example
7684 /// ```ignore,no_run
7685 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7686 /// let x = InstanceConfig::new().set_ssh_key_names(["a", "b", "c"]);
7687 /// ```
7688 pub fn set_ssh_key_names<T, V>(mut self, v: T) -> Self
7689 where
7690 T: std::iter::IntoIterator<Item = V>,
7691 V: std::convert::Into<std::string::String>,
7692 {
7693 use std::iter::Iterator;
7694 self.ssh_key_names = v.into_iter().map(|i| i.into()).collect();
7695 self
7696 }
7697}
7698
7699impl wkt::message::Message for InstanceConfig {
7700 fn typename() -> &'static str {
7701 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig"
7702 }
7703}
7704
7705/// Defines additional types related to [InstanceConfig].
7706pub mod instance_config {
7707 #[allow(unused_imports)]
7708 use super::*;
7709
7710 /// A network.
7711 #[derive(Clone, Default, PartialEq)]
7712 #[non_exhaustive]
7713 pub struct NetworkAddress {
7714 /// Id of the network to use, within the same ProvisioningConfig request.
7715 pub network_id: std::string::String,
7716
7717 /// IPv4 address to be assigned to the server.
7718 pub address: std::string::String,
7719
7720 /// Name of the existing network to use.
7721 pub existing_network_id: std::string::String,
7722
7723 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7724 }
7725
7726 impl NetworkAddress {
7727 /// Creates a new default instance.
7728 pub fn new() -> Self {
7729 std::default::Default::default()
7730 }
7731
7732 /// Sets the value of [network_id][crate::model::instance_config::NetworkAddress::network_id].
7733 ///
7734 /// # Example
7735 /// ```ignore,no_run
7736 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7737 /// let x = NetworkAddress::new().set_network_id("example");
7738 /// ```
7739 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7740 self.network_id = v.into();
7741 self
7742 }
7743
7744 /// Sets the value of [address][crate::model::instance_config::NetworkAddress::address].
7745 ///
7746 /// # Example
7747 /// ```ignore,no_run
7748 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7749 /// let x = NetworkAddress::new().set_address("example");
7750 /// ```
7751 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7752 self.address = v.into();
7753 self
7754 }
7755
7756 /// Sets the value of [existing_network_id][crate::model::instance_config::NetworkAddress::existing_network_id].
7757 ///
7758 /// # Example
7759 /// ```ignore,no_run
7760 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7761 /// let x = NetworkAddress::new().set_existing_network_id("example");
7762 /// ```
7763 pub fn set_existing_network_id<T: std::convert::Into<std::string::String>>(
7764 mut self,
7765 v: T,
7766 ) -> Self {
7767 self.existing_network_id = v.into();
7768 self
7769 }
7770 }
7771
7772 impl wkt::message::Message for NetworkAddress {
7773 fn typename() -> &'static str {
7774 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig.NetworkAddress"
7775 }
7776 }
7777
7778 /// The network configuration of the instance.
7779 ///
7780 /// # Working with unknown values
7781 ///
7782 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7783 /// additional enum variants at any time. Adding new variants is not considered
7784 /// a breaking change. Applications should write their code in anticipation of:
7785 ///
7786 /// - New values appearing in future releases of the client library, **and**
7787 /// - New values received dynamically, without application changes.
7788 ///
7789 /// Please consult the [Working with enums] section in the user guide for some
7790 /// guidelines.
7791 ///
7792 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7793 #[derive(Clone, Debug, PartialEq)]
7794 #[non_exhaustive]
7795 pub enum NetworkConfig {
7796 /// The unspecified network configuration.
7797 NetworkconfigUnspecified,
7798 /// Instance part of single client network and single private network.
7799 SingleVlan,
7800 /// Instance part of multiple (or single) client networks and private
7801 /// networks.
7802 MultiVlan,
7803 /// If set, the enum was initialized with an unknown value.
7804 ///
7805 /// Applications can examine the value using [NetworkConfig::value] or
7806 /// [NetworkConfig::name].
7807 UnknownValue(network_config::UnknownValue),
7808 }
7809
7810 #[doc(hidden)]
7811 pub mod network_config {
7812 #[allow(unused_imports)]
7813 use super::*;
7814 #[derive(Clone, Debug, PartialEq)]
7815 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7816 }
7817
7818 impl NetworkConfig {
7819 /// Gets the enum value.
7820 ///
7821 /// Returns `None` if the enum contains an unknown value deserialized from
7822 /// the string representation of enums.
7823 pub fn value(&self) -> std::option::Option<i32> {
7824 match self {
7825 Self::NetworkconfigUnspecified => std::option::Option::Some(0),
7826 Self::SingleVlan => std::option::Option::Some(1),
7827 Self::MultiVlan => std::option::Option::Some(2),
7828 Self::UnknownValue(u) => u.0.value(),
7829 }
7830 }
7831
7832 /// Gets the enum value as a string.
7833 ///
7834 /// Returns `None` if the enum contains an unknown value deserialized from
7835 /// the integer representation of enums.
7836 pub fn name(&self) -> std::option::Option<&str> {
7837 match self {
7838 Self::NetworkconfigUnspecified => {
7839 std::option::Option::Some("NETWORKCONFIG_UNSPECIFIED")
7840 }
7841 Self::SingleVlan => std::option::Option::Some("SINGLE_VLAN"),
7842 Self::MultiVlan => std::option::Option::Some("MULTI_VLAN"),
7843 Self::UnknownValue(u) => u.0.name(),
7844 }
7845 }
7846 }
7847
7848 impl std::default::Default for NetworkConfig {
7849 fn default() -> Self {
7850 use std::convert::From;
7851 Self::from(0)
7852 }
7853 }
7854
7855 impl std::fmt::Display for NetworkConfig {
7856 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7857 wkt::internal::display_enum(f, self.name(), self.value())
7858 }
7859 }
7860
7861 impl std::convert::From<i32> for NetworkConfig {
7862 fn from(value: i32) -> Self {
7863 match value {
7864 0 => Self::NetworkconfigUnspecified,
7865 1 => Self::SingleVlan,
7866 2 => Self::MultiVlan,
7867 _ => Self::UnknownValue(network_config::UnknownValue(
7868 wkt::internal::UnknownEnumValue::Integer(value),
7869 )),
7870 }
7871 }
7872 }
7873
7874 impl std::convert::From<&str> for NetworkConfig {
7875 fn from(value: &str) -> Self {
7876 use std::string::ToString;
7877 match value {
7878 "NETWORKCONFIG_UNSPECIFIED" => Self::NetworkconfigUnspecified,
7879 "SINGLE_VLAN" => Self::SingleVlan,
7880 "MULTI_VLAN" => Self::MultiVlan,
7881 _ => Self::UnknownValue(network_config::UnknownValue(
7882 wkt::internal::UnknownEnumValue::String(value.to_string()),
7883 )),
7884 }
7885 }
7886 }
7887
7888 impl serde::ser::Serialize for NetworkConfig {
7889 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7890 where
7891 S: serde::Serializer,
7892 {
7893 match self {
7894 Self::NetworkconfigUnspecified => serializer.serialize_i32(0),
7895 Self::SingleVlan => serializer.serialize_i32(1),
7896 Self::MultiVlan => serializer.serialize_i32(2),
7897 Self::UnknownValue(u) => u.0.serialize(serializer),
7898 }
7899 }
7900 }
7901
7902 impl<'de> serde::de::Deserialize<'de> for NetworkConfig {
7903 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7904 where
7905 D: serde::Deserializer<'de>,
7906 {
7907 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NetworkConfig>::new(
7908 ".google.cloud.baremetalsolution.v2.InstanceConfig.NetworkConfig",
7909 ))
7910 }
7911 }
7912}
7913
7914/// Configuration parameters for a new volume.
7915#[derive(Clone, Default, PartialEq)]
7916#[non_exhaustive]
7917pub struct VolumeConfig {
7918 /// Output only. The name of the volume config.
7919 pub name: std::string::String,
7920
7921 /// A transient unique identifier to identify a volume within an
7922 /// ProvisioningConfig request.
7923 pub id: std::string::String,
7924
7925 /// Whether snapshots should be enabled.
7926 pub snapshots_enabled: bool,
7927
7928 /// The type of this Volume.
7929 pub r#type: crate::model::volume_config::Type,
7930
7931 /// Volume protocol.
7932 pub protocol: crate::model::volume_config::Protocol,
7933
7934 /// The requested size of this volume, in GB.
7935 pub size_gb: i32,
7936
7937 /// LUN ranges to be configured. Set only when protocol is PROTOCOL_FC.
7938 pub lun_ranges: std::vec::Vec<crate::model::volume_config::LunRange>,
7939
7940 /// Machine ids connected to this volume. Set only when protocol is
7941 /// PROTOCOL_FC.
7942 pub machine_ids: std::vec::Vec<std::string::String>,
7943
7944 /// NFS exports. Set only when protocol is PROTOCOL_NFS.
7945 pub nfs_exports: std::vec::Vec<crate::model::volume_config::NfsExport>,
7946
7947 /// User note field, it can be used by customers to add additional information
7948 /// for the BMS Ops team .
7949 pub user_note: std::string::String,
7950
7951 /// The GCP service of the storage volume. Available gcp_service are in
7952 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
7953 pub gcp_service: std::string::String,
7954
7955 /// Performance tier of the Volume.
7956 /// Default is SHARED.
7957 pub performance_tier: crate::model::VolumePerformanceTier,
7958
7959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7960}
7961
7962impl VolumeConfig {
7963 /// Creates a new default instance.
7964 pub fn new() -> Self {
7965 std::default::Default::default()
7966 }
7967
7968 /// Sets the value of [name][crate::model::VolumeConfig::name].
7969 ///
7970 /// # Example
7971 /// ```ignore,no_run
7972 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7973 /// # let project_id = "project_id";
7974 /// # let location_id = "location_id";
7975 /// # let volume_config_id = "volume_config_id";
7976 /// let x = VolumeConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumeConfigs/{volume_config_id}"));
7977 /// ```
7978 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7979 self.name = v.into();
7980 self
7981 }
7982
7983 /// Sets the value of [id][crate::model::VolumeConfig::id].
7984 ///
7985 /// # Example
7986 /// ```ignore,no_run
7987 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7988 /// let x = VolumeConfig::new().set_id("example");
7989 /// ```
7990 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7991 self.id = v.into();
7992 self
7993 }
7994
7995 /// Sets the value of [snapshots_enabled][crate::model::VolumeConfig::snapshots_enabled].
7996 ///
7997 /// # Example
7998 /// ```ignore,no_run
7999 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8000 /// let x = VolumeConfig::new().set_snapshots_enabled(true);
8001 /// ```
8002 pub fn set_snapshots_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8003 self.snapshots_enabled = v.into();
8004 self
8005 }
8006
8007 /// Sets the value of [r#type][crate::model::VolumeConfig::type].
8008 ///
8009 /// # Example
8010 /// ```ignore,no_run
8011 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8012 /// use google_cloud_baremetalsolution_v2::model::volume_config::Type;
8013 /// let x0 = VolumeConfig::new().set_type(Type::Flash);
8014 /// let x1 = VolumeConfig::new().set_type(Type::Disk);
8015 /// ```
8016 pub fn set_type<T: std::convert::Into<crate::model::volume_config::Type>>(
8017 mut self,
8018 v: T,
8019 ) -> Self {
8020 self.r#type = v.into();
8021 self
8022 }
8023
8024 /// Sets the value of [protocol][crate::model::VolumeConfig::protocol].
8025 ///
8026 /// # Example
8027 /// ```ignore,no_run
8028 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8029 /// use google_cloud_baremetalsolution_v2::model::volume_config::Protocol;
8030 /// let x0 = VolumeConfig::new().set_protocol(Protocol::Fc);
8031 /// let x1 = VolumeConfig::new().set_protocol(Protocol::Nfs);
8032 /// ```
8033 pub fn set_protocol<T: std::convert::Into<crate::model::volume_config::Protocol>>(
8034 mut self,
8035 v: T,
8036 ) -> Self {
8037 self.protocol = v.into();
8038 self
8039 }
8040
8041 /// Sets the value of [size_gb][crate::model::VolumeConfig::size_gb].
8042 ///
8043 /// # Example
8044 /// ```ignore,no_run
8045 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8046 /// let x = VolumeConfig::new().set_size_gb(42);
8047 /// ```
8048 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8049 self.size_gb = v.into();
8050 self
8051 }
8052
8053 /// Sets the value of [lun_ranges][crate::model::VolumeConfig::lun_ranges].
8054 ///
8055 /// # Example
8056 /// ```ignore,no_run
8057 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8058 /// use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8059 /// let x = VolumeConfig::new()
8060 /// .set_lun_ranges([
8061 /// LunRange::default()/* use setters */,
8062 /// LunRange::default()/* use (different) setters */,
8063 /// ]);
8064 /// ```
8065 pub fn set_lun_ranges<T, V>(mut self, v: T) -> Self
8066 where
8067 T: std::iter::IntoIterator<Item = V>,
8068 V: std::convert::Into<crate::model::volume_config::LunRange>,
8069 {
8070 use std::iter::Iterator;
8071 self.lun_ranges = v.into_iter().map(|i| i.into()).collect();
8072 self
8073 }
8074
8075 /// Sets the value of [machine_ids][crate::model::VolumeConfig::machine_ids].
8076 ///
8077 /// # Example
8078 /// ```ignore,no_run
8079 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8080 /// let x = VolumeConfig::new().set_machine_ids(["a", "b", "c"]);
8081 /// ```
8082 pub fn set_machine_ids<T, V>(mut self, v: T) -> Self
8083 where
8084 T: std::iter::IntoIterator<Item = V>,
8085 V: std::convert::Into<std::string::String>,
8086 {
8087 use std::iter::Iterator;
8088 self.machine_ids = v.into_iter().map(|i| i.into()).collect();
8089 self
8090 }
8091
8092 /// Sets the value of [nfs_exports][crate::model::VolumeConfig::nfs_exports].
8093 ///
8094 /// # Example
8095 /// ```ignore,no_run
8096 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8097 /// use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8098 /// let x = VolumeConfig::new()
8099 /// .set_nfs_exports([
8100 /// NfsExport::default()/* use setters */,
8101 /// NfsExport::default()/* use (different) setters */,
8102 /// ]);
8103 /// ```
8104 pub fn set_nfs_exports<T, V>(mut self, v: T) -> Self
8105 where
8106 T: std::iter::IntoIterator<Item = V>,
8107 V: std::convert::Into<crate::model::volume_config::NfsExport>,
8108 {
8109 use std::iter::Iterator;
8110 self.nfs_exports = v.into_iter().map(|i| i.into()).collect();
8111 self
8112 }
8113
8114 /// Sets the value of [user_note][crate::model::VolumeConfig::user_note].
8115 ///
8116 /// # Example
8117 /// ```ignore,no_run
8118 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8119 /// let x = VolumeConfig::new().set_user_note("example");
8120 /// ```
8121 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8122 self.user_note = v.into();
8123 self
8124 }
8125
8126 /// Sets the value of [gcp_service][crate::model::VolumeConfig::gcp_service].
8127 ///
8128 /// # Example
8129 /// ```ignore,no_run
8130 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8131 /// let x = VolumeConfig::new().set_gcp_service("example");
8132 /// ```
8133 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8134 self.gcp_service = v.into();
8135 self
8136 }
8137
8138 /// Sets the value of [performance_tier][crate::model::VolumeConfig::performance_tier].
8139 ///
8140 /// # Example
8141 /// ```ignore,no_run
8142 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8143 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
8144 /// let x0 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Shared);
8145 /// let x1 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Assigned);
8146 /// let x2 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Ht);
8147 /// ```
8148 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
8149 mut self,
8150 v: T,
8151 ) -> Self {
8152 self.performance_tier = v.into();
8153 self
8154 }
8155}
8156
8157impl wkt::message::Message for VolumeConfig {
8158 fn typename() -> &'static str {
8159 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig"
8160 }
8161}
8162
8163/// Defines additional types related to [VolumeConfig].
8164pub mod volume_config {
8165 #[allow(unused_imports)]
8166 use super::*;
8167
8168 /// A LUN(Logical Unit Number) range.
8169 #[derive(Clone, Default, PartialEq)]
8170 #[non_exhaustive]
8171 pub struct LunRange {
8172 /// Number of LUNs to create.
8173 pub quantity: i32,
8174
8175 /// The requested size of each LUN, in GB.
8176 pub size_gb: i32,
8177
8178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8179 }
8180
8181 impl LunRange {
8182 /// Creates a new default instance.
8183 pub fn new() -> Self {
8184 std::default::Default::default()
8185 }
8186
8187 /// Sets the value of [quantity][crate::model::volume_config::LunRange::quantity].
8188 ///
8189 /// # Example
8190 /// ```ignore,no_run
8191 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8192 /// let x = LunRange::new().set_quantity(42);
8193 /// ```
8194 pub fn set_quantity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8195 self.quantity = v.into();
8196 self
8197 }
8198
8199 /// Sets the value of [size_gb][crate::model::volume_config::LunRange::size_gb].
8200 ///
8201 /// # Example
8202 /// ```ignore,no_run
8203 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8204 /// let x = LunRange::new().set_size_gb(42);
8205 /// ```
8206 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8207 self.size_gb = v.into();
8208 self
8209 }
8210 }
8211
8212 impl wkt::message::Message for LunRange {
8213 fn typename() -> &'static str {
8214 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.LunRange"
8215 }
8216 }
8217
8218 /// A NFS export entry.
8219 #[derive(Clone, Default, PartialEq)]
8220 #[non_exhaustive]
8221 pub struct NfsExport {
8222 /// Network to use to publish the export.
8223 pub network_id: std::string::String,
8224
8225 /// Export permissions.
8226 pub permissions: crate::model::volume_config::nfs_export::Permissions,
8227
8228 /// Disable root squashing, which is a feature of NFS.
8229 /// Root squash is a special mapping of the remote superuser (root) identity
8230 /// when using identity authentication.
8231 pub no_root_squash: bool,
8232
8233 /// Allow the setuid flag.
8234 pub allow_suid: bool,
8235
8236 /// Allow dev flag in NfsShare AllowedClientsRequest.
8237 pub allow_dev: bool,
8238
8239 /// A client object.
8240 pub client: std::option::Option<crate::model::volume_config::nfs_export::Client>,
8241
8242 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8243 }
8244
8245 impl NfsExport {
8246 /// Creates a new default instance.
8247 pub fn new() -> Self {
8248 std::default::Default::default()
8249 }
8250
8251 /// Sets the value of [network_id][crate::model::volume_config::NfsExport::network_id].
8252 ///
8253 /// # Example
8254 /// ```ignore,no_run
8255 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8256 /// let x = NfsExport::new().set_network_id("example");
8257 /// ```
8258 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8259 self.network_id = v.into();
8260 self
8261 }
8262
8263 /// Sets the value of [permissions][crate::model::volume_config::NfsExport::permissions].
8264 ///
8265 /// # Example
8266 /// ```ignore,no_run
8267 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8268 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Permissions;
8269 /// let x0 = NfsExport::new().set_permissions(Permissions::ReadOnly);
8270 /// let x1 = NfsExport::new().set_permissions(Permissions::ReadWrite);
8271 /// ```
8272 pub fn set_permissions<
8273 T: std::convert::Into<crate::model::volume_config::nfs_export::Permissions>,
8274 >(
8275 mut self,
8276 v: T,
8277 ) -> Self {
8278 self.permissions = v.into();
8279 self
8280 }
8281
8282 /// Sets the value of [no_root_squash][crate::model::volume_config::NfsExport::no_root_squash].
8283 ///
8284 /// # Example
8285 /// ```ignore,no_run
8286 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8287 /// let x = NfsExport::new().set_no_root_squash(true);
8288 /// ```
8289 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8290 self.no_root_squash = v.into();
8291 self
8292 }
8293
8294 /// Sets the value of [allow_suid][crate::model::volume_config::NfsExport::allow_suid].
8295 ///
8296 /// # Example
8297 /// ```ignore,no_run
8298 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8299 /// let x = NfsExport::new().set_allow_suid(true);
8300 /// ```
8301 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8302 self.allow_suid = v.into();
8303 self
8304 }
8305
8306 /// Sets the value of [allow_dev][crate::model::volume_config::NfsExport::allow_dev].
8307 ///
8308 /// # Example
8309 /// ```ignore,no_run
8310 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8311 /// let x = NfsExport::new().set_allow_dev(true);
8312 /// ```
8313 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8314 self.allow_dev = v.into();
8315 self
8316 }
8317
8318 /// Sets the value of [client][crate::model::volume_config::NfsExport::client].
8319 ///
8320 /// Note that all the setters affecting `client` are mutually
8321 /// exclusive.
8322 ///
8323 /// # Example
8324 /// ```ignore,no_run
8325 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8326 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Client;
8327 /// let x = NfsExport::new().set_client(Some(Client::MachineId("example".to_string())));
8328 /// ```
8329 pub fn set_client<
8330 T: std::convert::Into<
8331 std::option::Option<crate::model::volume_config::nfs_export::Client>,
8332 >,
8333 >(
8334 mut self,
8335 v: T,
8336 ) -> Self {
8337 self.client = v.into();
8338 self
8339 }
8340
8341 /// The value of [client][crate::model::volume_config::NfsExport::client]
8342 /// if it holds a `MachineId`, `None` if the field is not set or
8343 /// holds a different branch.
8344 pub fn machine_id(&self) -> std::option::Option<&std::string::String> {
8345 #[allow(unreachable_patterns)]
8346 self.client.as_ref().and_then(|v| match v {
8347 crate::model::volume_config::nfs_export::Client::MachineId(v) => {
8348 std::option::Option::Some(v)
8349 }
8350 _ => std::option::Option::None,
8351 })
8352 }
8353
8354 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8355 /// to hold a `MachineId`.
8356 ///
8357 /// Note that all the setters affecting `client` are
8358 /// mutually exclusive.
8359 ///
8360 /// # Example
8361 /// ```ignore,no_run
8362 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8363 /// let x = NfsExport::new().set_machine_id("example");
8364 /// assert!(x.machine_id().is_some());
8365 /// assert!(x.cidr().is_none());
8366 /// ```
8367 pub fn set_machine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8368 self.client = std::option::Option::Some(
8369 crate::model::volume_config::nfs_export::Client::MachineId(v.into()),
8370 );
8371 self
8372 }
8373
8374 /// The value of [client][crate::model::volume_config::NfsExport::client]
8375 /// if it holds a `Cidr`, `None` if the field is not set or
8376 /// holds a different branch.
8377 pub fn cidr(&self) -> std::option::Option<&std::string::String> {
8378 #[allow(unreachable_patterns)]
8379 self.client.as_ref().and_then(|v| match v {
8380 crate::model::volume_config::nfs_export::Client::Cidr(v) => {
8381 std::option::Option::Some(v)
8382 }
8383 _ => std::option::Option::None,
8384 })
8385 }
8386
8387 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8388 /// to hold a `Cidr`.
8389 ///
8390 /// Note that all the setters affecting `client` are
8391 /// mutually exclusive.
8392 ///
8393 /// # Example
8394 /// ```ignore,no_run
8395 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8396 /// let x = NfsExport::new().set_cidr("example");
8397 /// assert!(x.cidr().is_some());
8398 /// assert!(x.machine_id().is_none());
8399 /// ```
8400 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8401 self.client = std::option::Option::Some(
8402 crate::model::volume_config::nfs_export::Client::Cidr(v.into()),
8403 );
8404 self
8405 }
8406 }
8407
8408 impl wkt::message::Message for NfsExport {
8409 fn typename() -> &'static str {
8410 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport"
8411 }
8412 }
8413
8414 /// Defines additional types related to [NfsExport].
8415 pub mod nfs_export {
8416 #[allow(unused_imports)]
8417 use super::*;
8418
8419 /// Permissions that can granted for an export.
8420 ///
8421 /// # Working with unknown values
8422 ///
8423 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8424 /// additional enum variants at any time. Adding new variants is not considered
8425 /// a breaking change. Applications should write their code in anticipation of:
8426 ///
8427 /// - New values appearing in future releases of the client library, **and**
8428 /// - New values received dynamically, without application changes.
8429 ///
8430 /// Please consult the [Working with enums] section in the user guide for some
8431 /// guidelines.
8432 ///
8433 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8434 #[derive(Clone, Debug, PartialEq)]
8435 #[non_exhaustive]
8436 pub enum Permissions {
8437 /// Unspecified value.
8438 Unspecified,
8439 /// Read-only permission.
8440 ReadOnly,
8441 /// Read-write permission.
8442 ReadWrite,
8443 /// If set, the enum was initialized with an unknown value.
8444 ///
8445 /// Applications can examine the value using [Permissions::value] or
8446 /// [Permissions::name].
8447 UnknownValue(permissions::UnknownValue),
8448 }
8449
8450 #[doc(hidden)]
8451 pub mod permissions {
8452 #[allow(unused_imports)]
8453 use super::*;
8454 #[derive(Clone, Debug, PartialEq)]
8455 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8456 }
8457
8458 impl Permissions {
8459 /// Gets the enum value.
8460 ///
8461 /// Returns `None` if the enum contains an unknown value deserialized from
8462 /// the string representation of enums.
8463 pub fn value(&self) -> std::option::Option<i32> {
8464 match self {
8465 Self::Unspecified => std::option::Option::Some(0),
8466 Self::ReadOnly => std::option::Option::Some(1),
8467 Self::ReadWrite => std::option::Option::Some(2),
8468 Self::UnknownValue(u) => u.0.value(),
8469 }
8470 }
8471
8472 /// Gets the enum value as a string.
8473 ///
8474 /// Returns `None` if the enum contains an unknown value deserialized from
8475 /// the integer representation of enums.
8476 pub fn name(&self) -> std::option::Option<&str> {
8477 match self {
8478 Self::Unspecified => std::option::Option::Some("PERMISSIONS_UNSPECIFIED"),
8479 Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
8480 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
8481 Self::UnknownValue(u) => u.0.name(),
8482 }
8483 }
8484 }
8485
8486 impl std::default::Default for Permissions {
8487 fn default() -> Self {
8488 use std::convert::From;
8489 Self::from(0)
8490 }
8491 }
8492
8493 impl std::fmt::Display for Permissions {
8494 fn fmt(
8495 &self,
8496 f: &mut std::fmt::Formatter<'_>,
8497 ) -> std::result::Result<(), std::fmt::Error> {
8498 wkt::internal::display_enum(f, self.name(), self.value())
8499 }
8500 }
8501
8502 impl std::convert::From<i32> for Permissions {
8503 fn from(value: i32) -> Self {
8504 match value {
8505 0 => Self::Unspecified,
8506 1 => Self::ReadOnly,
8507 2 => Self::ReadWrite,
8508 _ => Self::UnknownValue(permissions::UnknownValue(
8509 wkt::internal::UnknownEnumValue::Integer(value),
8510 )),
8511 }
8512 }
8513 }
8514
8515 impl std::convert::From<&str> for Permissions {
8516 fn from(value: &str) -> Self {
8517 use std::string::ToString;
8518 match value {
8519 "PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
8520 "READ_ONLY" => Self::ReadOnly,
8521 "READ_WRITE" => Self::ReadWrite,
8522 _ => Self::UnknownValue(permissions::UnknownValue(
8523 wkt::internal::UnknownEnumValue::String(value.to_string()),
8524 )),
8525 }
8526 }
8527 }
8528
8529 impl serde::ser::Serialize for Permissions {
8530 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8531 where
8532 S: serde::Serializer,
8533 {
8534 match self {
8535 Self::Unspecified => serializer.serialize_i32(0),
8536 Self::ReadOnly => serializer.serialize_i32(1),
8537 Self::ReadWrite => serializer.serialize_i32(2),
8538 Self::UnknownValue(u) => u.0.serialize(serializer),
8539 }
8540 }
8541 }
8542
8543 impl<'de> serde::de::Deserialize<'de> for Permissions {
8544 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8545 where
8546 D: serde::Deserializer<'de>,
8547 {
8548 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Permissions>::new(
8549 ".google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport.Permissions",
8550 ))
8551 }
8552 }
8553
8554 /// A client object.
8555 #[derive(Clone, Debug, PartialEq)]
8556 #[non_exhaustive]
8557 pub enum Client {
8558 /// Either a single machine, identified by an ID, or a comma-separated
8559 /// list of machine IDs.
8560 MachineId(std::string::String),
8561 /// A CIDR range.
8562 Cidr(std::string::String),
8563 }
8564 }
8565
8566 /// The types of Volumes.
8567 ///
8568 /// # Working with unknown values
8569 ///
8570 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8571 /// additional enum variants at any time. Adding new variants is not considered
8572 /// a breaking change. Applications should write their code in anticipation of:
8573 ///
8574 /// - New values appearing in future releases of the client library, **and**
8575 /// - New values received dynamically, without application changes.
8576 ///
8577 /// Please consult the [Working with enums] section in the user guide for some
8578 /// guidelines.
8579 ///
8580 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8581 #[derive(Clone, Debug, PartialEq)]
8582 #[non_exhaustive]
8583 pub enum Type {
8584 /// The unspecified type.
8585 Unspecified,
8586 /// This Volume is on flash.
8587 Flash,
8588 /// This Volume is on disk.
8589 Disk,
8590 /// If set, the enum was initialized with an unknown value.
8591 ///
8592 /// Applications can examine the value using [Type::value] or
8593 /// [Type::name].
8594 UnknownValue(r#type::UnknownValue),
8595 }
8596
8597 #[doc(hidden)]
8598 pub mod r#type {
8599 #[allow(unused_imports)]
8600 use super::*;
8601 #[derive(Clone, Debug, PartialEq)]
8602 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8603 }
8604
8605 impl Type {
8606 /// Gets the enum value.
8607 ///
8608 /// Returns `None` if the enum contains an unknown value deserialized from
8609 /// the string representation of enums.
8610 pub fn value(&self) -> std::option::Option<i32> {
8611 match self {
8612 Self::Unspecified => std::option::Option::Some(0),
8613 Self::Flash => std::option::Option::Some(1),
8614 Self::Disk => std::option::Option::Some(2),
8615 Self::UnknownValue(u) => u.0.value(),
8616 }
8617 }
8618
8619 /// Gets the enum value as a string.
8620 ///
8621 /// Returns `None` if the enum contains an unknown value deserialized from
8622 /// the integer representation of enums.
8623 pub fn name(&self) -> std::option::Option<&str> {
8624 match self {
8625 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8626 Self::Flash => std::option::Option::Some("FLASH"),
8627 Self::Disk => std::option::Option::Some("DISK"),
8628 Self::UnknownValue(u) => u.0.name(),
8629 }
8630 }
8631 }
8632
8633 impl std::default::Default for Type {
8634 fn default() -> Self {
8635 use std::convert::From;
8636 Self::from(0)
8637 }
8638 }
8639
8640 impl std::fmt::Display for Type {
8641 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8642 wkt::internal::display_enum(f, self.name(), self.value())
8643 }
8644 }
8645
8646 impl std::convert::From<i32> for Type {
8647 fn from(value: i32) -> Self {
8648 match value {
8649 0 => Self::Unspecified,
8650 1 => Self::Flash,
8651 2 => Self::Disk,
8652 _ => Self::UnknownValue(r#type::UnknownValue(
8653 wkt::internal::UnknownEnumValue::Integer(value),
8654 )),
8655 }
8656 }
8657 }
8658
8659 impl std::convert::From<&str> for Type {
8660 fn from(value: &str) -> Self {
8661 use std::string::ToString;
8662 match value {
8663 "TYPE_UNSPECIFIED" => Self::Unspecified,
8664 "FLASH" => Self::Flash,
8665 "DISK" => Self::Disk,
8666 _ => Self::UnknownValue(r#type::UnknownValue(
8667 wkt::internal::UnknownEnumValue::String(value.to_string()),
8668 )),
8669 }
8670 }
8671 }
8672
8673 impl serde::ser::Serialize for Type {
8674 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8675 where
8676 S: serde::Serializer,
8677 {
8678 match self {
8679 Self::Unspecified => serializer.serialize_i32(0),
8680 Self::Flash => serializer.serialize_i32(1),
8681 Self::Disk => serializer.serialize_i32(2),
8682 Self::UnknownValue(u) => u.0.serialize(serializer),
8683 }
8684 }
8685 }
8686
8687 impl<'de> serde::de::Deserialize<'de> for Type {
8688 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8689 where
8690 D: serde::Deserializer<'de>,
8691 {
8692 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
8693 ".google.cloud.baremetalsolution.v2.VolumeConfig.Type",
8694 ))
8695 }
8696 }
8697
8698 /// The protocol used to access the volume.
8699 ///
8700 /// # Working with unknown values
8701 ///
8702 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8703 /// additional enum variants at any time. Adding new variants is not considered
8704 /// a breaking change. Applications should write their code in anticipation of:
8705 ///
8706 /// - New values appearing in future releases of the client library, **and**
8707 /// - New values received dynamically, without application changes.
8708 ///
8709 /// Please consult the [Working with enums] section in the user guide for some
8710 /// guidelines.
8711 ///
8712 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8713 #[derive(Clone, Debug, PartialEq)]
8714 #[non_exhaustive]
8715 pub enum Protocol {
8716 /// Unspecified value.
8717 Unspecified,
8718 /// Fibre channel.
8719 Fc,
8720 /// Network file system.
8721 Nfs,
8722 /// If set, the enum was initialized with an unknown value.
8723 ///
8724 /// Applications can examine the value using [Protocol::value] or
8725 /// [Protocol::name].
8726 UnknownValue(protocol::UnknownValue),
8727 }
8728
8729 #[doc(hidden)]
8730 pub mod protocol {
8731 #[allow(unused_imports)]
8732 use super::*;
8733 #[derive(Clone, Debug, PartialEq)]
8734 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8735 }
8736
8737 impl Protocol {
8738 /// Gets the enum value.
8739 ///
8740 /// Returns `None` if the enum contains an unknown value deserialized from
8741 /// the string representation of enums.
8742 pub fn value(&self) -> std::option::Option<i32> {
8743 match self {
8744 Self::Unspecified => std::option::Option::Some(0),
8745 Self::Fc => std::option::Option::Some(1),
8746 Self::Nfs => std::option::Option::Some(2),
8747 Self::UnknownValue(u) => u.0.value(),
8748 }
8749 }
8750
8751 /// Gets the enum value as a string.
8752 ///
8753 /// Returns `None` if the enum contains an unknown value deserialized from
8754 /// the integer representation of enums.
8755 pub fn name(&self) -> std::option::Option<&str> {
8756 match self {
8757 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
8758 Self::Fc => std::option::Option::Some("PROTOCOL_FC"),
8759 Self::Nfs => std::option::Option::Some("PROTOCOL_NFS"),
8760 Self::UnknownValue(u) => u.0.name(),
8761 }
8762 }
8763 }
8764
8765 impl std::default::Default for Protocol {
8766 fn default() -> Self {
8767 use std::convert::From;
8768 Self::from(0)
8769 }
8770 }
8771
8772 impl std::fmt::Display for Protocol {
8773 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8774 wkt::internal::display_enum(f, self.name(), self.value())
8775 }
8776 }
8777
8778 impl std::convert::From<i32> for Protocol {
8779 fn from(value: i32) -> Self {
8780 match value {
8781 0 => Self::Unspecified,
8782 1 => Self::Fc,
8783 2 => Self::Nfs,
8784 _ => Self::UnknownValue(protocol::UnknownValue(
8785 wkt::internal::UnknownEnumValue::Integer(value),
8786 )),
8787 }
8788 }
8789 }
8790
8791 impl std::convert::From<&str> for Protocol {
8792 fn from(value: &str) -> Self {
8793 use std::string::ToString;
8794 match value {
8795 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
8796 "PROTOCOL_FC" => Self::Fc,
8797 "PROTOCOL_NFS" => Self::Nfs,
8798 _ => Self::UnknownValue(protocol::UnknownValue(
8799 wkt::internal::UnknownEnumValue::String(value.to_string()),
8800 )),
8801 }
8802 }
8803 }
8804
8805 impl serde::ser::Serialize for Protocol {
8806 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8807 where
8808 S: serde::Serializer,
8809 {
8810 match self {
8811 Self::Unspecified => serializer.serialize_i32(0),
8812 Self::Fc => serializer.serialize_i32(1),
8813 Self::Nfs => serializer.serialize_i32(2),
8814 Self::UnknownValue(u) => u.0.serialize(serializer),
8815 }
8816 }
8817 }
8818
8819 impl<'de> serde::de::Deserialize<'de> for Protocol {
8820 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8821 where
8822 D: serde::Deserializer<'de>,
8823 {
8824 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
8825 ".google.cloud.baremetalsolution.v2.VolumeConfig.Protocol",
8826 ))
8827 }
8828 }
8829}
8830
8831/// Configuration parameters for a new network.
8832#[derive(Clone, Default, PartialEq)]
8833#[non_exhaustive]
8834pub struct NetworkConfig {
8835 /// Output only. The name of the network config.
8836 pub name: std::string::String,
8837
8838 /// A transient unique identifier to identify a volume within an
8839 /// ProvisioningConfig request.
8840 pub id: std::string::String,
8841
8842 /// The type of this network, either Client or Private.
8843 pub r#type: crate::model::network_config::Type,
8844
8845 /// Interconnect bandwidth. Set only when type is CLIENT.
8846 pub bandwidth: crate::model::network_config::Bandwidth,
8847
8848 /// List of VLAN attachments. As of now there are always 2 attachments, but it
8849 /// is going to change in the future (multi vlan).
8850 pub vlan_attachments: std::vec::Vec<crate::model::network_config::IntakeVlanAttachment>,
8851
8852 /// CIDR range of the network.
8853 pub cidr: std::string::String,
8854
8855 /// Service CIDR, if any.
8856 pub service_cidr: crate::model::network_config::ServiceCidr,
8857
8858 /// User note field, it can be used by customers to add additional information
8859 /// for the BMS Ops team .
8860 pub user_note: std::string::String,
8861
8862 /// The GCP service of the network. Available gcp_service are in
8863 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
8864 pub gcp_service: std::string::String,
8865
8866 /// Whether the VLAN attachment pair is located in the same project.
8867 pub vlan_same_project: bool,
8868
8869 /// The JumboFramesEnabled option for customer to set.
8870 pub jumbo_frames_enabled: bool,
8871
8872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8873}
8874
8875impl NetworkConfig {
8876 /// Creates a new default instance.
8877 pub fn new() -> Self {
8878 std::default::Default::default()
8879 }
8880
8881 /// Sets the value of [name][crate::model::NetworkConfig::name].
8882 ///
8883 /// # Example
8884 /// ```ignore,no_run
8885 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8886 /// # let project_id = "project_id";
8887 /// # let location_id = "location_id";
8888 /// # let network_config_id = "network_config_id";
8889 /// let x = NetworkConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/networkConfigs/{network_config_id}"));
8890 /// ```
8891 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8892 self.name = v.into();
8893 self
8894 }
8895
8896 /// Sets the value of [id][crate::model::NetworkConfig::id].
8897 ///
8898 /// # Example
8899 /// ```ignore,no_run
8900 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8901 /// let x = NetworkConfig::new().set_id("example");
8902 /// ```
8903 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8904 self.id = v.into();
8905 self
8906 }
8907
8908 /// Sets the value of [r#type][crate::model::NetworkConfig::type].
8909 ///
8910 /// # Example
8911 /// ```ignore,no_run
8912 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8913 /// use google_cloud_baremetalsolution_v2::model::network_config::Type;
8914 /// let x0 = NetworkConfig::new().set_type(Type::Client);
8915 /// let x1 = NetworkConfig::new().set_type(Type::Private);
8916 /// ```
8917 pub fn set_type<T: std::convert::Into<crate::model::network_config::Type>>(
8918 mut self,
8919 v: T,
8920 ) -> Self {
8921 self.r#type = v.into();
8922 self
8923 }
8924
8925 /// Sets the value of [bandwidth][crate::model::NetworkConfig::bandwidth].
8926 ///
8927 /// # Example
8928 /// ```ignore,no_run
8929 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8930 /// use google_cloud_baremetalsolution_v2::model::network_config::Bandwidth;
8931 /// let x0 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw1Gbps);
8932 /// let x1 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw2Gbps);
8933 /// let x2 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw5Gbps);
8934 /// ```
8935 pub fn set_bandwidth<T: std::convert::Into<crate::model::network_config::Bandwidth>>(
8936 mut self,
8937 v: T,
8938 ) -> Self {
8939 self.bandwidth = v.into();
8940 self
8941 }
8942
8943 /// Sets the value of [vlan_attachments][crate::model::NetworkConfig::vlan_attachments].
8944 ///
8945 /// # Example
8946 /// ```ignore,no_run
8947 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8948 /// use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8949 /// let x = NetworkConfig::new()
8950 /// .set_vlan_attachments([
8951 /// IntakeVlanAttachment::default()/* use setters */,
8952 /// IntakeVlanAttachment::default()/* use (different) setters */,
8953 /// ]);
8954 /// ```
8955 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
8956 where
8957 T: std::iter::IntoIterator<Item = V>,
8958 V: std::convert::Into<crate::model::network_config::IntakeVlanAttachment>,
8959 {
8960 use std::iter::Iterator;
8961 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
8962 self
8963 }
8964
8965 /// Sets the value of [cidr][crate::model::NetworkConfig::cidr].
8966 ///
8967 /// # Example
8968 /// ```ignore,no_run
8969 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8970 /// let x = NetworkConfig::new().set_cidr("example");
8971 /// ```
8972 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8973 self.cidr = v.into();
8974 self
8975 }
8976
8977 /// Sets the value of [service_cidr][crate::model::NetworkConfig::service_cidr].
8978 ///
8979 /// # Example
8980 /// ```ignore,no_run
8981 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8982 /// use google_cloud_baremetalsolution_v2::model::network_config::ServiceCidr;
8983 /// let x0 = NetworkConfig::new().set_service_cidr(ServiceCidr::Disabled);
8984 /// let x1 = NetworkConfig::new().set_service_cidr(ServiceCidr::High26);
8985 /// let x2 = NetworkConfig::new().set_service_cidr(ServiceCidr::High27);
8986 /// ```
8987 pub fn set_service_cidr<T: std::convert::Into<crate::model::network_config::ServiceCidr>>(
8988 mut self,
8989 v: T,
8990 ) -> Self {
8991 self.service_cidr = v.into();
8992 self
8993 }
8994
8995 /// Sets the value of [user_note][crate::model::NetworkConfig::user_note].
8996 ///
8997 /// # Example
8998 /// ```ignore,no_run
8999 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
9000 /// let x = NetworkConfig::new().set_user_note("example");
9001 /// ```
9002 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9003 self.user_note = v.into();
9004 self
9005 }
9006
9007 /// Sets the value of [gcp_service][crate::model::NetworkConfig::gcp_service].
9008 ///
9009 /// # Example
9010 /// ```ignore,no_run
9011 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
9012 /// let x = NetworkConfig::new().set_gcp_service("example");
9013 /// ```
9014 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9015 self.gcp_service = v.into();
9016 self
9017 }
9018
9019 /// Sets the value of [vlan_same_project][crate::model::NetworkConfig::vlan_same_project].
9020 ///
9021 /// # Example
9022 /// ```ignore,no_run
9023 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
9024 /// let x = NetworkConfig::new().set_vlan_same_project(true);
9025 /// ```
9026 pub fn set_vlan_same_project<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9027 self.vlan_same_project = v.into();
9028 self
9029 }
9030
9031 /// Sets the value of [jumbo_frames_enabled][crate::model::NetworkConfig::jumbo_frames_enabled].
9032 ///
9033 /// # Example
9034 /// ```ignore,no_run
9035 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
9036 /// let x = NetworkConfig::new().set_jumbo_frames_enabled(true);
9037 /// ```
9038 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9039 self.jumbo_frames_enabled = v.into();
9040 self
9041 }
9042}
9043
9044impl wkt::message::Message for NetworkConfig {
9045 fn typename() -> &'static str {
9046 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig"
9047 }
9048}
9049
9050/// Defines additional types related to [NetworkConfig].
9051pub mod network_config {
9052 #[allow(unused_imports)]
9053 use super::*;
9054
9055 /// A GCP vlan attachment.
9056 #[derive(Clone, Default, PartialEq)]
9057 #[non_exhaustive]
9058 pub struct IntakeVlanAttachment {
9059 /// Identifier of the VLAN attachment.
9060 pub id: std::string::String,
9061
9062 /// Attachment pairing key.
9063 pub pairing_key: std::string::String,
9064
9065 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9066 }
9067
9068 impl IntakeVlanAttachment {
9069 /// Creates a new default instance.
9070 pub fn new() -> Self {
9071 std::default::Default::default()
9072 }
9073
9074 /// Sets the value of [id][crate::model::network_config::IntakeVlanAttachment::id].
9075 ///
9076 /// # Example
9077 /// ```ignore,no_run
9078 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
9079 /// let x = IntakeVlanAttachment::new().set_id("example");
9080 /// ```
9081 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9082 self.id = v.into();
9083 self
9084 }
9085
9086 /// Sets the value of [pairing_key][crate::model::network_config::IntakeVlanAttachment::pairing_key].
9087 ///
9088 /// # Example
9089 /// ```ignore,no_run
9090 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
9091 /// let x = IntakeVlanAttachment::new().set_pairing_key("example");
9092 /// ```
9093 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9094 self.pairing_key = v.into();
9095 self
9096 }
9097 }
9098
9099 impl wkt::message::Message for IntakeVlanAttachment {
9100 fn typename() -> &'static str {
9101 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig.IntakeVlanAttachment"
9102 }
9103 }
9104
9105 /// Network type.
9106 ///
9107 /// # Working with unknown values
9108 ///
9109 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9110 /// additional enum variants at any time. Adding new variants is not considered
9111 /// a breaking change. Applications should write their code in anticipation of:
9112 ///
9113 /// - New values appearing in future releases of the client library, **and**
9114 /// - New values received dynamically, without application changes.
9115 ///
9116 /// Please consult the [Working with enums] section in the user guide for some
9117 /// guidelines.
9118 ///
9119 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9120 #[derive(Clone, Debug, PartialEq)]
9121 #[non_exhaustive]
9122 pub enum Type {
9123 /// Unspecified value.
9124 Unspecified,
9125 /// Client network, that is a network peered to a GCP VPC.
9126 Client,
9127 /// Private network, that is a network local to the BMS POD.
9128 Private,
9129 /// If set, the enum was initialized with an unknown value.
9130 ///
9131 /// Applications can examine the value using [Type::value] or
9132 /// [Type::name].
9133 UnknownValue(r#type::UnknownValue),
9134 }
9135
9136 #[doc(hidden)]
9137 pub mod r#type {
9138 #[allow(unused_imports)]
9139 use super::*;
9140 #[derive(Clone, Debug, PartialEq)]
9141 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9142 }
9143
9144 impl Type {
9145 /// Gets the enum value.
9146 ///
9147 /// Returns `None` if the enum contains an unknown value deserialized from
9148 /// the string representation of enums.
9149 pub fn value(&self) -> std::option::Option<i32> {
9150 match self {
9151 Self::Unspecified => std::option::Option::Some(0),
9152 Self::Client => std::option::Option::Some(1),
9153 Self::Private => std::option::Option::Some(2),
9154 Self::UnknownValue(u) => u.0.value(),
9155 }
9156 }
9157
9158 /// Gets the enum value as a string.
9159 ///
9160 /// Returns `None` if the enum contains an unknown value deserialized from
9161 /// the integer representation of enums.
9162 pub fn name(&self) -> std::option::Option<&str> {
9163 match self {
9164 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
9165 Self::Client => std::option::Option::Some("CLIENT"),
9166 Self::Private => std::option::Option::Some("PRIVATE"),
9167 Self::UnknownValue(u) => u.0.name(),
9168 }
9169 }
9170 }
9171
9172 impl std::default::Default for Type {
9173 fn default() -> Self {
9174 use std::convert::From;
9175 Self::from(0)
9176 }
9177 }
9178
9179 impl std::fmt::Display for Type {
9180 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9181 wkt::internal::display_enum(f, self.name(), self.value())
9182 }
9183 }
9184
9185 impl std::convert::From<i32> for Type {
9186 fn from(value: i32) -> Self {
9187 match value {
9188 0 => Self::Unspecified,
9189 1 => Self::Client,
9190 2 => Self::Private,
9191 _ => Self::UnknownValue(r#type::UnknownValue(
9192 wkt::internal::UnknownEnumValue::Integer(value),
9193 )),
9194 }
9195 }
9196 }
9197
9198 impl std::convert::From<&str> for Type {
9199 fn from(value: &str) -> Self {
9200 use std::string::ToString;
9201 match value {
9202 "TYPE_UNSPECIFIED" => Self::Unspecified,
9203 "CLIENT" => Self::Client,
9204 "PRIVATE" => Self::Private,
9205 _ => Self::UnknownValue(r#type::UnknownValue(
9206 wkt::internal::UnknownEnumValue::String(value.to_string()),
9207 )),
9208 }
9209 }
9210 }
9211
9212 impl serde::ser::Serialize for Type {
9213 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9214 where
9215 S: serde::Serializer,
9216 {
9217 match self {
9218 Self::Unspecified => serializer.serialize_i32(0),
9219 Self::Client => serializer.serialize_i32(1),
9220 Self::Private => serializer.serialize_i32(2),
9221 Self::UnknownValue(u) => u.0.serialize(serializer),
9222 }
9223 }
9224 }
9225
9226 impl<'de> serde::de::Deserialize<'de> for Type {
9227 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9228 where
9229 D: serde::Deserializer<'de>,
9230 {
9231 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
9232 ".google.cloud.baremetalsolution.v2.NetworkConfig.Type",
9233 ))
9234 }
9235 }
9236
9237 /// Interconnect bandwidth.
9238 ///
9239 /// # Working with unknown values
9240 ///
9241 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9242 /// additional enum variants at any time. Adding new variants is not considered
9243 /// a breaking change. Applications should write their code in anticipation of:
9244 ///
9245 /// - New values appearing in future releases of the client library, **and**
9246 /// - New values received dynamically, without application changes.
9247 ///
9248 /// Please consult the [Working with enums] section in the user guide for some
9249 /// guidelines.
9250 ///
9251 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9252 #[derive(Clone, Debug, PartialEq)]
9253 #[non_exhaustive]
9254 pub enum Bandwidth {
9255 /// Unspecified value.
9256 Unspecified,
9257 /// 1 Gbps.
9258 Bw1Gbps,
9259 /// 2 Gbps.
9260 Bw2Gbps,
9261 /// 5 Gbps.
9262 Bw5Gbps,
9263 /// 10 Gbps.
9264 Bw10Gbps,
9265 /// If set, the enum was initialized with an unknown value.
9266 ///
9267 /// Applications can examine the value using [Bandwidth::value] or
9268 /// [Bandwidth::name].
9269 UnknownValue(bandwidth::UnknownValue),
9270 }
9271
9272 #[doc(hidden)]
9273 pub mod bandwidth {
9274 #[allow(unused_imports)]
9275 use super::*;
9276 #[derive(Clone, Debug, PartialEq)]
9277 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9278 }
9279
9280 impl Bandwidth {
9281 /// Gets the enum value.
9282 ///
9283 /// Returns `None` if the enum contains an unknown value deserialized from
9284 /// the string representation of enums.
9285 pub fn value(&self) -> std::option::Option<i32> {
9286 match self {
9287 Self::Unspecified => std::option::Option::Some(0),
9288 Self::Bw1Gbps => std::option::Option::Some(1),
9289 Self::Bw2Gbps => std::option::Option::Some(2),
9290 Self::Bw5Gbps => std::option::Option::Some(3),
9291 Self::Bw10Gbps => std::option::Option::Some(4),
9292 Self::UnknownValue(u) => u.0.value(),
9293 }
9294 }
9295
9296 /// Gets the enum value as a string.
9297 ///
9298 /// Returns `None` if the enum contains an unknown value deserialized from
9299 /// the integer representation of enums.
9300 pub fn name(&self) -> std::option::Option<&str> {
9301 match self {
9302 Self::Unspecified => std::option::Option::Some("BANDWIDTH_UNSPECIFIED"),
9303 Self::Bw1Gbps => std::option::Option::Some("BW_1_GBPS"),
9304 Self::Bw2Gbps => std::option::Option::Some("BW_2_GBPS"),
9305 Self::Bw5Gbps => std::option::Option::Some("BW_5_GBPS"),
9306 Self::Bw10Gbps => std::option::Option::Some("BW_10_GBPS"),
9307 Self::UnknownValue(u) => u.0.name(),
9308 }
9309 }
9310 }
9311
9312 impl std::default::Default for Bandwidth {
9313 fn default() -> Self {
9314 use std::convert::From;
9315 Self::from(0)
9316 }
9317 }
9318
9319 impl std::fmt::Display for Bandwidth {
9320 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9321 wkt::internal::display_enum(f, self.name(), self.value())
9322 }
9323 }
9324
9325 impl std::convert::From<i32> for Bandwidth {
9326 fn from(value: i32) -> Self {
9327 match value {
9328 0 => Self::Unspecified,
9329 1 => Self::Bw1Gbps,
9330 2 => Self::Bw2Gbps,
9331 3 => Self::Bw5Gbps,
9332 4 => Self::Bw10Gbps,
9333 _ => Self::UnknownValue(bandwidth::UnknownValue(
9334 wkt::internal::UnknownEnumValue::Integer(value),
9335 )),
9336 }
9337 }
9338 }
9339
9340 impl std::convert::From<&str> for Bandwidth {
9341 fn from(value: &str) -> Self {
9342 use std::string::ToString;
9343 match value {
9344 "BANDWIDTH_UNSPECIFIED" => Self::Unspecified,
9345 "BW_1_GBPS" => Self::Bw1Gbps,
9346 "BW_2_GBPS" => Self::Bw2Gbps,
9347 "BW_5_GBPS" => Self::Bw5Gbps,
9348 "BW_10_GBPS" => Self::Bw10Gbps,
9349 _ => Self::UnknownValue(bandwidth::UnknownValue(
9350 wkt::internal::UnknownEnumValue::String(value.to_string()),
9351 )),
9352 }
9353 }
9354 }
9355
9356 impl serde::ser::Serialize for Bandwidth {
9357 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9358 where
9359 S: serde::Serializer,
9360 {
9361 match self {
9362 Self::Unspecified => serializer.serialize_i32(0),
9363 Self::Bw1Gbps => serializer.serialize_i32(1),
9364 Self::Bw2Gbps => serializer.serialize_i32(2),
9365 Self::Bw5Gbps => serializer.serialize_i32(3),
9366 Self::Bw10Gbps => serializer.serialize_i32(4),
9367 Self::UnknownValue(u) => u.0.serialize(serializer),
9368 }
9369 }
9370 }
9371
9372 impl<'de> serde::de::Deserialize<'de> for Bandwidth {
9373 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9374 where
9375 D: serde::Deserializer<'de>,
9376 {
9377 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Bandwidth>::new(
9378 ".google.cloud.baremetalsolution.v2.NetworkConfig.Bandwidth",
9379 ))
9380 }
9381 }
9382
9383 /// Service network block.
9384 ///
9385 /// # Working with unknown values
9386 ///
9387 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9388 /// additional enum variants at any time. Adding new variants is not considered
9389 /// a breaking change. Applications should write their code in anticipation of:
9390 ///
9391 /// - New values appearing in future releases of the client library, **and**
9392 /// - New values received dynamically, without application changes.
9393 ///
9394 /// Please consult the [Working with enums] section in the user guide for some
9395 /// guidelines.
9396 ///
9397 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9398 #[derive(Clone, Debug, PartialEq)]
9399 #[non_exhaustive]
9400 pub enum ServiceCidr {
9401 /// Unspecified value.
9402 Unspecified,
9403 /// Services are disabled for the given network.
9404 Disabled,
9405 /// Use the highest /26 block of the network to host services.
9406 High26,
9407 /// Use the highest /27 block of the network to host services.
9408 High27,
9409 /// Use the highest /28 block of the network to host services.
9410 High28,
9411 /// If set, the enum was initialized with an unknown value.
9412 ///
9413 /// Applications can examine the value using [ServiceCidr::value] or
9414 /// [ServiceCidr::name].
9415 UnknownValue(service_cidr::UnknownValue),
9416 }
9417
9418 #[doc(hidden)]
9419 pub mod service_cidr {
9420 #[allow(unused_imports)]
9421 use super::*;
9422 #[derive(Clone, Debug, PartialEq)]
9423 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9424 }
9425
9426 impl ServiceCidr {
9427 /// Gets the enum value.
9428 ///
9429 /// Returns `None` if the enum contains an unknown value deserialized from
9430 /// the string representation of enums.
9431 pub fn value(&self) -> std::option::Option<i32> {
9432 match self {
9433 Self::Unspecified => std::option::Option::Some(0),
9434 Self::Disabled => std::option::Option::Some(1),
9435 Self::High26 => std::option::Option::Some(2),
9436 Self::High27 => std::option::Option::Some(3),
9437 Self::High28 => std::option::Option::Some(4),
9438 Self::UnknownValue(u) => u.0.value(),
9439 }
9440 }
9441
9442 /// Gets the enum value as a string.
9443 ///
9444 /// Returns `None` if the enum contains an unknown value deserialized from
9445 /// the integer representation of enums.
9446 pub fn name(&self) -> std::option::Option<&str> {
9447 match self {
9448 Self::Unspecified => std::option::Option::Some("SERVICE_CIDR_UNSPECIFIED"),
9449 Self::Disabled => std::option::Option::Some("DISABLED"),
9450 Self::High26 => std::option::Option::Some("HIGH_26"),
9451 Self::High27 => std::option::Option::Some("HIGH_27"),
9452 Self::High28 => std::option::Option::Some("HIGH_28"),
9453 Self::UnknownValue(u) => u.0.name(),
9454 }
9455 }
9456 }
9457
9458 impl std::default::Default for ServiceCidr {
9459 fn default() -> Self {
9460 use std::convert::From;
9461 Self::from(0)
9462 }
9463 }
9464
9465 impl std::fmt::Display for ServiceCidr {
9466 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9467 wkt::internal::display_enum(f, self.name(), self.value())
9468 }
9469 }
9470
9471 impl std::convert::From<i32> for ServiceCidr {
9472 fn from(value: i32) -> Self {
9473 match value {
9474 0 => Self::Unspecified,
9475 1 => Self::Disabled,
9476 2 => Self::High26,
9477 3 => Self::High27,
9478 4 => Self::High28,
9479 _ => Self::UnknownValue(service_cidr::UnknownValue(
9480 wkt::internal::UnknownEnumValue::Integer(value),
9481 )),
9482 }
9483 }
9484 }
9485
9486 impl std::convert::From<&str> for ServiceCidr {
9487 fn from(value: &str) -> Self {
9488 use std::string::ToString;
9489 match value {
9490 "SERVICE_CIDR_UNSPECIFIED" => Self::Unspecified,
9491 "DISABLED" => Self::Disabled,
9492 "HIGH_26" => Self::High26,
9493 "HIGH_27" => Self::High27,
9494 "HIGH_28" => Self::High28,
9495 _ => Self::UnknownValue(service_cidr::UnknownValue(
9496 wkt::internal::UnknownEnumValue::String(value.to_string()),
9497 )),
9498 }
9499 }
9500 }
9501
9502 impl serde::ser::Serialize for ServiceCidr {
9503 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9504 where
9505 S: serde::Serializer,
9506 {
9507 match self {
9508 Self::Unspecified => serializer.serialize_i32(0),
9509 Self::Disabled => serializer.serialize_i32(1),
9510 Self::High26 => serializer.serialize_i32(2),
9511 Self::High27 => serializer.serialize_i32(3),
9512 Self::High28 => serializer.serialize_i32(4),
9513 Self::UnknownValue(u) => u.0.serialize(serializer),
9514 }
9515 }
9516 }
9517
9518 impl<'de> serde::de::Deserialize<'de> for ServiceCidr {
9519 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9520 where
9521 D: serde::Deserializer<'de>,
9522 {
9523 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceCidr>::new(
9524 ".google.cloud.baremetalsolution.v2.NetworkConfig.ServiceCidr",
9525 ))
9526 }
9527 }
9528}
9529
9530/// A resource budget.
9531#[derive(Clone, Default, PartialEq)]
9532#[non_exhaustive]
9533pub struct InstanceQuota {
9534 /// Output only. The name of the instance quota.
9535 pub name: std::string::String,
9536
9537 /// Instance type.
9538 /// Deprecated: use gcp_service.
9539 #[deprecated]
9540 pub instance_type: std::string::String,
9541
9542 /// The gcp service of the provisioning quota.
9543 pub gcp_service: std::string::String,
9544
9545 /// Location where the quota applies.
9546 pub location: std::string::String,
9547
9548 /// Number of machines than can be created for the given location and
9549 /// instance_type.
9550 pub available_machine_count: i32,
9551
9552 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9553}
9554
9555impl InstanceQuota {
9556 /// Creates a new default instance.
9557 pub fn new() -> Self {
9558 std::default::Default::default()
9559 }
9560
9561 /// Sets the value of [name][crate::model::InstanceQuota::name].
9562 ///
9563 /// # Example
9564 /// ```ignore,no_run
9565 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9566 /// # let project_id = "project_id";
9567 /// # let location_id = "location_id";
9568 /// # let instance_quota_id = "instance_quota_id";
9569 /// let x = InstanceQuota::new().set_name(format!("projects/{project_id}/locations/{location_id}/instanceQuotas/{instance_quota_id}"));
9570 /// ```
9571 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9572 self.name = v.into();
9573 self
9574 }
9575
9576 /// Sets the value of [instance_type][crate::model::InstanceQuota::instance_type].
9577 ///
9578 /// # Example
9579 /// ```ignore,no_run
9580 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9581 /// let x = InstanceQuota::new().set_instance_type("example");
9582 /// ```
9583 #[deprecated]
9584 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9585 self.instance_type = v.into();
9586 self
9587 }
9588
9589 /// Sets the value of [gcp_service][crate::model::InstanceQuota::gcp_service].
9590 ///
9591 /// # Example
9592 /// ```ignore,no_run
9593 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9594 /// let x = InstanceQuota::new().set_gcp_service("example");
9595 /// ```
9596 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9597 self.gcp_service = v.into();
9598 self
9599 }
9600
9601 /// Sets the value of [location][crate::model::InstanceQuota::location].
9602 ///
9603 /// # Example
9604 /// ```ignore,no_run
9605 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9606 /// let x = InstanceQuota::new().set_location("example");
9607 /// ```
9608 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9609 self.location = v.into();
9610 self
9611 }
9612
9613 /// Sets the value of [available_machine_count][crate::model::InstanceQuota::available_machine_count].
9614 ///
9615 /// # Example
9616 /// ```ignore,no_run
9617 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9618 /// let x = InstanceQuota::new().set_available_machine_count(42);
9619 /// ```
9620 pub fn set_available_machine_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9621 self.available_machine_count = v.into();
9622 self
9623 }
9624}
9625
9626impl wkt::message::Message for InstanceQuota {
9627 fn typename() -> &'static str {
9628 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceQuota"
9629 }
9630}
9631
9632/// Request for GetProvisioningConfig.
9633#[derive(Clone, Default, PartialEq)]
9634#[non_exhaustive]
9635pub struct GetProvisioningConfigRequest {
9636 /// Required. Name of the ProvisioningConfig.
9637 pub name: std::string::String,
9638
9639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9640}
9641
9642impl GetProvisioningConfigRequest {
9643 /// Creates a new default instance.
9644 pub fn new() -> Self {
9645 std::default::Default::default()
9646 }
9647
9648 /// Sets the value of [name][crate::model::GetProvisioningConfigRequest::name].
9649 ///
9650 /// # Example
9651 /// ```ignore,no_run
9652 /// # use google_cloud_baremetalsolution_v2::model::GetProvisioningConfigRequest;
9653 /// # let project_id = "project_id";
9654 /// # let location_id = "location_id";
9655 /// # let provisioning_config_id = "provisioning_config_id";
9656 /// let x = GetProvisioningConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/provisioningConfigs/{provisioning_config_id}"));
9657 /// ```
9658 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9659 self.name = v.into();
9660 self
9661 }
9662}
9663
9664impl wkt::message::Message for GetProvisioningConfigRequest {
9665 fn typename() -> &'static str {
9666 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetProvisioningConfigRequest"
9667 }
9668}
9669
9670/// Request for CreateProvisioningConfig.
9671#[derive(Clone, Default, PartialEq)]
9672#[non_exhaustive]
9673pub struct CreateProvisioningConfigRequest {
9674 /// Required. The parent project and location containing the
9675 /// ProvisioningConfig.
9676 pub parent: std::string::String,
9677
9678 /// Required. The ProvisioningConfig to create.
9679 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9680
9681 /// Optional. Email provided to send a confirmation with provisioning config
9682 /// to.
9683 pub email: std::string::String,
9684
9685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9686}
9687
9688impl CreateProvisioningConfigRequest {
9689 /// Creates a new default instance.
9690 pub fn new() -> Self {
9691 std::default::Default::default()
9692 }
9693
9694 /// Sets the value of [parent][crate::model::CreateProvisioningConfigRequest::parent].
9695 ///
9696 /// # Example
9697 /// ```ignore,no_run
9698 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9699 /// let x = CreateProvisioningConfigRequest::new().set_parent("example");
9700 /// ```
9701 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9702 self.parent = v.into();
9703 self
9704 }
9705
9706 /// Sets the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9707 ///
9708 /// # Example
9709 /// ```ignore,no_run
9710 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9711 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9712 /// let x = CreateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9713 /// ```
9714 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9715 where
9716 T: std::convert::Into<crate::model::ProvisioningConfig>,
9717 {
9718 self.provisioning_config = std::option::Option::Some(v.into());
9719 self
9720 }
9721
9722 /// Sets or clears the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9723 ///
9724 /// # Example
9725 /// ```ignore,no_run
9726 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9727 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9728 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9729 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9730 /// ```
9731 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9732 where
9733 T: std::convert::Into<crate::model::ProvisioningConfig>,
9734 {
9735 self.provisioning_config = v.map(|x| x.into());
9736 self
9737 }
9738
9739 /// Sets the value of [email][crate::model::CreateProvisioningConfigRequest::email].
9740 ///
9741 /// # Example
9742 /// ```ignore,no_run
9743 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9744 /// let x = CreateProvisioningConfigRequest::new().set_email("example");
9745 /// ```
9746 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9747 self.email = v.into();
9748 self
9749 }
9750}
9751
9752impl wkt::message::Message for CreateProvisioningConfigRequest {
9753 fn typename() -> &'static str {
9754 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateProvisioningConfigRequest"
9755 }
9756}
9757
9758/// Message for updating a ProvisioningConfig.
9759#[derive(Clone, Default, PartialEq)]
9760#[non_exhaustive]
9761pub struct UpdateProvisioningConfigRequest {
9762 /// Required. The ProvisioningConfig to update.
9763 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9764
9765 /// Required. The list of fields to update.
9766 pub update_mask: std::option::Option<wkt::FieldMask>,
9767
9768 /// Optional. Email provided to send a confirmation with provisioning config
9769 /// to.
9770 pub email: std::string::String,
9771
9772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9773}
9774
9775impl UpdateProvisioningConfigRequest {
9776 /// Creates a new default instance.
9777 pub fn new() -> Self {
9778 std::default::Default::default()
9779 }
9780
9781 /// Sets the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9782 ///
9783 /// # Example
9784 /// ```ignore,no_run
9785 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9786 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9787 /// let x = UpdateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9788 /// ```
9789 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9790 where
9791 T: std::convert::Into<crate::model::ProvisioningConfig>,
9792 {
9793 self.provisioning_config = std::option::Option::Some(v.into());
9794 self
9795 }
9796
9797 /// Sets or clears the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9798 ///
9799 /// # Example
9800 /// ```ignore,no_run
9801 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9802 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9803 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9804 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9805 /// ```
9806 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9807 where
9808 T: std::convert::Into<crate::model::ProvisioningConfig>,
9809 {
9810 self.provisioning_config = v.map(|x| x.into());
9811 self
9812 }
9813
9814 /// Sets the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9815 ///
9816 /// # Example
9817 /// ```ignore,no_run
9818 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9819 /// use wkt::FieldMask;
9820 /// let x = UpdateProvisioningConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9821 /// ```
9822 pub fn set_update_mask<T>(mut self, v: T) -> Self
9823 where
9824 T: std::convert::Into<wkt::FieldMask>,
9825 {
9826 self.update_mask = std::option::Option::Some(v.into());
9827 self
9828 }
9829
9830 /// Sets or clears the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9831 ///
9832 /// # Example
9833 /// ```ignore,no_run
9834 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9835 /// use wkt::FieldMask;
9836 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9837 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9838 /// ```
9839 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9840 where
9841 T: std::convert::Into<wkt::FieldMask>,
9842 {
9843 self.update_mask = v.map(|x| x.into());
9844 self
9845 }
9846
9847 /// Sets the value of [email][crate::model::UpdateProvisioningConfigRequest::email].
9848 ///
9849 /// # Example
9850 /// ```ignore,no_run
9851 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9852 /// let x = UpdateProvisioningConfigRequest::new().set_email("example");
9853 /// ```
9854 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9855 self.email = v.into();
9856 self
9857 }
9858}
9859
9860impl wkt::message::Message for UpdateProvisioningConfigRequest {
9861 fn typename() -> &'static str {
9862 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateProvisioningConfigRequest"
9863 }
9864}
9865
9866/// An SSH key, used for authorizing with the interactive serial console feature.
9867#[derive(Clone, Default, PartialEq)]
9868#[non_exhaustive]
9869pub struct SSHKey {
9870 /// Output only. The name of this SSH key.
9871 /// Currently, the only valid value for the location is "global".
9872 pub name: std::string::String,
9873
9874 /// The public SSH key. This must be in OpenSSH .authorized_keys format.
9875 pub public_key: std::string::String,
9876
9877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9878}
9879
9880impl SSHKey {
9881 /// Creates a new default instance.
9882 pub fn new() -> Self {
9883 std::default::Default::default()
9884 }
9885
9886 /// Sets the value of [name][crate::model::SSHKey::name].
9887 ///
9888 /// # Example
9889 /// ```ignore,no_run
9890 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9891 /// # let project_id = "project_id";
9892 /// # let location_id = "location_id";
9893 /// # let ssh_key_id = "ssh_key_id";
9894 /// let x = SSHKey::new().set_name(format!("projects/{project_id}/locations/{location_id}/sshKeys/{ssh_key_id}"));
9895 /// ```
9896 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9897 self.name = v.into();
9898 self
9899 }
9900
9901 /// Sets the value of [public_key][crate::model::SSHKey::public_key].
9902 ///
9903 /// # Example
9904 /// ```ignore,no_run
9905 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9906 /// let x = SSHKey::new().set_public_key("example");
9907 /// ```
9908 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9909 self.public_key = v.into();
9910 self
9911 }
9912}
9913
9914impl wkt::message::Message for SSHKey {
9915 fn typename() -> &'static str {
9916 "type.googleapis.com/google.cloud.baremetalsolution.v2.SSHKey"
9917 }
9918}
9919
9920/// Message for listing the public SSH keys in a project.
9921#[derive(Clone, Default, PartialEq)]
9922#[non_exhaustive]
9923pub struct ListSSHKeysRequest {
9924 /// Required. The parent containing the SSH keys.
9925 /// Currently, the only valid value for the location is "global".
9926 pub parent: std::string::String,
9927
9928 /// The maximum number of items to return.
9929 pub page_size: i32,
9930
9931 /// The next_page_token value returned from a previous List request, if any.
9932 pub page_token: std::string::String,
9933
9934 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9935}
9936
9937impl ListSSHKeysRequest {
9938 /// Creates a new default instance.
9939 pub fn new() -> Self {
9940 std::default::Default::default()
9941 }
9942
9943 /// Sets the value of [parent][crate::model::ListSSHKeysRequest::parent].
9944 ///
9945 /// # Example
9946 /// ```ignore,no_run
9947 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9948 /// let x = ListSSHKeysRequest::new().set_parent("example");
9949 /// ```
9950 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9951 self.parent = v.into();
9952 self
9953 }
9954
9955 /// Sets the value of [page_size][crate::model::ListSSHKeysRequest::page_size].
9956 ///
9957 /// # Example
9958 /// ```ignore,no_run
9959 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9960 /// let x = ListSSHKeysRequest::new().set_page_size(42);
9961 /// ```
9962 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9963 self.page_size = v.into();
9964 self
9965 }
9966
9967 /// Sets the value of [page_token][crate::model::ListSSHKeysRequest::page_token].
9968 ///
9969 /// # Example
9970 /// ```ignore,no_run
9971 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9972 /// let x = ListSSHKeysRequest::new().set_page_token("example");
9973 /// ```
9974 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9975 self.page_token = v.into();
9976 self
9977 }
9978}
9979
9980impl wkt::message::Message for ListSSHKeysRequest {
9981 fn typename() -> &'static str {
9982 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysRequest"
9983 }
9984}
9985
9986/// Message for response of ListSSHKeys.
9987#[derive(Clone, Default, PartialEq)]
9988#[non_exhaustive]
9989pub struct ListSSHKeysResponse {
9990 /// The SSH keys registered in the project.
9991 pub ssh_keys: std::vec::Vec<crate::model::SSHKey>,
9992
9993 /// Token to retrieve the next page of results, or empty if there are no more
9994 /// results in the list.
9995 pub next_page_token: std::string::String,
9996
9997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9998}
9999
10000impl ListSSHKeysResponse {
10001 /// Creates a new default instance.
10002 pub fn new() -> Self {
10003 std::default::Default::default()
10004 }
10005
10006 /// Sets the value of [ssh_keys][crate::model::ListSSHKeysResponse::ssh_keys].
10007 ///
10008 /// # Example
10009 /// ```ignore,no_run
10010 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
10011 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
10012 /// let x = ListSSHKeysResponse::new()
10013 /// .set_ssh_keys([
10014 /// SSHKey::default()/* use setters */,
10015 /// SSHKey::default()/* use (different) setters */,
10016 /// ]);
10017 /// ```
10018 pub fn set_ssh_keys<T, V>(mut self, v: T) -> Self
10019 where
10020 T: std::iter::IntoIterator<Item = V>,
10021 V: std::convert::Into<crate::model::SSHKey>,
10022 {
10023 use std::iter::Iterator;
10024 self.ssh_keys = v.into_iter().map(|i| i.into()).collect();
10025 self
10026 }
10027
10028 /// Sets the value of [next_page_token][crate::model::ListSSHKeysResponse::next_page_token].
10029 ///
10030 /// # Example
10031 /// ```ignore,no_run
10032 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
10033 /// let x = ListSSHKeysResponse::new().set_next_page_token("example");
10034 /// ```
10035 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10036 self.next_page_token = v.into();
10037 self
10038 }
10039}
10040
10041impl wkt::message::Message for ListSSHKeysResponse {
10042 fn typename() -> &'static str {
10043 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysResponse"
10044 }
10045}
10046
10047#[doc(hidden)]
10048impl google_cloud_gax::paginator::internal::PageableResponse for ListSSHKeysResponse {
10049 type PageItem = crate::model::SSHKey;
10050
10051 fn items(self) -> std::vec::Vec<Self::PageItem> {
10052 self.ssh_keys
10053 }
10054
10055 fn next_page_token(&self) -> std::string::String {
10056 use std::clone::Clone;
10057 self.next_page_token.clone()
10058 }
10059}
10060
10061/// Message for registering a public SSH key in a project.
10062#[derive(Clone, Default, PartialEq)]
10063#[non_exhaustive]
10064pub struct CreateSSHKeyRequest {
10065 /// Required. The parent containing the SSH keys.
10066 pub parent: std::string::String,
10067
10068 /// Required. The SSH key to register.
10069 pub ssh_key: std::option::Option<crate::model::SSHKey>,
10070
10071 /// Required. The ID to use for the key, which will become the final component
10072 /// of the key's resource name.
10073 ///
10074 /// This value must match the regex:
10075 /// [a-zA-Z0-9@.\-_]{1,64}
10076 pub ssh_key_id: std::string::String,
10077
10078 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10079}
10080
10081impl CreateSSHKeyRequest {
10082 /// Creates a new default instance.
10083 pub fn new() -> Self {
10084 std::default::Default::default()
10085 }
10086
10087 /// Sets the value of [parent][crate::model::CreateSSHKeyRequest::parent].
10088 ///
10089 /// # Example
10090 /// ```ignore,no_run
10091 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10092 /// let x = CreateSSHKeyRequest::new().set_parent("example");
10093 /// ```
10094 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10095 self.parent = v.into();
10096 self
10097 }
10098
10099 /// Sets the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
10100 ///
10101 /// # Example
10102 /// ```ignore,no_run
10103 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10104 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
10105 /// let x = CreateSSHKeyRequest::new().set_ssh_key(SSHKey::default()/* use setters */);
10106 /// ```
10107 pub fn set_ssh_key<T>(mut self, v: T) -> Self
10108 where
10109 T: std::convert::Into<crate::model::SSHKey>,
10110 {
10111 self.ssh_key = std::option::Option::Some(v.into());
10112 self
10113 }
10114
10115 /// Sets or clears the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
10116 ///
10117 /// # Example
10118 /// ```ignore,no_run
10119 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10120 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
10121 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(Some(SSHKey::default()/* use setters */));
10122 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(None::<SSHKey>);
10123 /// ```
10124 pub fn set_or_clear_ssh_key<T>(mut self, v: std::option::Option<T>) -> Self
10125 where
10126 T: std::convert::Into<crate::model::SSHKey>,
10127 {
10128 self.ssh_key = v.map(|x| x.into());
10129 self
10130 }
10131
10132 /// Sets the value of [ssh_key_id][crate::model::CreateSSHKeyRequest::ssh_key_id].
10133 ///
10134 /// # Example
10135 /// ```ignore,no_run
10136 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10137 /// let x = CreateSSHKeyRequest::new().set_ssh_key_id("example");
10138 /// ```
10139 pub fn set_ssh_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10140 self.ssh_key_id = v.into();
10141 self
10142 }
10143}
10144
10145impl wkt::message::Message for CreateSSHKeyRequest {
10146 fn typename() -> &'static str {
10147 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateSSHKeyRequest"
10148 }
10149}
10150
10151/// Message for deleting an SSH key from a project.
10152#[derive(Clone, Default, PartialEq)]
10153#[non_exhaustive]
10154pub struct DeleteSSHKeyRequest {
10155 /// Required. The name of the SSH key to delete.
10156 /// Currently, the only valid value for the location is "global".
10157 pub name: std::string::String,
10158
10159 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10160}
10161
10162impl DeleteSSHKeyRequest {
10163 /// Creates a new default instance.
10164 pub fn new() -> Self {
10165 std::default::Default::default()
10166 }
10167
10168 /// Sets the value of [name][crate::model::DeleteSSHKeyRequest::name].
10169 ///
10170 /// # Example
10171 /// ```ignore,no_run
10172 /// # use google_cloud_baremetalsolution_v2::model::DeleteSSHKeyRequest;
10173 /// # let project_id = "project_id";
10174 /// # let location_id = "location_id";
10175 /// # let ssh_key_id = "ssh_key_id";
10176 /// let x = DeleteSSHKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sshKeys/{ssh_key_id}"));
10177 /// ```
10178 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10179 self.name = v.into();
10180 self
10181 }
10182}
10183
10184impl wkt::message::Message for DeleteSSHKeyRequest {
10185 fn typename() -> &'static str {
10186 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteSSHKeyRequest"
10187 }
10188}
10189
10190/// A storage volume.
10191#[derive(Clone, Default, PartialEq)]
10192#[non_exhaustive]
10193pub struct Volume {
10194 /// Output only. The resource name of this `Volume`.
10195 /// Resource names are schemeless URIs that follow the conventions in
10196 /// <https://cloud.google.com/apis/design/resource_names>.
10197 /// Format:
10198 /// `projects/{project}/locations/{location}/volumes/{volume}`
10199 pub name: std::string::String,
10200
10201 /// An identifier for the `Volume`, generated by the backend.
10202 pub id: std::string::String,
10203
10204 /// The storage type for this volume.
10205 pub storage_type: crate::model::volume::StorageType,
10206
10207 /// The state of this storage volume.
10208 pub state: crate::model::volume::State,
10209
10210 /// The requested size of this storage volume, in GiB.
10211 pub requested_size_gib: i64,
10212
10213 /// Originally requested size, in GiB.
10214 pub originally_requested_size_gib: i64,
10215
10216 /// The current size of this storage volume, in GiB, including space reserved
10217 /// for snapshots. This size might be different than the requested size if the
10218 /// storage volume has been configured with auto grow or auto shrink.
10219 pub current_size_gib: i64,
10220
10221 /// Additional emergency size that was requested for this Volume, in GiB.
10222 /// current_size_gib includes this value.
10223 pub emergency_size_gib: i64,
10224
10225 /// Maximum size volume can be expanded to in case of evergency, in GiB.
10226 pub max_size_gib: i64,
10227
10228 /// The size, in GiB, that this storage volume has expanded as a result of an
10229 /// auto grow policy. In the absence of auto-grow, the value is 0.
10230 pub auto_grown_size_gib: i64,
10231
10232 /// The space remaining in the storage volume for new LUNs, in GiB, excluding
10233 /// space reserved for snapshots.
10234 pub remaining_space_gib: i64,
10235
10236 /// Details about snapshot space reservation and usage on the storage volume.
10237 pub snapshot_reservation_detail:
10238 std::option::Option<crate::model::volume::SnapshotReservationDetail>,
10239
10240 /// The behavior to use when snapshot reserved space is full.
10241 pub snapshot_auto_delete_behavior: crate::model::volume::SnapshotAutoDeleteBehavior,
10242
10243 /// Labels as key value pairs.
10244 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10245
10246 /// Whether snapshots are enabled.
10247 pub snapshot_enabled: bool,
10248
10249 /// Immutable. Pod name.
10250 pub pod: std::string::String,
10251
10252 /// Output only. Storage protocol for the Volume.
10253 pub protocol: crate::model::volume::Protocol,
10254
10255 /// Output only. Whether this volume is a boot volume. A boot volume is one
10256 /// which contains a boot LUN.
10257 pub boot_volume: bool,
10258
10259 /// Immutable. Performance tier of the Volume.
10260 /// Default is SHARED.
10261 pub performance_tier: crate::model::VolumePerformanceTier,
10262
10263 /// Input only. User-specified notes for new Volume.
10264 /// Used to provision Volumes that require manual intervention.
10265 pub notes: std::string::String,
10266
10267 /// The workload profile for the volume.
10268 pub workload_profile: crate::model::volume::WorkloadProfile,
10269
10270 /// Output only. Time after which volume will be fully deleted.
10271 /// It is filled only for volumes in COOLOFF state.
10272 pub expire_time: std::option::Option<wkt::Timestamp>,
10273
10274 /// Output only. Instances this Volume is attached to.
10275 /// This field is set only in Get requests.
10276 pub instances: std::vec::Vec<std::string::String>,
10277
10278 /// Output only. Is the Volume attached at at least one instance.
10279 /// This field is a lightweight counterpart of `instances` field.
10280 /// It is filled in List responses as well.
10281 pub attached: bool,
10282
10283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10284}
10285
10286impl Volume {
10287 /// Creates a new default instance.
10288 pub fn new() -> Self {
10289 std::default::Default::default()
10290 }
10291
10292 /// Sets the value of [name][crate::model::Volume::name].
10293 ///
10294 /// # Example
10295 /// ```ignore,no_run
10296 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10297 /// # let project_id = "project_id";
10298 /// # let location_id = "location_id";
10299 /// # let volume_id = "volume_id";
10300 /// let x = Volume::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
10301 /// ```
10302 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10303 self.name = v.into();
10304 self
10305 }
10306
10307 /// Sets the value of [id][crate::model::Volume::id].
10308 ///
10309 /// # Example
10310 /// ```ignore,no_run
10311 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10312 /// let x = Volume::new().set_id("example");
10313 /// ```
10314 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10315 self.id = v.into();
10316 self
10317 }
10318
10319 /// Sets the value of [storage_type][crate::model::Volume::storage_type].
10320 ///
10321 /// # Example
10322 /// ```ignore,no_run
10323 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10324 /// use google_cloud_baremetalsolution_v2::model::volume::StorageType;
10325 /// let x0 = Volume::new().set_storage_type(StorageType::Ssd);
10326 /// let x1 = Volume::new().set_storage_type(StorageType::Hdd);
10327 /// ```
10328 pub fn set_storage_type<T: std::convert::Into<crate::model::volume::StorageType>>(
10329 mut self,
10330 v: T,
10331 ) -> Self {
10332 self.storage_type = v.into();
10333 self
10334 }
10335
10336 /// Sets the value of [state][crate::model::Volume::state].
10337 ///
10338 /// # Example
10339 /// ```ignore,no_run
10340 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10341 /// use google_cloud_baremetalsolution_v2::model::volume::State;
10342 /// let x0 = Volume::new().set_state(State::Creating);
10343 /// let x1 = Volume::new().set_state(State::Ready);
10344 /// let x2 = Volume::new().set_state(State::Deleting);
10345 /// ```
10346 pub fn set_state<T: std::convert::Into<crate::model::volume::State>>(mut self, v: T) -> Self {
10347 self.state = v.into();
10348 self
10349 }
10350
10351 /// Sets the value of [requested_size_gib][crate::model::Volume::requested_size_gib].
10352 ///
10353 /// # Example
10354 /// ```ignore,no_run
10355 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10356 /// let x = Volume::new().set_requested_size_gib(42);
10357 /// ```
10358 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10359 self.requested_size_gib = v.into();
10360 self
10361 }
10362
10363 /// Sets the value of [originally_requested_size_gib][crate::model::Volume::originally_requested_size_gib].
10364 ///
10365 /// # Example
10366 /// ```ignore,no_run
10367 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10368 /// let x = Volume::new().set_originally_requested_size_gib(42);
10369 /// ```
10370 pub fn set_originally_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10371 self.originally_requested_size_gib = v.into();
10372 self
10373 }
10374
10375 /// Sets the value of [current_size_gib][crate::model::Volume::current_size_gib].
10376 ///
10377 /// # Example
10378 /// ```ignore,no_run
10379 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10380 /// let x = Volume::new().set_current_size_gib(42);
10381 /// ```
10382 pub fn set_current_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10383 self.current_size_gib = v.into();
10384 self
10385 }
10386
10387 /// Sets the value of [emergency_size_gib][crate::model::Volume::emergency_size_gib].
10388 ///
10389 /// # Example
10390 /// ```ignore,no_run
10391 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10392 /// let x = Volume::new().set_emergency_size_gib(42);
10393 /// ```
10394 pub fn set_emergency_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10395 self.emergency_size_gib = v.into();
10396 self
10397 }
10398
10399 /// Sets the value of [max_size_gib][crate::model::Volume::max_size_gib].
10400 ///
10401 /// # Example
10402 /// ```ignore,no_run
10403 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10404 /// let x = Volume::new().set_max_size_gib(42);
10405 /// ```
10406 pub fn set_max_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10407 self.max_size_gib = v.into();
10408 self
10409 }
10410
10411 /// Sets the value of [auto_grown_size_gib][crate::model::Volume::auto_grown_size_gib].
10412 ///
10413 /// # Example
10414 /// ```ignore,no_run
10415 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10416 /// let x = Volume::new().set_auto_grown_size_gib(42);
10417 /// ```
10418 pub fn set_auto_grown_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10419 self.auto_grown_size_gib = v.into();
10420 self
10421 }
10422
10423 /// Sets the value of [remaining_space_gib][crate::model::Volume::remaining_space_gib].
10424 ///
10425 /// # Example
10426 /// ```ignore,no_run
10427 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10428 /// let x = Volume::new().set_remaining_space_gib(42);
10429 /// ```
10430 pub fn set_remaining_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10431 self.remaining_space_gib = v.into();
10432 self
10433 }
10434
10435 /// Sets the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10436 ///
10437 /// # Example
10438 /// ```ignore,no_run
10439 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10440 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10441 /// let x = Volume::new().set_snapshot_reservation_detail(SnapshotReservationDetail::default()/* use setters */);
10442 /// ```
10443 pub fn set_snapshot_reservation_detail<T>(mut self, v: T) -> Self
10444 where
10445 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10446 {
10447 self.snapshot_reservation_detail = std::option::Option::Some(v.into());
10448 self
10449 }
10450
10451 /// Sets or clears the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10452 ///
10453 /// # Example
10454 /// ```ignore,no_run
10455 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10456 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10457 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(Some(SnapshotReservationDetail::default()/* use setters */));
10458 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(None::<SnapshotReservationDetail>);
10459 /// ```
10460 pub fn set_or_clear_snapshot_reservation_detail<T>(mut self, v: std::option::Option<T>) -> Self
10461 where
10462 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10463 {
10464 self.snapshot_reservation_detail = v.map(|x| x.into());
10465 self
10466 }
10467
10468 /// Sets the value of [snapshot_auto_delete_behavior][crate::model::Volume::snapshot_auto_delete_behavior].
10469 ///
10470 /// # Example
10471 /// ```ignore,no_run
10472 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10473 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotAutoDeleteBehavior;
10474 /// let x0 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::Disabled);
10475 /// let x1 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::OldestFirst);
10476 /// let x2 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::NewestFirst);
10477 /// ```
10478 pub fn set_snapshot_auto_delete_behavior<
10479 T: std::convert::Into<crate::model::volume::SnapshotAutoDeleteBehavior>,
10480 >(
10481 mut self,
10482 v: T,
10483 ) -> Self {
10484 self.snapshot_auto_delete_behavior = v.into();
10485 self
10486 }
10487
10488 /// Sets the value of [labels][crate::model::Volume::labels].
10489 ///
10490 /// # Example
10491 /// ```ignore,no_run
10492 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10493 /// let x = Volume::new().set_labels([
10494 /// ("key0", "abc"),
10495 /// ("key1", "xyz"),
10496 /// ]);
10497 /// ```
10498 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10499 where
10500 T: std::iter::IntoIterator<Item = (K, V)>,
10501 K: std::convert::Into<std::string::String>,
10502 V: std::convert::Into<std::string::String>,
10503 {
10504 use std::iter::Iterator;
10505 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10506 self
10507 }
10508
10509 /// Sets the value of [snapshot_enabled][crate::model::Volume::snapshot_enabled].
10510 ///
10511 /// # Example
10512 /// ```ignore,no_run
10513 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10514 /// let x = Volume::new().set_snapshot_enabled(true);
10515 /// ```
10516 pub fn set_snapshot_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10517 self.snapshot_enabled = v.into();
10518 self
10519 }
10520
10521 /// Sets the value of [pod][crate::model::Volume::pod].
10522 ///
10523 /// # Example
10524 /// ```ignore,no_run
10525 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10526 /// let x = Volume::new().set_pod("example");
10527 /// ```
10528 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10529 self.pod = v.into();
10530 self
10531 }
10532
10533 /// Sets the value of [protocol][crate::model::Volume::protocol].
10534 ///
10535 /// # Example
10536 /// ```ignore,no_run
10537 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10538 /// use google_cloud_baremetalsolution_v2::model::volume::Protocol;
10539 /// let x0 = Volume::new().set_protocol(Protocol::FibreChannel);
10540 /// let x1 = Volume::new().set_protocol(Protocol::Nfs);
10541 /// ```
10542 pub fn set_protocol<T: std::convert::Into<crate::model::volume::Protocol>>(
10543 mut self,
10544 v: T,
10545 ) -> Self {
10546 self.protocol = v.into();
10547 self
10548 }
10549
10550 /// Sets the value of [boot_volume][crate::model::Volume::boot_volume].
10551 ///
10552 /// # Example
10553 /// ```ignore,no_run
10554 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10555 /// let x = Volume::new().set_boot_volume(true);
10556 /// ```
10557 pub fn set_boot_volume<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10558 self.boot_volume = v.into();
10559 self
10560 }
10561
10562 /// Sets the value of [performance_tier][crate::model::Volume::performance_tier].
10563 ///
10564 /// # Example
10565 /// ```ignore,no_run
10566 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10567 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
10568 /// let x0 = Volume::new().set_performance_tier(VolumePerformanceTier::Shared);
10569 /// let x1 = Volume::new().set_performance_tier(VolumePerformanceTier::Assigned);
10570 /// let x2 = Volume::new().set_performance_tier(VolumePerformanceTier::Ht);
10571 /// ```
10572 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
10573 mut self,
10574 v: T,
10575 ) -> Self {
10576 self.performance_tier = v.into();
10577 self
10578 }
10579
10580 /// Sets the value of [notes][crate::model::Volume::notes].
10581 ///
10582 /// # Example
10583 /// ```ignore,no_run
10584 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10585 /// let x = Volume::new().set_notes("example");
10586 /// ```
10587 pub fn set_notes<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10588 self.notes = v.into();
10589 self
10590 }
10591
10592 /// Sets the value of [workload_profile][crate::model::Volume::workload_profile].
10593 ///
10594 /// # Example
10595 /// ```ignore,no_run
10596 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10597 /// use google_cloud_baremetalsolution_v2::model::volume::WorkloadProfile;
10598 /// let x0 = Volume::new().set_workload_profile(WorkloadProfile::Generic);
10599 /// let x1 = Volume::new().set_workload_profile(WorkloadProfile::Hana);
10600 /// ```
10601 pub fn set_workload_profile<T: std::convert::Into<crate::model::volume::WorkloadProfile>>(
10602 mut self,
10603 v: T,
10604 ) -> Self {
10605 self.workload_profile = v.into();
10606 self
10607 }
10608
10609 /// Sets the value of [expire_time][crate::model::Volume::expire_time].
10610 ///
10611 /// # Example
10612 /// ```ignore,no_run
10613 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10614 /// use wkt::Timestamp;
10615 /// let x = Volume::new().set_expire_time(Timestamp::default()/* use setters */);
10616 /// ```
10617 pub fn set_expire_time<T>(mut self, v: T) -> Self
10618 where
10619 T: std::convert::Into<wkt::Timestamp>,
10620 {
10621 self.expire_time = std::option::Option::Some(v.into());
10622 self
10623 }
10624
10625 /// Sets or clears the value of [expire_time][crate::model::Volume::expire_time].
10626 ///
10627 /// # Example
10628 /// ```ignore,no_run
10629 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10630 /// use wkt::Timestamp;
10631 /// let x = Volume::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10632 /// let x = Volume::new().set_or_clear_expire_time(None::<Timestamp>);
10633 /// ```
10634 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10635 where
10636 T: std::convert::Into<wkt::Timestamp>,
10637 {
10638 self.expire_time = v.map(|x| x.into());
10639 self
10640 }
10641
10642 /// Sets the value of [instances][crate::model::Volume::instances].
10643 ///
10644 /// # Example
10645 /// ```ignore,no_run
10646 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10647 /// let x = Volume::new().set_instances(["a", "b", "c"]);
10648 /// ```
10649 pub fn set_instances<T, V>(mut self, v: T) -> Self
10650 where
10651 T: std::iter::IntoIterator<Item = V>,
10652 V: std::convert::Into<std::string::String>,
10653 {
10654 use std::iter::Iterator;
10655 self.instances = v.into_iter().map(|i| i.into()).collect();
10656 self
10657 }
10658
10659 /// Sets the value of [attached][crate::model::Volume::attached].
10660 ///
10661 /// # Example
10662 /// ```ignore,no_run
10663 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10664 /// let x = Volume::new().set_attached(true);
10665 /// ```
10666 pub fn set_attached<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10667 self.attached = v.into();
10668 self
10669 }
10670}
10671
10672impl wkt::message::Message for Volume {
10673 fn typename() -> &'static str {
10674 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume"
10675 }
10676}
10677
10678/// Defines additional types related to [Volume].
10679pub mod volume {
10680 #[allow(unused_imports)]
10681 use super::*;
10682
10683 /// Details about snapshot space reservation and usage on the storage volume.
10684 #[derive(Clone, Default, PartialEq)]
10685 #[non_exhaustive]
10686 pub struct SnapshotReservationDetail {
10687 /// The space on this storage volume reserved for snapshots, shown in GiB.
10688 pub reserved_space_gib: i64,
10689
10690 /// The percent of snapshot space on this storage volume actually being used
10691 /// by the snapshot copies. This value might be higher than 100% if the
10692 /// snapshot copies have overflowed into the data portion of the storage
10693 /// volume.
10694 pub reserved_space_used_percent: i32,
10695
10696 /// The amount, in GiB, of available space in this storage volume's reserved
10697 /// snapshot space.
10698 pub reserved_space_remaining_gib: i64,
10699
10700 /// Percent of the total Volume size reserved for snapshot copies.
10701 /// Enabling snapshots requires reserving 20% or more of
10702 /// the storage volume space for snapshots. Maximum reserved space for
10703 /// snapshots is 40%.
10704 /// Setting this field will effectively set snapshot_enabled to true.
10705 pub reserved_space_percent: i32,
10706
10707 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10708 }
10709
10710 impl SnapshotReservationDetail {
10711 /// Creates a new default instance.
10712 pub fn new() -> Self {
10713 std::default::Default::default()
10714 }
10715
10716 /// Sets the value of [reserved_space_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_gib].
10717 ///
10718 /// # Example
10719 /// ```ignore,no_run
10720 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10721 /// let x = SnapshotReservationDetail::new().set_reserved_space_gib(42);
10722 /// ```
10723 pub fn set_reserved_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10724 self.reserved_space_gib = v.into();
10725 self
10726 }
10727
10728 /// Sets the value of [reserved_space_used_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_used_percent].
10729 ///
10730 /// # Example
10731 /// ```ignore,no_run
10732 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10733 /// let x = SnapshotReservationDetail::new().set_reserved_space_used_percent(42);
10734 /// ```
10735 pub fn set_reserved_space_used_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10736 self.reserved_space_used_percent = v.into();
10737 self
10738 }
10739
10740 /// Sets the value of [reserved_space_remaining_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_remaining_gib].
10741 ///
10742 /// # Example
10743 /// ```ignore,no_run
10744 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10745 /// let x = SnapshotReservationDetail::new().set_reserved_space_remaining_gib(42);
10746 /// ```
10747 pub fn set_reserved_space_remaining_gib<T: std::convert::Into<i64>>(
10748 mut self,
10749 v: T,
10750 ) -> Self {
10751 self.reserved_space_remaining_gib = v.into();
10752 self
10753 }
10754
10755 /// Sets the value of [reserved_space_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_percent].
10756 ///
10757 /// # Example
10758 /// ```ignore,no_run
10759 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10760 /// let x = SnapshotReservationDetail::new().set_reserved_space_percent(42);
10761 /// ```
10762 pub fn set_reserved_space_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10763 self.reserved_space_percent = v.into();
10764 self
10765 }
10766 }
10767
10768 impl wkt::message::Message for SnapshotReservationDetail {
10769 fn typename() -> &'static str {
10770 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume.SnapshotReservationDetail"
10771 }
10772 }
10773
10774 /// The storage type for a volume.
10775 ///
10776 /// # Working with unknown values
10777 ///
10778 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10779 /// additional enum variants at any time. Adding new variants is not considered
10780 /// a breaking change. Applications should write their code in anticipation of:
10781 ///
10782 /// - New values appearing in future releases of the client library, **and**
10783 /// - New values received dynamically, without application changes.
10784 ///
10785 /// Please consult the [Working with enums] section in the user guide for some
10786 /// guidelines.
10787 ///
10788 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10789 #[derive(Clone, Debug, PartialEq)]
10790 #[non_exhaustive]
10791 pub enum StorageType {
10792 /// The storage type for this volume is unknown.
10793 Unspecified,
10794 /// The storage type for this volume is SSD.
10795 Ssd,
10796 /// This storage type for this volume is HDD.
10797 Hdd,
10798 /// If set, the enum was initialized with an unknown value.
10799 ///
10800 /// Applications can examine the value using [StorageType::value] or
10801 /// [StorageType::name].
10802 UnknownValue(storage_type::UnknownValue),
10803 }
10804
10805 #[doc(hidden)]
10806 pub mod storage_type {
10807 #[allow(unused_imports)]
10808 use super::*;
10809 #[derive(Clone, Debug, PartialEq)]
10810 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10811 }
10812
10813 impl StorageType {
10814 /// Gets the enum value.
10815 ///
10816 /// Returns `None` if the enum contains an unknown value deserialized from
10817 /// the string representation of enums.
10818 pub fn value(&self) -> std::option::Option<i32> {
10819 match self {
10820 Self::Unspecified => std::option::Option::Some(0),
10821 Self::Ssd => std::option::Option::Some(1),
10822 Self::Hdd => std::option::Option::Some(2),
10823 Self::UnknownValue(u) => u.0.value(),
10824 }
10825 }
10826
10827 /// Gets the enum value as a string.
10828 ///
10829 /// Returns `None` if the enum contains an unknown value deserialized from
10830 /// the integer representation of enums.
10831 pub fn name(&self) -> std::option::Option<&str> {
10832 match self {
10833 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
10834 Self::Ssd => std::option::Option::Some("SSD"),
10835 Self::Hdd => std::option::Option::Some("HDD"),
10836 Self::UnknownValue(u) => u.0.name(),
10837 }
10838 }
10839 }
10840
10841 impl std::default::Default for StorageType {
10842 fn default() -> Self {
10843 use std::convert::From;
10844 Self::from(0)
10845 }
10846 }
10847
10848 impl std::fmt::Display for StorageType {
10849 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10850 wkt::internal::display_enum(f, self.name(), self.value())
10851 }
10852 }
10853
10854 impl std::convert::From<i32> for StorageType {
10855 fn from(value: i32) -> Self {
10856 match value {
10857 0 => Self::Unspecified,
10858 1 => Self::Ssd,
10859 2 => Self::Hdd,
10860 _ => Self::UnknownValue(storage_type::UnknownValue(
10861 wkt::internal::UnknownEnumValue::Integer(value),
10862 )),
10863 }
10864 }
10865 }
10866
10867 impl std::convert::From<&str> for StorageType {
10868 fn from(value: &str) -> Self {
10869 use std::string::ToString;
10870 match value {
10871 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
10872 "SSD" => Self::Ssd,
10873 "HDD" => Self::Hdd,
10874 _ => Self::UnknownValue(storage_type::UnknownValue(
10875 wkt::internal::UnknownEnumValue::String(value.to_string()),
10876 )),
10877 }
10878 }
10879 }
10880
10881 impl serde::ser::Serialize for StorageType {
10882 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10883 where
10884 S: serde::Serializer,
10885 {
10886 match self {
10887 Self::Unspecified => serializer.serialize_i32(0),
10888 Self::Ssd => serializer.serialize_i32(1),
10889 Self::Hdd => serializer.serialize_i32(2),
10890 Self::UnknownValue(u) => u.0.serialize(serializer),
10891 }
10892 }
10893 }
10894
10895 impl<'de> serde::de::Deserialize<'de> for StorageType {
10896 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10897 where
10898 D: serde::Deserializer<'de>,
10899 {
10900 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
10901 ".google.cloud.baremetalsolution.v2.Volume.StorageType",
10902 ))
10903 }
10904 }
10905
10906 /// The possible states for a storage volume.
10907 ///
10908 /// # Working with unknown values
10909 ///
10910 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10911 /// additional enum variants at any time. Adding new variants is not considered
10912 /// a breaking change. Applications should write their code in anticipation of:
10913 ///
10914 /// - New values appearing in future releases of the client library, **and**
10915 /// - New values received dynamically, without application changes.
10916 ///
10917 /// Please consult the [Working with enums] section in the user guide for some
10918 /// guidelines.
10919 ///
10920 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10921 #[derive(Clone, Debug, PartialEq)]
10922 #[non_exhaustive]
10923 pub enum State {
10924 /// The storage volume is in an unknown state.
10925 Unspecified,
10926 /// The storage volume is being created.
10927 Creating,
10928 /// The storage volume is ready for use.
10929 Ready,
10930 /// The storage volume has been requested to be deleted.
10931 Deleting,
10932 /// The storage volume is being updated.
10933 Updating,
10934 /// The storage volume is in cool off state. It will be deleted after
10935 /// `expire_time`.
10936 CoolOff,
10937 /// If set, the enum was initialized with an unknown value.
10938 ///
10939 /// Applications can examine the value using [State::value] or
10940 /// [State::name].
10941 UnknownValue(state::UnknownValue),
10942 }
10943
10944 #[doc(hidden)]
10945 pub mod state {
10946 #[allow(unused_imports)]
10947 use super::*;
10948 #[derive(Clone, Debug, PartialEq)]
10949 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10950 }
10951
10952 impl State {
10953 /// Gets the enum value.
10954 ///
10955 /// Returns `None` if the enum contains an unknown value deserialized from
10956 /// the string representation of enums.
10957 pub fn value(&self) -> std::option::Option<i32> {
10958 match self {
10959 Self::Unspecified => std::option::Option::Some(0),
10960 Self::Creating => std::option::Option::Some(1),
10961 Self::Ready => std::option::Option::Some(2),
10962 Self::Deleting => std::option::Option::Some(3),
10963 Self::Updating => std::option::Option::Some(4),
10964 Self::CoolOff => std::option::Option::Some(5),
10965 Self::UnknownValue(u) => u.0.value(),
10966 }
10967 }
10968
10969 /// Gets the enum value as a string.
10970 ///
10971 /// Returns `None` if the enum contains an unknown value deserialized from
10972 /// the integer representation of enums.
10973 pub fn name(&self) -> std::option::Option<&str> {
10974 match self {
10975 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10976 Self::Creating => std::option::Option::Some("CREATING"),
10977 Self::Ready => std::option::Option::Some("READY"),
10978 Self::Deleting => std::option::Option::Some("DELETING"),
10979 Self::Updating => std::option::Option::Some("UPDATING"),
10980 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
10981 Self::UnknownValue(u) => u.0.name(),
10982 }
10983 }
10984 }
10985
10986 impl std::default::Default for State {
10987 fn default() -> Self {
10988 use std::convert::From;
10989 Self::from(0)
10990 }
10991 }
10992
10993 impl std::fmt::Display for State {
10994 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10995 wkt::internal::display_enum(f, self.name(), self.value())
10996 }
10997 }
10998
10999 impl std::convert::From<i32> for State {
11000 fn from(value: i32) -> Self {
11001 match value {
11002 0 => Self::Unspecified,
11003 1 => Self::Creating,
11004 2 => Self::Ready,
11005 3 => Self::Deleting,
11006 4 => Self::Updating,
11007 5 => Self::CoolOff,
11008 _ => Self::UnknownValue(state::UnknownValue(
11009 wkt::internal::UnknownEnumValue::Integer(value),
11010 )),
11011 }
11012 }
11013 }
11014
11015 impl std::convert::From<&str> for State {
11016 fn from(value: &str) -> Self {
11017 use std::string::ToString;
11018 match value {
11019 "STATE_UNSPECIFIED" => Self::Unspecified,
11020 "CREATING" => Self::Creating,
11021 "READY" => Self::Ready,
11022 "DELETING" => Self::Deleting,
11023 "UPDATING" => Self::Updating,
11024 "COOL_OFF" => Self::CoolOff,
11025 _ => Self::UnknownValue(state::UnknownValue(
11026 wkt::internal::UnknownEnumValue::String(value.to_string()),
11027 )),
11028 }
11029 }
11030 }
11031
11032 impl serde::ser::Serialize for State {
11033 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11034 where
11035 S: serde::Serializer,
11036 {
11037 match self {
11038 Self::Unspecified => serializer.serialize_i32(0),
11039 Self::Creating => serializer.serialize_i32(1),
11040 Self::Ready => serializer.serialize_i32(2),
11041 Self::Deleting => serializer.serialize_i32(3),
11042 Self::Updating => serializer.serialize_i32(4),
11043 Self::CoolOff => serializer.serialize_i32(5),
11044 Self::UnknownValue(u) => u.0.serialize(serializer),
11045 }
11046 }
11047 }
11048
11049 impl<'de> serde::de::Deserialize<'de> for State {
11050 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11051 where
11052 D: serde::Deserializer<'de>,
11053 {
11054 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11055 ".google.cloud.baremetalsolution.v2.Volume.State",
11056 ))
11057 }
11058 }
11059
11060 /// The kinds of auto delete behavior to use when snapshot reserved space is
11061 /// full.
11062 ///
11063 /// # Working with unknown values
11064 ///
11065 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11066 /// additional enum variants at any time. Adding new variants is not considered
11067 /// a breaking change. Applications should write their code in anticipation of:
11068 ///
11069 /// - New values appearing in future releases of the client library, **and**
11070 /// - New values received dynamically, without application changes.
11071 ///
11072 /// Please consult the [Working with enums] section in the user guide for some
11073 /// guidelines.
11074 ///
11075 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11076 #[derive(Clone, Debug, PartialEq)]
11077 #[non_exhaustive]
11078 pub enum SnapshotAutoDeleteBehavior {
11079 /// The unspecified behavior.
11080 Unspecified,
11081 /// Don't delete any snapshots. This disables new snapshot creation, as
11082 /// long as the snapshot reserved space is full.
11083 Disabled,
11084 /// Delete the oldest snapshots first.
11085 OldestFirst,
11086 /// Delete the newest snapshots first.
11087 NewestFirst,
11088 /// If set, the enum was initialized with an unknown value.
11089 ///
11090 /// Applications can examine the value using [SnapshotAutoDeleteBehavior::value] or
11091 /// [SnapshotAutoDeleteBehavior::name].
11092 UnknownValue(snapshot_auto_delete_behavior::UnknownValue),
11093 }
11094
11095 #[doc(hidden)]
11096 pub mod snapshot_auto_delete_behavior {
11097 #[allow(unused_imports)]
11098 use super::*;
11099 #[derive(Clone, Debug, PartialEq)]
11100 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11101 }
11102
11103 impl SnapshotAutoDeleteBehavior {
11104 /// Gets the enum value.
11105 ///
11106 /// Returns `None` if the enum contains an unknown value deserialized from
11107 /// the string representation of enums.
11108 pub fn value(&self) -> std::option::Option<i32> {
11109 match self {
11110 Self::Unspecified => std::option::Option::Some(0),
11111 Self::Disabled => std::option::Option::Some(1),
11112 Self::OldestFirst => std::option::Option::Some(2),
11113 Self::NewestFirst => std::option::Option::Some(3),
11114 Self::UnknownValue(u) => u.0.value(),
11115 }
11116 }
11117
11118 /// Gets the enum value as a string.
11119 ///
11120 /// Returns `None` if the enum contains an unknown value deserialized from
11121 /// the integer representation of enums.
11122 pub fn name(&self) -> std::option::Option<&str> {
11123 match self {
11124 Self::Unspecified => {
11125 std::option::Option::Some("SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED")
11126 }
11127 Self::Disabled => std::option::Option::Some("DISABLED"),
11128 Self::OldestFirst => std::option::Option::Some("OLDEST_FIRST"),
11129 Self::NewestFirst => std::option::Option::Some("NEWEST_FIRST"),
11130 Self::UnknownValue(u) => u.0.name(),
11131 }
11132 }
11133 }
11134
11135 impl std::default::Default for SnapshotAutoDeleteBehavior {
11136 fn default() -> Self {
11137 use std::convert::From;
11138 Self::from(0)
11139 }
11140 }
11141
11142 impl std::fmt::Display for SnapshotAutoDeleteBehavior {
11143 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11144 wkt::internal::display_enum(f, self.name(), self.value())
11145 }
11146 }
11147
11148 impl std::convert::From<i32> for SnapshotAutoDeleteBehavior {
11149 fn from(value: i32) -> Self {
11150 match value {
11151 0 => Self::Unspecified,
11152 1 => Self::Disabled,
11153 2 => Self::OldestFirst,
11154 3 => Self::NewestFirst,
11155 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
11156 wkt::internal::UnknownEnumValue::Integer(value),
11157 )),
11158 }
11159 }
11160 }
11161
11162 impl std::convert::From<&str> for SnapshotAutoDeleteBehavior {
11163 fn from(value: &str) -> Self {
11164 use std::string::ToString;
11165 match value {
11166 "SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11167 "DISABLED" => Self::Disabled,
11168 "OLDEST_FIRST" => Self::OldestFirst,
11169 "NEWEST_FIRST" => Self::NewestFirst,
11170 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
11171 wkt::internal::UnknownEnumValue::String(value.to_string()),
11172 )),
11173 }
11174 }
11175 }
11176
11177 impl serde::ser::Serialize for SnapshotAutoDeleteBehavior {
11178 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11179 where
11180 S: serde::Serializer,
11181 {
11182 match self {
11183 Self::Unspecified => serializer.serialize_i32(0),
11184 Self::Disabled => serializer.serialize_i32(1),
11185 Self::OldestFirst => serializer.serialize_i32(2),
11186 Self::NewestFirst => serializer.serialize_i32(3),
11187 Self::UnknownValue(u) => u.0.serialize(serializer),
11188 }
11189 }
11190 }
11191
11192 impl<'de> serde::de::Deserialize<'de> for SnapshotAutoDeleteBehavior {
11193 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11194 where
11195 D: serde::Deserializer<'de>,
11196 {
11197 deserializer.deserialize_any(
11198 wkt::internal::EnumVisitor::<SnapshotAutoDeleteBehavior>::new(
11199 ".google.cloud.baremetalsolution.v2.Volume.SnapshotAutoDeleteBehavior",
11200 ),
11201 )
11202 }
11203 }
11204
11205 /// Storage protocol.
11206 ///
11207 /// # Working with unknown values
11208 ///
11209 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11210 /// additional enum variants at any time. Adding new variants is not considered
11211 /// a breaking change. Applications should write their code in anticipation of:
11212 ///
11213 /// - New values appearing in future releases of the client library, **and**
11214 /// - New values received dynamically, without application changes.
11215 ///
11216 /// Please consult the [Working with enums] section in the user guide for some
11217 /// guidelines.
11218 ///
11219 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11220 #[derive(Clone, Debug, PartialEq)]
11221 #[non_exhaustive]
11222 pub enum Protocol {
11223 /// Value is not specified.
11224 Unspecified,
11225 /// Fibre Channel protocol.
11226 FibreChannel,
11227 /// NFS protocol means Volume is a NFS Share volume.
11228 /// Such volumes cannot be manipulated via Volumes API.
11229 Nfs,
11230 /// If set, the enum was initialized with an unknown value.
11231 ///
11232 /// Applications can examine the value using [Protocol::value] or
11233 /// [Protocol::name].
11234 UnknownValue(protocol::UnknownValue),
11235 }
11236
11237 #[doc(hidden)]
11238 pub mod protocol {
11239 #[allow(unused_imports)]
11240 use super::*;
11241 #[derive(Clone, Debug, PartialEq)]
11242 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11243 }
11244
11245 impl Protocol {
11246 /// Gets the enum value.
11247 ///
11248 /// Returns `None` if the enum contains an unknown value deserialized from
11249 /// the string representation of enums.
11250 pub fn value(&self) -> std::option::Option<i32> {
11251 match self {
11252 Self::Unspecified => std::option::Option::Some(0),
11253 Self::FibreChannel => std::option::Option::Some(1),
11254 Self::Nfs => std::option::Option::Some(2),
11255 Self::UnknownValue(u) => u.0.value(),
11256 }
11257 }
11258
11259 /// Gets the enum value as a string.
11260 ///
11261 /// Returns `None` if the enum contains an unknown value deserialized from
11262 /// the integer representation of enums.
11263 pub fn name(&self) -> std::option::Option<&str> {
11264 match self {
11265 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
11266 Self::FibreChannel => std::option::Option::Some("FIBRE_CHANNEL"),
11267 Self::Nfs => std::option::Option::Some("NFS"),
11268 Self::UnknownValue(u) => u.0.name(),
11269 }
11270 }
11271 }
11272
11273 impl std::default::Default for Protocol {
11274 fn default() -> Self {
11275 use std::convert::From;
11276 Self::from(0)
11277 }
11278 }
11279
11280 impl std::fmt::Display for Protocol {
11281 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11282 wkt::internal::display_enum(f, self.name(), self.value())
11283 }
11284 }
11285
11286 impl std::convert::From<i32> for Protocol {
11287 fn from(value: i32) -> Self {
11288 match value {
11289 0 => Self::Unspecified,
11290 1 => Self::FibreChannel,
11291 2 => Self::Nfs,
11292 _ => Self::UnknownValue(protocol::UnknownValue(
11293 wkt::internal::UnknownEnumValue::Integer(value),
11294 )),
11295 }
11296 }
11297 }
11298
11299 impl std::convert::From<&str> for Protocol {
11300 fn from(value: &str) -> Self {
11301 use std::string::ToString;
11302 match value {
11303 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
11304 "FIBRE_CHANNEL" => Self::FibreChannel,
11305 "NFS" => Self::Nfs,
11306 _ => Self::UnknownValue(protocol::UnknownValue(
11307 wkt::internal::UnknownEnumValue::String(value.to_string()),
11308 )),
11309 }
11310 }
11311 }
11312
11313 impl serde::ser::Serialize for Protocol {
11314 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11315 where
11316 S: serde::Serializer,
11317 {
11318 match self {
11319 Self::Unspecified => serializer.serialize_i32(0),
11320 Self::FibreChannel => serializer.serialize_i32(1),
11321 Self::Nfs => serializer.serialize_i32(2),
11322 Self::UnknownValue(u) => u.0.serialize(serializer),
11323 }
11324 }
11325 }
11326
11327 impl<'de> serde::de::Deserialize<'de> for Protocol {
11328 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11329 where
11330 D: serde::Deserializer<'de>,
11331 {
11332 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
11333 ".google.cloud.baremetalsolution.v2.Volume.Protocol",
11334 ))
11335 }
11336 }
11337
11338 /// The possible values for a workload profile.
11339 ///
11340 /// # Working with unknown values
11341 ///
11342 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11343 /// additional enum variants at any time. Adding new variants is not considered
11344 /// a breaking change. Applications should write their code in anticipation of:
11345 ///
11346 /// - New values appearing in future releases of the client library, **and**
11347 /// - New values received dynamically, without application changes.
11348 ///
11349 /// Please consult the [Working with enums] section in the user guide for some
11350 /// guidelines.
11351 ///
11352 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11353 #[derive(Clone, Debug, PartialEq)]
11354 #[non_exhaustive]
11355 pub enum WorkloadProfile {
11356 /// The workload profile is in an unknown state.
11357 Unspecified,
11358 /// The workload profile is generic.
11359 Generic,
11360 /// The workload profile is hana.
11361 Hana,
11362 /// If set, the enum was initialized with an unknown value.
11363 ///
11364 /// Applications can examine the value using [WorkloadProfile::value] or
11365 /// [WorkloadProfile::name].
11366 UnknownValue(workload_profile::UnknownValue),
11367 }
11368
11369 #[doc(hidden)]
11370 pub mod workload_profile {
11371 #[allow(unused_imports)]
11372 use super::*;
11373 #[derive(Clone, Debug, PartialEq)]
11374 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11375 }
11376
11377 impl WorkloadProfile {
11378 /// Gets the enum value.
11379 ///
11380 /// Returns `None` if the enum contains an unknown value deserialized from
11381 /// the string representation of enums.
11382 pub fn value(&self) -> std::option::Option<i32> {
11383 match self {
11384 Self::Unspecified => std::option::Option::Some(0),
11385 Self::Generic => std::option::Option::Some(1),
11386 Self::Hana => std::option::Option::Some(2),
11387 Self::UnknownValue(u) => u.0.value(),
11388 }
11389 }
11390
11391 /// Gets the enum value as a string.
11392 ///
11393 /// Returns `None` if the enum contains an unknown value deserialized from
11394 /// the integer representation of enums.
11395 pub fn name(&self) -> std::option::Option<&str> {
11396 match self {
11397 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
11398 Self::Generic => std::option::Option::Some("GENERIC"),
11399 Self::Hana => std::option::Option::Some("HANA"),
11400 Self::UnknownValue(u) => u.0.name(),
11401 }
11402 }
11403 }
11404
11405 impl std::default::Default for WorkloadProfile {
11406 fn default() -> Self {
11407 use std::convert::From;
11408 Self::from(0)
11409 }
11410 }
11411
11412 impl std::fmt::Display for WorkloadProfile {
11413 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11414 wkt::internal::display_enum(f, self.name(), self.value())
11415 }
11416 }
11417
11418 impl std::convert::From<i32> for WorkloadProfile {
11419 fn from(value: i32) -> Self {
11420 match value {
11421 0 => Self::Unspecified,
11422 1 => Self::Generic,
11423 2 => Self::Hana,
11424 _ => Self::UnknownValue(workload_profile::UnknownValue(
11425 wkt::internal::UnknownEnumValue::Integer(value),
11426 )),
11427 }
11428 }
11429 }
11430
11431 impl std::convert::From<&str> for WorkloadProfile {
11432 fn from(value: &str) -> Self {
11433 use std::string::ToString;
11434 match value {
11435 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
11436 "GENERIC" => Self::Generic,
11437 "HANA" => Self::Hana,
11438 _ => Self::UnknownValue(workload_profile::UnknownValue(
11439 wkt::internal::UnknownEnumValue::String(value.to_string()),
11440 )),
11441 }
11442 }
11443 }
11444
11445 impl serde::ser::Serialize for WorkloadProfile {
11446 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11447 where
11448 S: serde::Serializer,
11449 {
11450 match self {
11451 Self::Unspecified => serializer.serialize_i32(0),
11452 Self::Generic => serializer.serialize_i32(1),
11453 Self::Hana => serializer.serialize_i32(2),
11454 Self::UnknownValue(u) => u.0.serialize(serializer),
11455 }
11456 }
11457 }
11458
11459 impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
11460 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11461 where
11462 D: serde::Deserializer<'de>,
11463 {
11464 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
11465 ".google.cloud.baremetalsolution.v2.Volume.WorkloadProfile",
11466 ))
11467 }
11468 }
11469}
11470
11471/// Message for requesting storage volume information.
11472#[derive(Clone, Default, PartialEq)]
11473#[non_exhaustive]
11474pub struct GetVolumeRequest {
11475 /// Required. Name of the resource.
11476 pub name: std::string::String,
11477
11478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11479}
11480
11481impl GetVolumeRequest {
11482 /// Creates a new default instance.
11483 pub fn new() -> Self {
11484 std::default::Default::default()
11485 }
11486
11487 /// Sets the value of [name][crate::model::GetVolumeRequest::name].
11488 ///
11489 /// # Example
11490 /// ```ignore,no_run
11491 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeRequest;
11492 /// # let project_id = "project_id";
11493 /// # let location_id = "location_id";
11494 /// # let volume_id = "volume_id";
11495 /// let x = GetVolumeRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
11496 /// ```
11497 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11498 self.name = v.into();
11499 self
11500 }
11501}
11502
11503impl wkt::message::Message for GetVolumeRequest {
11504 fn typename() -> &'static str {
11505 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeRequest"
11506 }
11507}
11508
11509/// Message for requesting a list of storage volumes.
11510#[derive(Clone, Default, PartialEq)]
11511#[non_exhaustive]
11512pub struct ListVolumesRequest {
11513 /// Required. Parent value for ListVolumesRequest.
11514 pub parent: std::string::String,
11515
11516 /// Requested page size. The server might return fewer items than requested.
11517 /// If unspecified, server will pick an appropriate default.
11518 pub page_size: i32,
11519
11520 /// A token identifying a page of results from the server.
11521 pub page_token: std::string::String,
11522
11523 /// List filter.
11524 pub filter: std::string::String,
11525
11526 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11527}
11528
11529impl ListVolumesRequest {
11530 /// Creates a new default instance.
11531 pub fn new() -> Self {
11532 std::default::Default::default()
11533 }
11534
11535 /// Sets the value of [parent][crate::model::ListVolumesRequest::parent].
11536 ///
11537 /// # Example
11538 /// ```ignore,no_run
11539 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11540 /// let x = ListVolumesRequest::new().set_parent("example");
11541 /// ```
11542 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11543 self.parent = v.into();
11544 self
11545 }
11546
11547 /// Sets the value of [page_size][crate::model::ListVolumesRequest::page_size].
11548 ///
11549 /// # Example
11550 /// ```ignore,no_run
11551 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11552 /// let x = ListVolumesRequest::new().set_page_size(42);
11553 /// ```
11554 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11555 self.page_size = v.into();
11556 self
11557 }
11558
11559 /// Sets the value of [page_token][crate::model::ListVolumesRequest::page_token].
11560 ///
11561 /// # Example
11562 /// ```ignore,no_run
11563 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11564 /// let x = ListVolumesRequest::new().set_page_token("example");
11565 /// ```
11566 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11567 self.page_token = v.into();
11568 self
11569 }
11570
11571 /// Sets the value of [filter][crate::model::ListVolumesRequest::filter].
11572 ///
11573 /// # Example
11574 /// ```ignore,no_run
11575 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11576 /// let x = ListVolumesRequest::new().set_filter("example");
11577 /// ```
11578 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11579 self.filter = v.into();
11580 self
11581 }
11582}
11583
11584impl wkt::message::Message for ListVolumesRequest {
11585 fn typename() -> &'static str {
11586 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesRequest"
11587 }
11588}
11589
11590/// Response message containing the list of storage volumes.
11591#[derive(Clone, Default, PartialEq)]
11592#[non_exhaustive]
11593pub struct ListVolumesResponse {
11594 /// The list of storage volumes.
11595 pub volumes: std::vec::Vec<crate::model::Volume>,
11596
11597 /// A token identifying a page of results from the server.
11598 pub next_page_token: std::string::String,
11599
11600 /// Locations that could not be reached.
11601 pub unreachable: std::vec::Vec<std::string::String>,
11602
11603 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11604}
11605
11606impl ListVolumesResponse {
11607 /// Creates a new default instance.
11608 pub fn new() -> Self {
11609 std::default::Default::default()
11610 }
11611
11612 /// Sets the value of [volumes][crate::model::ListVolumesResponse::volumes].
11613 ///
11614 /// # Example
11615 /// ```ignore,no_run
11616 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11617 /// use google_cloud_baremetalsolution_v2::model::Volume;
11618 /// let x = ListVolumesResponse::new()
11619 /// .set_volumes([
11620 /// Volume::default()/* use setters */,
11621 /// Volume::default()/* use (different) setters */,
11622 /// ]);
11623 /// ```
11624 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11625 where
11626 T: std::iter::IntoIterator<Item = V>,
11627 V: std::convert::Into<crate::model::Volume>,
11628 {
11629 use std::iter::Iterator;
11630 self.volumes = v.into_iter().map(|i| i.into()).collect();
11631 self
11632 }
11633
11634 /// Sets the value of [next_page_token][crate::model::ListVolumesResponse::next_page_token].
11635 ///
11636 /// # Example
11637 /// ```ignore,no_run
11638 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11639 /// let x = ListVolumesResponse::new().set_next_page_token("example");
11640 /// ```
11641 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11642 self.next_page_token = v.into();
11643 self
11644 }
11645
11646 /// Sets the value of [unreachable][crate::model::ListVolumesResponse::unreachable].
11647 ///
11648 /// # Example
11649 /// ```ignore,no_run
11650 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11651 /// let x = ListVolumesResponse::new().set_unreachable(["a", "b", "c"]);
11652 /// ```
11653 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
11654 where
11655 T: std::iter::IntoIterator<Item = V>,
11656 V: std::convert::Into<std::string::String>,
11657 {
11658 use std::iter::Iterator;
11659 self.unreachable = v.into_iter().map(|i| i.into()).collect();
11660 self
11661 }
11662}
11663
11664impl wkt::message::Message for ListVolumesResponse {
11665 fn typename() -> &'static str {
11666 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesResponse"
11667 }
11668}
11669
11670#[doc(hidden)]
11671impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumesResponse {
11672 type PageItem = crate::model::Volume;
11673
11674 fn items(self) -> std::vec::Vec<Self::PageItem> {
11675 self.volumes
11676 }
11677
11678 fn next_page_token(&self) -> std::string::String {
11679 use std::clone::Clone;
11680 self.next_page_token.clone()
11681 }
11682}
11683
11684/// Message for updating a volume.
11685#[derive(Clone, Default, PartialEq)]
11686#[non_exhaustive]
11687pub struct UpdateVolumeRequest {
11688 /// Required. The volume to update.
11689 ///
11690 /// The `name` field is used to identify the volume to update.
11691 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11692 pub volume: std::option::Option<crate::model::Volume>,
11693
11694 /// The list of fields to update.
11695 /// The only currently supported fields are:
11696 /// 'labels'
11697 pub update_mask: std::option::Option<wkt::FieldMask>,
11698
11699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11700}
11701
11702impl UpdateVolumeRequest {
11703 /// Creates a new default instance.
11704 pub fn new() -> Self {
11705 std::default::Default::default()
11706 }
11707
11708 /// Sets the value of [volume][crate::model::UpdateVolumeRequest::volume].
11709 ///
11710 /// # Example
11711 /// ```ignore,no_run
11712 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11713 /// use google_cloud_baremetalsolution_v2::model::Volume;
11714 /// let x = UpdateVolumeRequest::new().set_volume(Volume::default()/* use setters */);
11715 /// ```
11716 pub fn set_volume<T>(mut self, v: T) -> Self
11717 where
11718 T: std::convert::Into<crate::model::Volume>,
11719 {
11720 self.volume = std::option::Option::Some(v.into());
11721 self
11722 }
11723
11724 /// Sets or clears the value of [volume][crate::model::UpdateVolumeRequest::volume].
11725 ///
11726 /// # Example
11727 /// ```ignore,no_run
11728 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11729 /// use google_cloud_baremetalsolution_v2::model::Volume;
11730 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(Some(Volume::default()/* use setters */));
11731 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(None::<Volume>);
11732 /// ```
11733 pub fn set_or_clear_volume<T>(mut self, v: std::option::Option<T>) -> Self
11734 where
11735 T: std::convert::Into<crate::model::Volume>,
11736 {
11737 self.volume = v.map(|x| x.into());
11738 self
11739 }
11740
11741 /// Sets the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11742 ///
11743 /// # Example
11744 /// ```ignore,no_run
11745 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11746 /// use wkt::FieldMask;
11747 /// let x = UpdateVolumeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11748 /// ```
11749 pub fn set_update_mask<T>(mut self, v: T) -> Self
11750 where
11751 T: std::convert::Into<wkt::FieldMask>,
11752 {
11753 self.update_mask = std::option::Option::Some(v.into());
11754 self
11755 }
11756
11757 /// Sets or clears the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11758 ///
11759 /// # Example
11760 /// ```ignore,no_run
11761 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11762 /// use wkt::FieldMask;
11763 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11764 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11765 /// ```
11766 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11767 where
11768 T: std::convert::Into<wkt::FieldMask>,
11769 {
11770 self.update_mask = v.map(|x| x.into());
11771 self
11772 }
11773}
11774
11775impl wkt::message::Message for UpdateVolumeRequest {
11776 fn typename() -> &'static str {
11777 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateVolumeRequest"
11778 }
11779}
11780
11781/// Message requesting rename of a server.
11782#[derive(Clone, Default, PartialEq)]
11783#[non_exhaustive]
11784pub struct RenameVolumeRequest {
11785 /// Required. The `name` field is used to identify the volume.
11786 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11787 pub name: std::string::String,
11788
11789 /// Required. The new `id` of the volume.
11790 pub new_volume_id: std::string::String,
11791
11792 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11793}
11794
11795impl RenameVolumeRequest {
11796 /// Creates a new default instance.
11797 pub fn new() -> Self {
11798 std::default::Default::default()
11799 }
11800
11801 /// Sets the value of [name][crate::model::RenameVolumeRequest::name].
11802 ///
11803 /// # Example
11804 /// ```ignore,no_run
11805 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11806 /// # let project_id = "project_id";
11807 /// # let location_id = "location_id";
11808 /// # let volume_id = "volume_id";
11809 /// let x = RenameVolumeRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
11810 /// ```
11811 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11812 self.name = v.into();
11813 self
11814 }
11815
11816 /// Sets the value of [new_volume_id][crate::model::RenameVolumeRequest::new_volume_id].
11817 ///
11818 /// # Example
11819 /// ```ignore,no_run
11820 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11821 /// let x = RenameVolumeRequest::new().set_new_volume_id("example");
11822 /// ```
11823 pub fn set_new_volume_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11824 self.new_volume_id = v.into();
11825 self
11826 }
11827}
11828
11829impl wkt::message::Message for RenameVolumeRequest {
11830 fn typename() -> &'static str {
11831 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameVolumeRequest"
11832 }
11833}
11834
11835/// Request for skip volume cooloff and delete it.
11836#[derive(Clone, Default, PartialEq)]
11837#[non_exhaustive]
11838pub struct EvictVolumeRequest {
11839 /// Required. The name of the Volume.
11840 pub name: std::string::String,
11841
11842 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11843}
11844
11845impl EvictVolumeRequest {
11846 /// Creates a new default instance.
11847 pub fn new() -> Self {
11848 std::default::Default::default()
11849 }
11850
11851 /// Sets the value of [name][crate::model::EvictVolumeRequest::name].
11852 ///
11853 /// # Example
11854 /// ```ignore,no_run
11855 /// # use google_cloud_baremetalsolution_v2::model::EvictVolumeRequest;
11856 /// # let project_id = "project_id";
11857 /// # let location_id = "location_id";
11858 /// # let volume_id = "volume_id";
11859 /// let x = EvictVolumeRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
11860 /// ```
11861 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11862 self.name = v.into();
11863 self
11864 }
11865}
11866
11867impl wkt::message::Message for EvictVolumeRequest {
11868 fn typename() -> &'static str {
11869 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictVolumeRequest"
11870 }
11871}
11872
11873/// Request for emergency resize Volume.
11874#[derive(Clone, Default, PartialEq)]
11875#[non_exhaustive]
11876pub struct ResizeVolumeRequest {
11877 /// Required. Volume to resize.
11878 pub volume: std::string::String,
11879
11880 /// New Volume size, in GiB.
11881 pub size_gib: i64,
11882
11883 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11884}
11885
11886impl ResizeVolumeRequest {
11887 /// Creates a new default instance.
11888 pub fn new() -> Self {
11889 std::default::Default::default()
11890 }
11891
11892 /// Sets the value of [volume][crate::model::ResizeVolumeRequest::volume].
11893 ///
11894 /// # Example
11895 /// ```ignore,no_run
11896 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11897 /// # let project_id = "project_id";
11898 /// # let location_id = "location_id";
11899 /// # let volume_id = "volume_id";
11900 /// let x = ResizeVolumeRequest::new().set_volume(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
11901 /// ```
11902 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11903 self.volume = v.into();
11904 self
11905 }
11906
11907 /// Sets the value of [size_gib][crate::model::ResizeVolumeRequest::size_gib].
11908 ///
11909 /// # Example
11910 /// ```ignore,no_run
11911 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11912 /// let x = ResizeVolumeRequest::new().set_size_gib(42);
11913 /// ```
11914 pub fn set_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11915 self.size_gib = v.into();
11916 self
11917 }
11918}
11919
11920impl wkt::message::Message for ResizeVolumeRequest {
11921 fn typename() -> &'static str {
11922 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResizeVolumeRequest"
11923 }
11924}
11925
11926/// A snapshot of a volume. Only boot volumes can have snapshots.
11927#[derive(Clone, Default, PartialEq)]
11928#[non_exhaustive]
11929pub struct VolumeSnapshot {
11930 /// The name of the snapshot.
11931 pub name: std::string::String,
11932
11933 /// Output only. An identifier for the snapshot, generated by the backend.
11934 pub id: std::string::String,
11935
11936 /// The description of the snapshot.
11937 pub description: std::string::String,
11938
11939 /// Output only. The creation time of the snapshot.
11940 pub create_time: std::option::Option<wkt::Timestamp>,
11941
11942 /// Output only. The name of the volume which this snapshot belongs to.
11943 pub storage_volume: std::string::String,
11944
11945 /// Output only. The type of the snapshot which indicates whether it was
11946 /// scheduled or manual/ad-hoc.
11947 pub r#type: crate::model::volume_snapshot::SnapshotType,
11948
11949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11950}
11951
11952impl VolumeSnapshot {
11953 /// Creates a new default instance.
11954 pub fn new() -> Self {
11955 std::default::Default::default()
11956 }
11957
11958 /// Sets the value of [name][crate::model::VolumeSnapshot::name].
11959 ///
11960 /// # Example
11961 /// ```ignore,no_run
11962 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11963 /// # let project_id = "project_id";
11964 /// # let location_id = "location_id";
11965 /// # let volume_id = "volume_id";
11966 /// # let snapshot_id = "snapshot_id";
11967 /// let x = VolumeSnapshot::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/snapshots/{snapshot_id}"));
11968 /// ```
11969 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11970 self.name = v.into();
11971 self
11972 }
11973
11974 /// Sets the value of [id][crate::model::VolumeSnapshot::id].
11975 ///
11976 /// # Example
11977 /// ```ignore,no_run
11978 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11979 /// let x = VolumeSnapshot::new().set_id("example");
11980 /// ```
11981 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11982 self.id = v.into();
11983 self
11984 }
11985
11986 /// Sets the value of [description][crate::model::VolumeSnapshot::description].
11987 ///
11988 /// # Example
11989 /// ```ignore,no_run
11990 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11991 /// let x = VolumeSnapshot::new().set_description("example");
11992 /// ```
11993 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11994 self.description = v.into();
11995 self
11996 }
11997
11998 /// Sets the value of [create_time][crate::model::VolumeSnapshot::create_time].
11999 ///
12000 /// # Example
12001 /// ```ignore,no_run
12002 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12003 /// use wkt::Timestamp;
12004 /// let x = VolumeSnapshot::new().set_create_time(Timestamp::default()/* use setters */);
12005 /// ```
12006 pub fn set_create_time<T>(mut self, v: T) -> Self
12007 where
12008 T: std::convert::Into<wkt::Timestamp>,
12009 {
12010 self.create_time = std::option::Option::Some(v.into());
12011 self
12012 }
12013
12014 /// Sets or clears the value of [create_time][crate::model::VolumeSnapshot::create_time].
12015 ///
12016 /// # Example
12017 /// ```ignore,no_run
12018 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12019 /// use wkt::Timestamp;
12020 /// let x = VolumeSnapshot::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12021 /// let x = VolumeSnapshot::new().set_or_clear_create_time(None::<Timestamp>);
12022 /// ```
12023 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12024 where
12025 T: std::convert::Into<wkt::Timestamp>,
12026 {
12027 self.create_time = v.map(|x| x.into());
12028 self
12029 }
12030
12031 /// Sets the value of [storage_volume][crate::model::VolumeSnapshot::storage_volume].
12032 ///
12033 /// # Example
12034 /// ```ignore,no_run
12035 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12036 /// # let project_id = "project_id";
12037 /// # let location_id = "location_id";
12038 /// # let volume_id = "volume_id";
12039 /// let x = VolumeSnapshot::new().set_storage_volume(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
12040 /// ```
12041 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12042 self.storage_volume = v.into();
12043 self
12044 }
12045
12046 /// Sets the value of [r#type][crate::model::VolumeSnapshot::type].
12047 ///
12048 /// # Example
12049 /// ```ignore,no_run
12050 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12051 /// use google_cloud_baremetalsolution_v2::model::volume_snapshot::SnapshotType;
12052 /// let x0 = VolumeSnapshot::new().set_type(SnapshotType::AdHoc);
12053 /// let x1 = VolumeSnapshot::new().set_type(SnapshotType::Scheduled);
12054 /// ```
12055 pub fn set_type<T: std::convert::Into<crate::model::volume_snapshot::SnapshotType>>(
12056 mut self,
12057 v: T,
12058 ) -> Self {
12059 self.r#type = v.into();
12060 self
12061 }
12062}
12063
12064impl wkt::message::Message for VolumeSnapshot {
12065 fn typename() -> &'static str {
12066 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeSnapshot"
12067 }
12068}
12069
12070/// Defines additional types related to [VolumeSnapshot].
12071pub mod volume_snapshot {
12072 #[allow(unused_imports)]
12073 use super::*;
12074
12075 /// Represents the type of a snapshot.
12076 ///
12077 /// # Working with unknown values
12078 ///
12079 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12080 /// additional enum variants at any time. Adding new variants is not considered
12081 /// a breaking change. Applications should write their code in anticipation of:
12082 ///
12083 /// - New values appearing in future releases of the client library, **and**
12084 /// - New values received dynamically, without application changes.
12085 ///
12086 /// Please consult the [Working with enums] section in the user guide for some
12087 /// guidelines.
12088 ///
12089 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12090 #[derive(Clone, Debug, PartialEq)]
12091 #[non_exhaustive]
12092 pub enum SnapshotType {
12093 /// Type is not specified.
12094 Unspecified,
12095 /// Snapshot was taken manually by user.
12096 AdHoc,
12097 /// Snapshot was taken automatically as a part of a snapshot schedule.
12098 Scheduled,
12099 /// If set, the enum was initialized with an unknown value.
12100 ///
12101 /// Applications can examine the value using [SnapshotType::value] or
12102 /// [SnapshotType::name].
12103 UnknownValue(snapshot_type::UnknownValue),
12104 }
12105
12106 #[doc(hidden)]
12107 pub mod snapshot_type {
12108 #[allow(unused_imports)]
12109 use super::*;
12110 #[derive(Clone, Debug, PartialEq)]
12111 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12112 }
12113
12114 impl SnapshotType {
12115 /// Gets the enum value.
12116 ///
12117 /// Returns `None` if the enum contains an unknown value deserialized from
12118 /// the string representation of enums.
12119 pub fn value(&self) -> std::option::Option<i32> {
12120 match self {
12121 Self::Unspecified => std::option::Option::Some(0),
12122 Self::AdHoc => std::option::Option::Some(1),
12123 Self::Scheduled => std::option::Option::Some(2),
12124 Self::UnknownValue(u) => u.0.value(),
12125 }
12126 }
12127
12128 /// Gets the enum value as a string.
12129 ///
12130 /// Returns `None` if the enum contains an unknown value deserialized from
12131 /// the integer representation of enums.
12132 pub fn name(&self) -> std::option::Option<&str> {
12133 match self {
12134 Self::Unspecified => std::option::Option::Some("SNAPSHOT_TYPE_UNSPECIFIED"),
12135 Self::AdHoc => std::option::Option::Some("AD_HOC"),
12136 Self::Scheduled => std::option::Option::Some("SCHEDULED"),
12137 Self::UnknownValue(u) => u.0.name(),
12138 }
12139 }
12140 }
12141
12142 impl std::default::Default for SnapshotType {
12143 fn default() -> Self {
12144 use std::convert::From;
12145 Self::from(0)
12146 }
12147 }
12148
12149 impl std::fmt::Display for SnapshotType {
12150 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12151 wkt::internal::display_enum(f, self.name(), self.value())
12152 }
12153 }
12154
12155 impl std::convert::From<i32> for SnapshotType {
12156 fn from(value: i32) -> Self {
12157 match value {
12158 0 => Self::Unspecified,
12159 1 => Self::AdHoc,
12160 2 => Self::Scheduled,
12161 _ => Self::UnknownValue(snapshot_type::UnknownValue(
12162 wkt::internal::UnknownEnumValue::Integer(value),
12163 )),
12164 }
12165 }
12166 }
12167
12168 impl std::convert::From<&str> for SnapshotType {
12169 fn from(value: &str) -> Self {
12170 use std::string::ToString;
12171 match value {
12172 "SNAPSHOT_TYPE_UNSPECIFIED" => Self::Unspecified,
12173 "AD_HOC" => Self::AdHoc,
12174 "SCHEDULED" => Self::Scheduled,
12175 _ => Self::UnknownValue(snapshot_type::UnknownValue(
12176 wkt::internal::UnknownEnumValue::String(value.to_string()),
12177 )),
12178 }
12179 }
12180 }
12181
12182 impl serde::ser::Serialize for SnapshotType {
12183 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12184 where
12185 S: serde::Serializer,
12186 {
12187 match self {
12188 Self::Unspecified => serializer.serialize_i32(0),
12189 Self::AdHoc => serializer.serialize_i32(1),
12190 Self::Scheduled => serializer.serialize_i32(2),
12191 Self::UnknownValue(u) => u.0.serialize(serializer),
12192 }
12193 }
12194 }
12195
12196 impl<'de> serde::de::Deserialize<'de> for SnapshotType {
12197 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12198 where
12199 D: serde::Deserializer<'de>,
12200 {
12201 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotType>::new(
12202 ".google.cloud.baremetalsolution.v2.VolumeSnapshot.SnapshotType",
12203 ))
12204 }
12205 }
12206}
12207
12208/// Message for requesting volume snapshot information.
12209#[derive(Clone, Default, PartialEq)]
12210#[non_exhaustive]
12211pub struct GetVolumeSnapshotRequest {
12212 /// Required. The name of the snapshot.
12213 pub name: std::string::String,
12214
12215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12216}
12217
12218impl GetVolumeSnapshotRequest {
12219 /// Creates a new default instance.
12220 pub fn new() -> Self {
12221 std::default::Default::default()
12222 }
12223
12224 /// Sets the value of [name][crate::model::GetVolumeSnapshotRequest::name].
12225 ///
12226 /// # Example
12227 /// ```ignore,no_run
12228 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeSnapshotRequest;
12229 /// # let project_id = "project_id";
12230 /// # let location_id = "location_id";
12231 /// # let volume_id = "volume_id";
12232 /// # let snapshot_id = "snapshot_id";
12233 /// let x = GetVolumeSnapshotRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/snapshots/{snapshot_id}"));
12234 /// ```
12235 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12236 self.name = v.into();
12237 self
12238 }
12239}
12240
12241impl wkt::message::Message for GetVolumeSnapshotRequest {
12242 fn typename() -> &'static str {
12243 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeSnapshotRequest"
12244 }
12245}
12246
12247/// Message for requesting a list of volume snapshots.
12248#[derive(Clone, Default, PartialEq)]
12249#[non_exhaustive]
12250pub struct ListVolumeSnapshotsRequest {
12251 /// Required. Parent value for ListVolumesRequest.
12252 pub parent: std::string::String,
12253
12254 /// Requested page size. The server might return fewer items than requested.
12255 /// If unspecified, server will pick an appropriate default.
12256 pub page_size: i32,
12257
12258 /// A token identifying a page of results from the server.
12259 pub page_token: std::string::String,
12260
12261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12262}
12263
12264impl ListVolumeSnapshotsRequest {
12265 /// Creates a new default instance.
12266 pub fn new() -> Self {
12267 std::default::Default::default()
12268 }
12269
12270 /// Sets the value of [parent][crate::model::ListVolumeSnapshotsRequest::parent].
12271 ///
12272 /// # Example
12273 /// ```ignore,no_run
12274 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12275 /// # let project_id = "project_id";
12276 /// # let location_id = "location_id";
12277 /// # let volume_id = "volume_id";
12278 /// let x = ListVolumeSnapshotsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
12279 /// ```
12280 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12281 self.parent = v.into();
12282 self
12283 }
12284
12285 /// Sets the value of [page_size][crate::model::ListVolumeSnapshotsRequest::page_size].
12286 ///
12287 /// # Example
12288 /// ```ignore,no_run
12289 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12290 /// let x = ListVolumeSnapshotsRequest::new().set_page_size(42);
12291 /// ```
12292 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12293 self.page_size = v.into();
12294 self
12295 }
12296
12297 /// Sets the value of [page_token][crate::model::ListVolumeSnapshotsRequest::page_token].
12298 ///
12299 /// # Example
12300 /// ```ignore,no_run
12301 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12302 /// let x = ListVolumeSnapshotsRequest::new().set_page_token("example");
12303 /// ```
12304 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12305 self.page_token = v.into();
12306 self
12307 }
12308}
12309
12310impl wkt::message::Message for ListVolumeSnapshotsRequest {
12311 fn typename() -> &'static str {
12312 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsRequest"
12313 }
12314}
12315
12316/// Response message containing the list of volume snapshots.
12317#[derive(Clone, Default, PartialEq)]
12318#[non_exhaustive]
12319pub struct ListVolumeSnapshotsResponse {
12320 /// The list of snapshots.
12321 pub volume_snapshots: std::vec::Vec<crate::model::VolumeSnapshot>,
12322
12323 /// A token identifying a page of results from the server.
12324 pub next_page_token: std::string::String,
12325
12326 /// Locations that could not be reached.
12327 pub unreachable: std::vec::Vec<std::string::String>,
12328
12329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12330}
12331
12332impl ListVolumeSnapshotsResponse {
12333 /// Creates a new default instance.
12334 pub fn new() -> Self {
12335 std::default::Default::default()
12336 }
12337
12338 /// Sets the value of [volume_snapshots][crate::model::ListVolumeSnapshotsResponse::volume_snapshots].
12339 ///
12340 /// # Example
12341 /// ```ignore,no_run
12342 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12343 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12344 /// let x = ListVolumeSnapshotsResponse::new()
12345 /// .set_volume_snapshots([
12346 /// VolumeSnapshot::default()/* use setters */,
12347 /// VolumeSnapshot::default()/* use (different) setters */,
12348 /// ]);
12349 /// ```
12350 pub fn set_volume_snapshots<T, V>(mut self, v: T) -> Self
12351 where
12352 T: std::iter::IntoIterator<Item = V>,
12353 V: std::convert::Into<crate::model::VolumeSnapshot>,
12354 {
12355 use std::iter::Iterator;
12356 self.volume_snapshots = v.into_iter().map(|i| i.into()).collect();
12357 self
12358 }
12359
12360 /// Sets the value of [next_page_token][crate::model::ListVolumeSnapshotsResponse::next_page_token].
12361 ///
12362 /// # Example
12363 /// ```ignore,no_run
12364 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12365 /// let x = ListVolumeSnapshotsResponse::new().set_next_page_token("example");
12366 /// ```
12367 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12368 self.next_page_token = v.into();
12369 self
12370 }
12371
12372 /// Sets the value of [unreachable][crate::model::ListVolumeSnapshotsResponse::unreachable].
12373 ///
12374 /// # Example
12375 /// ```ignore,no_run
12376 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12377 /// let x = ListVolumeSnapshotsResponse::new().set_unreachable(["a", "b", "c"]);
12378 /// ```
12379 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
12380 where
12381 T: std::iter::IntoIterator<Item = V>,
12382 V: std::convert::Into<std::string::String>,
12383 {
12384 use std::iter::Iterator;
12385 self.unreachable = v.into_iter().map(|i| i.into()).collect();
12386 self
12387 }
12388}
12389
12390impl wkt::message::Message for ListVolumeSnapshotsResponse {
12391 fn typename() -> &'static str {
12392 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsResponse"
12393 }
12394}
12395
12396#[doc(hidden)]
12397impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumeSnapshotsResponse {
12398 type PageItem = crate::model::VolumeSnapshot;
12399
12400 fn items(self) -> std::vec::Vec<Self::PageItem> {
12401 self.volume_snapshots
12402 }
12403
12404 fn next_page_token(&self) -> std::string::String {
12405 use std::clone::Clone;
12406 self.next_page_token.clone()
12407 }
12408}
12409
12410/// Message for deleting named Volume snapshot.
12411#[derive(Clone, Default, PartialEq)]
12412#[non_exhaustive]
12413pub struct DeleteVolumeSnapshotRequest {
12414 /// Required. The name of the snapshot to delete.
12415 pub name: std::string::String,
12416
12417 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12418}
12419
12420impl DeleteVolumeSnapshotRequest {
12421 /// Creates a new default instance.
12422 pub fn new() -> Self {
12423 std::default::Default::default()
12424 }
12425
12426 /// Sets the value of [name][crate::model::DeleteVolumeSnapshotRequest::name].
12427 ///
12428 /// # Example
12429 /// ```ignore,no_run
12430 /// # use google_cloud_baremetalsolution_v2::model::DeleteVolumeSnapshotRequest;
12431 /// # let project_id = "project_id";
12432 /// # let location_id = "location_id";
12433 /// # let volume_id = "volume_id";
12434 /// # let snapshot_id = "snapshot_id";
12435 /// let x = DeleteVolumeSnapshotRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/snapshots/{snapshot_id}"));
12436 /// ```
12437 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12438 self.name = v.into();
12439 self
12440 }
12441}
12442
12443impl wkt::message::Message for DeleteVolumeSnapshotRequest {
12444 fn typename() -> &'static str {
12445 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteVolumeSnapshotRequest"
12446 }
12447}
12448
12449/// Message for creating a volume snapshot.
12450#[derive(Clone, Default, PartialEq)]
12451#[non_exhaustive]
12452pub struct CreateVolumeSnapshotRequest {
12453 /// Required. The volume to snapshot.
12454 pub parent: std::string::String,
12455
12456 /// Required. The snapshot to create.
12457 pub volume_snapshot: std::option::Option<crate::model::VolumeSnapshot>,
12458
12459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12460}
12461
12462impl CreateVolumeSnapshotRequest {
12463 /// Creates a new default instance.
12464 pub fn new() -> Self {
12465 std::default::Default::default()
12466 }
12467
12468 /// Sets the value of [parent][crate::model::CreateVolumeSnapshotRequest::parent].
12469 ///
12470 /// # Example
12471 /// ```ignore,no_run
12472 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12473 /// # let project_id = "project_id";
12474 /// # let location_id = "location_id";
12475 /// # let volume_id = "volume_id";
12476 /// let x = CreateVolumeSnapshotRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
12477 /// ```
12478 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12479 self.parent = v.into();
12480 self
12481 }
12482
12483 /// Sets the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12484 ///
12485 /// # Example
12486 /// ```ignore,no_run
12487 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12488 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12489 /// let x = CreateVolumeSnapshotRequest::new().set_volume_snapshot(VolumeSnapshot::default()/* use setters */);
12490 /// ```
12491 pub fn set_volume_snapshot<T>(mut self, v: T) -> Self
12492 where
12493 T: std::convert::Into<crate::model::VolumeSnapshot>,
12494 {
12495 self.volume_snapshot = std::option::Option::Some(v.into());
12496 self
12497 }
12498
12499 /// Sets or clears the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12500 ///
12501 /// # Example
12502 /// ```ignore,no_run
12503 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12504 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12505 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(Some(VolumeSnapshot::default()/* use setters */));
12506 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(None::<VolumeSnapshot>);
12507 /// ```
12508 pub fn set_or_clear_volume_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
12509 where
12510 T: std::convert::Into<crate::model::VolumeSnapshot>,
12511 {
12512 self.volume_snapshot = v.map(|x| x.into());
12513 self
12514 }
12515}
12516
12517impl wkt::message::Message for CreateVolumeSnapshotRequest {
12518 fn typename() -> &'static str {
12519 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateVolumeSnapshotRequest"
12520 }
12521}
12522
12523/// Message for restoring a volume snapshot.
12524#[derive(Clone, Default, PartialEq)]
12525#[non_exhaustive]
12526pub struct RestoreVolumeSnapshotRequest {
12527 /// Required. Name of the snapshot which will be used to restore its parent
12528 /// volume.
12529 pub volume_snapshot: std::string::String,
12530
12531 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12532}
12533
12534impl RestoreVolumeSnapshotRequest {
12535 /// Creates a new default instance.
12536 pub fn new() -> Self {
12537 std::default::Default::default()
12538 }
12539
12540 /// Sets the value of [volume_snapshot][crate::model::RestoreVolumeSnapshotRequest::volume_snapshot].
12541 ///
12542 /// # Example
12543 /// ```ignore,no_run
12544 /// # use google_cloud_baremetalsolution_v2::model::RestoreVolumeSnapshotRequest;
12545 /// # let project_id = "project_id";
12546 /// # let location_id = "location_id";
12547 /// # let volume_id = "volume_id";
12548 /// # let snapshot_id = "snapshot_id";
12549 /// let x = RestoreVolumeSnapshotRequest::new().set_volume_snapshot(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/snapshots/{snapshot_id}"));
12550 /// ```
12551 pub fn set_volume_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12552 self.volume_snapshot = v.into();
12553 self
12554 }
12555}
12556
12557impl wkt::message::Message for RestoreVolumeSnapshotRequest {
12558 fn typename() -> &'static str {
12559 "type.googleapis.com/google.cloud.baremetalsolution.v2.RestoreVolumeSnapshotRequest"
12560 }
12561}
12562
12563/// Performance tier of the Volume.
12564///
12565/// # Working with unknown values
12566///
12567/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12568/// additional enum variants at any time. Adding new variants is not considered
12569/// a breaking change. Applications should write their code in anticipation of:
12570///
12571/// - New values appearing in future releases of the client library, **and**
12572/// - New values received dynamically, without application changes.
12573///
12574/// Please consult the [Working with enums] section in the user guide for some
12575/// guidelines.
12576///
12577/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12578#[derive(Clone, Debug, PartialEq)]
12579#[non_exhaustive]
12580pub enum VolumePerformanceTier {
12581 /// Value is not specified.
12582 Unspecified,
12583 /// Regular volumes, shared aggregates.
12584 Shared,
12585 /// Assigned aggregates.
12586 Assigned,
12587 /// High throughput aggregates.
12588 Ht,
12589 /// If set, the enum was initialized with an unknown value.
12590 ///
12591 /// Applications can examine the value using [VolumePerformanceTier::value] or
12592 /// [VolumePerformanceTier::name].
12593 UnknownValue(volume_performance_tier::UnknownValue),
12594}
12595
12596#[doc(hidden)]
12597pub mod volume_performance_tier {
12598 #[allow(unused_imports)]
12599 use super::*;
12600 #[derive(Clone, Debug, PartialEq)]
12601 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12602}
12603
12604impl VolumePerformanceTier {
12605 /// Gets the enum value.
12606 ///
12607 /// Returns `None` if the enum contains an unknown value deserialized from
12608 /// the string representation of enums.
12609 pub fn value(&self) -> std::option::Option<i32> {
12610 match self {
12611 Self::Unspecified => std::option::Option::Some(0),
12612 Self::Shared => std::option::Option::Some(1),
12613 Self::Assigned => std::option::Option::Some(2),
12614 Self::Ht => std::option::Option::Some(3),
12615 Self::UnknownValue(u) => u.0.value(),
12616 }
12617 }
12618
12619 /// Gets the enum value as a string.
12620 ///
12621 /// Returns `None` if the enum contains an unknown value deserialized from
12622 /// the integer representation of enums.
12623 pub fn name(&self) -> std::option::Option<&str> {
12624 match self {
12625 Self::Unspecified => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_UNSPECIFIED"),
12626 Self::Shared => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_SHARED"),
12627 Self::Assigned => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_ASSIGNED"),
12628 Self::Ht => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_HT"),
12629 Self::UnknownValue(u) => u.0.name(),
12630 }
12631 }
12632}
12633
12634impl std::default::Default for VolumePerformanceTier {
12635 fn default() -> Self {
12636 use std::convert::From;
12637 Self::from(0)
12638 }
12639}
12640
12641impl std::fmt::Display for VolumePerformanceTier {
12642 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12643 wkt::internal::display_enum(f, self.name(), self.value())
12644 }
12645}
12646
12647impl std::convert::From<i32> for VolumePerformanceTier {
12648 fn from(value: i32) -> Self {
12649 match value {
12650 0 => Self::Unspecified,
12651 1 => Self::Shared,
12652 2 => Self::Assigned,
12653 3 => Self::Ht,
12654 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12655 wkt::internal::UnknownEnumValue::Integer(value),
12656 )),
12657 }
12658 }
12659}
12660
12661impl std::convert::From<&str> for VolumePerformanceTier {
12662 fn from(value: &str) -> Self {
12663 use std::string::ToString;
12664 match value {
12665 "VOLUME_PERFORMANCE_TIER_UNSPECIFIED" => Self::Unspecified,
12666 "VOLUME_PERFORMANCE_TIER_SHARED" => Self::Shared,
12667 "VOLUME_PERFORMANCE_TIER_ASSIGNED" => Self::Assigned,
12668 "VOLUME_PERFORMANCE_TIER_HT" => Self::Ht,
12669 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12670 wkt::internal::UnknownEnumValue::String(value.to_string()),
12671 )),
12672 }
12673 }
12674}
12675
12676impl serde::ser::Serialize for VolumePerformanceTier {
12677 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12678 where
12679 S: serde::Serializer,
12680 {
12681 match self {
12682 Self::Unspecified => serializer.serialize_i32(0),
12683 Self::Shared => serializer.serialize_i32(1),
12684 Self::Assigned => serializer.serialize_i32(2),
12685 Self::Ht => serializer.serialize_i32(3),
12686 Self::UnknownValue(u) => u.0.serialize(serializer),
12687 }
12688 }
12689}
12690
12691impl<'de> serde::de::Deserialize<'de> for VolumePerformanceTier {
12692 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12693 where
12694 D: serde::Deserializer<'de>,
12695 {
12696 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumePerformanceTier>::new(
12697 ".google.cloud.baremetalsolution.v2.VolumePerformanceTier",
12698 ))
12699 }
12700}
12701
12702/// The possible values for a workload profile.
12703///
12704/// # Working with unknown values
12705///
12706/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12707/// additional enum variants at any time. Adding new variants is not considered
12708/// a breaking change. Applications should write their code in anticipation of:
12709///
12710/// - New values appearing in future releases of the client library, **and**
12711/// - New values received dynamically, without application changes.
12712///
12713/// Please consult the [Working with enums] section in the user guide for some
12714/// guidelines.
12715///
12716/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12717#[derive(Clone, Debug, PartialEq)]
12718#[non_exhaustive]
12719pub enum WorkloadProfile {
12720 /// The workload profile is in an unknown state.
12721 Unspecified,
12722 /// The workload profile is generic.
12723 Generic,
12724 /// The workload profile is hana.
12725 Hana,
12726 /// If set, the enum was initialized with an unknown value.
12727 ///
12728 /// Applications can examine the value using [WorkloadProfile::value] or
12729 /// [WorkloadProfile::name].
12730 UnknownValue(workload_profile::UnknownValue),
12731}
12732
12733#[doc(hidden)]
12734pub mod workload_profile {
12735 #[allow(unused_imports)]
12736 use super::*;
12737 #[derive(Clone, Debug, PartialEq)]
12738 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12739}
12740
12741impl WorkloadProfile {
12742 /// Gets the enum value.
12743 ///
12744 /// Returns `None` if the enum contains an unknown value deserialized from
12745 /// the string representation of enums.
12746 pub fn value(&self) -> std::option::Option<i32> {
12747 match self {
12748 Self::Unspecified => std::option::Option::Some(0),
12749 Self::Generic => std::option::Option::Some(1),
12750 Self::Hana => std::option::Option::Some(2),
12751 Self::UnknownValue(u) => u.0.value(),
12752 }
12753 }
12754
12755 /// Gets the enum value as a string.
12756 ///
12757 /// Returns `None` if the enum contains an unknown value deserialized from
12758 /// the integer representation of enums.
12759 pub fn name(&self) -> std::option::Option<&str> {
12760 match self {
12761 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
12762 Self::Generic => std::option::Option::Some("WORKLOAD_PROFILE_GENERIC"),
12763 Self::Hana => std::option::Option::Some("WORKLOAD_PROFILE_HANA"),
12764 Self::UnknownValue(u) => u.0.name(),
12765 }
12766 }
12767}
12768
12769impl std::default::Default for WorkloadProfile {
12770 fn default() -> Self {
12771 use std::convert::From;
12772 Self::from(0)
12773 }
12774}
12775
12776impl std::fmt::Display for WorkloadProfile {
12777 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12778 wkt::internal::display_enum(f, self.name(), self.value())
12779 }
12780}
12781
12782impl std::convert::From<i32> for WorkloadProfile {
12783 fn from(value: i32) -> Self {
12784 match value {
12785 0 => Self::Unspecified,
12786 1 => Self::Generic,
12787 2 => Self::Hana,
12788 _ => Self::UnknownValue(workload_profile::UnknownValue(
12789 wkt::internal::UnknownEnumValue::Integer(value),
12790 )),
12791 }
12792 }
12793}
12794
12795impl std::convert::From<&str> for WorkloadProfile {
12796 fn from(value: &str) -> Self {
12797 use std::string::ToString;
12798 match value {
12799 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
12800 "WORKLOAD_PROFILE_GENERIC" => Self::Generic,
12801 "WORKLOAD_PROFILE_HANA" => Self::Hana,
12802 _ => Self::UnknownValue(workload_profile::UnknownValue(
12803 wkt::internal::UnknownEnumValue::String(value.to_string()),
12804 )),
12805 }
12806 }
12807}
12808
12809impl serde::ser::Serialize for WorkloadProfile {
12810 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12811 where
12812 S: serde::Serializer,
12813 {
12814 match self {
12815 Self::Unspecified => serializer.serialize_i32(0),
12816 Self::Generic => serializer.serialize_i32(1),
12817 Self::Hana => serializer.serialize_i32(2),
12818 Self::UnknownValue(u) => u.0.serialize(serializer),
12819 }
12820 }
12821}
12822
12823impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
12824 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12825 where
12826 D: serde::Deserializer<'de>,
12827 {
12828 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
12829 ".google.cloud.baremetalsolution.v2.WorkloadProfile",
12830 ))
12831 }
12832}