google_cloud_baremetalsolution_v2/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// Represents the metadata from a long-running operation.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct OperationMetadata {
42 /// Output only. The time the operation was created.
43 pub create_time: std::option::Option<wkt::Timestamp>,
44
45 /// Output only. The time the operation finished running.
46 pub end_time: std::option::Option<wkt::Timestamp>,
47
48 /// Output only. Server-defined resource path for the target of the operation.
49 pub target: std::string::String,
50
51 /// Output only. Name of the action executed by the operation.
52 pub verb: std::string::String,
53
54 /// Output only. Human-readable status of the operation, if any.
55 pub status_message: std::string::String,
56
57 /// Output only. Identifies whether the user requested the cancellation
58 /// of the operation. Operations that have been successfully cancelled
59 /// have [Operation.error][] value with a
60 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
61 /// `Code.CANCELLED`.
62 pub requested_cancellation: bool,
63
64 /// Output only. API version used with the operation.
65 pub api_version: std::string::String,
66
67 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
68}
69
70impl OperationMetadata {
71 /// Creates a new default instance.
72 pub fn new() -> Self {
73 std::default::Default::default()
74 }
75
76 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
77 ///
78 /// # Example
79 /// ```ignore,no_run
80 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
81 /// use wkt::Timestamp;
82 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
83 /// ```
84 pub fn set_create_time<T>(mut self, v: T) -> Self
85 where
86 T: std::convert::Into<wkt::Timestamp>,
87 {
88 self.create_time = std::option::Option::Some(v.into());
89 self
90 }
91
92 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
93 ///
94 /// # Example
95 /// ```ignore,no_run
96 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
97 /// use wkt::Timestamp;
98 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
99 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
100 /// ```
101 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
102 where
103 T: std::convert::Into<wkt::Timestamp>,
104 {
105 self.create_time = v.map(|x| x.into());
106 self
107 }
108
109 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
110 ///
111 /// # Example
112 /// ```ignore,no_run
113 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
114 /// use wkt::Timestamp;
115 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
116 /// ```
117 pub fn set_end_time<T>(mut self, v: T) -> Self
118 where
119 T: std::convert::Into<wkt::Timestamp>,
120 {
121 self.end_time = std::option::Option::Some(v.into());
122 self
123 }
124
125 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
126 ///
127 /// # Example
128 /// ```ignore,no_run
129 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
130 /// use wkt::Timestamp;
131 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
132 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
133 /// ```
134 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
135 where
136 T: std::convert::Into<wkt::Timestamp>,
137 {
138 self.end_time = v.map(|x| x.into());
139 self
140 }
141
142 /// Sets the value of [target][crate::model::OperationMetadata::target].
143 ///
144 /// # Example
145 /// ```ignore,no_run
146 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
147 /// let x = OperationMetadata::new().set_target("example");
148 /// ```
149 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
150 self.target = v.into();
151 self
152 }
153
154 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
155 ///
156 /// # Example
157 /// ```ignore,no_run
158 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
159 /// let x = OperationMetadata::new().set_verb("example");
160 /// ```
161 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
162 self.verb = v.into();
163 self
164 }
165
166 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
167 ///
168 /// # Example
169 /// ```ignore,no_run
170 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
171 /// let x = OperationMetadata::new().set_status_message("example");
172 /// ```
173 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
174 self.status_message = v.into();
175 self
176 }
177
178 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
179 ///
180 /// # Example
181 /// ```ignore,no_run
182 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
183 /// let x = OperationMetadata::new().set_requested_cancellation(true);
184 /// ```
185 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
186 self.requested_cancellation = v.into();
187 self
188 }
189
190 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
191 ///
192 /// # Example
193 /// ```ignore,no_run
194 /// # use google_cloud_baremetalsolution_v2::model::OperationMetadata;
195 /// let x = OperationMetadata::new().set_api_version("example");
196 /// ```
197 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
198 self.api_version = v.into();
199 self
200 }
201}
202
203impl wkt::message::Message for OperationMetadata {
204 fn typename() -> &'static str {
205 "type.googleapis.com/google.cloud.baremetalsolution.v2.OperationMetadata"
206 }
207}
208
209/// Response message from resetting a server.
210#[derive(Clone, Default, PartialEq)]
211#[non_exhaustive]
212pub struct ResetInstanceResponse {
213 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
214}
215
216impl ResetInstanceResponse {
217 /// Creates a new default instance.
218 pub fn new() -> Self {
219 std::default::Default::default()
220 }
221}
222
223impl wkt::message::Message for ResetInstanceResponse {
224 fn typename() -> &'static str {
225 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceResponse"
226 }
227}
228
229/// A server.
230#[derive(Clone, Default, PartialEq)]
231#[non_exhaustive]
232pub struct Instance {
233 /// Immutable. The resource name of this `Instance`.
234 /// Resource names are schemeless URIs that follow the conventions in
235 /// <https://cloud.google.com/apis/design/resource_names>.
236 /// Format:
237 /// `projects/{project}/locations/{location}/instances/{instance}`
238 pub name: std::string::String,
239
240 /// Output only. An identifier for the `Instance`, generated by the backend.
241 pub id: std::string::String,
242
243 /// Output only. Create a time stamp.
244 pub create_time: std::option::Option<wkt::Timestamp>,
245
246 /// Output only. Update a time stamp.
247 pub update_time: std::option::Option<wkt::Timestamp>,
248
249 /// Immutable. The server type.
250 /// [Available server
251 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
252 pub machine_type: std::string::String,
253
254 /// Output only. The state of the server.
255 pub state: crate::model::instance::State,
256
257 /// True if you enable hyperthreading for the server, otherwise false.
258 /// The default value is false.
259 pub hyperthreading_enabled: bool,
260
261 /// Labels as key value pairs.
262 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
263
264 /// Immutable. List of LUNs associated with this server.
265 pub luns: std::vec::Vec<crate::model::Lun>,
266
267 /// Input only. List of Volumes to attach to this Instance on creation.
268 /// This field won't be populated in Get/List responses.
269 pub volumes: std::vec::Vec<crate::model::Volume>,
270
271 /// Output only. List of networks associated with this server.
272 pub networks: std::vec::Vec<crate::model::Network>,
273
274 /// Output only. True if the interactive serial console feature is enabled for
275 /// the instance, false otherwise. The default value is false.
276 pub interactive_serial_console_enabled: bool,
277
278 /// The OS image currently installed on the server.
279 pub os_image: std::string::String,
280
281 /// Immutable. Pod name.
282 /// Pod is an independent part of infrastructure.
283 /// Instance can be connected to the assets (networks, volumes) allocated
284 /// in the same pod only.
285 pub pod: std::string::String,
286
287 /// Instance network template name. For eg, bondaa-bondaa, bondab-nic, etc.
288 /// Generally, the template name follows the syntax of
289 /// "bond<bond_mode>" or "nic".
290 pub network_template: std::string::String,
291
292 /// List of logical interfaces for the instance. The number of logical
293 /// interfaces will be the same as number of hardware bond/nic on the chosen
294 /// network template. For the non-multivlan configurations (for eg, existing
295 /// servers) that use existing default network template (bondaa-bondaa), both
296 /// the Instance.networks field and the Instance.logical_interfaces fields will
297 /// be filled to ensure backward compatibility. For the others, only
298 /// Instance.logical_interfaces will be filled.
299 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
300
301 /// Output only. Text field about info for logging in.
302 pub login_info: std::string::String,
303
304 /// The workload profile for the instance.
305 pub workload_profile: crate::model::WorkloadProfile,
306
307 /// Output only. The firmware version for the instance.
308 pub firmware_version: std::string::String,
309
310 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
311}
312
313impl Instance {
314 /// Creates a new default instance.
315 pub fn new() -> Self {
316 std::default::Default::default()
317 }
318
319 /// Sets the value of [name][crate::model::Instance::name].
320 ///
321 /// # Example
322 /// ```ignore,no_run
323 /// # use google_cloud_baremetalsolution_v2::model::Instance;
324 /// # let project_id = "project_id";
325 /// # let location_id = "location_id";
326 /// # let instance_id = "instance_id";
327 /// let x = Instance::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
328 /// ```
329 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
330 self.name = v.into();
331 self
332 }
333
334 /// Sets the value of [id][crate::model::Instance::id].
335 ///
336 /// # Example
337 /// ```ignore,no_run
338 /// # use google_cloud_baremetalsolution_v2::model::Instance;
339 /// let x = Instance::new().set_id("example");
340 /// ```
341 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
342 self.id = v.into();
343 self
344 }
345
346 /// Sets the value of [create_time][crate::model::Instance::create_time].
347 ///
348 /// # Example
349 /// ```ignore,no_run
350 /// # use google_cloud_baremetalsolution_v2::model::Instance;
351 /// use wkt::Timestamp;
352 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
353 /// ```
354 pub fn set_create_time<T>(mut self, v: T) -> Self
355 where
356 T: std::convert::Into<wkt::Timestamp>,
357 {
358 self.create_time = std::option::Option::Some(v.into());
359 self
360 }
361
362 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
363 ///
364 /// # Example
365 /// ```ignore,no_run
366 /// # use google_cloud_baremetalsolution_v2::model::Instance;
367 /// use wkt::Timestamp;
368 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
369 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
370 /// ```
371 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
372 where
373 T: std::convert::Into<wkt::Timestamp>,
374 {
375 self.create_time = v.map(|x| x.into());
376 self
377 }
378
379 /// Sets the value of [update_time][crate::model::Instance::update_time].
380 ///
381 /// # Example
382 /// ```ignore,no_run
383 /// # use google_cloud_baremetalsolution_v2::model::Instance;
384 /// use wkt::Timestamp;
385 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
386 /// ```
387 pub fn set_update_time<T>(mut self, v: T) -> Self
388 where
389 T: std::convert::Into<wkt::Timestamp>,
390 {
391 self.update_time = std::option::Option::Some(v.into());
392 self
393 }
394
395 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
396 ///
397 /// # Example
398 /// ```ignore,no_run
399 /// # use google_cloud_baremetalsolution_v2::model::Instance;
400 /// use wkt::Timestamp;
401 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
402 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
403 /// ```
404 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
405 where
406 T: std::convert::Into<wkt::Timestamp>,
407 {
408 self.update_time = v.map(|x| x.into());
409 self
410 }
411
412 /// Sets the value of [machine_type][crate::model::Instance::machine_type].
413 ///
414 /// # Example
415 /// ```ignore,no_run
416 /// # use google_cloud_baremetalsolution_v2::model::Instance;
417 /// let x = Instance::new().set_machine_type("example");
418 /// ```
419 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
420 self.machine_type = v.into();
421 self
422 }
423
424 /// Sets the value of [state][crate::model::Instance::state].
425 ///
426 /// # Example
427 /// ```ignore,no_run
428 /// # use google_cloud_baremetalsolution_v2::model::Instance;
429 /// use google_cloud_baremetalsolution_v2::model::instance::State;
430 /// let x0 = Instance::new().set_state(State::Provisioning);
431 /// let x1 = Instance::new().set_state(State::Running);
432 /// let x2 = Instance::new().set_state(State::Deleted);
433 /// ```
434 pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
435 self.state = v.into();
436 self
437 }
438
439 /// Sets the value of [hyperthreading_enabled][crate::model::Instance::hyperthreading_enabled].
440 ///
441 /// # Example
442 /// ```ignore,no_run
443 /// # use google_cloud_baremetalsolution_v2::model::Instance;
444 /// let x = Instance::new().set_hyperthreading_enabled(true);
445 /// ```
446 pub fn set_hyperthreading_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
447 self.hyperthreading_enabled = v.into();
448 self
449 }
450
451 /// Sets the value of [labels][crate::model::Instance::labels].
452 ///
453 /// # Example
454 /// ```ignore,no_run
455 /// # use google_cloud_baremetalsolution_v2::model::Instance;
456 /// let x = Instance::new().set_labels([
457 /// ("key0", "abc"),
458 /// ("key1", "xyz"),
459 /// ]);
460 /// ```
461 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
462 where
463 T: std::iter::IntoIterator<Item = (K, V)>,
464 K: std::convert::Into<std::string::String>,
465 V: std::convert::Into<std::string::String>,
466 {
467 use std::iter::Iterator;
468 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
469 self
470 }
471
472 /// Sets the value of [luns][crate::model::Instance::luns].
473 ///
474 /// # Example
475 /// ```ignore,no_run
476 /// # use google_cloud_baremetalsolution_v2::model::Instance;
477 /// use google_cloud_baremetalsolution_v2::model::Lun;
478 /// let x = Instance::new()
479 /// .set_luns([
480 /// Lun::default()/* use setters */,
481 /// Lun::default()/* use (different) setters */,
482 /// ]);
483 /// ```
484 pub fn set_luns<T, V>(mut self, v: T) -> Self
485 where
486 T: std::iter::IntoIterator<Item = V>,
487 V: std::convert::Into<crate::model::Lun>,
488 {
489 use std::iter::Iterator;
490 self.luns = v.into_iter().map(|i| i.into()).collect();
491 self
492 }
493
494 /// Sets the value of [volumes][crate::model::Instance::volumes].
495 ///
496 /// # Example
497 /// ```ignore,no_run
498 /// # use google_cloud_baremetalsolution_v2::model::Instance;
499 /// use google_cloud_baremetalsolution_v2::model::Volume;
500 /// let x = Instance::new()
501 /// .set_volumes([
502 /// Volume::default()/* use setters */,
503 /// Volume::default()/* use (different) setters */,
504 /// ]);
505 /// ```
506 pub fn set_volumes<T, V>(mut self, v: T) -> Self
507 where
508 T: std::iter::IntoIterator<Item = V>,
509 V: std::convert::Into<crate::model::Volume>,
510 {
511 use std::iter::Iterator;
512 self.volumes = v.into_iter().map(|i| i.into()).collect();
513 self
514 }
515
516 /// Sets the value of [networks][crate::model::Instance::networks].
517 ///
518 /// # Example
519 /// ```ignore,no_run
520 /// # use google_cloud_baremetalsolution_v2::model::Instance;
521 /// use google_cloud_baremetalsolution_v2::model::Network;
522 /// let x = Instance::new()
523 /// .set_networks([
524 /// Network::default()/* use setters */,
525 /// Network::default()/* use (different) setters */,
526 /// ]);
527 /// ```
528 pub fn set_networks<T, V>(mut self, v: T) -> Self
529 where
530 T: std::iter::IntoIterator<Item = V>,
531 V: std::convert::Into<crate::model::Network>,
532 {
533 use std::iter::Iterator;
534 self.networks = v.into_iter().map(|i| i.into()).collect();
535 self
536 }
537
538 /// Sets the value of [interactive_serial_console_enabled][crate::model::Instance::interactive_serial_console_enabled].
539 ///
540 /// # Example
541 /// ```ignore,no_run
542 /// # use google_cloud_baremetalsolution_v2::model::Instance;
543 /// let x = Instance::new().set_interactive_serial_console_enabled(true);
544 /// ```
545 pub fn set_interactive_serial_console_enabled<T: std::convert::Into<bool>>(
546 mut self,
547 v: T,
548 ) -> Self {
549 self.interactive_serial_console_enabled = v.into();
550 self
551 }
552
553 /// Sets the value of [os_image][crate::model::Instance::os_image].
554 ///
555 /// # Example
556 /// ```ignore,no_run
557 /// # use google_cloud_baremetalsolution_v2::model::Instance;
558 /// let x = Instance::new().set_os_image("example");
559 /// ```
560 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
561 self.os_image = v.into();
562 self
563 }
564
565 /// Sets the value of [pod][crate::model::Instance::pod].
566 ///
567 /// # Example
568 /// ```ignore,no_run
569 /// # use google_cloud_baremetalsolution_v2::model::Instance;
570 /// let x = Instance::new().set_pod("example");
571 /// ```
572 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
573 self.pod = v.into();
574 self
575 }
576
577 /// Sets the value of [network_template][crate::model::Instance::network_template].
578 ///
579 /// # Example
580 /// ```ignore,no_run
581 /// # use google_cloud_baremetalsolution_v2::model::Instance;
582 /// # let project_id = "project_id";
583 /// # let location_id = "location_id";
584 /// # let server_network_template_id = "server_network_template_id";
585 /// let x = Instance::new().set_network_template(format!("projects/{project_id}/locations/{location_id}/serverNetworkTemplate/{server_network_template_id}"));
586 /// ```
587 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
588 mut self,
589 v: T,
590 ) -> Self {
591 self.network_template = v.into();
592 self
593 }
594
595 /// Sets the value of [logical_interfaces][crate::model::Instance::logical_interfaces].
596 ///
597 /// # Example
598 /// ```ignore,no_run
599 /// # use google_cloud_baremetalsolution_v2::model::Instance;
600 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
601 /// let x = Instance::new()
602 /// .set_logical_interfaces([
603 /// LogicalInterface::default()/* use setters */,
604 /// LogicalInterface::default()/* use (different) setters */,
605 /// ]);
606 /// ```
607 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
608 where
609 T: std::iter::IntoIterator<Item = V>,
610 V: std::convert::Into<crate::model::LogicalInterface>,
611 {
612 use std::iter::Iterator;
613 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
614 self
615 }
616
617 /// Sets the value of [login_info][crate::model::Instance::login_info].
618 ///
619 /// # Example
620 /// ```ignore,no_run
621 /// # use google_cloud_baremetalsolution_v2::model::Instance;
622 /// let x = Instance::new().set_login_info("example");
623 /// ```
624 pub fn set_login_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
625 self.login_info = v.into();
626 self
627 }
628
629 /// Sets the value of [workload_profile][crate::model::Instance::workload_profile].
630 ///
631 /// # Example
632 /// ```ignore,no_run
633 /// # use google_cloud_baremetalsolution_v2::model::Instance;
634 /// use google_cloud_baremetalsolution_v2::model::WorkloadProfile;
635 /// let x0 = Instance::new().set_workload_profile(WorkloadProfile::Generic);
636 /// let x1 = Instance::new().set_workload_profile(WorkloadProfile::Hana);
637 /// ```
638 pub fn set_workload_profile<T: std::convert::Into<crate::model::WorkloadProfile>>(
639 mut self,
640 v: T,
641 ) -> Self {
642 self.workload_profile = v.into();
643 self
644 }
645
646 /// Sets the value of [firmware_version][crate::model::Instance::firmware_version].
647 ///
648 /// # Example
649 /// ```ignore,no_run
650 /// # use google_cloud_baremetalsolution_v2::model::Instance;
651 /// let x = Instance::new().set_firmware_version("example");
652 /// ```
653 pub fn set_firmware_version<T: std::convert::Into<std::string::String>>(
654 mut self,
655 v: T,
656 ) -> Self {
657 self.firmware_version = v.into();
658 self
659 }
660}
661
662impl wkt::message::Message for Instance {
663 fn typename() -> &'static str {
664 "type.googleapis.com/google.cloud.baremetalsolution.v2.Instance"
665 }
666}
667
668/// Defines additional types related to [Instance].
669pub mod instance {
670 #[allow(unused_imports)]
671 use super::*;
672
673 /// The possible states for this server.
674 ///
675 /// # Working with unknown values
676 ///
677 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
678 /// additional enum variants at any time. Adding new variants is not considered
679 /// a breaking change. Applications should write their code in anticipation of:
680 ///
681 /// - New values appearing in future releases of the client library, **and**
682 /// - New values received dynamically, without application changes.
683 ///
684 /// Please consult the [Working with enums] section in the user guide for some
685 /// guidelines.
686 ///
687 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
688 #[derive(Clone, Debug, PartialEq)]
689 #[non_exhaustive]
690 pub enum State {
691 /// The server is in an unknown state.
692 Unspecified,
693 /// The server is being provisioned.
694 Provisioning,
695 /// The server is running.
696 Running,
697 /// The server has been deleted.
698 Deleted,
699 /// The server is being updated.
700 Updating,
701 /// The server is starting.
702 Starting,
703 /// The server is stopping.
704 Stopping,
705 /// The server is shutdown.
706 Shutdown,
707 /// If set, the enum was initialized with an unknown value.
708 ///
709 /// Applications can examine the value using [State::value] or
710 /// [State::name].
711 UnknownValue(state::UnknownValue),
712 }
713
714 #[doc(hidden)]
715 pub mod state {
716 #[allow(unused_imports)]
717 use super::*;
718 #[derive(Clone, Debug, PartialEq)]
719 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
720 }
721
722 impl State {
723 /// Gets the enum value.
724 ///
725 /// Returns `None` if the enum contains an unknown value deserialized from
726 /// the string representation of enums.
727 pub fn value(&self) -> std::option::Option<i32> {
728 match self {
729 Self::Unspecified => std::option::Option::Some(0),
730 Self::Provisioning => std::option::Option::Some(1),
731 Self::Running => std::option::Option::Some(2),
732 Self::Deleted => std::option::Option::Some(3),
733 Self::Updating => std::option::Option::Some(4),
734 Self::Starting => std::option::Option::Some(5),
735 Self::Stopping => std::option::Option::Some(6),
736 Self::Shutdown => std::option::Option::Some(7),
737 Self::UnknownValue(u) => u.0.value(),
738 }
739 }
740
741 /// Gets the enum value as a string.
742 ///
743 /// Returns `None` if the enum contains an unknown value deserialized from
744 /// the integer representation of enums.
745 pub fn name(&self) -> std::option::Option<&str> {
746 match self {
747 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
748 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
749 Self::Running => std::option::Option::Some("RUNNING"),
750 Self::Deleted => std::option::Option::Some("DELETED"),
751 Self::Updating => std::option::Option::Some("UPDATING"),
752 Self::Starting => std::option::Option::Some("STARTING"),
753 Self::Stopping => std::option::Option::Some("STOPPING"),
754 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
755 Self::UnknownValue(u) => u.0.name(),
756 }
757 }
758 }
759
760 impl std::default::Default for State {
761 fn default() -> Self {
762 use std::convert::From;
763 Self::from(0)
764 }
765 }
766
767 impl std::fmt::Display for State {
768 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
769 wkt::internal::display_enum(f, self.name(), self.value())
770 }
771 }
772
773 impl std::convert::From<i32> for State {
774 fn from(value: i32) -> Self {
775 match value {
776 0 => Self::Unspecified,
777 1 => Self::Provisioning,
778 2 => Self::Running,
779 3 => Self::Deleted,
780 4 => Self::Updating,
781 5 => Self::Starting,
782 6 => Self::Stopping,
783 7 => Self::Shutdown,
784 _ => Self::UnknownValue(state::UnknownValue(
785 wkt::internal::UnknownEnumValue::Integer(value),
786 )),
787 }
788 }
789 }
790
791 impl std::convert::From<&str> for State {
792 fn from(value: &str) -> Self {
793 use std::string::ToString;
794 match value {
795 "STATE_UNSPECIFIED" => Self::Unspecified,
796 "PROVISIONING" => Self::Provisioning,
797 "RUNNING" => Self::Running,
798 "DELETED" => Self::Deleted,
799 "UPDATING" => Self::Updating,
800 "STARTING" => Self::Starting,
801 "STOPPING" => Self::Stopping,
802 "SHUTDOWN" => Self::Shutdown,
803 _ => Self::UnknownValue(state::UnknownValue(
804 wkt::internal::UnknownEnumValue::String(value.to_string()),
805 )),
806 }
807 }
808 }
809
810 impl serde::ser::Serialize for State {
811 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
812 where
813 S: serde::Serializer,
814 {
815 match self {
816 Self::Unspecified => serializer.serialize_i32(0),
817 Self::Provisioning => serializer.serialize_i32(1),
818 Self::Running => serializer.serialize_i32(2),
819 Self::Deleted => serializer.serialize_i32(3),
820 Self::Updating => serializer.serialize_i32(4),
821 Self::Starting => serializer.serialize_i32(5),
822 Self::Stopping => serializer.serialize_i32(6),
823 Self::Shutdown => serializer.serialize_i32(7),
824 Self::UnknownValue(u) => u.0.serialize(serializer),
825 }
826 }
827 }
828
829 impl<'de> serde::de::Deserialize<'de> for State {
830 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
831 where
832 D: serde::Deserializer<'de>,
833 {
834 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
835 ".google.cloud.baremetalsolution.v2.Instance.State",
836 ))
837 }
838 }
839}
840
841/// Message for requesting server information.
842#[derive(Clone, Default, PartialEq)]
843#[non_exhaustive]
844pub struct GetInstanceRequest {
845 /// Required. Name of the resource.
846 pub name: std::string::String,
847
848 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
849}
850
851impl GetInstanceRequest {
852 /// Creates a new default instance.
853 pub fn new() -> Self {
854 std::default::Default::default()
855 }
856
857 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
858 ///
859 /// # Example
860 /// ```ignore,no_run
861 /// # use google_cloud_baremetalsolution_v2::model::GetInstanceRequest;
862 /// # let project_id = "project_id";
863 /// # let location_id = "location_id";
864 /// # let instance_id = "instance_id";
865 /// let x = GetInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
866 /// ```
867 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
868 self.name = v.into();
869 self
870 }
871}
872
873impl wkt::message::Message for GetInstanceRequest {
874 fn typename() -> &'static str {
875 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetInstanceRequest"
876 }
877}
878
879/// Message for requesting the list of servers.
880#[derive(Clone, Default, PartialEq)]
881#[non_exhaustive]
882pub struct ListInstancesRequest {
883 /// Required. Parent value for ListInstancesRequest.
884 pub parent: std::string::String,
885
886 /// Requested page size. Server may return fewer items than requested.
887 /// If unspecified, the server will pick an appropriate default.
888 pub page_size: i32,
889
890 /// A token identifying a page of results from the server.
891 pub page_token: std::string::String,
892
893 /// List filter.
894 pub filter: std::string::String,
895
896 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
897}
898
899impl ListInstancesRequest {
900 /// Creates a new default instance.
901 pub fn new() -> Self {
902 std::default::Default::default()
903 }
904
905 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
906 ///
907 /// # Example
908 /// ```ignore,no_run
909 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
910 /// let x = ListInstancesRequest::new().set_parent("example");
911 /// ```
912 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
913 self.parent = v.into();
914 self
915 }
916
917 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
918 ///
919 /// # Example
920 /// ```ignore,no_run
921 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
922 /// let x = ListInstancesRequest::new().set_page_size(42);
923 /// ```
924 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
925 self.page_size = v.into();
926 self
927 }
928
929 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
930 ///
931 /// # Example
932 /// ```ignore,no_run
933 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
934 /// let x = ListInstancesRequest::new().set_page_token("example");
935 /// ```
936 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
937 self.page_token = v.into();
938 self
939 }
940
941 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
942 ///
943 /// # Example
944 /// ```ignore,no_run
945 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesRequest;
946 /// let x = ListInstancesRequest::new().set_filter("example");
947 /// ```
948 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
949 self.filter = v.into();
950 self
951 }
952}
953
954impl wkt::message::Message for ListInstancesRequest {
955 fn typename() -> &'static str {
956 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesRequest"
957 }
958}
959
960/// Response message for the list of servers.
961#[derive(Clone, Default, PartialEq)]
962#[non_exhaustive]
963pub struct ListInstancesResponse {
964 /// The list of servers.
965 pub instances: std::vec::Vec<crate::model::Instance>,
966
967 /// A token identifying a page of results from the server.
968 pub next_page_token: std::string::String,
969
970 /// Locations that could not be reached.
971 pub unreachable: std::vec::Vec<std::string::String>,
972
973 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
974}
975
976impl ListInstancesResponse {
977 /// Creates a new default instance.
978 pub fn new() -> Self {
979 std::default::Default::default()
980 }
981
982 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
983 ///
984 /// # Example
985 /// ```ignore,no_run
986 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
987 /// use google_cloud_baremetalsolution_v2::model::Instance;
988 /// let x = ListInstancesResponse::new()
989 /// .set_instances([
990 /// Instance::default()/* use setters */,
991 /// Instance::default()/* use (different) setters */,
992 /// ]);
993 /// ```
994 pub fn set_instances<T, V>(mut self, v: T) -> Self
995 where
996 T: std::iter::IntoIterator<Item = V>,
997 V: std::convert::Into<crate::model::Instance>,
998 {
999 use std::iter::Iterator;
1000 self.instances = v.into_iter().map(|i| i.into()).collect();
1001 self
1002 }
1003
1004 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
1005 ///
1006 /// # Example
1007 /// ```ignore,no_run
1008 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
1009 /// let x = ListInstancesResponse::new().set_next_page_token("example");
1010 /// ```
1011 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1012 self.next_page_token = v.into();
1013 self
1014 }
1015
1016 /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
1017 ///
1018 /// # Example
1019 /// ```ignore,no_run
1020 /// # use google_cloud_baremetalsolution_v2::model::ListInstancesResponse;
1021 /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
1022 /// ```
1023 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1024 where
1025 T: std::iter::IntoIterator<Item = V>,
1026 V: std::convert::Into<std::string::String>,
1027 {
1028 use std::iter::Iterator;
1029 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1030 self
1031 }
1032}
1033
1034impl wkt::message::Message for ListInstancesResponse {
1035 fn typename() -> &'static str {
1036 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListInstancesResponse"
1037 }
1038}
1039
1040#[doc(hidden)]
1041impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
1042 type PageItem = crate::model::Instance;
1043
1044 fn items(self) -> std::vec::Vec<Self::PageItem> {
1045 self.instances
1046 }
1047
1048 fn next_page_token(&self) -> std::string::String {
1049 use std::clone::Clone;
1050 self.next_page_token.clone()
1051 }
1052}
1053
1054/// Message requesting to updating a server.
1055#[derive(Clone, Default, PartialEq)]
1056#[non_exhaustive]
1057pub struct UpdateInstanceRequest {
1058 /// Required. The server to update.
1059 ///
1060 /// The `name` field is used to identify the instance to update.
1061 /// Format: projects/{project}/locations/{location}/instances/{instance}
1062 pub instance: std::option::Option<crate::model::Instance>,
1063
1064 /// The list of fields to update.
1065 /// The currently supported fields are:
1066 /// `labels`
1067 /// `hyperthreading_enabled`
1068 /// `os_image`
1069 pub update_mask: std::option::Option<wkt::FieldMask>,
1070
1071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1072}
1073
1074impl UpdateInstanceRequest {
1075 /// Creates a new default instance.
1076 pub fn new() -> Self {
1077 std::default::Default::default()
1078 }
1079
1080 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
1081 ///
1082 /// # Example
1083 /// ```ignore,no_run
1084 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1085 /// use google_cloud_baremetalsolution_v2::model::Instance;
1086 /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
1087 /// ```
1088 pub fn set_instance<T>(mut self, v: T) -> Self
1089 where
1090 T: std::convert::Into<crate::model::Instance>,
1091 {
1092 self.instance = std::option::Option::Some(v.into());
1093 self
1094 }
1095
1096 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
1097 ///
1098 /// # Example
1099 /// ```ignore,no_run
1100 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1101 /// use google_cloud_baremetalsolution_v2::model::Instance;
1102 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
1103 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
1104 /// ```
1105 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1106 where
1107 T: std::convert::Into<crate::model::Instance>,
1108 {
1109 self.instance = v.map(|x| x.into());
1110 self
1111 }
1112
1113 /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1114 ///
1115 /// # Example
1116 /// ```ignore,no_run
1117 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1118 /// use wkt::FieldMask;
1119 /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1120 /// ```
1121 pub fn set_update_mask<T>(mut self, v: T) -> Self
1122 where
1123 T: std::convert::Into<wkt::FieldMask>,
1124 {
1125 self.update_mask = std::option::Option::Some(v.into());
1126 self
1127 }
1128
1129 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
1130 ///
1131 /// # Example
1132 /// ```ignore,no_run
1133 /// # use google_cloud_baremetalsolution_v2::model::UpdateInstanceRequest;
1134 /// use wkt::FieldMask;
1135 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1136 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1137 /// ```
1138 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1139 where
1140 T: std::convert::Into<wkt::FieldMask>,
1141 {
1142 self.update_mask = v.map(|x| x.into());
1143 self
1144 }
1145}
1146
1147impl wkt::message::Message for UpdateInstanceRequest {
1148 fn typename() -> &'static str {
1149 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateInstanceRequest"
1150 }
1151}
1152
1153/// Message requesting rename of a server.
1154#[derive(Clone, Default, PartialEq)]
1155#[non_exhaustive]
1156pub struct RenameInstanceRequest {
1157 /// Required. The `name` field is used to identify the instance.
1158 /// Format: projects/{project}/locations/{location}/instances/{instance}
1159 pub name: std::string::String,
1160
1161 /// Required. The new `id` of the instance.
1162 pub new_instance_id: std::string::String,
1163
1164 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1165}
1166
1167impl RenameInstanceRequest {
1168 /// Creates a new default instance.
1169 pub fn new() -> Self {
1170 std::default::Default::default()
1171 }
1172
1173 /// Sets the value of [name][crate::model::RenameInstanceRequest::name].
1174 ///
1175 /// # Example
1176 /// ```ignore,no_run
1177 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1178 /// # let project_id = "project_id";
1179 /// # let location_id = "location_id";
1180 /// # let instance_id = "instance_id";
1181 /// let x = RenameInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1182 /// ```
1183 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1184 self.name = v.into();
1185 self
1186 }
1187
1188 /// Sets the value of [new_instance_id][crate::model::RenameInstanceRequest::new_instance_id].
1189 ///
1190 /// # Example
1191 /// ```ignore,no_run
1192 /// # use google_cloud_baremetalsolution_v2::model::RenameInstanceRequest;
1193 /// let x = RenameInstanceRequest::new().set_new_instance_id("example");
1194 /// ```
1195 pub fn set_new_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1196 self.new_instance_id = v.into();
1197 self
1198 }
1199}
1200
1201impl wkt::message::Message for RenameInstanceRequest {
1202 fn typename() -> &'static str {
1203 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameInstanceRequest"
1204 }
1205}
1206
1207/// Message requesting to reset a server.
1208#[derive(Clone, Default, PartialEq)]
1209#[non_exhaustive]
1210pub struct ResetInstanceRequest {
1211 /// Required. Name of the resource.
1212 pub name: std::string::String,
1213
1214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1215}
1216
1217impl ResetInstanceRequest {
1218 /// Creates a new default instance.
1219 pub fn new() -> Self {
1220 std::default::Default::default()
1221 }
1222
1223 /// Sets the value of [name][crate::model::ResetInstanceRequest::name].
1224 ///
1225 /// # Example
1226 /// ```ignore,no_run
1227 /// # use google_cloud_baremetalsolution_v2::model::ResetInstanceRequest;
1228 /// # let project_id = "project_id";
1229 /// # let location_id = "location_id";
1230 /// # let instance_id = "instance_id";
1231 /// let x = ResetInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1232 /// ```
1233 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1234 self.name = v.into();
1235 self
1236 }
1237}
1238
1239impl wkt::message::Message for ResetInstanceRequest {
1240 fn typename() -> &'static str {
1241 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResetInstanceRequest"
1242 }
1243}
1244
1245/// Message requesting to start a server.
1246#[derive(Clone, Default, PartialEq)]
1247#[non_exhaustive]
1248pub struct StartInstanceRequest {
1249 /// Required. Name of the resource.
1250 pub name: std::string::String,
1251
1252 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1253}
1254
1255impl StartInstanceRequest {
1256 /// Creates a new default instance.
1257 pub fn new() -> Self {
1258 std::default::Default::default()
1259 }
1260
1261 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
1262 ///
1263 /// # Example
1264 /// ```ignore,no_run
1265 /// # use google_cloud_baremetalsolution_v2::model::StartInstanceRequest;
1266 /// # let project_id = "project_id";
1267 /// # let location_id = "location_id";
1268 /// # let instance_id = "instance_id";
1269 /// let x = StartInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1270 /// ```
1271 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1272 self.name = v.into();
1273 self
1274 }
1275}
1276
1277impl wkt::message::Message for StartInstanceRequest {
1278 fn typename() -> &'static str {
1279 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceRequest"
1280 }
1281}
1282
1283/// Response message from starting a server.
1284#[derive(Clone, Default, PartialEq)]
1285#[non_exhaustive]
1286pub struct StartInstanceResponse {
1287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1288}
1289
1290impl StartInstanceResponse {
1291 /// Creates a new default instance.
1292 pub fn new() -> Self {
1293 std::default::Default::default()
1294 }
1295}
1296
1297impl wkt::message::Message for StartInstanceResponse {
1298 fn typename() -> &'static str {
1299 "type.googleapis.com/google.cloud.baremetalsolution.v2.StartInstanceResponse"
1300 }
1301}
1302
1303/// Message requesting to stop a server.
1304#[derive(Clone, Default, PartialEq)]
1305#[non_exhaustive]
1306pub struct StopInstanceRequest {
1307 /// Required. Name of the resource.
1308 pub name: std::string::String,
1309
1310 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1311}
1312
1313impl StopInstanceRequest {
1314 /// Creates a new default instance.
1315 pub fn new() -> Self {
1316 std::default::Default::default()
1317 }
1318
1319 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
1320 ///
1321 /// # Example
1322 /// ```ignore,no_run
1323 /// # use google_cloud_baremetalsolution_v2::model::StopInstanceRequest;
1324 /// # let project_id = "project_id";
1325 /// # let location_id = "location_id";
1326 /// # let instance_id = "instance_id";
1327 /// let x = StopInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1328 /// ```
1329 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1330 self.name = v.into();
1331 self
1332 }
1333}
1334
1335impl wkt::message::Message for StopInstanceRequest {
1336 fn typename() -> &'static str {
1337 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceRequest"
1338 }
1339}
1340
1341/// Response message from stopping a server.
1342#[derive(Clone, Default, PartialEq)]
1343#[non_exhaustive]
1344pub struct StopInstanceResponse {
1345 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1346}
1347
1348impl StopInstanceResponse {
1349 /// Creates a new default instance.
1350 pub fn new() -> Self {
1351 std::default::Default::default()
1352 }
1353}
1354
1355impl wkt::message::Message for StopInstanceResponse {
1356 fn typename() -> &'static str {
1357 "type.googleapis.com/google.cloud.baremetalsolution.v2.StopInstanceResponse"
1358 }
1359}
1360
1361/// Message for enabling the interactive serial console on an instance.
1362#[derive(Clone, Default, PartialEq)]
1363#[non_exhaustive]
1364pub struct EnableInteractiveSerialConsoleRequest {
1365 /// Required. Name of the resource.
1366 pub name: std::string::String,
1367
1368 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1369}
1370
1371impl EnableInteractiveSerialConsoleRequest {
1372 /// Creates a new default instance.
1373 pub fn new() -> Self {
1374 std::default::Default::default()
1375 }
1376
1377 /// Sets the value of [name][crate::model::EnableInteractiveSerialConsoleRequest::name].
1378 ///
1379 /// # Example
1380 /// ```ignore,no_run
1381 /// # use google_cloud_baremetalsolution_v2::model::EnableInteractiveSerialConsoleRequest;
1382 /// # let project_id = "project_id";
1383 /// # let location_id = "location_id";
1384 /// # let instance_id = "instance_id";
1385 /// let x = EnableInteractiveSerialConsoleRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1386 /// ```
1387 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1388 self.name = v.into();
1389 self
1390 }
1391}
1392
1393impl wkt::message::Message for EnableInteractiveSerialConsoleRequest {
1394 fn typename() -> &'static str {
1395 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleRequest"
1396 }
1397}
1398
1399/// Message for response of EnableInteractiveSerialConsole.
1400#[derive(Clone, Default, PartialEq)]
1401#[non_exhaustive]
1402pub struct EnableInteractiveSerialConsoleResponse {
1403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1404}
1405
1406impl EnableInteractiveSerialConsoleResponse {
1407 /// Creates a new default instance.
1408 pub fn new() -> Self {
1409 std::default::Default::default()
1410 }
1411}
1412
1413impl wkt::message::Message for EnableInteractiveSerialConsoleResponse {
1414 fn typename() -> &'static str {
1415 "type.googleapis.com/google.cloud.baremetalsolution.v2.EnableInteractiveSerialConsoleResponse"
1416 }
1417}
1418
1419/// Message for disabling the interactive serial console on an instance.
1420#[derive(Clone, Default, PartialEq)]
1421#[non_exhaustive]
1422pub struct DisableInteractiveSerialConsoleRequest {
1423 /// Required. Name of the resource.
1424 pub name: std::string::String,
1425
1426 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1427}
1428
1429impl DisableInteractiveSerialConsoleRequest {
1430 /// Creates a new default instance.
1431 pub fn new() -> Self {
1432 std::default::Default::default()
1433 }
1434
1435 /// Sets the value of [name][crate::model::DisableInteractiveSerialConsoleRequest::name].
1436 ///
1437 /// # Example
1438 /// ```ignore,no_run
1439 /// # use google_cloud_baremetalsolution_v2::model::DisableInteractiveSerialConsoleRequest;
1440 /// # let project_id = "project_id";
1441 /// # let location_id = "location_id";
1442 /// # let instance_id = "instance_id";
1443 /// let x = DisableInteractiveSerialConsoleRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1444 /// ```
1445 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1446 self.name = v.into();
1447 self
1448 }
1449}
1450
1451impl wkt::message::Message for DisableInteractiveSerialConsoleRequest {
1452 fn typename() -> &'static str {
1453 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleRequest"
1454 }
1455}
1456
1457/// Message for response of DisableInteractiveSerialConsole.
1458#[derive(Clone, Default, PartialEq)]
1459#[non_exhaustive]
1460pub struct DisableInteractiveSerialConsoleResponse {
1461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1462}
1463
1464impl DisableInteractiveSerialConsoleResponse {
1465 /// Creates a new default instance.
1466 pub fn new() -> Self {
1467 std::default::Default::default()
1468 }
1469}
1470
1471impl wkt::message::Message for DisableInteractiveSerialConsoleResponse {
1472 fn typename() -> &'static str {
1473 "type.googleapis.com/google.cloud.baremetalsolution.v2.DisableInteractiveSerialConsoleResponse"
1474 }
1475}
1476
1477/// Message for detach specific LUN from an Instance.
1478#[derive(Clone, Default, PartialEq)]
1479#[non_exhaustive]
1480pub struct DetachLunRequest {
1481 /// Required. Name of the instance.
1482 pub instance: std::string::String,
1483
1484 /// Required. Name of the Lun to detach.
1485 pub lun: std::string::String,
1486
1487 /// If true, performs lun unmapping without instance reboot.
1488 pub skip_reboot: bool,
1489
1490 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1491}
1492
1493impl DetachLunRequest {
1494 /// Creates a new default instance.
1495 pub fn new() -> Self {
1496 std::default::Default::default()
1497 }
1498
1499 /// Sets the value of [instance][crate::model::DetachLunRequest::instance].
1500 ///
1501 /// # Example
1502 /// ```ignore,no_run
1503 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1504 /// # let project_id = "project_id";
1505 /// # let location_id = "location_id";
1506 /// # let instance_id = "instance_id";
1507 /// let x = DetachLunRequest::new().set_instance(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
1508 /// ```
1509 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1510 self.instance = v.into();
1511 self
1512 }
1513
1514 /// Sets the value of [lun][crate::model::DetachLunRequest::lun].
1515 ///
1516 /// # Example
1517 /// ```ignore,no_run
1518 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1519 /// # let project_id = "project_id";
1520 /// # let location_id = "location_id";
1521 /// # let volume_id = "volume_id";
1522 /// # let lun_id = "lun_id";
1523 /// let x = DetachLunRequest::new().set_lun(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/luns/{lun_id}"));
1524 /// ```
1525 pub fn set_lun<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1526 self.lun = v.into();
1527 self
1528 }
1529
1530 /// Sets the value of [skip_reboot][crate::model::DetachLunRequest::skip_reboot].
1531 ///
1532 /// # Example
1533 /// ```ignore,no_run
1534 /// # use google_cloud_baremetalsolution_v2::model::DetachLunRequest;
1535 /// let x = DetachLunRequest::new().set_skip_reboot(true);
1536 /// ```
1537 pub fn set_skip_reboot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1538 self.skip_reboot = v.into();
1539 self
1540 }
1541}
1542
1543impl wkt::message::Message for DetachLunRequest {
1544 fn typename() -> &'static str {
1545 "type.googleapis.com/google.cloud.baremetalsolution.v2.DetachLunRequest"
1546 }
1547}
1548
1549/// Network template.
1550#[derive(Clone, Default, PartialEq)]
1551#[non_exhaustive]
1552pub struct ServerNetworkTemplate {
1553 /// Output only. Template's unique name. The full resource name follows the
1554 /// pattern:
1555 /// `projects/{project}/locations/{location}/serverNetworkTemplate/{server_network_template}`
1556 /// Generally, the {server_network_template} follows the syntax of
1557 /// "bond<interface_type_index><bond_mode>" or "nic<interface_type_index>".
1558 pub name: std::string::String,
1559
1560 /// Instance types this template is applicable to.
1561 pub applicable_instance_types: std::vec::Vec<std::string::String>,
1562
1563 /// Logical interfaces.
1564 pub logical_interfaces: std::vec::Vec<crate::model::server_network_template::LogicalInterface>,
1565
1566 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1567}
1568
1569impl ServerNetworkTemplate {
1570 /// Creates a new default instance.
1571 pub fn new() -> Self {
1572 std::default::Default::default()
1573 }
1574
1575 /// Sets the value of [name][crate::model::ServerNetworkTemplate::name].
1576 ///
1577 /// # Example
1578 /// ```ignore,no_run
1579 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1580 /// # let project_id = "project_id";
1581 /// # let location_id = "location_id";
1582 /// # let server_network_template_id = "server_network_template_id";
1583 /// let x = ServerNetworkTemplate::new().set_name(format!("projects/{project_id}/locations/{location_id}/serverNetworkTemplate/{server_network_template_id}"));
1584 /// ```
1585 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1586 self.name = v.into();
1587 self
1588 }
1589
1590 /// Sets the value of [applicable_instance_types][crate::model::ServerNetworkTemplate::applicable_instance_types].
1591 ///
1592 /// # Example
1593 /// ```ignore,no_run
1594 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1595 /// let x = ServerNetworkTemplate::new().set_applicable_instance_types(["a", "b", "c"]);
1596 /// ```
1597 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
1598 where
1599 T: std::iter::IntoIterator<Item = V>,
1600 V: std::convert::Into<std::string::String>,
1601 {
1602 use std::iter::Iterator;
1603 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
1604 self
1605 }
1606
1607 /// Sets the value of [logical_interfaces][crate::model::ServerNetworkTemplate::logical_interfaces].
1608 ///
1609 /// # Example
1610 /// ```ignore,no_run
1611 /// # use google_cloud_baremetalsolution_v2::model::ServerNetworkTemplate;
1612 /// use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1613 /// let x = ServerNetworkTemplate::new()
1614 /// .set_logical_interfaces([
1615 /// LogicalInterface::default()/* use setters */,
1616 /// LogicalInterface::default()/* use (different) setters */,
1617 /// ]);
1618 /// ```
1619 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
1620 where
1621 T: std::iter::IntoIterator<Item = V>,
1622 V: std::convert::Into<crate::model::server_network_template::LogicalInterface>,
1623 {
1624 use std::iter::Iterator;
1625 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
1626 self
1627 }
1628}
1629
1630impl wkt::message::Message for ServerNetworkTemplate {
1631 fn typename() -> &'static str {
1632 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate"
1633 }
1634}
1635
1636/// Defines additional types related to [ServerNetworkTemplate].
1637pub mod server_network_template {
1638 #[allow(unused_imports)]
1639 use super::*;
1640
1641 /// Logical interface.
1642 #[derive(Clone, Default, PartialEq)]
1643 #[non_exhaustive]
1644 pub struct LogicalInterface {
1645 /// Interface name.
1646 /// This is not a globally unique identifier.
1647 /// Name is unique only inside the ServerNetworkTemplate. This is of syntax
1648 /// \<bond\><interface_type_index><bond_mode> or \<nic\><interface_type_index>
1649 /// and forms part of the network template name.
1650 pub name: std::string::String,
1651
1652 /// Interface type.
1653 pub r#type: crate::model::server_network_template::logical_interface::InterfaceType,
1654
1655 /// If true, interface must have network connected.
1656 pub required: bool,
1657
1658 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1659 }
1660
1661 impl LogicalInterface {
1662 /// Creates a new default instance.
1663 pub fn new() -> Self {
1664 std::default::Default::default()
1665 }
1666
1667 /// Sets the value of [name][crate::model::server_network_template::LogicalInterface::name].
1668 ///
1669 /// # Example
1670 /// ```ignore,no_run
1671 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1672 /// let x = LogicalInterface::new().set_name("example");
1673 /// ```
1674 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1675 self.name = v.into();
1676 self
1677 }
1678
1679 /// Sets the value of [r#type][crate::model::server_network_template::LogicalInterface::type].
1680 ///
1681 /// # Example
1682 /// ```ignore,no_run
1683 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1684 /// use google_cloud_baremetalsolution_v2::model::server_network_template::logical_interface::InterfaceType;
1685 /// let x0 = LogicalInterface::new().set_type(InterfaceType::Bond);
1686 /// let x1 = LogicalInterface::new().set_type(InterfaceType::Nic);
1687 /// ```
1688 pub fn set_type<
1689 T: std::convert::Into<
1690 crate::model::server_network_template::logical_interface::InterfaceType,
1691 >,
1692 >(
1693 mut self,
1694 v: T,
1695 ) -> Self {
1696 self.r#type = v.into();
1697 self
1698 }
1699
1700 /// Sets the value of [required][crate::model::server_network_template::LogicalInterface::required].
1701 ///
1702 /// # Example
1703 /// ```ignore,no_run
1704 /// # use google_cloud_baremetalsolution_v2::model::server_network_template::LogicalInterface;
1705 /// let x = LogicalInterface::new().set_required(true);
1706 /// ```
1707 pub fn set_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1708 self.required = v.into();
1709 self
1710 }
1711 }
1712
1713 impl wkt::message::Message for LogicalInterface {
1714 fn typename() -> &'static str {
1715 "type.googleapis.com/google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface"
1716 }
1717 }
1718
1719 /// Defines additional types related to [LogicalInterface].
1720 pub mod logical_interface {
1721 #[allow(unused_imports)]
1722 use super::*;
1723
1724 /// Interface type.
1725 ///
1726 /// # Working with unknown values
1727 ///
1728 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1729 /// additional enum variants at any time. Adding new variants is not considered
1730 /// a breaking change. Applications should write their code in anticipation of:
1731 ///
1732 /// - New values appearing in future releases of the client library, **and**
1733 /// - New values received dynamically, without application changes.
1734 ///
1735 /// Please consult the [Working with enums] section in the user guide for some
1736 /// guidelines.
1737 ///
1738 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1739 #[derive(Clone, Debug, PartialEq)]
1740 #[non_exhaustive]
1741 pub enum InterfaceType {
1742 /// Unspecified value.
1743 Unspecified,
1744 /// Bond interface type.
1745 Bond,
1746 /// NIC interface type.
1747 Nic,
1748 /// If set, the enum was initialized with an unknown value.
1749 ///
1750 /// Applications can examine the value using [InterfaceType::value] or
1751 /// [InterfaceType::name].
1752 UnknownValue(interface_type::UnknownValue),
1753 }
1754
1755 #[doc(hidden)]
1756 pub mod interface_type {
1757 #[allow(unused_imports)]
1758 use super::*;
1759 #[derive(Clone, Debug, PartialEq)]
1760 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1761 }
1762
1763 impl InterfaceType {
1764 /// Gets the enum value.
1765 ///
1766 /// Returns `None` if the enum contains an unknown value deserialized from
1767 /// the string representation of enums.
1768 pub fn value(&self) -> std::option::Option<i32> {
1769 match self {
1770 Self::Unspecified => std::option::Option::Some(0),
1771 Self::Bond => std::option::Option::Some(1),
1772 Self::Nic => std::option::Option::Some(2),
1773 Self::UnknownValue(u) => u.0.value(),
1774 }
1775 }
1776
1777 /// Gets the enum value as a string.
1778 ///
1779 /// Returns `None` if the enum contains an unknown value deserialized from
1780 /// the integer representation of enums.
1781 pub fn name(&self) -> std::option::Option<&str> {
1782 match self {
1783 Self::Unspecified => std::option::Option::Some("INTERFACE_TYPE_UNSPECIFIED"),
1784 Self::Bond => std::option::Option::Some("BOND"),
1785 Self::Nic => std::option::Option::Some("NIC"),
1786 Self::UnknownValue(u) => u.0.name(),
1787 }
1788 }
1789 }
1790
1791 impl std::default::Default for InterfaceType {
1792 fn default() -> Self {
1793 use std::convert::From;
1794 Self::from(0)
1795 }
1796 }
1797
1798 impl std::fmt::Display for InterfaceType {
1799 fn fmt(
1800 &self,
1801 f: &mut std::fmt::Formatter<'_>,
1802 ) -> std::result::Result<(), std::fmt::Error> {
1803 wkt::internal::display_enum(f, self.name(), self.value())
1804 }
1805 }
1806
1807 impl std::convert::From<i32> for InterfaceType {
1808 fn from(value: i32) -> Self {
1809 match value {
1810 0 => Self::Unspecified,
1811 1 => Self::Bond,
1812 2 => Self::Nic,
1813 _ => Self::UnknownValue(interface_type::UnknownValue(
1814 wkt::internal::UnknownEnumValue::Integer(value),
1815 )),
1816 }
1817 }
1818 }
1819
1820 impl std::convert::From<&str> for InterfaceType {
1821 fn from(value: &str) -> Self {
1822 use std::string::ToString;
1823 match value {
1824 "INTERFACE_TYPE_UNSPECIFIED" => Self::Unspecified,
1825 "BOND" => Self::Bond,
1826 "NIC" => Self::Nic,
1827 _ => Self::UnknownValue(interface_type::UnknownValue(
1828 wkt::internal::UnknownEnumValue::String(value.to_string()),
1829 )),
1830 }
1831 }
1832 }
1833
1834 impl serde::ser::Serialize for InterfaceType {
1835 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1836 where
1837 S: serde::Serializer,
1838 {
1839 match self {
1840 Self::Unspecified => serializer.serialize_i32(0),
1841 Self::Bond => serializer.serialize_i32(1),
1842 Self::Nic => serializer.serialize_i32(2),
1843 Self::UnknownValue(u) => u.0.serialize(serializer),
1844 }
1845 }
1846 }
1847
1848 impl<'de> serde::de::Deserialize<'de> for InterfaceType {
1849 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1850 where
1851 D: serde::Deserializer<'de>,
1852 {
1853 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InterfaceType>::new(
1854 ".google.cloud.baremetalsolution.v2.ServerNetworkTemplate.LogicalInterface.InterfaceType"))
1855 }
1856 }
1857 }
1858}
1859
1860/// A storage volume logical unit number (LUN).
1861#[derive(Clone, Default, PartialEq)]
1862#[non_exhaustive]
1863pub struct Lun {
1864 /// Output only. The name of the LUN.
1865 pub name: std::string::String,
1866
1867 /// An identifier for the LUN, generated by the backend.
1868 pub id: std::string::String,
1869
1870 /// The state of this storage volume.
1871 pub state: crate::model::lun::State,
1872
1873 /// The size of this LUN, in gigabytes.
1874 pub size_gb: i64,
1875
1876 /// The LUN multiprotocol type ensures the characteristics of the LUN are
1877 /// optimized for each operating system.
1878 pub multiprotocol_type: crate::model::lun::MultiprotocolType,
1879
1880 /// Display the storage volume for this LUN.
1881 pub storage_volume: std::string::String,
1882
1883 /// Display if this LUN can be shared between multiple physical servers.
1884 pub shareable: bool,
1885
1886 /// Display if this LUN is a boot LUN.
1887 pub boot_lun: bool,
1888
1889 /// The storage type for this LUN.
1890 pub storage_type: crate::model::lun::StorageType,
1891
1892 /// The WWID for this LUN.
1893 pub wwid: std::string::String,
1894
1895 /// Output only. Time after which LUN will be fully deleted.
1896 /// It is filled only for LUNs in COOL_OFF state.
1897 pub expire_time: std::option::Option<wkt::Timestamp>,
1898
1899 /// Output only. Instances this Lun is attached to.
1900 pub instances: std::vec::Vec<std::string::String>,
1901
1902 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1903}
1904
1905impl Lun {
1906 /// Creates a new default instance.
1907 pub fn new() -> Self {
1908 std::default::Default::default()
1909 }
1910
1911 /// Sets the value of [name][crate::model::Lun::name].
1912 ///
1913 /// # Example
1914 /// ```ignore,no_run
1915 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1916 /// # let project_id = "project_id";
1917 /// # let location_id = "location_id";
1918 /// # let volume_id = "volume_id";
1919 /// # let lun_id = "lun_id";
1920 /// let x = Lun::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/luns/{lun_id}"));
1921 /// ```
1922 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1923 self.name = v.into();
1924 self
1925 }
1926
1927 /// Sets the value of [id][crate::model::Lun::id].
1928 ///
1929 /// # Example
1930 /// ```ignore,no_run
1931 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1932 /// let x = Lun::new().set_id("example");
1933 /// ```
1934 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1935 self.id = v.into();
1936 self
1937 }
1938
1939 /// Sets the value of [state][crate::model::Lun::state].
1940 ///
1941 /// # Example
1942 /// ```ignore,no_run
1943 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1944 /// use google_cloud_baremetalsolution_v2::model::lun::State;
1945 /// let x0 = Lun::new().set_state(State::Creating);
1946 /// let x1 = Lun::new().set_state(State::Updating);
1947 /// let x2 = Lun::new().set_state(State::Ready);
1948 /// ```
1949 pub fn set_state<T: std::convert::Into<crate::model::lun::State>>(mut self, v: T) -> Self {
1950 self.state = v.into();
1951 self
1952 }
1953
1954 /// Sets the value of [size_gb][crate::model::Lun::size_gb].
1955 ///
1956 /// # Example
1957 /// ```ignore,no_run
1958 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1959 /// let x = Lun::new().set_size_gb(42);
1960 /// ```
1961 pub fn set_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1962 self.size_gb = v.into();
1963 self
1964 }
1965
1966 /// Sets the value of [multiprotocol_type][crate::model::Lun::multiprotocol_type].
1967 ///
1968 /// # Example
1969 /// ```ignore,no_run
1970 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1971 /// use google_cloud_baremetalsolution_v2::model::lun::MultiprotocolType;
1972 /// let x0 = Lun::new().set_multiprotocol_type(MultiprotocolType::Linux);
1973 /// ```
1974 pub fn set_multiprotocol_type<T: std::convert::Into<crate::model::lun::MultiprotocolType>>(
1975 mut self,
1976 v: T,
1977 ) -> Self {
1978 self.multiprotocol_type = v.into();
1979 self
1980 }
1981
1982 /// Sets the value of [storage_volume][crate::model::Lun::storage_volume].
1983 ///
1984 /// # Example
1985 /// ```ignore,no_run
1986 /// # use google_cloud_baremetalsolution_v2::model::Lun;
1987 /// # let project_id = "project_id";
1988 /// # let location_id = "location_id";
1989 /// # let volume_id = "volume_id";
1990 /// let x = Lun::new().set_storage_volume(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
1991 /// ```
1992 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1993 self.storage_volume = v.into();
1994 self
1995 }
1996
1997 /// Sets the value of [shareable][crate::model::Lun::shareable].
1998 ///
1999 /// # Example
2000 /// ```ignore,no_run
2001 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2002 /// let x = Lun::new().set_shareable(true);
2003 /// ```
2004 pub fn set_shareable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2005 self.shareable = v.into();
2006 self
2007 }
2008
2009 /// Sets the value of [boot_lun][crate::model::Lun::boot_lun].
2010 ///
2011 /// # Example
2012 /// ```ignore,no_run
2013 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2014 /// let x = Lun::new().set_boot_lun(true);
2015 /// ```
2016 pub fn set_boot_lun<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2017 self.boot_lun = v.into();
2018 self
2019 }
2020
2021 /// Sets the value of [storage_type][crate::model::Lun::storage_type].
2022 ///
2023 /// # Example
2024 /// ```ignore,no_run
2025 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2026 /// use google_cloud_baremetalsolution_v2::model::lun::StorageType;
2027 /// let x0 = Lun::new().set_storage_type(StorageType::Ssd);
2028 /// let x1 = Lun::new().set_storage_type(StorageType::Hdd);
2029 /// ```
2030 pub fn set_storage_type<T: std::convert::Into<crate::model::lun::StorageType>>(
2031 mut self,
2032 v: T,
2033 ) -> Self {
2034 self.storage_type = v.into();
2035 self
2036 }
2037
2038 /// Sets the value of [wwid][crate::model::Lun::wwid].
2039 ///
2040 /// # Example
2041 /// ```ignore,no_run
2042 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2043 /// let x = Lun::new().set_wwid("example");
2044 /// ```
2045 pub fn set_wwid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2046 self.wwid = v.into();
2047 self
2048 }
2049
2050 /// Sets the value of [expire_time][crate::model::Lun::expire_time].
2051 ///
2052 /// # Example
2053 /// ```ignore,no_run
2054 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2055 /// use wkt::Timestamp;
2056 /// let x = Lun::new().set_expire_time(Timestamp::default()/* use setters */);
2057 /// ```
2058 pub fn set_expire_time<T>(mut self, v: T) -> Self
2059 where
2060 T: std::convert::Into<wkt::Timestamp>,
2061 {
2062 self.expire_time = std::option::Option::Some(v.into());
2063 self
2064 }
2065
2066 /// Sets or clears the value of [expire_time][crate::model::Lun::expire_time].
2067 ///
2068 /// # Example
2069 /// ```ignore,no_run
2070 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2071 /// use wkt::Timestamp;
2072 /// let x = Lun::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2073 /// let x = Lun::new().set_or_clear_expire_time(None::<Timestamp>);
2074 /// ```
2075 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2076 where
2077 T: std::convert::Into<wkt::Timestamp>,
2078 {
2079 self.expire_time = v.map(|x| x.into());
2080 self
2081 }
2082
2083 /// Sets the value of [instances][crate::model::Lun::instances].
2084 ///
2085 /// # Example
2086 /// ```ignore,no_run
2087 /// # use google_cloud_baremetalsolution_v2::model::Lun;
2088 /// let x = Lun::new().set_instances(["a", "b", "c"]);
2089 /// ```
2090 pub fn set_instances<T, V>(mut self, v: T) -> Self
2091 where
2092 T: std::iter::IntoIterator<Item = V>,
2093 V: std::convert::Into<std::string::String>,
2094 {
2095 use std::iter::Iterator;
2096 self.instances = v.into_iter().map(|i| i.into()).collect();
2097 self
2098 }
2099}
2100
2101impl wkt::message::Message for Lun {
2102 fn typename() -> &'static str {
2103 "type.googleapis.com/google.cloud.baremetalsolution.v2.Lun"
2104 }
2105}
2106
2107/// Defines additional types related to [Lun].
2108pub mod lun {
2109 #[allow(unused_imports)]
2110 use super::*;
2111
2112 /// The possible states for the LUN.
2113 ///
2114 /// # Working with unknown values
2115 ///
2116 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2117 /// additional enum variants at any time. Adding new variants is not considered
2118 /// a breaking change. Applications should write their code in anticipation of:
2119 ///
2120 /// - New values appearing in future releases of the client library, **and**
2121 /// - New values received dynamically, without application changes.
2122 ///
2123 /// Please consult the [Working with enums] section in the user guide for some
2124 /// guidelines.
2125 ///
2126 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2127 #[derive(Clone, Debug, PartialEq)]
2128 #[non_exhaustive]
2129 pub enum State {
2130 /// The LUN is in an unknown state.
2131 Unspecified,
2132 /// The LUN is being created.
2133 Creating,
2134 /// The LUN is being updated.
2135 Updating,
2136 /// The LUN is ready for use.
2137 Ready,
2138 /// The LUN has been requested to be deleted.
2139 Deleting,
2140 /// The LUN is in cool off state. It will be deleted after `expire_time`.
2141 CoolOff,
2142 /// If set, the enum was initialized with an unknown value.
2143 ///
2144 /// Applications can examine the value using [State::value] or
2145 /// [State::name].
2146 UnknownValue(state::UnknownValue),
2147 }
2148
2149 #[doc(hidden)]
2150 pub mod state {
2151 #[allow(unused_imports)]
2152 use super::*;
2153 #[derive(Clone, Debug, PartialEq)]
2154 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2155 }
2156
2157 impl State {
2158 /// Gets the enum value.
2159 ///
2160 /// Returns `None` if the enum contains an unknown value deserialized from
2161 /// the string representation of enums.
2162 pub fn value(&self) -> std::option::Option<i32> {
2163 match self {
2164 Self::Unspecified => std::option::Option::Some(0),
2165 Self::Creating => std::option::Option::Some(1),
2166 Self::Updating => std::option::Option::Some(2),
2167 Self::Ready => std::option::Option::Some(3),
2168 Self::Deleting => std::option::Option::Some(4),
2169 Self::CoolOff => std::option::Option::Some(5),
2170 Self::UnknownValue(u) => u.0.value(),
2171 }
2172 }
2173
2174 /// Gets the enum value as a string.
2175 ///
2176 /// Returns `None` if the enum contains an unknown value deserialized from
2177 /// the integer representation of enums.
2178 pub fn name(&self) -> std::option::Option<&str> {
2179 match self {
2180 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2181 Self::Creating => std::option::Option::Some("CREATING"),
2182 Self::Updating => std::option::Option::Some("UPDATING"),
2183 Self::Ready => std::option::Option::Some("READY"),
2184 Self::Deleting => std::option::Option::Some("DELETING"),
2185 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
2186 Self::UnknownValue(u) => u.0.name(),
2187 }
2188 }
2189 }
2190
2191 impl std::default::Default for State {
2192 fn default() -> Self {
2193 use std::convert::From;
2194 Self::from(0)
2195 }
2196 }
2197
2198 impl std::fmt::Display for State {
2199 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2200 wkt::internal::display_enum(f, self.name(), self.value())
2201 }
2202 }
2203
2204 impl std::convert::From<i32> for State {
2205 fn from(value: i32) -> Self {
2206 match value {
2207 0 => Self::Unspecified,
2208 1 => Self::Creating,
2209 2 => Self::Updating,
2210 3 => Self::Ready,
2211 4 => Self::Deleting,
2212 5 => Self::CoolOff,
2213 _ => Self::UnknownValue(state::UnknownValue(
2214 wkt::internal::UnknownEnumValue::Integer(value),
2215 )),
2216 }
2217 }
2218 }
2219
2220 impl std::convert::From<&str> for State {
2221 fn from(value: &str) -> Self {
2222 use std::string::ToString;
2223 match value {
2224 "STATE_UNSPECIFIED" => Self::Unspecified,
2225 "CREATING" => Self::Creating,
2226 "UPDATING" => Self::Updating,
2227 "READY" => Self::Ready,
2228 "DELETING" => Self::Deleting,
2229 "COOL_OFF" => Self::CoolOff,
2230 _ => Self::UnknownValue(state::UnknownValue(
2231 wkt::internal::UnknownEnumValue::String(value.to_string()),
2232 )),
2233 }
2234 }
2235 }
2236
2237 impl serde::ser::Serialize for State {
2238 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2239 where
2240 S: serde::Serializer,
2241 {
2242 match self {
2243 Self::Unspecified => serializer.serialize_i32(0),
2244 Self::Creating => serializer.serialize_i32(1),
2245 Self::Updating => serializer.serialize_i32(2),
2246 Self::Ready => serializer.serialize_i32(3),
2247 Self::Deleting => serializer.serialize_i32(4),
2248 Self::CoolOff => serializer.serialize_i32(5),
2249 Self::UnknownValue(u) => u.0.serialize(serializer),
2250 }
2251 }
2252 }
2253
2254 impl<'de> serde::de::Deserialize<'de> for State {
2255 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2256 where
2257 D: serde::Deserializer<'de>,
2258 {
2259 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2260 ".google.cloud.baremetalsolution.v2.Lun.State",
2261 ))
2262 }
2263 }
2264
2265 /// Display the operating systems present for the LUN multiprotocol type.
2266 ///
2267 /// # Working with unknown values
2268 ///
2269 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2270 /// additional enum variants at any time. Adding new variants is not considered
2271 /// a breaking change. Applications should write their code in anticipation of:
2272 ///
2273 /// - New values appearing in future releases of the client library, **and**
2274 /// - New values received dynamically, without application changes.
2275 ///
2276 /// Please consult the [Working with enums] section in the user guide for some
2277 /// guidelines.
2278 ///
2279 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2280 #[derive(Clone, Debug, PartialEq)]
2281 #[non_exhaustive]
2282 pub enum MultiprotocolType {
2283 /// Server has no OS specified.
2284 Unspecified,
2285 /// Server with Linux OS.
2286 Linux,
2287 /// If set, the enum was initialized with an unknown value.
2288 ///
2289 /// Applications can examine the value using [MultiprotocolType::value] or
2290 /// [MultiprotocolType::name].
2291 UnknownValue(multiprotocol_type::UnknownValue),
2292 }
2293
2294 #[doc(hidden)]
2295 pub mod multiprotocol_type {
2296 #[allow(unused_imports)]
2297 use super::*;
2298 #[derive(Clone, Debug, PartialEq)]
2299 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2300 }
2301
2302 impl MultiprotocolType {
2303 /// Gets the enum value.
2304 ///
2305 /// Returns `None` if the enum contains an unknown value deserialized from
2306 /// the string representation of enums.
2307 pub fn value(&self) -> std::option::Option<i32> {
2308 match self {
2309 Self::Unspecified => std::option::Option::Some(0),
2310 Self::Linux => std::option::Option::Some(1),
2311 Self::UnknownValue(u) => u.0.value(),
2312 }
2313 }
2314
2315 /// Gets the enum value as a string.
2316 ///
2317 /// Returns `None` if the enum contains an unknown value deserialized from
2318 /// the integer representation of enums.
2319 pub fn name(&self) -> std::option::Option<&str> {
2320 match self {
2321 Self::Unspecified => std::option::Option::Some("MULTIPROTOCOL_TYPE_UNSPECIFIED"),
2322 Self::Linux => std::option::Option::Some("LINUX"),
2323 Self::UnknownValue(u) => u.0.name(),
2324 }
2325 }
2326 }
2327
2328 impl std::default::Default for MultiprotocolType {
2329 fn default() -> Self {
2330 use std::convert::From;
2331 Self::from(0)
2332 }
2333 }
2334
2335 impl std::fmt::Display for MultiprotocolType {
2336 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2337 wkt::internal::display_enum(f, self.name(), self.value())
2338 }
2339 }
2340
2341 impl std::convert::From<i32> for MultiprotocolType {
2342 fn from(value: i32) -> Self {
2343 match value {
2344 0 => Self::Unspecified,
2345 1 => Self::Linux,
2346 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2347 wkt::internal::UnknownEnumValue::Integer(value),
2348 )),
2349 }
2350 }
2351 }
2352
2353 impl std::convert::From<&str> for MultiprotocolType {
2354 fn from(value: &str) -> Self {
2355 use std::string::ToString;
2356 match value {
2357 "MULTIPROTOCOL_TYPE_UNSPECIFIED" => Self::Unspecified,
2358 "LINUX" => Self::Linux,
2359 _ => Self::UnknownValue(multiprotocol_type::UnknownValue(
2360 wkt::internal::UnknownEnumValue::String(value.to_string()),
2361 )),
2362 }
2363 }
2364 }
2365
2366 impl serde::ser::Serialize for MultiprotocolType {
2367 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2368 where
2369 S: serde::Serializer,
2370 {
2371 match self {
2372 Self::Unspecified => serializer.serialize_i32(0),
2373 Self::Linux => serializer.serialize_i32(1),
2374 Self::UnknownValue(u) => u.0.serialize(serializer),
2375 }
2376 }
2377 }
2378
2379 impl<'de> serde::de::Deserialize<'de> for MultiprotocolType {
2380 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2381 where
2382 D: serde::Deserializer<'de>,
2383 {
2384 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MultiprotocolType>::new(
2385 ".google.cloud.baremetalsolution.v2.Lun.MultiprotocolType",
2386 ))
2387 }
2388 }
2389
2390 /// The storage types for a LUN.
2391 ///
2392 /// # Working with unknown values
2393 ///
2394 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2395 /// additional enum variants at any time. Adding new variants is not considered
2396 /// a breaking change. Applications should write their code in anticipation of:
2397 ///
2398 /// - New values appearing in future releases of the client library, **and**
2399 /// - New values received dynamically, without application changes.
2400 ///
2401 /// Please consult the [Working with enums] section in the user guide for some
2402 /// guidelines.
2403 ///
2404 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2405 #[derive(Clone, Debug, PartialEq)]
2406 #[non_exhaustive]
2407 pub enum StorageType {
2408 /// The storage type for this LUN is unknown.
2409 Unspecified,
2410 /// This storage type for this LUN is SSD.
2411 Ssd,
2412 /// This storage type for this LUN is HDD.
2413 Hdd,
2414 /// If set, the enum was initialized with an unknown value.
2415 ///
2416 /// Applications can examine the value using [StorageType::value] or
2417 /// [StorageType::name].
2418 UnknownValue(storage_type::UnknownValue),
2419 }
2420
2421 #[doc(hidden)]
2422 pub mod storage_type {
2423 #[allow(unused_imports)]
2424 use super::*;
2425 #[derive(Clone, Debug, PartialEq)]
2426 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2427 }
2428
2429 impl StorageType {
2430 /// Gets the enum value.
2431 ///
2432 /// Returns `None` if the enum contains an unknown value deserialized from
2433 /// the string representation of enums.
2434 pub fn value(&self) -> std::option::Option<i32> {
2435 match self {
2436 Self::Unspecified => std::option::Option::Some(0),
2437 Self::Ssd => std::option::Option::Some(1),
2438 Self::Hdd => std::option::Option::Some(2),
2439 Self::UnknownValue(u) => u.0.value(),
2440 }
2441 }
2442
2443 /// Gets the enum value as a string.
2444 ///
2445 /// Returns `None` if the enum contains an unknown value deserialized from
2446 /// the integer representation of enums.
2447 pub fn name(&self) -> std::option::Option<&str> {
2448 match self {
2449 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
2450 Self::Ssd => std::option::Option::Some("SSD"),
2451 Self::Hdd => std::option::Option::Some("HDD"),
2452 Self::UnknownValue(u) => u.0.name(),
2453 }
2454 }
2455 }
2456
2457 impl std::default::Default for StorageType {
2458 fn default() -> Self {
2459 use std::convert::From;
2460 Self::from(0)
2461 }
2462 }
2463
2464 impl std::fmt::Display for StorageType {
2465 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2466 wkt::internal::display_enum(f, self.name(), self.value())
2467 }
2468 }
2469
2470 impl std::convert::From<i32> for StorageType {
2471 fn from(value: i32) -> Self {
2472 match value {
2473 0 => Self::Unspecified,
2474 1 => Self::Ssd,
2475 2 => Self::Hdd,
2476 _ => Self::UnknownValue(storage_type::UnknownValue(
2477 wkt::internal::UnknownEnumValue::Integer(value),
2478 )),
2479 }
2480 }
2481 }
2482
2483 impl std::convert::From<&str> for StorageType {
2484 fn from(value: &str) -> Self {
2485 use std::string::ToString;
2486 match value {
2487 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
2488 "SSD" => Self::Ssd,
2489 "HDD" => Self::Hdd,
2490 _ => Self::UnknownValue(storage_type::UnknownValue(
2491 wkt::internal::UnknownEnumValue::String(value.to_string()),
2492 )),
2493 }
2494 }
2495 }
2496
2497 impl serde::ser::Serialize for StorageType {
2498 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2499 where
2500 S: serde::Serializer,
2501 {
2502 match self {
2503 Self::Unspecified => serializer.serialize_i32(0),
2504 Self::Ssd => serializer.serialize_i32(1),
2505 Self::Hdd => serializer.serialize_i32(2),
2506 Self::UnknownValue(u) => u.0.serialize(serializer),
2507 }
2508 }
2509 }
2510
2511 impl<'de> serde::de::Deserialize<'de> for StorageType {
2512 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2513 where
2514 D: serde::Deserializer<'de>,
2515 {
2516 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
2517 ".google.cloud.baremetalsolution.v2.Lun.StorageType",
2518 ))
2519 }
2520 }
2521}
2522
2523/// Message for requesting storage lun information.
2524#[derive(Clone, Default, PartialEq)]
2525#[non_exhaustive]
2526pub struct GetLunRequest {
2527 /// Required. Name of the resource.
2528 pub name: std::string::String,
2529
2530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2531}
2532
2533impl GetLunRequest {
2534 /// Creates a new default instance.
2535 pub fn new() -> Self {
2536 std::default::Default::default()
2537 }
2538
2539 /// Sets the value of [name][crate::model::GetLunRequest::name].
2540 ///
2541 /// # Example
2542 /// ```ignore,no_run
2543 /// # use google_cloud_baremetalsolution_v2::model::GetLunRequest;
2544 /// # let project_id = "project_id";
2545 /// # let location_id = "location_id";
2546 /// # let volume_id = "volume_id";
2547 /// # let lun_id = "lun_id";
2548 /// let x = GetLunRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/luns/{lun_id}"));
2549 /// ```
2550 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2551 self.name = v.into();
2552 self
2553 }
2554}
2555
2556impl wkt::message::Message for GetLunRequest {
2557 fn typename() -> &'static str {
2558 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetLunRequest"
2559 }
2560}
2561
2562/// Message for requesting a list of storage volume luns.
2563#[derive(Clone, Default, PartialEq)]
2564#[non_exhaustive]
2565pub struct ListLunsRequest {
2566 /// Required. Parent value for ListLunsRequest.
2567 pub parent: std::string::String,
2568
2569 /// Requested page size. The server might return fewer items than requested.
2570 /// If unspecified, server will pick an appropriate default.
2571 pub page_size: i32,
2572
2573 /// A token identifying a page of results from the server.
2574 pub page_token: std::string::String,
2575
2576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2577}
2578
2579impl ListLunsRequest {
2580 /// Creates a new default instance.
2581 pub fn new() -> Self {
2582 std::default::Default::default()
2583 }
2584
2585 /// Sets the value of [parent][crate::model::ListLunsRequest::parent].
2586 ///
2587 /// # Example
2588 /// ```ignore,no_run
2589 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2590 /// # let project_id = "project_id";
2591 /// # let location_id = "location_id";
2592 /// # let volume_id = "volume_id";
2593 /// let x = ListLunsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
2594 /// ```
2595 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2596 self.parent = v.into();
2597 self
2598 }
2599
2600 /// Sets the value of [page_size][crate::model::ListLunsRequest::page_size].
2601 ///
2602 /// # Example
2603 /// ```ignore,no_run
2604 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2605 /// let x = ListLunsRequest::new().set_page_size(42);
2606 /// ```
2607 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2608 self.page_size = v.into();
2609 self
2610 }
2611
2612 /// Sets the value of [page_token][crate::model::ListLunsRequest::page_token].
2613 ///
2614 /// # Example
2615 /// ```ignore,no_run
2616 /// # use google_cloud_baremetalsolution_v2::model::ListLunsRequest;
2617 /// let x = ListLunsRequest::new().set_page_token("example");
2618 /// ```
2619 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2620 self.page_token = v.into();
2621 self
2622 }
2623}
2624
2625impl wkt::message::Message for ListLunsRequest {
2626 fn typename() -> &'static str {
2627 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsRequest"
2628 }
2629}
2630
2631/// Response message containing the list of storage volume luns.
2632#[derive(Clone, Default, PartialEq)]
2633#[non_exhaustive]
2634pub struct ListLunsResponse {
2635 /// The list of luns.
2636 pub luns: std::vec::Vec<crate::model::Lun>,
2637
2638 /// A token identifying a page of results from the server.
2639 pub next_page_token: std::string::String,
2640
2641 /// Locations that could not be reached.
2642 pub unreachable: std::vec::Vec<std::string::String>,
2643
2644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2645}
2646
2647impl ListLunsResponse {
2648 /// Creates a new default instance.
2649 pub fn new() -> Self {
2650 std::default::Default::default()
2651 }
2652
2653 /// Sets the value of [luns][crate::model::ListLunsResponse::luns].
2654 ///
2655 /// # Example
2656 /// ```ignore,no_run
2657 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2658 /// use google_cloud_baremetalsolution_v2::model::Lun;
2659 /// let x = ListLunsResponse::new()
2660 /// .set_luns([
2661 /// Lun::default()/* use setters */,
2662 /// Lun::default()/* use (different) setters */,
2663 /// ]);
2664 /// ```
2665 pub fn set_luns<T, V>(mut self, v: T) -> Self
2666 where
2667 T: std::iter::IntoIterator<Item = V>,
2668 V: std::convert::Into<crate::model::Lun>,
2669 {
2670 use std::iter::Iterator;
2671 self.luns = v.into_iter().map(|i| i.into()).collect();
2672 self
2673 }
2674
2675 /// Sets the value of [next_page_token][crate::model::ListLunsResponse::next_page_token].
2676 ///
2677 /// # Example
2678 /// ```ignore,no_run
2679 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2680 /// let x = ListLunsResponse::new().set_next_page_token("example");
2681 /// ```
2682 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2683 self.next_page_token = v.into();
2684 self
2685 }
2686
2687 /// Sets the value of [unreachable][crate::model::ListLunsResponse::unreachable].
2688 ///
2689 /// # Example
2690 /// ```ignore,no_run
2691 /// # use google_cloud_baremetalsolution_v2::model::ListLunsResponse;
2692 /// let x = ListLunsResponse::new().set_unreachable(["a", "b", "c"]);
2693 /// ```
2694 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2695 where
2696 T: std::iter::IntoIterator<Item = V>,
2697 V: std::convert::Into<std::string::String>,
2698 {
2699 use std::iter::Iterator;
2700 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2701 self
2702 }
2703}
2704
2705impl wkt::message::Message for ListLunsResponse {
2706 fn typename() -> &'static str {
2707 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListLunsResponse"
2708 }
2709}
2710
2711#[doc(hidden)]
2712impl google_cloud_gax::paginator::internal::PageableResponse for ListLunsResponse {
2713 type PageItem = crate::model::Lun;
2714
2715 fn items(self) -> std::vec::Vec<Self::PageItem> {
2716 self.luns
2717 }
2718
2719 fn next_page_token(&self) -> std::string::String {
2720 use std::clone::Clone;
2721 self.next_page_token.clone()
2722 }
2723}
2724
2725/// Request for skip lun cooloff and delete it.
2726#[derive(Clone, Default, PartialEq)]
2727#[non_exhaustive]
2728pub struct EvictLunRequest {
2729 /// Required. The name of the lun.
2730 pub name: std::string::String,
2731
2732 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2733}
2734
2735impl EvictLunRequest {
2736 /// Creates a new default instance.
2737 pub fn new() -> Self {
2738 std::default::Default::default()
2739 }
2740
2741 /// Sets the value of [name][crate::model::EvictLunRequest::name].
2742 ///
2743 /// # Example
2744 /// ```ignore,no_run
2745 /// # use google_cloud_baremetalsolution_v2::model::EvictLunRequest;
2746 /// # let project_id = "project_id";
2747 /// # let location_id = "location_id";
2748 /// # let volume_id = "volume_id";
2749 /// # let lun_id = "lun_id";
2750 /// let x = EvictLunRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/luns/{lun_id}"));
2751 /// ```
2752 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2753 self.name = v.into();
2754 self
2755 }
2756}
2757
2758impl wkt::message::Message for EvictLunRequest {
2759 fn typename() -> &'static str {
2760 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictLunRequest"
2761 }
2762}
2763
2764/// A Network.
2765#[derive(Clone, Default, PartialEq)]
2766#[non_exhaustive]
2767pub struct Network {
2768 /// Output only. The resource name of this `Network`.
2769 /// Resource names are schemeless URIs that follow the conventions in
2770 /// <https://cloud.google.com/apis/design/resource_names>.
2771 /// Format:
2772 /// `projects/{project}/locations/{location}/networks/{network}`
2773 pub name: std::string::String,
2774
2775 /// An identifier for the `Network`, generated by the backend.
2776 pub id: std::string::String,
2777
2778 /// The type of this network.
2779 pub r#type: crate::model::network::Type,
2780
2781 /// IP address configured.
2782 pub ip_address: std::string::String,
2783
2784 /// List of physical interfaces.
2785 pub mac_address: std::vec::Vec<std::string::String>,
2786
2787 /// The Network state.
2788 pub state: crate::model::network::State,
2789
2790 /// The vlan id of the Network.
2791 pub vlan_id: std::string::String,
2792
2793 /// The cidr of the Network.
2794 pub cidr: std::string::String,
2795
2796 /// The vrf for the Network.
2797 pub vrf: std::option::Option<crate::model::Vrf>,
2798
2799 /// Labels as key value pairs.
2800 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2801
2802 /// IP range for reserved for services (e.g. NFS).
2803 pub services_cidr: std::string::String,
2804
2805 /// List of IP address reservations in this network.
2806 /// When updating this field, an error will be generated if a reservation
2807 /// conflicts with an IP address already allocated to a physical server.
2808 pub reservations: std::vec::Vec<crate::model::NetworkAddressReservation>,
2809
2810 /// Output only. Pod name.
2811 pub pod: std::string::String,
2812
2813 /// Input only. List of mount points to attach the network to.
2814 pub mount_points: std::vec::Vec<crate::model::NetworkMountPoint>,
2815
2816 /// Whether network uses standard frames or jumbo ones.
2817 pub jumbo_frames_enabled: bool,
2818
2819 /// Output only. Gateway ip address.
2820 pub gateway_ip: std::string::String,
2821
2822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2823}
2824
2825impl Network {
2826 /// Creates a new default instance.
2827 pub fn new() -> Self {
2828 std::default::Default::default()
2829 }
2830
2831 /// Sets the value of [name][crate::model::Network::name].
2832 ///
2833 /// # Example
2834 /// ```ignore,no_run
2835 /// # use google_cloud_baremetalsolution_v2::model::Network;
2836 /// # let project_id = "project_id";
2837 /// # let location_id = "location_id";
2838 /// # let network_id = "network_id";
2839 /// let x = Network::new().set_name(format!("projects/{project_id}/locations/{location_id}/networks/{network_id}"));
2840 /// ```
2841 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2842 self.name = v.into();
2843 self
2844 }
2845
2846 /// Sets the value of [id][crate::model::Network::id].
2847 ///
2848 /// # Example
2849 /// ```ignore,no_run
2850 /// # use google_cloud_baremetalsolution_v2::model::Network;
2851 /// let x = Network::new().set_id("example");
2852 /// ```
2853 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2854 self.id = v.into();
2855 self
2856 }
2857
2858 /// Sets the value of [r#type][crate::model::Network::type].
2859 ///
2860 /// # Example
2861 /// ```ignore,no_run
2862 /// # use google_cloud_baremetalsolution_v2::model::Network;
2863 /// use google_cloud_baremetalsolution_v2::model::network::Type;
2864 /// let x0 = Network::new().set_type(Type::Client);
2865 /// let x1 = Network::new().set_type(Type::Private);
2866 /// ```
2867 pub fn set_type<T: std::convert::Into<crate::model::network::Type>>(mut self, v: T) -> Self {
2868 self.r#type = v.into();
2869 self
2870 }
2871
2872 /// Sets the value of [ip_address][crate::model::Network::ip_address].
2873 ///
2874 /// # Example
2875 /// ```ignore,no_run
2876 /// # use google_cloud_baremetalsolution_v2::model::Network;
2877 /// let x = Network::new().set_ip_address("example");
2878 /// ```
2879 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2880 self.ip_address = v.into();
2881 self
2882 }
2883
2884 /// Sets the value of [mac_address][crate::model::Network::mac_address].
2885 ///
2886 /// # Example
2887 /// ```ignore,no_run
2888 /// # use google_cloud_baremetalsolution_v2::model::Network;
2889 /// let x = Network::new().set_mac_address(["a", "b", "c"]);
2890 /// ```
2891 pub fn set_mac_address<T, V>(mut self, v: T) -> Self
2892 where
2893 T: std::iter::IntoIterator<Item = V>,
2894 V: std::convert::Into<std::string::String>,
2895 {
2896 use std::iter::Iterator;
2897 self.mac_address = v.into_iter().map(|i| i.into()).collect();
2898 self
2899 }
2900
2901 /// Sets the value of [state][crate::model::Network::state].
2902 ///
2903 /// # Example
2904 /// ```ignore,no_run
2905 /// # use google_cloud_baremetalsolution_v2::model::Network;
2906 /// use google_cloud_baremetalsolution_v2::model::network::State;
2907 /// let x0 = Network::new().set_state(State::Provisioning);
2908 /// let x1 = Network::new().set_state(State::Provisioned);
2909 /// let x2 = Network::new().set_state(State::Deprovisioning);
2910 /// ```
2911 pub fn set_state<T: std::convert::Into<crate::model::network::State>>(mut self, v: T) -> Self {
2912 self.state = v.into();
2913 self
2914 }
2915
2916 /// Sets the value of [vlan_id][crate::model::Network::vlan_id].
2917 ///
2918 /// # Example
2919 /// ```ignore,no_run
2920 /// # use google_cloud_baremetalsolution_v2::model::Network;
2921 /// let x = Network::new().set_vlan_id("example");
2922 /// ```
2923 pub fn set_vlan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2924 self.vlan_id = v.into();
2925 self
2926 }
2927
2928 /// Sets the value of [cidr][crate::model::Network::cidr].
2929 ///
2930 /// # Example
2931 /// ```ignore,no_run
2932 /// # use google_cloud_baremetalsolution_v2::model::Network;
2933 /// let x = Network::new().set_cidr("example");
2934 /// ```
2935 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2936 self.cidr = v.into();
2937 self
2938 }
2939
2940 /// Sets the value of [vrf][crate::model::Network::vrf].
2941 ///
2942 /// # Example
2943 /// ```ignore,no_run
2944 /// # use google_cloud_baremetalsolution_v2::model::Network;
2945 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2946 /// let x = Network::new().set_vrf(Vrf::default()/* use setters */);
2947 /// ```
2948 pub fn set_vrf<T>(mut self, v: T) -> Self
2949 where
2950 T: std::convert::Into<crate::model::Vrf>,
2951 {
2952 self.vrf = std::option::Option::Some(v.into());
2953 self
2954 }
2955
2956 /// Sets or clears the value of [vrf][crate::model::Network::vrf].
2957 ///
2958 /// # Example
2959 /// ```ignore,no_run
2960 /// # use google_cloud_baremetalsolution_v2::model::Network;
2961 /// use google_cloud_baremetalsolution_v2::model::Vrf;
2962 /// let x = Network::new().set_or_clear_vrf(Some(Vrf::default()/* use setters */));
2963 /// let x = Network::new().set_or_clear_vrf(None::<Vrf>);
2964 /// ```
2965 pub fn set_or_clear_vrf<T>(mut self, v: std::option::Option<T>) -> Self
2966 where
2967 T: std::convert::Into<crate::model::Vrf>,
2968 {
2969 self.vrf = v.map(|x| x.into());
2970 self
2971 }
2972
2973 /// Sets the value of [labels][crate::model::Network::labels].
2974 ///
2975 /// # Example
2976 /// ```ignore,no_run
2977 /// # use google_cloud_baremetalsolution_v2::model::Network;
2978 /// let x = Network::new().set_labels([
2979 /// ("key0", "abc"),
2980 /// ("key1", "xyz"),
2981 /// ]);
2982 /// ```
2983 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2984 where
2985 T: std::iter::IntoIterator<Item = (K, V)>,
2986 K: std::convert::Into<std::string::String>,
2987 V: std::convert::Into<std::string::String>,
2988 {
2989 use std::iter::Iterator;
2990 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2991 self
2992 }
2993
2994 /// Sets the value of [services_cidr][crate::model::Network::services_cidr].
2995 ///
2996 /// # Example
2997 /// ```ignore,no_run
2998 /// # use google_cloud_baremetalsolution_v2::model::Network;
2999 /// let x = Network::new().set_services_cidr("example");
3000 /// ```
3001 pub fn set_services_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3002 self.services_cidr = v.into();
3003 self
3004 }
3005
3006 /// Sets the value of [reservations][crate::model::Network::reservations].
3007 ///
3008 /// # Example
3009 /// ```ignore,no_run
3010 /// # use google_cloud_baremetalsolution_v2::model::Network;
3011 /// use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3012 /// let x = Network::new()
3013 /// .set_reservations([
3014 /// NetworkAddressReservation::default()/* use setters */,
3015 /// NetworkAddressReservation::default()/* use (different) setters */,
3016 /// ]);
3017 /// ```
3018 pub fn set_reservations<T, V>(mut self, v: T) -> Self
3019 where
3020 T: std::iter::IntoIterator<Item = V>,
3021 V: std::convert::Into<crate::model::NetworkAddressReservation>,
3022 {
3023 use std::iter::Iterator;
3024 self.reservations = v.into_iter().map(|i| i.into()).collect();
3025 self
3026 }
3027
3028 /// Sets the value of [pod][crate::model::Network::pod].
3029 ///
3030 /// # Example
3031 /// ```ignore,no_run
3032 /// # use google_cloud_baremetalsolution_v2::model::Network;
3033 /// let x = Network::new().set_pod("example");
3034 /// ```
3035 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3036 self.pod = v.into();
3037 self
3038 }
3039
3040 /// Sets the value of [mount_points][crate::model::Network::mount_points].
3041 ///
3042 /// # Example
3043 /// ```ignore,no_run
3044 /// # use google_cloud_baremetalsolution_v2::model::Network;
3045 /// use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
3046 /// let x = Network::new()
3047 /// .set_mount_points([
3048 /// NetworkMountPoint::default()/* use setters */,
3049 /// NetworkMountPoint::default()/* use (different) setters */,
3050 /// ]);
3051 /// ```
3052 pub fn set_mount_points<T, V>(mut self, v: T) -> Self
3053 where
3054 T: std::iter::IntoIterator<Item = V>,
3055 V: std::convert::Into<crate::model::NetworkMountPoint>,
3056 {
3057 use std::iter::Iterator;
3058 self.mount_points = v.into_iter().map(|i| i.into()).collect();
3059 self
3060 }
3061
3062 /// Sets the value of [jumbo_frames_enabled][crate::model::Network::jumbo_frames_enabled].
3063 ///
3064 /// # Example
3065 /// ```ignore,no_run
3066 /// # use google_cloud_baremetalsolution_v2::model::Network;
3067 /// let x = Network::new().set_jumbo_frames_enabled(true);
3068 /// ```
3069 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3070 self.jumbo_frames_enabled = v.into();
3071 self
3072 }
3073
3074 /// Sets the value of [gateway_ip][crate::model::Network::gateway_ip].
3075 ///
3076 /// # Example
3077 /// ```ignore,no_run
3078 /// # use google_cloud_baremetalsolution_v2::model::Network;
3079 /// let x = Network::new().set_gateway_ip("example");
3080 /// ```
3081 pub fn set_gateway_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3082 self.gateway_ip = v.into();
3083 self
3084 }
3085}
3086
3087impl wkt::message::Message for Network {
3088 fn typename() -> &'static str {
3089 "type.googleapis.com/google.cloud.baremetalsolution.v2.Network"
3090 }
3091}
3092
3093/// Defines additional types related to [Network].
3094pub mod network {
3095 #[allow(unused_imports)]
3096 use super::*;
3097
3098 /// Network type.
3099 ///
3100 /// # Working with unknown values
3101 ///
3102 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3103 /// additional enum variants at any time. Adding new variants is not considered
3104 /// a breaking change. Applications should write their code in anticipation of:
3105 ///
3106 /// - New values appearing in future releases of the client library, **and**
3107 /// - New values received dynamically, without application changes.
3108 ///
3109 /// Please consult the [Working with enums] section in the user guide for some
3110 /// guidelines.
3111 ///
3112 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3113 #[derive(Clone, Debug, PartialEq)]
3114 #[non_exhaustive]
3115 pub enum Type {
3116 /// Unspecified value.
3117 Unspecified,
3118 /// Client network, a network peered to a Google Cloud VPC.
3119 Client,
3120 /// Private network, a network local to the Bare Metal Solution environment.
3121 Private,
3122 /// If set, the enum was initialized with an unknown value.
3123 ///
3124 /// Applications can examine the value using [Type::value] or
3125 /// [Type::name].
3126 UnknownValue(r#type::UnknownValue),
3127 }
3128
3129 #[doc(hidden)]
3130 pub mod r#type {
3131 #[allow(unused_imports)]
3132 use super::*;
3133 #[derive(Clone, Debug, PartialEq)]
3134 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3135 }
3136
3137 impl Type {
3138 /// Gets the enum value.
3139 ///
3140 /// Returns `None` if the enum contains an unknown value deserialized from
3141 /// the string representation of enums.
3142 pub fn value(&self) -> std::option::Option<i32> {
3143 match self {
3144 Self::Unspecified => std::option::Option::Some(0),
3145 Self::Client => std::option::Option::Some(1),
3146 Self::Private => std::option::Option::Some(2),
3147 Self::UnknownValue(u) => u.0.value(),
3148 }
3149 }
3150
3151 /// Gets the enum value as a string.
3152 ///
3153 /// Returns `None` if the enum contains an unknown value deserialized from
3154 /// the integer representation of enums.
3155 pub fn name(&self) -> std::option::Option<&str> {
3156 match self {
3157 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
3158 Self::Client => std::option::Option::Some("CLIENT"),
3159 Self::Private => std::option::Option::Some("PRIVATE"),
3160 Self::UnknownValue(u) => u.0.name(),
3161 }
3162 }
3163 }
3164
3165 impl std::default::Default for Type {
3166 fn default() -> Self {
3167 use std::convert::From;
3168 Self::from(0)
3169 }
3170 }
3171
3172 impl std::fmt::Display for Type {
3173 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3174 wkt::internal::display_enum(f, self.name(), self.value())
3175 }
3176 }
3177
3178 impl std::convert::From<i32> for Type {
3179 fn from(value: i32) -> Self {
3180 match value {
3181 0 => Self::Unspecified,
3182 1 => Self::Client,
3183 2 => Self::Private,
3184 _ => Self::UnknownValue(r#type::UnknownValue(
3185 wkt::internal::UnknownEnumValue::Integer(value),
3186 )),
3187 }
3188 }
3189 }
3190
3191 impl std::convert::From<&str> for Type {
3192 fn from(value: &str) -> Self {
3193 use std::string::ToString;
3194 match value {
3195 "TYPE_UNSPECIFIED" => Self::Unspecified,
3196 "CLIENT" => Self::Client,
3197 "PRIVATE" => Self::Private,
3198 _ => Self::UnknownValue(r#type::UnknownValue(
3199 wkt::internal::UnknownEnumValue::String(value.to_string()),
3200 )),
3201 }
3202 }
3203 }
3204
3205 impl serde::ser::Serialize for Type {
3206 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3207 where
3208 S: serde::Serializer,
3209 {
3210 match self {
3211 Self::Unspecified => serializer.serialize_i32(0),
3212 Self::Client => serializer.serialize_i32(1),
3213 Self::Private => serializer.serialize_i32(2),
3214 Self::UnknownValue(u) => u.0.serialize(serializer),
3215 }
3216 }
3217 }
3218
3219 impl<'de> serde::de::Deserialize<'de> for Type {
3220 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3221 where
3222 D: serde::Deserializer<'de>,
3223 {
3224 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
3225 ".google.cloud.baremetalsolution.v2.Network.Type",
3226 ))
3227 }
3228 }
3229
3230 /// The possible states for this Network.
3231 ///
3232 /// # Working with unknown values
3233 ///
3234 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3235 /// additional enum variants at any time. Adding new variants is not considered
3236 /// a breaking change. Applications should write their code in anticipation of:
3237 ///
3238 /// - New values appearing in future releases of the client library, **and**
3239 /// - New values received dynamically, without application changes.
3240 ///
3241 /// Please consult the [Working with enums] section in the user guide for some
3242 /// guidelines.
3243 ///
3244 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3245 #[derive(Clone, Debug, PartialEq)]
3246 #[non_exhaustive]
3247 pub enum State {
3248 /// The Network is in an unknown state.
3249 Unspecified,
3250 /// The Network is provisioning.
3251 Provisioning,
3252 /// The Network has been provisioned.
3253 Provisioned,
3254 /// The Network is being deprovisioned.
3255 Deprovisioning,
3256 /// The Network is being updated.
3257 Updating,
3258 /// If set, the enum was initialized with an unknown value.
3259 ///
3260 /// Applications can examine the value using [State::value] or
3261 /// [State::name].
3262 UnknownValue(state::UnknownValue),
3263 }
3264
3265 #[doc(hidden)]
3266 pub mod state {
3267 #[allow(unused_imports)]
3268 use super::*;
3269 #[derive(Clone, Debug, PartialEq)]
3270 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3271 }
3272
3273 impl State {
3274 /// Gets the enum value.
3275 ///
3276 /// Returns `None` if the enum contains an unknown value deserialized from
3277 /// the string representation of enums.
3278 pub fn value(&self) -> std::option::Option<i32> {
3279 match self {
3280 Self::Unspecified => std::option::Option::Some(0),
3281 Self::Provisioning => std::option::Option::Some(1),
3282 Self::Provisioned => std::option::Option::Some(2),
3283 Self::Deprovisioning => std::option::Option::Some(3),
3284 Self::Updating => std::option::Option::Some(4),
3285 Self::UnknownValue(u) => u.0.value(),
3286 }
3287 }
3288
3289 /// Gets the enum value as a string.
3290 ///
3291 /// Returns `None` if the enum contains an unknown value deserialized from
3292 /// the integer representation of enums.
3293 pub fn name(&self) -> std::option::Option<&str> {
3294 match self {
3295 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3296 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3297 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3298 Self::Deprovisioning => std::option::Option::Some("DEPROVISIONING"),
3299 Self::Updating => std::option::Option::Some("UPDATING"),
3300 Self::UnknownValue(u) => u.0.name(),
3301 }
3302 }
3303 }
3304
3305 impl std::default::Default for State {
3306 fn default() -> Self {
3307 use std::convert::From;
3308 Self::from(0)
3309 }
3310 }
3311
3312 impl std::fmt::Display for State {
3313 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3314 wkt::internal::display_enum(f, self.name(), self.value())
3315 }
3316 }
3317
3318 impl std::convert::From<i32> for State {
3319 fn from(value: i32) -> Self {
3320 match value {
3321 0 => Self::Unspecified,
3322 1 => Self::Provisioning,
3323 2 => Self::Provisioned,
3324 3 => Self::Deprovisioning,
3325 4 => Self::Updating,
3326 _ => Self::UnknownValue(state::UnknownValue(
3327 wkt::internal::UnknownEnumValue::Integer(value),
3328 )),
3329 }
3330 }
3331 }
3332
3333 impl std::convert::From<&str> for State {
3334 fn from(value: &str) -> Self {
3335 use std::string::ToString;
3336 match value {
3337 "STATE_UNSPECIFIED" => Self::Unspecified,
3338 "PROVISIONING" => Self::Provisioning,
3339 "PROVISIONED" => Self::Provisioned,
3340 "DEPROVISIONING" => Self::Deprovisioning,
3341 "UPDATING" => Self::Updating,
3342 _ => Self::UnknownValue(state::UnknownValue(
3343 wkt::internal::UnknownEnumValue::String(value.to_string()),
3344 )),
3345 }
3346 }
3347 }
3348
3349 impl serde::ser::Serialize for State {
3350 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3351 where
3352 S: serde::Serializer,
3353 {
3354 match self {
3355 Self::Unspecified => serializer.serialize_i32(0),
3356 Self::Provisioning => serializer.serialize_i32(1),
3357 Self::Provisioned => serializer.serialize_i32(2),
3358 Self::Deprovisioning => serializer.serialize_i32(3),
3359 Self::Updating => serializer.serialize_i32(4),
3360 Self::UnknownValue(u) => u.0.serialize(serializer),
3361 }
3362 }
3363 }
3364
3365 impl<'de> serde::de::Deserialize<'de> for State {
3366 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3367 where
3368 D: serde::Deserializer<'de>,
3369 {
3370 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3371 ".google.cloud.baremetalsolution.v2.Network.State",
3372 ))
3373 }
3374 }
3375}
3376
3377/// A reservation of one or more addresses in a network.
3378#[derive(Clone, Default, PartialEq)]
3379#[non_exhaustive]
3380pub struct NetworkAddressReservation {
3381 /// The first address of this reservation block.
3382 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3383 pub start_address: std::string::String,
3384
3385 /// The last address of this reservation block, inclusive. I.e., for cases when
3386 /// reservations are only single addresses, end_address and start_address will
3387 /// be the same.
3388 /// Must be specified as a single IPv4 address, e.g. 10.1.2.2.
3389 pub end_address: std::string::String,
3390
3391 /// A note about this reservation, intended for human consumption.
3392 pub note: std::string::String,
3393
3394 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3395}
3396
3397impl NetworkAddressReservation {
3398 /// Creates a new default instance.
3399 pub fn new() -> Self {
3400 std::default::Default::default()
3401 }
3402
3403 /// Sets the value of [start_address][crate::model::NetworkAddressReservation::start_address].
3404 ///
3405 /// # Example
3406 /// ```ignore,no_run
3407 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3408 /// let x = NetworkAddressReservation::new().set_start_address("example");
3409 /// ```
3410 pub fn set_start_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3411 self.start_address = v.into();
3412 self
3413 }
3414
3415 /// Sets the value of [end_address][crate::model::NetworkAddressReservation::end_address].
3416 ///
3417 /// # Example
3418 /// ```ignore,no_run
3419 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3420 /// let x = NetworkAddressReservation::new().set_end_address("example");
3421 /// ```
3422 pub fn set_end_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3423 self.end_address = v.into();
3424 self
3425 }
3426
3427 /// Sets the value of [note][crate::model::NetworkAddressReservation::note].
3428 ///
3429 /// # Example
3430 /// ```ignore,no_run
3431 /// # use google_cloud_baremetalsolution_v2::model::NetworkAddressReservation;
3432 /// let x = NetworkAddressReservation::new().set_note("example");
3433 /// ```
3434 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3435 self.note = v.into();
3436 self
3437 }
3438}
3439
3440impl wkt::message::Message for NetworkAddressReservation {
3441 fn typename() -> &'static str {
3442 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkAddressReservation"
3443 }
3444}
3445
3446/// A network VRF.
3447#[derive(Clone, Default, PartialEq)]
3448#[non_exhaustive]
3449pub struct Vrf {
3450 /// The name of the VRF.
3451 pub name: std::string::String,
3452
3453 /// The possible state of VRF.
3454 pub state: crate::model::vrf::State,
3455
3456 /// The QOS policy applied to this VRF.
3457 /// The value is only meaningful when all the vlan attachments have the same
3458 /// QoS. This field should not be used for new integrations, use vlan
3459 /// attachment level qos instead. The field is left for backward-compatibility.
3460 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3461
3462 /// The list of VLAN attachments for the VRF.
3463 pub vlan_attachments: std::vec::Vec<crate::model::vrf::VlanAttachment>,
3464
3465 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3466}
3467
3468impl Vrf {
3469 /// Creates a new default instance.
3470 pub fn new() -> Self {
3471 std::default::Default::default()
3472 }
3473
3474 /// Sets the value of [name][crate::model::Vrf::name].
3475 ///
3476 /// # Example
3477 /// ```ignore,no_run
3478 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3479 /// let x = Vrf::new().set_name("example");
3480 /// ```
3481 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3482 self.name = v.into();
3483 self
3484 }
3485
3486 /// Sets the value of [state][crate::model::Vrf::state].
3487 ///
3488 /// # Example
3489 /// ```ignore,no_run
3490 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3491 /// use google_cloud_baremetalsolution_v2::model::vrf::State;
3492 /// let x0 = Vrf::new().set_state(State::Provisioning);
3493 /// let x1 = Vrf::new().set_state(State::Provisioned);
3494 /// ```
3495 pub fn set_state<T: std::convert::Into<crate::model::vrf::State>>(mut self, v: T) -> Self {
3496 self.state = v.into();
3497 self
3498 }
3499
3500 /// Sets the value of [qos_policy][crate::model::Vrf::qos_policy].
3501 ///
3502 /// # Example
3503 /// ```ignore,no_run
3504 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3505 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3506 /// let x = Vrf::new().set_qos_policy(QosPolicy::default()/* use setters */);
3507 /// ```
3508 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3509 where
3510 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3511 {
3512 self.qos_policy = std::option::Option::Some(v.into());
3513 self
3514 }
3515
3516 /// Sets or clears the value of [qos_policy][crate::model::Vrf::qos_policy].
3517 ///
3518 /// # Example
3519 /// ```ignore,no_run
3520 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3521 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3522 /// let x = Vrf::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3523 /// let x = Vrf::new().set_or_clear_qos_policy(None::<QosPolicy>);
3524 /// ```
3525 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3526 where
3527 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3528 {
3529 self.qos_policy = v.map(|x| x.into());
3530 self
3531 }
3532
3533 /// Sets the value of [vlan_attachments][crate::model::Vrf::vlan_attachments].
3534 ///
3535 /// # Example
3536 /// ```ignore,no_run
3537 /// # use google_cloud_baremetalsolution_v2::model::Vrf;
3538 /// use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3539 /// let x = Vrf::new()
3540 /// .set_vlan_attachments([
3541 /// VlanAttachment::default()/* use setters */,
3542 /// VlanAttachment::default()/* use (different) setters */,
3543 /// ]);
3544 /// ```
3545 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
3546 where
3547 T: std::iter::IntoIterator<Item = V>,
3548 V: std::convert::Into<crate::model::vrf::VlanAttachment>,
3549 {
3550 use std::iter::Iterator;
3551 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
3552 self
3553 }
3554}
3555
3556impl wkt::message::Message for Vrf {
3557 fn typename() -> &'static str {
3558 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF"
3559 }
3560}
3561
3562/// Defines additional types related to [Vrf].
3563pub mod vrf {
3564 #[allow(unused_imports)]
3565 use super::*;
3566
3567 /// QOS policy parameters.
3568 #[derive(Clone, Default, PartialEq)]
3569 #[non_exhaustive]
3570 pub struct QosPolicy {
3571 /// The bandwidth permitted by the QOS policy, in gbps.
3572 pub bandwidth_gbps: f64,
3573
3574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3575 }
3576
3577 impl QosPolicy {
3578 /// Creates a new default instance.
3579 pub fn new() -> Self {
3580 std::default::Default::default()
3581 }
3582
3583 /// Sets the value of [bandwidth_gbps][crate::model::vrf::QosPolicy::bandwidth_gbps].
3584 ///
3585 /// # Example
3586 /// ```ignore,no_run
3587 /// # use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3588 /// let x = QosPolicy::new().set_bandwidth_gbps(42.0);
3589 /// ```
3590 pub fn set_bandwidth_gbps<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3591 self.bandwidth_gbps = v.into();
3592 self
3593 }
3594 }
3595
3596 impl wkt::message::Message for QosPolicy {
3597 fn typename() -> &'static str {
3598 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.QosPolicy"
3599 }
3600 }
3601
3602 /// VLAN attachment details.
3603 #[derive(Clone, Default, PartialEq)]
3604 #[non_exhaustive]
3605 pub struct VlanAttachment {
3606 /// The peer vlan ID of the attachment.
3607 pub peer_vlan_id: i64,
3608
3609 /// The peer IP of the attachment.
3610 pub peer_ip: std::string::String,
3611
3612 /// The router IP of the attachment.
3613 pub router_ip: std::string::String,
3614
3615 /// Input only. Pairing key.
3616 pub pairing_key: std::string::String,
3617
3618 /// The QOS policy applied to this VLAN attachment.
3619 /// This value should be preferred to using qos at vrf level.
3620 pub qos_policy: std::option::Option<crate::model::vrf::QosPolicy>,
3621
3622 /// Immutable. The identifier of the attachment within vrf.
3623 pub id: std::string::String,
3624
3625 /// Optional. The name of the vlan attachment within vrf. This is of the form
3626 /// projects/{project_number}/regions/{region}/interconnectAttachments/{interconnect_attachment}
3627 pub interconnect_attachment: std::string::String,
3628
3629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3630 }
3631
3632 impl VlanAttachment {
3633 /// Creates a new default instance.
3634 pub fn new() -> Self {
3635 std::default::Default::default()
3636 }
3637
3638 /// Sets the value of [peer_vlan_id][crate::model::vrf::VlanAttachment::peer_vlan_id].
3639 ///
3640 /// # Example
3641 /// ```ignore,no_run
3642 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3643 /// let x = VlanAttachment::new().set_peer_vlan_id(42);
3644 /// ```
3645 pub fn set_peer_vlan_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3646 self.peer_vlan_id = v.into();
3647 self
3648 }
3649
3650 /// Sets the value of [peer_ip][crate::model::vrf::VlanAttachment::peer_ip].
3651 ///
3652 /// # Example
3653 /// ```ignore,no_run
3654 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3655 /// let x = VlanAttachment::new().set_peer_ip("example");
3656 /// ```
3657 pub fn set_peer_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3658 self.peer_ip = v.into();
3659 self
3660 }
3661
3662 /// Sets the value of [router_ip][crate::model::vrf::VlanAttachment::router_ip].
3663 ///
3664 /// # Example
3665 /// ```ignore,no_run
3666 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3667 /// let x = VlanAttachment::new().set_router_ip("example");
3668 /// ```
3669 pub fn set_router_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3670 self.router_ip = v.into();
3671 self
3672 }
3673
3674 /// Sets the value of [pairing_key][crate::model::vrf::VlanAttachment::pairing_key].
3675 ///
3676 /// # Example
3677 /// ```ignore,no_run
3678 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3679 /// let x = VlanAttachment::new().set_pairing_key("example");
3680 /// ```
3681 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3682 self.pairing_key = v.into();
3683 self
3684 }
3685
3686 /// Sets the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3687 ///
3688 /// # Example
3689 /// ```ignore,no_run
3690 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3691 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3692 /// let x = VlanAttachment::new().set_qos_policy(QosPolicy::default()/* use setters */);
3693 /// ```
3694 pub fn set_qos_policy<T>(mut self, v: T) -> Self
3695 where
3696 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3697 {
3698 self.qos_policy = std::option::Option::Some(v.into());
3699 self
3700 }
3701
3702 /// Sets or clears the value of [qos_policy][crate::model::vrf::VlanAttachment::qos_policy].
3703 ///
3704 /// # Example
3705 /// ```ignore,no_run
3706 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3707 /// use google_cloud_baremetalsolution_v2::model::vrf::QosPolicy;
3708 /// let x = VlanAttachment::new().set_or_clear_qos_policy(Some(QosPolicy::default()/* use setters */));
3709 /// let x = VlanAttachment::new().set_or_clear_qos_policy(None::<QosPolicy>);
3710 /// ```
3711 pub fn set_or_clear_qos_policy<T>(mut self, v: std::option::Option<T>) -> Self
3712 where
3713 T: std::convert::Into<crate::model::vrf::QosPolicy>,
3714 {
3715 self.qos_policy = v.map(|x| x.into());
3716 self
3717 }
3718
3719 /// Sets the value of [id][crate::model::vrf::VlanAttachment::id].
3720 ///
3721 /// # Example
3722 /// ```ignore,no_run
3723 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3724 /// let x = VlanAttachment::new().set_id("example");
3725 /// ```
3726 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3727 self.id = v.into();
3728 self
3729 }
3730
3731 /// Sets the value of [interconnect_attachment][crate::model::vrf::VlanAttachment::interconnect_attachment].
3732 ///
3733 /// # Example
3734 /// ```ignore,no_run
3735 /// # use google_cloud_baremetalsolution_v2::model::vrf::VlanAttachment;
3736 /// let x = VlanAttachment::new().set_interconnect_attachment("example");
3737 /// ```
3738 pub fn set_interconnect_attachment<T: std::convert::Into<std::string::String>>(
3739 mut self,
3740 v: T,
3741 ) -> Self {
3742 self.interconnect_attachment = v.into();
3743 self
3744 }
3745 }
3746
3747 impl wkt::message::Message for VlanAttachment {
3748 fn typename() -> &'static str {
3749 "type.googleapis.com/google.cloud.baremetalsolution.v2.VRF.VlanAttachment"
3750 }
3751 }
3752
3753 /// The possible states for this VRF.
3754 ///
3755 /// # Working with unknown values
3756 ///
3757 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3758 /// additional enum variants at any time. Adding new variants is not considered
3759 /// a breaking change. Applications should write their code in anticipation of:
3760 ///
3761 /// - New values appearing in future releases of the client library, **and**
3762 /// - New values received dynamically, without application changes.
3763 ///
3764 /// Please consult the [Working with enums] section in the user guide for some
3765 /// guidelines.
3766 ///
3767 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3768 #[derive(Clone, Debug, PartialEq)]
3769 #[non_exhaustive]
3770 pub enum State {
3771 /// The unspecified state.
3772 Unspecified,
3773 /// The vrf is provisioning.
3774 Provisioning,
3775 /// The vrf is provisioned.
3776 Provisioned,
3777 /// If set, the enum was initialized with an unknown value.
3778 ///
3779 /// Applications can examine the value using [State::value] or
3780 /// [State::name].
3781 UnknownValue(state::UnknownValue),
3782 }
3783
3784 #[doc(hidden)]
3785 pub mod state {
3786 #[allow(unused_imports)]
3787 use super::*;
3788 #[derive(Clone, Debug, PartialEq)]
3789 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3790 }
3791
3792 impl State {
3793 /// Gets the enum value.
3794 ///
3795 /// Returns `None` if the enum contains an unknown value deserialized from
3796 /// the string representation of enums.
3797 pub fn value(&self) -> std::option::Option<i32> {
3798 match self {
3799 Self::Unspecified => std::option::Option::Some(0),
3800 Self::Provisioning => std::option::Option::Some(1),
3801 Self::Provisioned => std::option::Option::Some(2),
3802 Self::UnknownValue(u) => u.0.value(),
3803 }
3804 }
3805
3806 /// Gets the enum value as a string.
3807 ///
3808 /// Returns `None` if the enum contains an unknown value deserialized from
3809 /// the integer representation of enums.
3810 pub fn name(&self) -> std::option::Option<&str> {
3811 match self {
3812 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3813 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3814 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
3815 Self::UnknownValue(u) => u.0.name(),
3816 }
3817 }
3818 }
3819
3820 impl std::default::Default for State {
3821 fn default() -> Self {
3822 use std::convert::From;
3823 Self::from(0)
3824 }
3825 }
3826
3827 impl std::fmt::Display for State {
3828 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3829 wkt::internal::display_enum(f, self.name(), self.value())
3830 }
3831 }
3832
3833 impl std::convert::From<i32> for State {
3834 fn from(value: i32) -> Self {
3835 match value {
3836 0 => Self::Unspecified,
3837 1 => Self::Provisioning,
3838 2 => Self::Provisioned,
3839 _ => Self::UnknownValue(state::UnknownValue(
3840 wkt::internal::UnknownEnumValue::Integer(value),
3841 )),
3842 }
3843 }
3844 }
3845
3846 impl std::convert::From<&str> for State {
3847 fn from(value: &str) -> Self {
3848 use std::string::ToString;
3849 match value {
3850 "STATE_UNSPECIFIED" => Self::Unspecified,
3851 "PROVISIONING" => Self::Provisioning,
3852 "PROVISIONED" => Self::Provisioned,
3853 _ => Self::UnknownValue(state::UnknownValue(
3854 wkt::internal::UnknownEnumValue::String(value.to_string()),
3855 )),
3856 }
3857 }
3858 }
3859
3860 impl serde::ser::Serialize for State {
3861 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3862 where
3863 S: serde::Serializer,
3864 {
3865 match self {
3866 Self::Unspecified => serializer.serialize_i32(0),
3867 Self::Provisioning => serializer.serialize_i32(1),
3868 Self::Provisioned => serializer.serialize_i32(2),
3869 Self::UnknownValue(u) => u.0.serialize(serializer),
3870 }
3871 }
3872 }
3873
3874 impl<'de> serde::de::Deserialize<'de> for State {
3875 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3876 where
3877 D: serde::Deserializer<'de>,
3878 {
3879 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3880 ".google.cloud.baremetalsolution.v2.VRF.State",
3881 ))
3882 }
3883 }
3884}
3885
3886/// Each logical interface represents a logical abstraction of the underlying
3887/// physical interface (for eg. bond, nic) of the instance. Each logical
3888/// interface can effectively map to multiple network-IP pairs and still be
3889/// mapped to one underlying physical interface.
3890#[derive(Clone, Default, PartialEq)]
3891#[non_exhaustive]
3892pub struct LogicalInterface {
3893 /// List of logical network interfaces within a logical interface.
3894 pub logical_network_interfaces:
3895 std::vec::Vec<crate::model::logical_interface::LogicalNetworkInterface>,
3896
3897 /// Interface name. This is of syntax \<bond\><bond_mode> or \<nic\> and
3898 /// forms part of the network template name.
3899 pub name: std::string::String,
3900
3901 /// The index of the logical interface mapping to the index of the hardware
3902 /// bond or nic on the chosen network template. This field is deprecated.
3903 #[deprecated]
3904 pub interface_index: i32,
3905
3906 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3907}
3908
3909impl LogicalInterface {
3910 /// Creates a new default instance.
3911 pub fn new() -> Self {
3912 std::default::Default::default()
3913 }
3914
3915 /// Sets the value of [logical_network_interfaces][crate::model::LogicalInterface::logical_network_interfaces].
3916 ///
3917 /// # Example
3918 /// ```ignore,no_run
3919 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3920 /// use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
3921 /// let x = LogicalInterface::new()
3922 /// .set_logical_network_interfaces([
3923 /// LogicalNetworkInterface::default()/* use setters */,
3924 /// LogicalNetworkInterface::default()/* use (different) setters */,
3925 /// ]);
3926 /// ```
3927 pub fn set_logical_network_interfaces<T, V>(mut self, v: T) -> Self
3928 where
3929 T: std::iter::IntoIterator<Item = V>,
3930 V: std::convert::Into<crate::model::logical_interface::LogicalNetworkInterface>,
3931 {
3932 use std::iter::Iterator;
3933 self.logical_network_interfaces = v.into_iter().map(|i| i.into()).collect();
3934 self
3935 }
3936
3937 /// Sets the value of [name][crate::model::LogicalInterface::name].
3938 ///
3939 /// # Example
3940 /// ```ignore,no_run
3941 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3942 /// let x = LogicalInterface::new().set_name("example");
3943 /// ```
3944 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3945 self.name = v.into();
3946 self
3947 }
3948
3949 /// Sets the value of [interface_index][crate::model::LogicalInterface::interface_index].
3950 ///
3951 /// # Example
3952 /// ```ignore,no_run
3953 /// # use google_cloud_baremetalsolution_v2::model::LogicalInterface;
3954 /// let x = LogicalInterface::new().set_interface_index(42);
3955 /// ```
3956 #[deprecated]
3957 pub fn set_interface_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3958 self.interface_index = v.into();
3959 self
3960 }
3961}
3962
3963impl wkt::message::Message for LogicalInterface {
3964 fn typename() -> &'static str {
3965 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface"
3966 }
3967}
3968
3969/// Defines additional types related to [LogicalInterface].
3970pub mod logical_interface {
3971 #[allow(unused_imports)]
3972 use super::*;
3973
3974 /// Each logical network interface is effectively a network and IP pair.
3975 #[derive(Clone, Default, PartialEq)]
3976 #[non_exhaustive]
3977 pub struct LogicalNetworkInterface {
3978 /// Name of the network
3979 pub network: std::string::String,
3980
3981 /// IP address in the network
3982 pub ip_address: std::string::String,
3983
3984 /// Whether this interface is the default gateway for the instance. Only
3985 /// one interface can be the default gateway for the instance.
3986 pub default_gateway: bool,
3987
3988 /// Type of network.
3989 pub network_type: crate::model::network::Type,
3990
3991 /// An identifier for the `Network`, generated by the backend.
3992 pub id: std::string::String,
3993
3994 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3995 }
3996
3997 impl LogicalNetworkInterface {
3998 /// Creates a new default instance.
3999 pub fn new() -> Self {
4000 std::default::Default::default()
4001 }
4002
4003 /// Sets the value of [network][crate::model::logical_interface::LogicalNetworkInterface::network].
4004 ///
4005 /// # Example
4006 /// ```ignore,no_run
4007 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4008 /// let x = LogicalNetworkInterface::new().set_network("example");
4009 /// ```
4010 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4011 self.network = v.into();
4012 self
4013 }
4014
4015 /// Sets the value of [ip_address][crate::model::logical_interface::LogicalNetworkInterface::ip_address].
4016 ///
4017 /// # Example
4018 /// ```ignore,no_run
4019 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4020 /// let x = LogicalNetworkInterface::new().set_ip_address("example");
4021 /// ```
4022 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4023 self.ip_address = v.into();
4024 self
4025 }
4026
4027 /// Sets the value of [default_gateway][crate::model::logical_interface::LogicalNetworkInterface::default_gateway].
4028 ///
4029 /// # Example
4030 /// ```ignore,no_run
4031 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4032 /// let x = LogicalNetworkInterface::new().set_default_gateway(true);
4033 /// ```
4034 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4035 self.default_gateway = v.into();
4036 self
4037 }
4038
4039 /// Sets the value of [network_type][crate::model::logical_interface::LogicalNetworkInterface::network_type].
4040 ///
4041 /// # Example
4042 /// ```ignore,no_run
4043 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4044 /// use google_cloud_baremetalsolution_v2::model::network::Type;
4045 /// let x0 = LogicalNetworkInterface::new().set_network_type(Type::Client);
4046 /// let x1 = LogicalNetworkInterface::new().set_network_type(Type::Private);
4047 /// ```
4048 pub fn set_network_type<T: std::convert::Into<crate::model::network::Type>>(
4049 mut self,
4050 v: T,
4051 ) -> Self {
4052 self.network_type = v.into();
4053 self
4054 }
4055
4056 /// Sets the value of [id][crate::model::logical_interface::LogicalNetworkInterface::id].
4057 ///
4058 /// # Example
4059 /// ```ignore,no_run
4060 /// # use google_cloud_baremetalsolution_v2::model::logical_interface::LogicalNetworkInterface;
4061 /// let x = LogicalNetworkInterface::new().set_id("example");
4062 /// ```
4063 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4064 self.id = v.into();
4065 self
4066 }
4067 }
4068
4069 impl wkt::message::Message for LogicalNetworkInterface {
4070 fn typename() -> &'static str {
4071 "type.googleapis.com/google.cloud.baremetalsolution.v2.LogicalInterface.LogicalNetworkInterface"
4072 }
4073 }
4074}
4075
4076/// Message for requesting network information.
4077#[derive(Clone, Default, PartialEq)]
4078#[non_exhaustive]
4079pub struct GetNetworkRequest {
4080 /// Required. Name of the resource.
4081 pub name: std::string::String,
4082
4083 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4084}
4085
4086impl GetNetworkRequest {
4087 /// Creates a new default instance.
4088 pub fn new() -> Self {
4089 std::default::Default::default()
4090 }
4091
4092 /// Sets the value of [name][crate::model::GetNetworkRequest::name].
4093 ///
4094 /// # Example
4095 /// ```ignore,no_run
4096 /// # use google_cloud_baremetalsolution_v2::model::GetNetworkRequest;
4097 /// # let project_id = "project_id";
4098 /// # let location_id = "location_id";
4099 /// # let network_id = "network_id";
4100 /// let x = GetNetworkRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/networks/{network_id}"));
4101 /// ```
4102 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4103 self.name = v.into();
4104 self
4105 }
4106}
4107
4108impl wkt::message::Message for GetNetworkRequest {
4109 fn typename() -> &'static str {
4110 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNetworkRequest"
4111 }
4112}
4113
4114/// Message for requesting a list of networks.
4115#[derive(Clone, Default, PartialEq)]
4116#[non_exhaustive]
4117pub struct ListNetworksRequest {
4118 /// Required. Parent value for ListNetworksRequest.
4119 pub parent: std::string::String,
4120
4121 /// Requested page size. The server might return fewer items than requested.
4122 /// If unspecified, server will pick an appropriate default.
4123 pub page_size: i32,
4124
4125 /// A token identifying a page of results from the server.
4126 pub page_token: std::string::String,
4127
4128 /// List filter.
4129 pub filter: std::string::String,
4130
4131 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4132}
4133
4134impl ListNetworksRequest {
4135 /// Creates a new default instance.
4136 pub fn new() -> Self {
4137 std::default::Default::default()
4138 }
4139
4140 /// Sets the value of [parent][crate::model::ListNetworksRequest::parent].
4141 ///
4142 /// # Example
4143 /// ```ignore,no_run
4144 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4145 /// let x = ListNetworksRequest::new().set_parent("example");
4146 /// ```
4147 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4148 self.parent = v.into();
4149 self
4150 }
4151
4152 /// Sets the value of [page_size][crate::model::ListNetworksRequest::page_size].
4153 ///
4154 /// # Example
4155 /// ```ignore,no_run
4156 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4157 /// let x = ListNetworksRequest::new().set_page_size(42);
4158 /// ```
4159 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4160 self.page_size = v.into();
4161 self
4162 }
4163
4164 /// Sets the value of [page_token][crate::model::ListNetworksRequest::page_token].
4165 ///
4166 /// # Example
4167 /// ```ignore,no_run
4168 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4169 /// let x = ListNetworksRequest::new().set_page_token("example");
4170 /// ```
4171 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4172 self.page_token = v.into();
4173 self
4174 }
4175
4176 /// Sets the value of [filter][crate::model::ListNetworksRequest::filter].
4177 ///
4178 /// # Example
4179 /// ```ignore,no_run
4180 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksRequest;
4181 /// let x = ListNetworksRequest::new().set_filter("example");
4182 /// ```
4183 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4184 self.filter = v.into();
4185 self
4186 }
4187}
4188
4189impl wkt::message::Message for ListNetworksRequest {
4190 fn typename() -> &'static str {
4191 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksRequest"
4192 }
4193}
4194
4195/// Response message containing the list of networks.
4196#[derive(Clone, Default, PartialEq)]
4197#[non_exhaustive]
4198pub struct ListNetworksResponse {
4199 /// The list of networks.
4200 pub networks: std::vec::Vec<crate::model::Network>,
4201
4202 /// A token identifying a page of results from the server.
4203 pub next_page_token: std::string::String,
4204
4205 /// Locations that could not be reached.
4206 pub unreachable: std::vec::Vec<std::string::String>,
4207
4208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4209}
4210
4211impl ListNetworksResponse {
4212 /// Creates a new default instance.
4213 pub fn new() -> Self {
4214 std::default::Default::default()
4215 }
4216
4217 /// Sets the value of [networks][crate::model::ListNetworksResponse::networks].
4218 ///
4219 /// # Example
4220 /// ```ignore,no_run
4221 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4222 /// use google_cloud_baremetalsolution_v2::model::Network;
4223 /// let x = ListNetworksResponse::new()
4224 /// .set_networks([
4225 /// Network::default()/* use setters */,
4226 /// Network::default()/* use (different) setters */,
4227 /// ]);
4228 /// ```
4229 pub fn set_networks<T, V>(mut self, v: T) -> Self
4230 where
4231 T: std::iter::IntoIterator<Item = V>,
4232 V: std::convert::Into<crate::model::Network>,
4233 {
4234 use std::iter::Iterator;
4235 self.networks = v.into_iter().map(|i| i.into()).collect();
4236 self
4237 }
4238
4239 /// Sets the value of [next_page_token][crate::model::ListNetworksResponse::next_page_token].
4240 ///
4241 /// # Example
4242 /// ```ignore,no_run
4243 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4244 /// let x = ListNetworksResponse::new().set_next_page_token("example");
4245 /// ```
4246 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4247 self.next_page_token = v.into();
4248 self
4249 }
4250
4251 /// Sets the value of [unreachable][crate::model::ListNetworksResponse::unreachable].
4252 ///
4253 /// # Example
4254 /// ```ignore,no_run
4255 /// # use google_cloud_baremetalsolution_v2::model::ListNetworksResponse;
4256 /// let x = ListNetworksResponse::new().set_unreachable(["a", "b", "c"]);
4257 /// ```
4258 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4259 where
4260 T: std::iter::IntoIterator<Item = V>,
4261 V: std::convert::Into<std::string::String>,
4262 {
4263 use std::iter::Iterator;
4264 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4265 self
4266 }
4267}
4268
4269impl wkt::message::Message for ListNetworksResponse {
4270 fn typename() -> &'static str {
4271 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworksResponse"
4272 }
4273}
4274
4275#[doc(hidden)]
4276impl google_cloud_gax::paginator::internal::PageableResponse for ListNetworksResponse {
4277 type PageItem = crate::model::Network;
4278
4279 fn items(self) -> std::vec::Vec<Self::PageItem> {
4280 self.networks
4281 }
4282
4283 fn next_page_token(&self) -> std::string::String {
4284 use std::clone::Clone;
4285 self.next_page_token.clone()
4286 }
4287}
4288
4289/// Message requesting to updating a network.
4290#[derive(Clone, Default, PartialEq)]
4291#[non_exhaustive]
4292pub struct UpdateNetworkRequest {
4293 /// Required. The network to update.
4294 ///
4295 /// The `name` field is used to identify the instance to update.
4296 /// Format: projects/{project}/locations/{location}/networks/{network}
4297 pub network: std::option::Option<crate::model::Network>,
4298
4299 /// The list of fields to update.
4300 /// The only currently supported fields are:
4301 /// `labels`, `reservations`, `vrf.vlan_attachments`
4302 pub update_mask: std::option::Option<wkt::FieldMask>,
4303
4304 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4305}
4306
4307impl UpdateNetworkRequest {
4308 /// Creates a new default instance.
4309 pub fn new() -> Self {
4310 std::default::Default::default()
4311 }
4312
4313 /// Sets the value of [network][crate::model::UpdateNetworkRequest::network].
4314 ///
4315 /// # Example
4316 /// ```ignore,no_run
4317 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4318 /// use google_cloud_baremetalsolution_v2::model::Network;
4319 /// let x = UpdateNetworkRequest::new().set_network(Network::default()/* use setters */);
4320 /// ```
4321 pub fn set_network<T>(mut self, v: T) -> Self
4322 where
4323 T: std::convert::Into<crate::model::Network>,
4324 {
4325 self.network = std::option::Option::Some(v.into());
4326 self
4327 }
4328
4329 /// Sets or clears the value of [network][crate::model::UpdateNetworkRequest::network].
4330 ///
4331 /// # Example
4332 /// ```ignore,no_run
4333 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4334 /// use google_cloud_baremetalsolution_v2::model::Network;
4335 /// let x = UpdateNetworkRequest::new().set_or_clear_network(Some(Network::default()/* use setters */));
4336 /// let x = UpdateNetworkRequest::new().set_or_clear_network(None::<Network>);
4337 /// ```
4338 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4339 where
4340 T: std::convert::Into<crate::model::Network>,
4341 {
4342 self.network = v.map(|x| x.into());
4343 self
4344 }
4345
4346 /// Sets the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4347 ///
4348 /// # Example
4349 /// ```ignore,no_run
4350 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4351 /// use wkt::FieldMask;
4352 /// let x = UpdateNetworkRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4353 /// ```
4354 pub fn set_update_mask<T>(mut self, v: T) -> Self
4355 where
4356 T: std::convert::Into<wkt::FieldMask>,
4357 {
4358 self.update_mask = std::option::Option::Some(v.into());
4359 self
4360 }
4361
4362 /// Sets or clears the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
4363 ///
4364 /// # Example
4365 /// ```ignore,no_run
4366 /// # use google_cloud_baremetalsolution_v2::model::UpdateNetworkRequest;
4367 /// use wkt::FieldMask;
4368 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4369 /// let x = UpdateNetworkRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4370 /// ```
4371 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4372 where
4373 T: std::convert::Into<wkt::FieldMask>,
4374 {
4375 self.update_mask = v.map(|x| x.into());
4376 self
4377 }
4378}
4379
4380impl wkt::message::Message for UpdateNetworkRequest {
4381 fn typename() -> &'static str {
4382 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNetworkRequest"
4383 }
4384}
4385
4386/// Network with all used IP addresses.
4387#[derive(Clone, Default, PartialEq)]
4388#[non_exhaustive]
4389pub struct NetworkUsage {
4390 /// Network.
4391 pub network: std::option::Option<crate::model::Network>,
4392
4393 /// All used IP addresses in this network.
4394 pub used_ips: std::vec::Vec<std::string::String>,
4395
4396 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4397}
4398
4399impl NetworkUsage {
4400 /// Creates a new default instance.
4401 pub fn new() -> Self {
4402 std::default::Default::default()
4403 }
4404
4405 /// Sets the value of [network][crate::model::NetworkUsage::network].
4406 ///
4407 /// # Example
4408 /// ```ignore,no_run
4409 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4410 /// use google_cloud_baremetalsolution_v2::model::Network;
4411 /// let x = NetworkUsage::new().set_network(Network::default()/* use setters */);
4412 /// ```
4413 pub fn set_network<T>(mut self, v: T) -> Self
4414 where
4415 T: std::convert::Into<crate::model::Network>,
4416 {
4417 self.network = std::option::Option::Some(v.into());
4418 self
4419 }
4420
4421 /// Sets or clears the value of [network][crate::model::NetworkUsage::network].
4422 ///
4423 /// # Example
4424 /// ```ignore,no_run
4425 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4426 /// use google_cloud_baremetalsolution_v2::model::Network;
4427 /// let x = NetworkUsage::new().set_or_clear_network(Some(Network::default()/* use setters */));
4428 /// let x = NetworkUsage::new().set_or_clear_network(None::<Network>);
4429 /// ```
4430 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
4431 where
4432 T: std::convert::Into<crate::model::Network>,
4433 {
4434 self.network = v.map(|x| x.into());
4435 self
4436 }
4437
4438 /// Sets the value of [used_ips][crate::model::NetworkUsage::used_ips].
4439 ///
4440 /// # Example
4441 /// ```ignore,no_run
4442 /// # use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4443 /// let x = NetworkUsage::new().set_used_ips(["a", "b", "c"]);
4444 /// ```
4445 pub fn set_used_ips<T, V>(mut self, v: T) -> Self
4446 where
4447 T: std::iter::IntoIterator<Item = V>,
4448 V: std::convert::Into<std::string::String>,
4449 {
4450 use std::iter::Iterator;
4451 self.used_ips = v.into_iter().map(|i| i.into()).collect();
4452 self
4453 }
4454}
4455
4456impl wkt::message::Message for NetworkUsage {
4457 fn typename() -> &'static str {
4458 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkUsage"
4459 }
4460}
4461
4462/// Request to get networks with IPs.
4463#[derive(Clone, Default, PartialEq)]
4464#[non_exhaustive]
4465pub struct ListNetworkUsageRequest {
4466 /// Required. Parent value (project and location).
4467 pub location: std::string::String,
4468
4469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4470}
4471
4472impl ListNetworkUsageRequest {
4473 /// Creates a new default instance.
4474 pub fn new() -> Self {
4475 std::default::Default::default()
4476 }
4477
4478 /// Sets the value of [location][crate::model::ListNetworkUsageRequest::location].
4479 ///
4480 /// # Example
4481 /// ```ignore,no_run
4482 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageRequest;
4483 /// let x = ListNetworkUsageRequest::new().set_location("example");
4484 /// ```
4485 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4486 self.location = v.into();
4487 self
4488 }
4489}
4490
4491impl wkt::message::Message for ListNetworkUsageRequest {
4492 fn typename() -> &'static str {
4493 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageRequest"
4494 }
4495}
4496
4497/// Response with Networks with IPs
4498#[derive(Clone, Default, PartialEq)]
4499#[non_exhaustive]
4500pub struct ListNetworkUsageResponse {
4501 /// Networks with IPs.
4502 pub networks: std::vec::Vec<crate::model::NetworkUsage>,
4503
4504 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4505}
4506
4507impl ListNetworkUsageResponse {
4508 /// Creates a new default instance.
4509 pub fn new() -> Self {
4510 std::default::Default::default()
4511 }
4512
4513 /// Sets the value of [networks][crate::model::ListNetworkUsageResponse::networks].
4514 ///
4515 /// # Example
4516 /// ```ignore,no_run
4517 /// # use google_cloud_baremetalsolution_v2::model::ListNetworkUsageResponse;
4518 /// use google_cloud_baremetalsolution_v2::model::NetworkUsage;
4519 /// let x = ListNetworkUsageResponse::new()
4520 /// .set_networks([
4521 /// NetworkUsage::default()/* use setters */,
4522 /// NetworkUsage::default()/* use (different) setters */,
4523 /// ]);
4524 /// ```
4525 pub fn set_networks<T, V>(mut self, v: T) -> Self
4526 where
4527 T: std::iter::IntoIterator<Item = V>,
4528 V: std::convert::Into<crate::model::NetworkUsage>,
4529 {
4530 use std::iter::Iterator;
4531 self.networks = v.into_iter().map(|i| i.into()).collect();
4532 self
4533 }
4534}
4535
4536impl wkt::message::Message for ListNetworkUsageResponse {
4537 fn typename() -> &'static str {
4538 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNetworkUsageResponse"
4539 }
4540}
4541
4542/// Mount point for a network.
4543#[derive(Clone, Default, PartialEq)]
4544#[non_exhaustive]
4545pub struct NetworkMountPoint {
4546 /// Instance to attach network to.
4547 pub instance: std::string::String,
4548
4549 /// Logical interface to detach from.
4550 pub logical_interface: std::string::String,
4551
4552 /// Network should be a default gateway.
4553 pub default_gateway: bool,
4554
4555 /// Ip address of the server.
4556 pub ip_address: std::string::String,
4557
4558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4559}
4560
4561impl NetworkMountPoint {
4562 /// Creates a new default instance.
4563 pub fn new() -> Self {
4564 std::default::Default::default()
4565 }
4566
4567 /// Sets the value of [instance][crate::model::NetworkMountPoint::instance].
4568 ///
4569 /// # Example
4570 /// ```ignore,no_run
4571 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4572 /// # let project_id = "project_id";
4573 /// # let location_id = "location_id";
4574 /// # let instance_id = "instance_id";
4575 /// let x = NetworkMountPoint::new().set_instance(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
4576 /// ```
4577 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4578 self.instance = v.into();
4579 self
4580 }
4581
4582 /// Sets the value of [logical_interface][crate::model::NetworkMountPoint::logical_interface].
4583 ///
4584 /// # Example
4585 /// ```ignore,no_run
4586 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4587 /// let x = NetworkMountPoint::new().set_logical_interface("example");
4588 /// ```
4589 pub fn set_logical_interface<T: std::convert::Into<std::string::String>>(
4590 mut self,
4591 v: T,
4592 ) -> Self {
4593 self.logical_interface = v.into();
4594 self
4595 }
4596
4597 /// Sets the value of [default_gateway][crate::model::NetworkMountPoint::default_gateway].
4598 ///
4599 /// # Example
4600 /// ```ignore,no_run
4601 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4602 /// let x = NetworkMountPoint::new().set_default_gateway(true);
4603 /// ```
4604 pub fn set_default_gateway<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4605 self.default_gateway = v.into();
4606 self
4607 }
4608
4609 /// Sets the value of [ip_address][crate::model::NetworkMountPoint::ip_address].
4610 ///
4611 /// # Example
4612 /// ```ignore,no_run
4613 /// # use google_cloud_baremetalsolution_v2::model::NetworkMountPoint;
4614 /// let x = NetworkMountPoint::new().set_ip_address("example");
4615 /// ```
4616 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4617 self.ip_address = v.into();
4618 self
4619 }
4620}
4621
4622impl wkt::message::Message for NetworkMountPoint {
4623 fn typename() -> &'static str {
4624 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkMountPoint"
4625 }
4626}
4627
4628/// Message requesting rename of a server.
4629#[derive(Clone, Default, PartialEq)]
4630#[non_exhaustive]
4631pub struct RenameNetworkRequest {
4632 /// Required. The `name` field is used to identify the network.
4633 /// Format: projects/{project}/locations/{location}/networks/{network}
4634 pub name: std::string::String,
4635
4636 /// Required. The new `id` of the network.
4637 pub new_network_id: std::string::String,
4638
4639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4640}
4641
4642impl RenameNetworkRequest {
4643 /// Creates a new default instance.
4644 pub fn new() -> Self {
4645 std::default::Default::default()
4646 }
4647
4648 /// Sets the value of [name][crate::model::RenameNetworkRequest::name].
4649 ///
4650 /// # Example
4651 /// ```ignore,no_run
4652 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4653 /// # let project_id = "project_id";
4654 /// # let location_id = "location_id";
4655 /// # let network_id = "network_id";
4656 /// let x = RenameNetworkRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/networks/{network_id}"));
4657 /// ```
4658 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4659 self.name = v.into();
4660 self
4661 }
4662
4663 /// Sets the value of [new_network_id][crate::model::RenameNetworkRequest::new_network_id].
4664 ///
4665 /// # Example
4666 /// ```ignore,no_run
4667 /// # use google_cloud_baremetalsolution_v2::model::RenameNetworkRequest;
4668 /// let x = RenameNetworkRequest::new().set_new_network_id("example");
4669 /// ```
4670 pub fn set_new_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4671 self.new_network_id = v.into();
4672 self
4673 }
4674}
4675
4676impl wkt::message::Message for RenameNetworkRequest {
4677 fn typename() -> &'static str {
4678 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNetworkRequest"
4679 }
4680}
4681
4682/// An NFS share.
4683#[derive(Clone, Default, PartialEq)]
4684#[non_exhaustive]
4685pub struct NfsShare {
4686 /// Immutable. The name of the NFS share.
4687 pub name: std::string::String,
4688
4689 /// Output only. An identifier for the NFS share, generated by the backend.
4690 /// This field will be deprecated in the future, use `id` instead.
4691 pub nfs_share_id: std::string::String,
4692
4693 /// Output only. An identifier for the NFS share, generated by the backend.
4694 /// This is the same value as nfs_share_id and will replace it in the future.
4695 pub id: std::string::String,
4696
4697 /// Output only. The state of the NFS share.
4698 pub state: crate::model::nfs_share::State,
4699
4700 /// Output only. The underlying volume of the share. Created automatically
4701 /// during provisioning.
4702 pub volume: std::string::String,
4703
4704 /// List of allowed access points.
4705 pub allowed_clients: std::vec::Vec<crate::model::nfs_share::AllowedClient>,
4706
4707 /// Labels as key value pairs.
4708 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4709
4710 /// The requested size, in GiB.
4711 pub requested_size_gib: i64,
4712
4713 /// Immutable. The storage type of the underlying volume.
4714 pub storage_type: crate::model::nfs_share::StorageType,
4715
4716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4717}
4718
4719impl NfsShare {
4720 /// Creates a new default instance.
4721 pub fn new() -> Self {
4722 std::default::Default::default()
4723 }
4724
4725 /// Sets the value of [name][crate::model::NfsShare::name].
4726 ///
4727 /// # Example
4728 /// ```ignore,no_run
4729 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4730 /// # let project_id = "project_id";
4731 /// # let location_id = "location_id";
4732 /// # let nfs_share_id = "nfs_share_id";
4733 /// let x = NfsShare::new().set_name(format!("projects/{project_id}/locations/{location_id}/nfsShares/{nfs_share_id}"));
4734 /// ```
4735 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4736 self.name = v.into();
4737 self
4738 }
4739
4740 /// Sets the value of [nfs_share_id][crate::model::NfsShare::nfs_share_id].
4741 ///
4742 /// # Example
4743 /// ```ignore,no_run
4744 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4745 /// let x = NfsShare::new().set_nfs_share_id("example");
4746 /// ```
4747 pub fn set_nfs_share_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4748 self.nfs_share_id = v.into();
4749 self
4750 }
4751
4752 /// Sets the value of [id][crate::model::NfsShare::id].
4753 ///
4754 /// # Example
4755 /// ```ignore,no_run
4756 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4757 /// let x = NfsShare::new().set_id("example");
4758 /// ```
4759 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4760 self.id = v.into();
4761 self
4762 }
4763
4764 /// Sets the value of [state][crate::model::NfsShare::state].
4765 ///
4766 /// # Example
4767 /// ```ignore,no_run
4768 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4769 /// use google_cloud_baremetalsolution_v2::model::nfs_share::State;
4770 /// let x0 = NfsShare::new().set_state(State::Provisioned);
4771 /// let x1 = NfsShare::new().set_state(State::Creating);
4772 /// let x2 = NfsShare::new().set_state(State::Updating);
4773 /// ```
4774 pub fn set_state<T: std::convert::Into<crate::model::nfs_share::State>>(
4775 mut self,
4776 v: T,
4777 ) -> Self {
4778 self.state = v.into();
4779 self
4780 }
4781
4782 /// Sets the value of [volume][crate::model::NfsShare::volume].
4783 ///
4784 /// # Example
4785 /// ```ignore,no_run
4786 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4787 /// # let project_id = "project_id";
4788 /// # let location_id = "location_id";
4789 /// # let volume_id = "volume_id";
4790 /// let x = NfsShare::new().set_volume(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
4791 /// ```
4792 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4793 self.volume = v.into();
4794 self
4795 }
4796
4797 /// Sets the value of [allowed_clients][crate::model::NfsShare::allowed_clients].
4798 ///
4799 /// # Example
4800 /// ```ignore,no_run
4801 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4802 /// use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4803 /// let x = NfsShare::new()
4804 /// .set_allowed_clients([
4805 /// AllowedClient::default()/* use setters */,
4806 /// AllowedClient::default()/* use (different) setters */,
4807 /// ]);
4808 /// ```
4809 pub fn set_allowed_clients<T, V>(mut self, v: T) -> Self
4810 where
4811 T: std::iter::IntoIterator<Item = V>,
4812 V: std::convert::Into<crate::model::nfs_share::AllowedClient>,
4813 {
4814 use std::iter::Iterator;
4815 self.allowed_clients = v.into_iter().map(|i| i.into()).collect();
4816 self
4817 }
4818
4819 /// Sets the value of [labels][crate::model::NfsShare::labels].
4820 ///
4821 /// # Example
4822 /// ```ignore,no_run
4823 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4824 /// let x = NfsShare::new().set_labels([
4825 /// ("key0", "abc"),
4826 /// ("key1", "xyz"),
4827 /// ]);
4828 /// ```
4829 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4830 where
4831 T: std::iter::IntoIterator<Item = (K, V)>,
4832 K: std::convert::Into<std::string::String>,
4833 V: std::convert::Into<std::string::String>,
4834 {
4835 use std::iter::Iterator;
4836 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4837 self
4838 }
4839
4840 /// Sets the value of [requested_size_gib][crate::model::NfsShare::requested_size_gib].
4841 ///
4842 /// # Example
4843 /// ```ignore,no_run
4844 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4845 /// let x = NfsShare::new().set_requested_size_gib(42);
4846 /// ```
4847 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4848 self.requested_size_gib = v.into();
4849 self
4850 }
4851
4852 /// Sets the value of [storage_type][crate::model::NfsShare::storage_type].
4853 ///
4854 /// # Example
4855 /// ```ignore,no_run
4856 /// # use google_cloud_baremetalsolution_v2::model::NfsShare;
4857 /// use google_cloud_baremetalsolution_v2::model::nfs_share::StorageType;
4858 /// let x0 = NfsShare::new().set_storage_type(StorageType::Ssd);
4859 /// let x1 = NfsShare::new().set_storage_type(StorageType::Hdd);
4860 /// ```
4861 pub fn set_storage_type<T: std::convert::Into<crate::model::nfs_share::StorageType>>(
4862 mut self,
4863 v: T,
4864 ) -> Self {
4865 self.storage_type = v.into();
4866 self
4867 }
4868}
4869
4870impl wkt::message::Message for NfsShare {
4871 fn typename() -> &'static str {
4872 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare"
4873 }
4874}
4875
4876/// Defines additional types related to [NfsShare].
4877pub mod nfs_share {
4878 #[allow(unused_imports)]
4879 use super::*;
4880
4881 /// Represents an 'access point' for the share.
4882 #[derive(Clone, Default, PartialEq)]
4883 #[non_exhaustive]
4884 pub struct AllowedClient {
4885 /// The network the access point sits on.
4886 pub network: std::string::String,
4887
4888 /// Output only. The IP address of the share on this network. Assigned
4889 /// automatically during provisioning based on the network's services_cidr.
4890 pub share_ip: std::string::String,
4891
4892 /// The subnet of IP addresses permitted to access the share.
4893 pub allowed_clients_cidr: std::string::String,
4894
4895 /// Mount permissions.
4896 pub mount_permissions: crate::model::nfs_share::MountPermissions,
4897
4898 /// Allow dev flag. Which controls whether to allow creation of devices.
4899 pub allow_dev: bool,
4900
4901 /// Allow the setuid flag.
4902 pub allow_suid: bool,
4903
4904 /// Disable root squashing, which is a feature of NFS.
4905 /// Root squash is a special mapping of the remote superuser (root) identity
4906 /// when using identity authentication.
4907 pub no_root_squash: bool,
4908
4909 /// Output only. The path to access NFS, in format shareIP:/InstanceID
4910 /// InstanceID is the generated ID instead of customer provided name.
4911 /// example like "10.0.0.0:/g123456789-nfs001"
4912 pub nfs_path: std::string::String,
4913
4914 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4915 }
4916
4917 impl AllowedClient {
4918 /// Creates a new default instance.
4919 pub fn new() -> Self {
4920 std::default::Default::default()
4921 }
4922
4923 /// Sets the value of [network][crate::model::nfs_share::AllowedClient::network].
4924 ///
4925 /// # Example
4926 /// ```ignore,no_run
4927 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4928 /// # let project_id = "project_id";
4929 /// # let location_id = "location_id";
4930 /// # let network_id = "network_id";
4931 /// let x = AllowedClient::new().set_network(format!("projects/{project_id}/locations/{location_id}/networks/{network_id}"));
4932 /// ```
4933 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4934 self.network = v.into();
4935 self
4936 }
4937
4938 /// Sets the value of [share_ip][crate::model::nfs_share::AllowedClient::share_ip].
4939 ///
4940 /// # Example
4941 /// ```ignore,no_run
4942 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4943 /// let x = AllowedClient::new().set_share_ip("example");
4944 /// ```
4945 pub fn set_share_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4946 self.share_ip = v.into();
4947 self
4948 }
4949
4950 /// Sets the value of [allowed_clients_cidr][crate::model::nfs_share::AllowedClient::allowed_clients_cidr].
4951 ///
4952 /// # Example
4953 /// ```ignore,no_run
4954 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4955 /// let x = AllowedClient::new().set_allowed_clients_cidr("example");
4956 /// ```
4957 pub fn set_allowed_clients_cidr<T: std::convert::Into<std::string::String>>(
4958 mut self,
4959 v: T,
4960 ) -> Self {
4961 self.allowed_clients_cidr = v.into();
4962 self
4963 }
4964
4965 /// Sets the value of [mount_permissions][crate::model::nfs_share::AllowedClient::mount_permissions].
4966 ///
4967 /// # Example
4968 /// ```ignore,no_run
4969 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4970 /// use google_cloud_baremetalsolution_v2::model::nfs_share::MountPermissions;
4971 /// let x0 = AllowedClient::new().set_mount_permissions(MountPermissions::Read);
4972 /// let x1 = AllowedClient::new().set_mount_permissions(MountPermissions::ReadWrite);
4973 /// ```
4974 pub fn set_mount_permissions<
4975 T: std::convert::Into<crate::model::nfs_share::MountPermissions>,
4976 >(
4977 mut self,
4978 v: T,
4979 ) -> Self {
4980 self.mount_permissions = v.into();
4981 self
4982 }
4983
4984 /// Sets the value of [allow_dev][crate::model::nfs_share::AllowedClient::allow_dev].
4985 ///
4986 /// # Example
4987 /// ```ignore,no_run
4988 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
4989 /// let x = AllowedClient::new().set_allow_dev(true);
4990 /// ```
4991 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4992 self.allow_dev = v.into();
4993 self
4994 }
4995
4996 /// Sets the value of [allow_suid][crate::model::nfs_share::AllowedClient::allow_suid].
4997 ///
4998 /// # Example
4999 /// ```ignore,no_run
5000 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
5001 /// let x = AllowedClient::new().set_allow_suid(true);
5002 /// ```
5003 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5004 self.allow_suid = v.into();
5005 self
5006 }
5007
5008 /// Sets the value of [no_root_squash][crate::model::nfs_share::AllowedClient::no_root_squash].
5009 ///
5010 /// # Example
5011 /// ```ignore,no_run
5012 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
5013 /// let x = AllowedClient::new().set_no_root_squash(true);
5014 /// ```
5015 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5016 self.no_root_squash = v.into();
5017 self
5018 }
5019
5020 /// Sets the value of [nfs_path][crate::model::nfs_share::AllowedClient::nfs_path].
5021 ///
5022 /// # Example
5023 /// ```ignore,no_run
5024 /// # use google_cloud_baremetalsolution_v2::model::nfs_share::AllowedClient;
5025 /// let x = AllowedClient::new().set_nfs_path("example");
5026 /// ```
5027 pub fn set_nfs_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5028 self.nfs_path = v.into();
5029 self
5030 }
5031 }
5032
5033 impl wkt::message::Message for AllowedClient {
5034 fn typename() -> &'static str {
5035 "type.googleapis.com/google.cloud.baremetalsolution.v2.NfsShare.AllowedClient"
5036 }
5037 }
5038
5039 /// The possible states for this NFS share.
5040 ///
5041 /// # Working with unknown values
5042 ///
5043 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5044 /// additional enum variants at any time. Adding new variants is not considered
5045 /// a breaking change. Applications should write their code in anticipation of:
5046 ///
5047 /// - New values appearing in future releases of the client library, **and**
5048 /// - New values received dynamically, without application changes.
5049 ///
5050 /// Please consult the [Working with enums] section in the user guide for some
5051 /// guidelines.
5052 ///
5053 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5054 #[derive(Clone, Debug, PartialEq)]
5055 #[non_exhaustive]
5056 pub enum State {
5057 /// The share is in an unknown state.
5058 Unspecified,
5059 /// The share has been provisioned.
5060 Provisioned,
5061 /// The NFS Share is being created.
5062 Creating,
5063 /// The NFS Share is being updated.
5064 Updating,
5065 /// The NFS Share has been requested to be deleted.
5066 Deleting,
5067 /// If set, the enum was initialized with an unknown value.
5068 ///
5069 /// Applications can examine the value using [State::value] or
5070 /// [State::name].
5071 UnknownValue(state::UnknownValue),
5072 }
5073
5074 #[doc(hidden)]
5075 pub mod state {
5076 #[allow(unused_imports)]
5077 use super::*;
5078 #[derive(Clone, Debug, PartialEq)]
5079 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5080 }
5081
5082 impl State {
5083 /// Gets the enum value.
5084 ///
5085 /// Returns `None` if the enum contains an unknown value deserialized from
5086 /// the string representation of enums.
5087 pub fn value(&self) -> std::option::Option<i32> {
5088 match self {
5089 Self::Unspecified => std::option::Option::Some(0),
5090 Self::Provisioned => std::option::Option::Some(1),
5091 Self::Creating => std::option::Option::Some(2),
5092 Self::Updating => std::option::Option::Some(3),
5093 Self::Deleting => std::option::Option::Some(4),
5094 Self::UnknownValue(u) => u.0.value(),
5095 }
5096 }
5097
5098 /// Gets the enum value as a string.
5099 ///
5100 /// Returns `None` if the enum contains an unknown value deserialized from
5101 /// the integer representation of enums.
5102 pub fn name(&self) -> std::option::Option<&str> {
5103 match self {
5104 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5105 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
5106 Self::Creating => std::option::Option::Some("CREATING"),
5107 Self::Updating => std::option::Option::Some("UPDATING"),
5108 Self::Deleting => std::option::Option::Some("DELETING"),
5109 Self::UnknownValue(u) => u.0.name(),
5110 }
5111 }
5112 }
5113
5114 impl std::default::Default for State {
5115 fn default() -> Self {
5116 use std::convert::From;
5117 Self::from(0)
5118 }
5119 }
5120
5121 impl std::fmt::Display for State {
5122 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5123 wkt::internal::display_enum(f, self.name(), self.value())
5124 }
5125 }
5126
5127 impl std::convert::From<i32> for State {
5128 fn from(value: i32) -> Self {
5129 match value {
5130 0 => Self::Unspecified,
5131 1 => Self::Provisioned,
5132 2 => Self::Creating,
5133 3 => Self::Updating,
5134 4 => Self::Deleting,
5135 _ => Self::UnknownValue(state::UnknownValue(
5136 wkt::internal::UnknownEnumValue::Integer(value),
5137 )),
5138 }
5139 }
5140 }
5141
5142 impl std::convert::From<&str> for State {
5143 fn from(value: &str) -> Self {
5144 use std::string::ToString;
5145 match value {
5146 "STATE_UNSPECIFIED" => Self::Unspecified,
5147 "PROVISIONED" => Self::Provisioned,
5148 "CREATING" => Self::Creating,
5149 "UPDATING" => Self::Updating,
5150 "DELETING" => Self::Deleting,
5151 _ => Self::UnknownValue(state::UnknownValue(
5152 wkt::internal::UnknownEnumValue::String(value.to_string()),
5153 )),
5154 }
5155 }
5156 }
5157
5158 impl serde::ser::Serialize for State {
5159 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5160 where
5161 S: serde::Serializer,
5162 {
5163 match self {
5164 Self::Unspecified => serializer.serialize_i32(0),
5165 Self::Provisioned => serializer.serialize_i32(1),
5166 Self::Creating => serializer.serialize_i32(2),
5167 Self::Updating => serializer.serialize_i32(3),
5168 Self::Deleting => serializer.serialize_i32(4),
5169 Self::UnknownValue(u) => u.0.serialize(serializer),
5170 }
5171 }
5172 }
5173
5174 impl<'de> serde::de::Deserialize<'de> for State {
5175 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5176 where
5177 D: serde::Deserializer<'de>,
5178 {
5179 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5180 ".google.cloud.baremetalsolution.v2.NfsShare.State",
5181 ))
5182 }
5183 }
5184
5185 /// The possible mount permissions.
5186 ///
5187 /// # Working with unknown values
5188 ///
5189 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5190 /// additional enum variants at any time. Adding new variants is not considered
5191 /// a breaking change. Applications should write their code in anticipation of:
5192 ///
5193 /// - New values appearing in future releases of the client library, **and**
5194 /// - New values received dynamically, without application changes.
5195 ///
5196 /// Please consult the [Working with enums] section in the user guide for some
5197 /// guidelines.
5198 ///
5199 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5200 #[derive(Clone, Debug, PartialEq)]
5201 #[non_exhaustive]
5202 pub enum MountPermissions {
5203 /// Permissions were not specified.
5204 Unspecified,
5205 /// NFS share can be mount with read-only permissions.
5206 Read,
5207 /// NFS share can be mount with read-write permissions.
5208 ReadWrite,
5209 /// If set, the enum was initialized with an unknown value.
5210 ///
5211 /// Applications can examine the value using [MountPermissions::value] or
5212 /// [MountPermissions::name].
5213 UnknownValue(mount_permissions::UnknownValue),
5214 }
5215
5216 #[doc(hidden)]
5217 pub mod mount_permissions {
5218 #[allow(unused_imports)]
5219 use super::*;
5220 #[derive(Clone, Debug, PartialEq)]
5221 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5222 }
5223
5224 impl MountPermissions {
5225 /// Gets the enum value.
5226 ///
5227 /// Returns `None` if the enum contains an unknown value deserialized from
5228 /// the string representation of enums.
5229 pub fn value(&self) -> std::option::Option<i32> {
5230 match self {
5231 Self::Unspecified => std::option::Option::Some(0),
5232 Self::Read => std::option::Option::Some(1),
5233 Self::ReadWrite => std::option::Option::Some(2),
5234 Self::UnknownValue(u) => u.0.value(),
5235 }
5236 }
5237
5238 /// Gets the enum value as a string.
5239 ///
5240 /// Returns `None` if the enum contains an unknown value deserialized from
5241 /// the integer representation of enums.
5242 pub fn name(&self) -> std::option::Option<&str> {
5243 match self {
5244 Self::Unspecified => std::option::Option::Some("MOUNT_PERMISSIONS_UNSPECIFIED"),
5245 Self::Read => std::option::Option::Some("READ"),
5246 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
5247 Self::UnknownValue(u) => u.0.name(),
5248 }
5249 }
5250 }
5251
5252 impl std::default::Default for MountPermissions {
5253 fn default() -> Self {
5254 use std::convert::From;
5255 Self::from(0)
5256 }
5257 }
5258
5259 impl std::fmt::Display for MountPermissions {
5260 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5261 wkt::internal::display_enum(f, self.name(), self.value())
5262 }
5263 }
5264
5265 impl std::convert::From<i32> for MountPermissions {
5266 fn from(value: i32) -> Self {
5267 match value {
5268 0 => Self::Unspecified,
5269 1 => Self::Read,
5270 2 => Self::ReadWrite,
5271 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5272 wkt::internal::UnknownEnumValue::Integer(value),
5273 )),
5274 }
5275 }
5276 }
5277
5278 impl std::convert::From<&str> for MountPermissions {
5279 fn from(value: &str) -> Self {
5280 use std::string::ToString;
5281 match value {
5282 "MOUNT_PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
5283 "READ" => Self::Read,
5284 "READ_WRITE" => Self::ReadWrite,
5285 _ => Self::UnknownValue(mount_permissions::UnknownValue(
5286 wkt::internal::UnknownEnumValue::String(value.to_string()),
5287 )),
5288 }
5289 }
5290 }
5291
5292 impl serde::ser::Serialize for MountPermissions {
5293 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5294 where
5295 S: serde::Serializer,
5296 {
5297 match self {
5298 Self::Unspecified => serializer.serialize_i32(0),
5299 Self::Read => serializer.serialize_i32(1),
5300 Self::ReadWrite => serializer.serialize_i32(2),
5301 Self::UnknownValue(u) => u.0.serialize(serializer),
5302 }
5303 }
5304 }
5305
5306 impl<'de> serde::de::Deserialize<'de> for MountPermissions {
5307 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5308 where
5309 D: serde::Deserializer<'de>,
5310 {
5311 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MountPermissions>::new(
5312 ".google.cloud.baremetalsolution.v2.NfsShare.MountPermissions",
5313 ))
5314 }
5315 }
5316
5317 /// The storage type for a volume.
5318 ///
5319 /// # Working with unknown values
5320 ///
5321 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5322 /// additional enum variants at any time. Adding new variants is not considered
5323 /// a breaking change. Applications should write their code in anticipation of:
5324 ///
5325 /// - New values appearing in future releases of the client library, **and**
5326 /// - New values received dynamically, without application changes.
5327 ///
5328 /// Please consult the [Working with enums] section in the user guide for some
5329 /// guidelines.
5330 ///
5331 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5332 #[derive(Clone, Debug, PartialEq)]
5333 #[non_exhaustive]
5334 pub enum StorageType {
5335 /// The storage type for this volume is unknown.
5336 Unspecified,
5337 /// The storage type for this volume is SSD.
5338 Ssd,
5339 /// This storage type for this volume is HDD.
5340 Hdd,
5341 /// If set, the enum was initialized with an unknown value.
5342 ///
5343 /// Applications can examine the value using [StorageType::value] or
5344 /// [StorageType::name].
5345 UnknownValue(storage_type::UnknownValue),
5346 }
5347
5348 #[doc(hidden)]
5349 pub mod storage_type {
5350 #[allow(unused_imports)]
5351 use super::*;
5352 #[derive(Clone, Debug, PartialEq)]
5353 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5354 }
5355
5356 impl StorageType {
5357 /// Gets the enum value.
5358 ///
5359 /// Returns `None` if the enum contains an unknown value deserialized from
5360 /// the string representation of enums.
5361 pub fn value(&self) -> std::option::Option<i32> {
5362 match self {
5363 Self::Unspecified => std::option::Option::Some(0),
5364 Self::Ssd => std::option::Option::Some(1),
5365 Self::Hdd => std::option::Option::Some(2),
5366 Self::UnknownValue(u) => u.0.value(),
5367 }
5368 }
5369
5370 /// Gets the enum value as a string.
5371 ///
5372 /// Returns `None` if the enum contains an unknown value deserialized from
5373 /// the integer representation of enums.
5374 pub fn name(&self) -> std::option::Option<&str> {
5375 match self {
5376 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
5377 Self::Ssd => std::option::Option::Some("SSD"),
5378 Self::Hdd => std::option::Option::Some("HDD"),
5379 Self::UnknownValue(u) => u.0.name(),
5380 }
5381 }
5382 }
5383
5384 impl std::default::Default for StorageType {
5385 fn default() -> Self {
5386 use std::convert::From;
5387 Self::from(0)
5388 }
5389 }
5390
5391 impl std::fmt::Display for StorageType {
5392 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5393 wkt::internal::display_enum(f, self.name(), self.value())
5394 }
5395 }
5396
5397 impl std::convert::From<i32> for StorageType {
5398 fn from(value: i32) -> Self {
5399 match value {
5400 0 => Self::Unspecified,
5401 1 => Self::Ssd,
5402 2 => Self::Hdd,
5403 _ => Self::UnknownValue(storage_type::UnknownValue(
5404 wkt::internal::UnknownEnumValue::Integer(value),
5405 )),
5406 }
5407 }
5408 }
5409
5410 impl std::convert::From<&str> for StorageType {
5411 fn from(value: &str) -> Self {
5412 use std::string::ToString;
5413 match value {
5414 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
5415 "SSD" => Self::Ssd,
5416 "HDD" => Self::Hdd,
5417 _ => Self::UnknownValue(storage_type::UnknownValue(
5418 wkt::internal::UnknownEnumValue::String(value.to_string()),
5419 )),
5420 }
5421 }
5422 }
5423
5424 impl serde::ser::Serialize for StorageType {
5425 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5426 where
5427 S: serde::Serializer,
5428 {
5429 match self {
5430 Self::Unspecified => serializer.serialize_i32(0),
5431 Self::Ssd => serializer.serialize_i32(1),
5432 Self::Hdd => serializer.serialize_i32(2),
5433 Self::UnknownValue(u) => u.0.serialize(serializer),
5434 }
5435 }
5436 }
5437
5438 impl<'de> serde::de::Deserialize<'de> for StorageType {
5439 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5440 where
5441 D: serde::Deserializer<'de>,
5442 {
5443 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
5444 ".google.cloud.baremetalsolution.v2.NfsShare.StorageType",
5445 ))
5446 }
5447 }
5448}
5449
5450/// Message for requesting NFS share information.
5451#[derive(Clone, Default, PartialEq)]
5452#[non_exhaustive]
5453pub struct GetNfsShareRequest {
5454 /// Required. Name of the resource.
5455 pub name: std::string::String,
5456
5457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5458}
5459
5460impl GetNfsShareRequest {
5461 /// Creates a new default instance.
5462 pub fn new() -> Self {
5463 std::default::Default::default()
5464 }
5465
5466 /// Sets the value of [name][crate::model::GetNfsShareRequest::name].
5467 ///
5468 /// # Example
5469 /// ```ignore,no_run
5470 /// # use google_cloud_baremetalsolution_v2::model::GetNfsShareRequest;
5471 /// # let project_id = "project_id";
5472 /// # let location_id = "location_id";
5473 /// # let nfs_share_id = "nfs_share_id";
5474 /// let x = GetNfsShareRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/nfsShares/{nfs_share_id}"));
5475 /// ```
5476 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5477 self.name = v.into();
5478 self
5479 }
5480}
5481
5482impl wkt::message::Message for GetNfsShareRequest {
5483 fn typename() -> &'static str {
5484 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetNfsShareRequest"
5485 }
5486}
5487
5488/// Message for requesting a list of NFS shares.
5489#[derive(Clone, Default, PartialEq)]
5490#[non_exhaustive]
5491pub struct ListNfsSharesRequest {
5492 /// Required. Parent value for ListNfsSharesRequest.
5493 pub parent: std::string::String,
5494
5495 /// Requested page size. The server might return fewer items than requested.
5496 /// If unspecified, server will pick an appropriate default.
5497 pub page_size: i32,
5498
5499 /// A token identifying a page of results from the server.
5500 pub page_token: std::string::String,
5501
5502 /// List filter.
5503 pub filter: std::string::String,
5504
5505 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5506}
5507
5508impl ListNfsSharesRequest {
5509 /// Creates a new default instance.
5510 pub fn new() -> Self {
5511 std::default::Default::default()
5512 }
5513
5514 /// Sets the value of [parent][crate::model::ListNfsSharesRequest::parent].
5515 ///
5516 /// # Example
5517 /// ```ignore,no_run
5518 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5519 /// let x = ListNfsSharesRequest::new().set_parent("example");
5520 /// ```
5521 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5522 self.parent = v.into();
5523 self
5524 }
5525
5526 /// Sets the value of [page_size][crate::model::ListNfsSharesRequest::page_size].
5527 ///
5528 /// # Example
5529 /// ```ignore,no_run
5530 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5531 /// let x = ListNfsSharesRequest::new().set_page_size(42);
5532 /// ```
5533 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5534 self.page_size = v.into();
5535 self
5536 }
5537
5538 /// Sets the value of [page_token][crate::model::ListNfsSharesRequest::page_token].
5539 ///
5540 /// # Example
5541 /// ```ignore,no_run
5542 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5543 /// let x = ListNfsSharesRequest::new().set_page_token("example");
5544 /// ```
5545 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5546 self.page_token = v.into();
5547 self
5548 }
5549
5550 /// Sets the value of [filter][crate::model::ListNfsSharesRequest::filter].
5551 ///
5552 /// # Example
5553 /// ```ignore,no_run
5554 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesRequest;
5555 /// let x = ListNfsSharesRequest::new().set_filter("example");
5556 /// ```
5557 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5558 self.filter = v.into();
5559 self
5560 }
5561}
5562
5563impl wkt::message::Message for ListNfsSharesRequest {
5564 fn typename() -> &'static str {
5565 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesRequest"
5566 }
5567}
5568
5569/// Response message containing the list of NFS shares.
5570#[derive(Clone, Default, PartialEq)]
5571#[non_exhaustive]
5572pub struct ListNfsSharesResponse {
5573 /// The list of NFS shares.
5574 pub nfs_shares: std::vec::Vec<crate::model::NfsShare>,
5575
5576 /// A token identifying a page of results from the server.
5577 pub next_page_token: std::string::String,
5578
5579 /// Locations that could not be reached.
5580 pub unreachable: std::vec::Vec<std::string::String>,
5581
5582 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5583}
5584
5585impl ListNfsSharesResponse {
5586 /// Creates a new default instance.
5587 pub fn new() -> Self {
5588 std::default::Default::default()
5589 }
5590
5591 /// Sets the value of [nfs_shares][crate::model::ListNfsSharesResponse::nfs_shares].
5592 ///
5593 /// # Example
5594 /// ```ignore,no_run
5595 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5596 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5597 /// let x = ListNfsSharesResponse::new()
5598 /// .set_nfs_shares([
5599 /// NfsShare::default()/* use setters */,
5600 /// NfsShare::default()/* use (different) setters */,
5601 /// ]);
5602 /// ```
5603 pub fn set_nfs_shares<T, V>(mut self, v: T) -> Self
5604 where
5605 T: std::iter::IntoIterator<Item = V>,
5606 V: std::convert::Into<crate::model::NfsShare>,
5607 {
5608 use std::iter::Iterator;
5609 self.nfs_shares = v.into_iter().map(|i| i.into()).collect();
5610 self
5611 }
5612
5613 /// Sets the value of [next_page_token][crate::model::ListNfsSharesResponse::next_page_token].
5614 ///
5615 /// # Example
5616 /// ```ignore,no_run
5617 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5618 /// let x = ListNfsSharesResponse::new().set_next_page_token("example");
5619 /// ```
5620 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5621 self.next_page_token = v.into();
5622 self
5623 }
5624
5625 /// Sets the value of [unreachable][crate::model::ListNfsSharesResponse::unreachable].
5626 ///
5627 /// # Example
5628 /// ```ignore,no_run
5629 /// # use google_cloud_baremetalsolution_v2::model::ListNfsSharesResponse;
5630 /// let x = ListNfsSharesResponse::new().set_unreachable(["a", "b", "c"]);
5631 /// ```
5632 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5633 where
5634 T: std::iter::IntoIterator<Item = V>,
5635 V: std::convert::Into<std::string::String>,
5636 {
5637 use std::iter::Iterator;
5638 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5639 self
5640 }
5641}
5642
5643impl wkt::message::Message for ListNfsSharesResponse {
5644 fn typename() -> &'static str {
5645 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListNfsSharesResponse"
5646 }
5647}
5648
5649#[doc(hidden)]
5650impl google_cloud_gax::paginator::internal::PageableResponse for ListNfsSharesResponse {
5651 type PageItem = crate::model::NfsShare;
5652
5653 fn items(self) -> std::vec::Vec<Self::PageItem> {
5654 self.nfs_shares
5655 }
5656
5657 fn next_page_token(&self) -> std::string::String {
5658 use std::clone::Clone;
5659 self.next_page_token.clone()
5660 }
5661}
5662
5663/// Message requesting to updating an NFS share.
5664#[derive(Clone, Default, PartialEq)]
5665#[non_exhaustive]
5666pub struct UpdateNfsShareRequest {
5667 /// Required. The NFS share to update.
5668 ///
5669 /// The `name` field is used to identify the NFS share to update.
5670 /// Format: projects/{project}/locations/{location}/nfsShares/{nfs_share}
5671 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5672
5673 /// The list of fields to update.
5674 /// The only currently supported fields are:
5675 /// `labels`
5676 /// `allowed_clients`
5677 pub update_mask: std::option::Option<wkt::FieldMask>,
5678
5679 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5680}
5681
5682impl UpdateNfsShareRequest {
5683 /// Creates a new default instance.
5684 pub fn new() -> Self {
5685 std::default::Default::default()
5686 }
5687
5688 /// Sets the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5689 ///
5690 /// # Example
5691 /// ```ignore,no_run
5692 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5693 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5694 /// let x = UpdateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5695 /// ```
5696 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5697 where
5698 T: std::convert::Into<crate::model::NfsShare>,
5699 {
5700 self.nfs_share = std::option::Option::Some(v.into());
5701 self
5702 }
5703
5704 /// Sets or clears the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
5705 ///
5706 /// # Example
5707 /// ```ignore,no_run
5708 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5709 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5710 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5711 /// let x = UpdateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5712 /// ```
5713 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5714 where
5715 T: std::convert::Into<crate::model::NfsShare>,
5716 {
5717 self.nfs_share = v.map(|x| x.into());
5718 self
5719 }
5720
5721 /// Sets the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5722 ///
5723 /// # Example
5724 /// ```ignore,no_run
5725 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5726 /// use wkt::FieldMask;
5727 /// let x = UpdateNfsShareRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5728 /// ```
5729 pub fn set_update_mask<T>(mut self, v: T) -> Self
5730 where
5731 T: std::convert::Into<wkt::FieldMask>,
5732 {
5733 self.update_mask = std::option::Option::Some(v.into());
5734 self
5735 }
5736
5737 /// Sets or clears the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
5738 ///
5739 /// # Example
5740 /// ```ignore,no_run
5741 /// # use google_cloud_baremetalsolution_v2::model::UpdateNfsShareRequest;
5742 /// use wkt::FieldMask;
5743 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5744 /// let x = UpdateNfsShareRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5745 /// ```
5746 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5747 where
5748 T: std::convert::Into<wkt::FieldMask>,
5749 {
5750 self.update_mask = v.map(|x| x.into());
5751 self
5752 }
5753}
5754
5755impl wkt::message::Message for UpdateNfsShareRequest {
5756 fn typename() -> &'static str {
5757 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateNfsShareRequest"
5758 }
5759}
5760
5761/// Message requesting rename of a server.
5762#[derive(Clone, Default, PartialEq)]
5763#[non_exhaustive]
5764pub struct RenameNfsShareRequest {
5765 /// Required. The `name` field is used to identify the nfsshare.
5766 /// Format: projects/{project}/locations/{location}/nfsshares/{nfsshare}
5767 pub name: std::string::String,
5768
5769 /// Required. The new `id` of the nfsshare.
5770 pub new_nfsshare_id: std::string::String,
5771
5772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5773}
5774
5775impl RenameNfsShareRequest {
5776 /// Creates a new default instance.
5777 pub fn new() -> Self {
5778 std::default::Default::default()
5779 }
5780
5781 /// Sets the value of [name][crate::model::RenameNfsShareRequest::name].
5782 ///
5783 /// # Example
5784 /// ```ignore,no_run
5785 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5786 /// # let project_id = "project_id";
5787 /// # let location_id = "location_id";
5788 /// # let nfs_share_id = "nfs_share_id";
5789 /// let x = RenameNfsShareRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/nfsShares/{nfs_share_id}"));
5790 /// ```
5791 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5792 self.name = v.into();
5793 self
5794 }
5795
5796 /// Sets the value of [new_nfsshare_id][crate::model::RenameNfsShareRequest::new_nfsshare_id].
5797 ///
5798 /// # Example
5799 /// ```ignore,no_run
5800 /// # use google_cloud_baremetalsolution_v2::model::RenameNfsShareRequest;
5801 /// let x = RenameNfsShareRequest::new().set_new_nfsshare_id("example");
5802 /// ```
5803 pub fn set_new_nfsshare_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5804 self.new_nfsshare_id = v.into();
5805 self
5806 }
5807}
5808
5809impl wkt::message::Message for RenameNfsShareRequest {
5810 fn typename() -> &'static str {
5811 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameNfsShareRequest"
5812 }
5813}
5814
5815/// Message for creating an NFS share.
5816#[derive(Clone, Default, PartialEq)]
5817#[non_exhaustive]
5818pub struct CreateNfsShareRequest {
5819 /// Required. The parent project and location.
5820 pub parent: std::string::String,
5821
5822 /// Required. The NfsShare to create.
5823 pub nfs_share: std::option::Option<crate::model::NfsShare>,
5824
5825 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5826}
5827
5828impl CreateNfsShareRequest {
5829 /// Creates a new default instance.
5830 pub fn new() -> Self {
5831 std::default::Default::default()
5832 }
5833
5834 /// Sets the value of [parent][crate::model::CreateNfsShareRequest::parent].
5835 ///
5836 /// # Example
5837 /// ```ignore,no_run
5838 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5839 /// let x = CreateNfsShareRequest::new().set_parent("example");
5840 /// ```
5841 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5842 self.parent = v.into();
5843 self
5844 }
5845
5846 /// Sets the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5847 ///
5848 /// # Example
5849 /// ```ignore,no_run
5850 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5851 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5852 /// let x = CreateNfsShareRequest::new().set_nfs_share(NfsShare::default()/* use setters */);
5853 /// ```
5854 pub fn set_nfs_share<T>(mut self, v: T) -> Self
5855 where
5856 T: std::convert::Into<crate::model::NfsShare>,
5857 {
5858 self.nfs_share = std::option::Option::Some(v.into());
5859 self
5860 }
5861
5862 /// Sets or clears the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
5863 ///
5864 /// # Example
5865 /// ```ignore,no_run
5866 /// # use google_cloud_baremetalsolution_v2::model::CreateNfsShareRequest;
5867 /// use google_cloud_baremetalsolution_v2::model::NfsShare;
5868 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(Some(NfsShare::default()/* use setters */));
5869 /// let x = CreateNfsShareRequest::new().set_or_clear_nfs_share(None::<NfsShare>);
5870 /// ```
5871 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
5872 where
5873 T: std::convert::Into<crate::model::NfsShare>,
5874 {
5875 self.nfs_share = v.map(|x| x.into());
5876 self
5877 }
5878}
5879
5880impl wkt::message::Message for CreateNfsShareRequest {
5881 fn typename() -> &'static str {
5882 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateNfsShareRequest"
5883 }
5884}
5885
5886/// Message for deleting an NFS share.
5887#[derive(Clone, Default, PartialEq)]
5888#[non_exhaustive]
5889pub struct DeleteNfsShareRequest {
5890 /// Required. The name of the NFS share to delete.
5891 pub name: std::string::String,
5892
5893 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5894}
5895
5896impl DeleteNfsShareRequest {
5897 /// Creates a new default instance.
5898 pub fn new() -> Self {
5899 std::default::Default::default()
5900 }
5901
5902 /// Sets the value of [name][crate::model::DeleteNfsShareRequest::name].
5903 ///
5904 /// # Example
5905 /// ```ignore,no_run
5906 /// # use google_cloud_baremetalsolution_v2::model::DeleteNfsShareRequest;
5907 /// # let project_id = "project_id";
5908 /// # let location_id = "location_id";
5909 /// # let nfs_share_id = "nfs_share_id";
5910 /// let x = DeleteNfsShareRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/nfsShares/{nfs_share_id}"));
5911 /// ```
5912 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5913 self.name = v.into();
5914 self
5915 }
5916}
5917
5918impl wkt::message::Message for DeleteNfsShareRequest {
5919 fn typename() -> &'static str {
5920 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteNfsShareRequest"
5921 }
5922}
5923
5924/// Operation System image.
5925#[derive(Clone, Default, PartialEq)]
5926#[non_exhaustive]
5927pub struct OSImage {
5928 /// Output only. OS Image's unique name.
5929 pub name: std::string::String,
5930
5931 /// OS Image code.
5932 pub code: std::string::String,
5933
5934 /// OS Image description.
5935 pub description: std::string::String,
5936
5937 /// Instance types this image is applicable to.
5938 /// [Available
5939 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
5940 pub applicable_instance_types: std::vec::Vec<std::string::String>,
5941
5942 /// Network templates that can be used with this OS Image.
5943 pub supported_network_templates: std::vec::Vec<std::string::String>,
5944
5945 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5946}
5947
5948impl OSImage {
5949 /// Creates a new default instance.
5950 pub fn new() -> Self {
5951 std::default::Default::default()
5952 }
5953
5954 /// Sets the value of [name][crate::model::OSImage::name].
5955 ///
5956 /// # Example
5957 /// ```ignore,no_run
5958 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5959 /// # let project_id = "project_id";
5960 /// # let location_id = "location_id";
5961 /// # let os_image_id = "os_image_id";
5962 /// let x = OSImage::new().set_name(format!("projects/{project_id}/locations/{location_id}/osImages/{os_image_id}"));
5963 /// ```
5964 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5965 self.name = v.into();
5966 self
5967 }
5968
5969 /// Sets the value of [code][crate::model::OSImage::code].
5970 ///
5971 /// # Example
5972 /// ```ignore,no_run
5973 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5974 /// let x = OSImage::new().set_code("example");
5975 /// ```
5976 pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5977 self.code = v.into();
5978 self
5979 }
5980
5981 /// Sets the value of [description][crate::model::OSImage::description].
5982 ///
5983 /// # Example
5984 /// ```ignore,no_run
5985 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5986 /// let x = OSImage::new().set_description("example");
5987 /// ```
5988 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5989 self.description = v.into();
5990 self
5991 }
5992
5993 /// Sets the value of [applicable_instance_types][crate::model::OSImage::applicable_instance_types].
5994 ///
5995 /// # Example
5996 /// ```ignore,no_run
5997 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
5998 /// let x = OSImage::new().set_applicable_instance_types(["a", "b", "c"]);
5999 /// ```
6000 pub fn set_applicable_instance_types<T, V>(mut self, v: T) -> Self
6001 where
6002 T: std::iter::IntoIterator<Item = V>,
6003 V: std::convert::Into<std::string::String>,
6004 {
6005 use std::iter::Iterator;
6006 self.applicable_instance_types = v.into_iter().map(|i| i.into()).collect();
6007 self
6008 }
6009
6010 /// Sets the value of [supported_network_templates][crate::model::OSImage::supported_network_templates].
6011 ///
6012 /// # Example
6013 /// ```ignore,no_run
6014 /// # use google_cloud_baremetalsolution_v2::model::OSImage;
6015 /// let x = OSImage::new().set_supported_network_templates(["a", "b", "c"]);
6016 /// ```
6017 pub fn set_supported_network_templates<T, V>(mut self, v: T) -> Self
6018 where
6019 T: std::iter::IntoIterator<Item = V>,
6020 V: std::convert::Into<std::string::String>,
6021 {
6022 use std::iter::Iterator;
6023 self.supported_network_templates = v.into_iter().map(|i| i.into()).collect();
6024 self
6025 }
6026}
6027
6028impl wkt::message::Message for OSImage {
6029 fn typename() -> &'static str {
6030 "type.googleapis.com/google.cloud.baremetalsolution.v2.OSImage"
6031 }
6032}
6033
6034/// Request for getting all available OS images.
6035#[derive(Clone, Default, PartialEq)]
6036#[non_exhaustive]
6037pub struct ListOSImagesRequest {
6038 /// Required. Parent value for ListProvisioningQuotasRequest.
6039 pub parent: std::string::String,
6040
6041 /// Requested page size. The server might return fewer items than requested.
6042 /// If unspecified, server will pick an appropriate default.
6043 /// Notice that page_size field is not supported and won't be respected in
6044 /// the API request for now, will be updated when pagination is supported.
6045 pub page_size: i32,
6046
6047 /// A token identifying a page of results from the server.
6048 pub page_token: std::string::String,
6049
6050 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6051}
6052
6053impl ListOSImagesRequest {
6054 /// Creates a new default instance.
6055 pub fn new() -> Self {
6056 std::default::Default::default()
6057 }
6058
6059 /// Sets the value of [parent][crate::model::ListOSImagesRequest::parent].
6060 ///
6061 /// # Example
6062 /// ```ignore,no_run
6063 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
6064 /// let x = ListOSImagesRequest::new().set_parent("example");
6065 /// ```
6066 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6067 self.parent = v.into();
6068 self
6069 }
6070
6071 /// Sets the value of [page_size][crate::model::ListOSImagesRequest::page_size].
6072 ///
6073 /// # Example
6074 /// ```ignore,no_run
6075 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
6076 /// let x = ListOSImagesRequest::new().set_page_size(42);
6077 /// ```
6078 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6079 self.page_size = v.into();
6080 self
6081 }
6082
6083 /// Sets the value of [page_token][crate::model::ListOSImagesRequest::page_token].
6084 ///
6085 /// # Example
6086 /// ```ignore,no_run
6087 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesRequest;
6088 /// let x = ListOSImagesRequest::new().set_page_token("example");
6089 /// ```
6090 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6091 self.page_token = v.into();
6092 self
6093 }
6094}
6095
6096impl wkt::message::Message for ListOSImagesRequest {
6097 fn typename() -> &'static str {
6098 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesRequest"
6099 }
6100}
6101
6102/// Request for getting all available OS images.
6103#[derive(Clone, Default, PartialEq)]
6104#[non_exhaustive]
6105pub struct ListOSImagesResponse {
6106 /// The OS images available.
6107 pub os_images: std::vec::Vec<crate::model::OSImage>,
6108
6109 /// Token to retrieve the next page of results, or empty if there are no more
6110 /// results in the list.
6111 pub next_page_token: std::string::String,
6112
6113 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6114}
6115
6116impl ListOSImagesResponse {
6117 /// Creates a new default instance.
6118 pub fn new() -> Self {
6119 std::default::Default::default()
6120 }
6121
6122 /// Sets the value of [os_images][crate::model::ListOSImagesResponse::os_images].
6123 ///
6124 /// # Example
6125 /// ```ignore,no_run
6126 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
6127 /// use google_cloud_baremetalsolution_v2::model::OSImage;
6128 /// let x = ListOSImagesResponse::new()
6129 /// .set_os_images([
6130 /// OSImage::default()/* use setters */,
6131 /// OSImage::default()/* use (different) setters */,
6132 /// ]);
6133 /// ```
6134 pub fn set_os_images<T, V>(mut self, v: T) -> Self
6135 where
6136 T: std::iter::IntoIterator<Item = V>,
6137 V: std::convert::Into<crate::model::OSImage>,
6138 {
6139 use std::iter::Iterator;
6140 self.os_images = v.into_iter().map(|i| i.into()).collect();
6141 self
6142 }
6143
6144 /// Sets the value of [next_page_token][crate::model::ListOSImagesResponse::next_page_token].
6145 ///
6146 /// # Example
6147 /// ```ignore,no_run
6148 /// # use google_cloud_baremetalsolution_v2::model::ListOSImagesResponse;
6149 /// let x = ListOSImagesResponse::new().set_next_page_token("example");
6150 /// ```
6151 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6152 self.next_page_token = v.into();
6153 self
6154 }
6155}
6156
6157impl wkt::message::Message for ListOSImagesResponse {
6158 fn typename() -> &'static str {
6159 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListOSImagesResponse"
6160 }
6161}
6162
6163#[doc(hidden)]
6164impl google_cloud_gax::paginator::internal::PageableResponse for ListOSImagesResponse {
6165 type PageItem = crate::model::OSImage;
6166
6167 fn items(self) -> std::vec::Vec<Self::PageItem> {
6168 self.os_images
6169 }
6170
6171 fn next_page_token(&self) -> std::string::String {
6172 use std::clone::Clone;
6173 self.next_page_token.clone()
6174 }
6175}
6176
6177/// A provisioning configuration.
6178#[derive(Clone, Default, PartialEq)]
6179#[non_exhaustive]
6180pub struct ProvisioningConfig {
6181 /// Output only. The system-generated name of the provisioning config. This
6182 /// follows the UUID format.
6183 pub name: std::string::String,
6184
6185 /// Instances to be created.
6186 pub instances: std::vec::Vec<crate::model::InstanceConfig>,
6187
6188 /// Networks to be created.
6189 pub networks: std::vec::Vec<crate::model::NetworkConfig>,
6190
6191 /// Volumes to be created.
6192 pub volumes: std::vec::Vec<crate::model::VolumeConfig>,
6193
6194 /// A generated ticket id to track provisioning request.
6195 pub ticket_id: std::string::String,
6196
6197 /// A service account to enable customers to access instance credentials upon
6198 /// handover.
6199 pub handover_service_account: std::string::String,
6200
6201 /// Email provided to send a confirmation with provisioning config to.
6202 /// Deprecated in favour of email field in request messages.
6203 #[deprecated]
6204 pub email: std::string::String,
6205
6206 /// Output only. State of ProvisioningConfig.
6207 pub state: crate::model::provisioning_config::State,
6208
6209 /// Optional. Location name of this ProvisioningConfig.
6210 /// It is optional only for Intake UI transition period.
6211 pub location: std::string::String,
6212
6213 /// Output only. Last update timestamp.
6214 pub update_time: std::option::Option<wkt::Timestamp>,
6215
6216 /// Output only. URI to Cloud Console UI view of this provisioning config.
6217 pub cloud_console_uri: std::string::String,
6218
6219 /// If true, VPC SC is enabled for the cluster.
6220 pub vpc_sc_enabled: bool,
6221
6222 /// Optional status messages associated with the FAILED state.
6223 pub status_message: std::string::String,
6224
6225 /// Optional. The user-defined identifier of the provisioning config.
6226 pub custom_id: std::string::String,
6227
6228 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6229}
6230
6231impl ProvisioningConfig {
6232 /// Creates a new default instance.
6233 pub fn new() -> Self {
6234 std::default::Default::default()
6235 }
6236
6237 /// Sets the value of [name][crate::model::ProvisioningConfig::name].
6238 ///
6239 /// # Example
6240 /// ```ignore,no_run
6241 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6242 /// # let project_id = "project_id";
6243 /// # let location_id = "location_id";
6244 /// # let provisioning_config_id = "provisioning_config_id";
6245 /// let x = ProvisioningConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/provisioningConfigs/{provisioning_config_id}"));
6246 /// ```
6247 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6248 self.name = v.into();
6249 self
6250 }
6251
6252 /// Sets the value of [instances][crate::model::ProvisioningConfig::instances].
6253 ///
6254 /// # Example
6255 /// ```ignore,no_run
6256 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6257 /// use google_cloud_baremetalsolution_v2::model::InstanceConfig;
6258 /// let x = ProvisioningConfig::new()
6259 /// .set_instances([
6260 /// InstanceConfig::default()/* use setters */,
6261 /// InstanceConfig::default()/* use (different) setters */,
6262 /// ]);
6263 /// ```
6264 pub fn set_instances<T, V>(mut self, v: T) -> Self
6265 where
6266 T: std::iter::IntoIterator<Item = V>,
6267 V: std::convert::Into<crate::model::InstanceConfig>,
6268 {
6269 use std::iter::Iterator;
6270 self.instances = v.into_iter().map(|i| i.into()).collect();
6271 self
6272 }
6273
6274 /// Sets the value of [networks][crate::model::ProvisioningConfig::networks].
6275 ///
6276 /// # Example
6277 /// ```ignore,no_run
6278 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6279 /// use google_cloud_baremetalsolution_v2::model::NetworkConfig;
6280 /// let x = ProvisioningConfig::new()
6281 /// .set_networks([
6282 /// NetworkConfig::default()/* use setters */,
6283 /// NetworkConfig::default()/* use (different) setters */,
6284 /// ]);
6285 /// ```
6286 pub fn set_networks<T, V>(mut self, v: T) -> Self
6287 where
6288 T: std::iter::IntoIterator<Item = V>,
6289 V: std::convert::Into<crate::model::NetworkConfig>,
6290 {
6291 use std::iter::Iterator;
6292 self.networks = v.into_iter().map(|i| i.into()).collect();
6293 self
6294 }
6295
6296 /// Sets the value of [volumes][crate::model::ProvisioningConfig::volumes].
6297 ///
6298 /// # Example
6299 /// ```ignore,no_run
6300 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6301 /// use google_cloud_baremetalsolution_v2::model::VolumeConfig;
6302 /// let x = ProvisioningConfig::new()
6303 /// .set_volumes([
6304 /// VolumeConfig::default()/* use setters */,
6305 /// VolumeConfig::default()/* use (different) setters */,
6306 /// ]);
6307 /// ```
6308 pub fn set_volumes<T, V>(mut self, v: T) -> Self
6309 where
6310 T: std::iter::IntoIterator<Item = V>,
6311 V: std::convert::Into<crate::model::VolumeConfig>,
6312 {
6313 use std::iter::Iterator;
6314 self.volumes = v.into_iter().map(|i| i.into()).collect();
6315 self
6316 }
6317
6318 /// Sets the value of [ticket_id][crate::model::ProvisioningConfig::ticket_id].
6319 ///
6320 /// # Example
6321 /// ```ignore,no_run
6322 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6323 /// let x = ProvisioningConfig::new().set_ticket_id("example");
6324 /// ```
6325 pub fn set_ticket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6326 self.ticket_id = v.into();
6327 self
6328 }
6329
6330 /// Sets the value of [handover_service_account][crate::model::ProvisioningConfig::handover_service_account].
6331 ///
6332 /// # Example
6333 /// ```ignore,no_run
6334 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6335 /// let x = ProvisioningConfig::new().set_handover_service_account("example");
6336 /// ```
6337 pub fn set_handover_service_account<T: std::convert::Into<std::string::String>>(
6338 mut self,
6339 v: T,
6340 ) -> Self {
6341 self.handover_service_account = v.into();
6342 self
6343 }
6344
6345 /// Sets the value of [email][crate::model::ProvisioningConfig::email].
6346 ///
6347 /// # Example
6348 /// ```ignore,no_run
6349 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6350 /// let x = ProvisioningConfig::new().set_email("example");
6351 /// ```
6352 #[deprecated]
6353 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6354 self.email = v.into();
6355 self
6356 }
6357
6358 /// Sets the value of [state][crate::model::ProvisioningConfig::state].
6359 ///
6360 /// # Example
6361 /// ```ignore,no_run
6362 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6363 /// use google_cloud_baremetalsolution_v2::model::provisioning_config::State;
6364 /// let x0 = ProvisioningConfig::new().set_state(State::Draft);
6365 /// let x1 = ProvisioningConfig::new().set_state(State::Submitted);
6366 /// let x2 = ProvisioningConfig::new().set_state(State::Provisioning);
6367 /// ```
6368 pub fn set_state<T: std::convert::Into<crate::model::provisioning_config::State>>(
6369 mut self,
6370 v: T,
6371 ) -> Self {
6372 self.state = v.into();
6373 self
6374 }
6375
6376 /// Sets the value of [location][crate::model::ProvisioningConfig::location].
6377 ///
6378 /// # Example
6379 /// ```ignore,no_run
6380 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6381 /// let x = ProvisioningConfig::new().set_location("example");
6382 /// ```
6383 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6384 self.location = v.into();
6385 self
6386 }
6387
6388 /// Sets the value of [update_time][crate::model::ProvisioningConfig::update_time].
6389 ///
6390 /// # Example
6391 /// ```ignore,no_run
6392 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6393 /// use wkt::Timestamp;
6394 /// let x = ProvisioningConfig::new().set_update_time(Timestamp::default()/* use setters */);
6395 /// ```
6396 pub fn set_update_time<T>(mut self, v: T) -> Self
6397 where
6398 T: std::convert::Into<wkt::Timestamp>,
6399 {
6400 self.update_time = std::option::Option::Some(v.into());
6401 self
6402 }
6403
6404 /// Sets or clears the value of [update_time][crate::model::ProvisioningConfig::update_time].
6405 ///
6406 /// # Example
6407 /// ```ignore,no_run
6408 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6409 /// use wkt::Timestamp;
6410 /// let x = ProvisioningConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6411 /// let x = ProvisioningConfig::new().set_or_clear_update_time(None::<Timestamp>);
6412 /// ```
6413 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6414 where
6415 T: std::convert::Into<wkt::Timestamp>,
6416 {
6417 self.update_time = v.map(|x| x.into());
6418 self
6419 }
6420
6421 /// Sets the value of [cloud_console_uri][crate::model::ProvisioningConfig::cloud_console_uri].
6422 ///
6423 /// # Example
6424 /// ```ignore,no_run
6425 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6426 /// let x = ProvisioningConfig::new().set_cloud_console_uri("example");
6427 /// ```
6428 pub fn set_cloud_console_uri<T: std::convert::Into<std::string::String>>(
6429 mut self,
6430 v: T,
6431 ) -> Self {
6432 self.cloud_console_uri = v.into();
6433 self
6434 }
6435
6436 /// Sets the value of [vpc_sc_enabled][crate::model::ProvisioningConfig::vpc_sc_enabled].
6437 ///
6438 /// # Example
6439 /// ```ignore,no_run
6440 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6441 /// let x = ProvisioningConfig::new().set_vpc_sc_enabled(true);
6442 /// ```
6443 pub fn set_vpc_sc_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6444 self.vpc_sc_enabled = v.into();
6445 self
6446 }
6447
6448 /// Sets the value of [status_message][crate::model::ProvisioningConfig::status_message].
6449 ///
6450 /// # Example
6451 /// ```ignore,no_run
6452 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6453 /// let x = ProvisioningConfig::new().set_status_message("example");
6454 /// ```
6455 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6456 self.status_message = v.into();
6457 self
6458 }
6459
6460 /// Sets the value of [custom_id][crate::model::ProvisioningConfig::custom_id].
6461 ///
6462 /// # Example
6463 /// ```ignore,no_run
6464 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6465 /// let x = ProvisioningConfig::new().set_custom_id("example");
6466 /// ```
6467 pub fn set_custom_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6468 self.custom_id = v.into();
6469 self
6470 }
6471}
6472
6473impl wkt::message::Message for ProvisioningConfig {
6474 fn typename() -> &'static str {
6475 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningConfig"
6476 }
6477}
6478
6479/// Defines additional types related to [ProvisioningConfig].
6480pub mod provisioning_config {
6481 #[allow(unused_imports)]
6482 use super::*;
6483
6484 /// The possible states for this ProvisioningConfig.
6485 ///
6486 /// # Working with unknown values
6487 ///
6488 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6489 /// additional enum variants at any time. Adding new variants is not considered
6490 /// a breaking change. Applications should write their code in anticipation of:
6491 ///
6492 /// - New values appearing in future releases of the client library, **and**
6493 /// - New values received dynamically, without application changes.
6494 ///
6495 /// Please consult the [Working with enums] section in the user guide for some
6496 /// guidelines.
6497 ///
6498 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6499 #[derive(Clone, Debug, PartialEq)]
6500 #[non_exhaustive]
6501 pub enum State {
6502 /// State wasn't specified.
6503 Unspecified,
6504 /// ProvisioningConfig is a draft and can be freely modified.
6505 Draft,
6506 /// ProvisioningConfig was already submitted and cannot be modified.
6507 Submitted,
6508 /// ProvisioningConfig was in the provisioning state. Initially this state
6509 /// comes from the work order table in big query when SNOW is used. Later
6510 /// this field can be set by the work order API.
6511 Provisioning,
6512 /// ProvisioningConfig was provisioned, meaning the resources exist.
6513 Provisioned,
6514 /// ProvisioningConfig was validated. A validation tool will be run to
6515 /// set this state.
6516 Validated,
6517 /// ProvisioningConfig was canceled.
6518 Cancelled,
6519 /// The request is submitted for provisioning, with error return.
6520 Failed,
6521 /// If set, the enum was initialized with an unknown value.
6522 ///
6523 /// Applications can examine the value using [State::value] or
6524 /// [State::name].
6525 UnknownValue(state::UnknownValue),
6526 }
6527
6528 #[doc(hidden)]
6529 pub mod state {
6530 #[allow(unused_imports)]
6531 use super::*;
6532 #[derive(Clone, Debug, PartialEq)]
6533 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6534 }
6535
6536 impl State {
6537 /// Gets the enum value.
6538 ///
6539 /// Returns `None` if the enum contains an unknown value deserialized from
6540 /// the string representation of enums.
6541 pub fn value(&self) -> std::option::Option<i32> {
6542 match self {
6543 Self::Unspecified => std::option::Option::Some(0),
6544 Self::Draft => std::option::Option::Some(1),
6545 Self::Submitted => std::option::Option::Some(2),
6546 Self::Provisioning => std::option::Option::Some(3),
6547 Self::Provisioned => std::option::Option::Some(4),
6548 Self::Validated => std::option::Option::Some(5),
6549 Self::Cancelled => std::option::Option::Some(6),
6550 Self::Failed => std::option::Option::Some(7),
6551 Self::UnknownValue(u) => u.0.value(),
6552 }
6553 }
6554
6555 /// Gets the enum value as a string.
6556 ///
6557 /// Returns `None` if the enum contains an unknown value deserialized from
6558 /// the integer representation of enums.
6559 pub fn name(&self) -> std::option::Option<&str> {
6560 match self {
6561 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6562 Self::Draft => std::option::Option::Some("DRAFT"),
6563 Self::Submitted => std::option::Option::Some("SUBMITTED"),
6564 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
6565 Self::Provisioned => std::option::Option::Some("PROVISIONED"),
6566 Self::Validated => std::option::Option::Some("VALIDATED"),
6567 Self::Cancelled => std::option::Option::Some("CANCELLED"),
6568 Self::Failed => std::option::Option::Some("FAILED"),
6569 Self::UnknownValue(u) => u.0.name(),
6570 }
6571 }
6572 }
6573
6574 impl std::default::Default for State {
6575 fn default() -> Self {
6576 use std::convert::From;
6577 Self::from(0)
6578 }
6579 }
6580
6581 impl std::fmt::Display for State {
6582 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6583 wkt::internal::display_enum(f, self.name(), self.value())
6584 }
6585 }
6586
6587 impl std::convert::From<i32> for State {
6588 fn from(value: i32) -> Self {
6589 match value {
6590 0 => Self::Unspecified,
6591 1 => Self::Draft,
6592 2 => Self::Submitted,
6593 3 => Self::Provisioning,
6594 4 => Self::Provisioned,
6595 5 => Self::Validated,
6596 6 => Self::Cancelled,
6597 7 => Self::Failed,
6598 _ => Self::UnknownValue(state::UnknownValue(
6599 wkt::internal::UnknownEnumValue::Integer(value),
6600 )),
6601 }
6602 }
6603 }
6604
6605 impl std::convert::From<&str> for State {
6606 fn from(value: &str) -> Self {
6607 use std::string::ToString;
6608 match value {
6609 "STATE_UNSPECIFIED" => Self::Unspecified,
6610 "DRAFT" => Self::Draft,
6611 "SUBMITTED" => Self::Submitted,
6612 "PROVISIONING" => Self::Provisioning,
6613 "PROVISIONED" => Self::Provisioned,
6614 "VALIDATED" => Self::Validated,
6615 "CANCELLED" => Self::Cancelled,
6616 "FAILED" => Self::Failed,
6617 _ => Self::UnknownValue(state::UnknownValue(
6618 wkt::internal::UnknownEnumValue::String(value.to_string()),
6619 )),
6620 }
6621 }
6622 }
6623
6624 impl serde::ser::Serialize for State {
6625 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6626 where
6627 S: serde::Serializer,
6628 {
6629 match self {
6630 Self::Unspecified => serializer.serialize_i32(0),
6631 Self::Draft => serializer.serialize_i32(1),
6632 Self::Submitted => serializer.serialize_i32(2),
6633 Self::Provisioning => serializer.serialize_i32(3),
6634 Self::Provisioned => serializer.serialize_i32(4),
6635 Self::Validated => serializer.serialize_i32(5),
6636 Self::Cancelled => serializer.serialize_i32(6),
6637 Self::Failed => serializer.serialize_i32(7),
6638 Self::UnknownValue(u) => u.0.serialize(serializer),
6639 }
6640 }
6641 }
6642
6643 impl<'de> serde::de::Deserialize<'de> for State {
6644 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6645 where
6646 D: serde::Deserializer<'de>,
6647 {
6648 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6649 ".google.cloud.baremetalsolution.v2.ProvisioningConfig.State",
6650 ))
6651 }
6652 }
6653}
6654
6655/// Request for SubmitProvisioningConfig.
6656#[derive(Clone, Default, PartialEq)]
6657#[non_exhaustive]
6658pub struct SubmitProvisioningConfigRequest {
6659 /// Required. The parent project and location containing the
6660 /// ProvisioningConfig.
6661 pub parent: std::string::String,
6662
6663 /// Required. The ProvisioningConfig to create.
6664 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6665
6666 /// Optional. Email provided to send a confirmation with provisioning config
6667 /// to.
6668 pub email: std::string::String,
6669
6670 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6671}
6672
6673impl SubmitProvisioningConfigRequest {
6674 /// Creates a new default instance.
6675 pub fn new() -> Self {
6676 std::default::Default::default()
6677 }
6678
6679 /// Sets the value of [parent][crate::model::SubmitProvisioningConfigRequest::parent].
6680 ///
6681 /// # Example
6682 /// ```ignore,no_run
6683 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6684 /// let x = SubmitProvisioningConfigRequest::new().set_parent("example");
6685 /// ```
6686 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6687 self.parent = v.into();
6688 self
6689 }
6690
6691 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6692 ///
6693 /// # Example
6694 /// ```ignore,no_run
6695 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6696 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6697 /// let x = SubmitProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6698 /// ```
6699 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6700 where
6701 T: std::convert::Into<crate::model::ProvisioningConfig>,
6702 {
6703 self.provisioning_config = std::option::Option::Some(v.into());
6704 self
6705 }
6706
6707 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
6708 ///
6709 /// # Example
6710 /// ```ignore,no_run
6711 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6712 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6713 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6714 /// let x = SubmitProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6715 /// ```
6716 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6717 where
6718 T: std::convert::Into<crate::model::ProvisioningConfig>,
6719 {
6720 self.provisioning_config = v.map(|x| x.into());
6721 self
6722 }
6723
6724 /// Sets the value of [email][crate::model::SubmitProvisioningConfigRequest::email].
6725 ///
6726 /// # Example
6727 /// ```ignore,no_run
6728 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigRequest;
6729 /// let x = SubmitProvisioningConfigRequest::new().set_email("example");
6730 /// ```
6731 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6732 self.email = v.into();
6733 self
6734 }
6735}
6736
6737impl wkt::message::Message for SubmitProvisioningConfigRequest {
6738 fn typename() -> &'static str {
6739 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigRequest"
6740 }
6741}
6742
6743/// Response for SubmitProvisioningConfig.
6744#[derive(Clone, Default, PartialEq)]
6745#[non_exhaustive]
6746pub struct SubmitProvisioningConfigResponse {
6747 /// The submitted provisioning config.
6748 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
6749
6750 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6751}
6752
6753impl SubmitProvisioningConfigResponse {
6754 /// Creates a new default instance.
6755 pub fn new() -> Self {
6756 std::default::Default::default()
6757 }
6758
6759 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6760 ///
6761 /// # Example
6762 /// ```ignore,no_run
6763 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6764 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6765 /// let x = SubmitProvisioningConfigResponse::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
6766 /// ```
6767 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
6768 where
6769 T: std::convert::Into<crate::model::ProvisioningConfig>,
6770 {
6771 self.provisioning_config = std::option::Option::Some(v.into());
6772 self
6773 }
6774
6775 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigResponse::provisioning_config].
6776 ///
6777 /// # Example
6778 /// ```ignore,no_run
6779 /// # use google_cloud_baremetalsolution_v2::model::SubmitProvisioningConfigResponse;
6780 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
6781 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
6782 /// let x = SubmitProvisioningConfigResponse::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
6783 /// ```
6784 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
6785 where
6786 T: std::convert::Into<crate::model::ProvisioningConfig>,
6787 {
6788 self.provisioning_config = v.map(|x| x.into());
6789 self
6790 }
6791}
6792
6793impl wkt::message::Message for SubmitProvisioningConfigResponse {
6794 fn typename() -> &'static str {
6795 "type.googleapis.com/google.cloud.baremetalsolution.v2.SubmitProvisioningConfigResponse"
6796 }
6797}
6798
6799/// A provisioning quota for a given project.
6800#[derive(Clone, Default, PartialEq)]
6801#[non_exhaustive]
6802pub struct ProvisioningQuota {
6803 /// Output only. The name of the provisioning quota.
6804 pub name: std::string::String,
6805
6806 /// The asset type of this provisioning quota.
6807 pub asset_type: crate::model::provisioning_quota::AssetType,
6808
6809 /// The gcp service of the provisioning quota.
6810 pub gcp_service: std::string::String,
6811
6812 /// The specific location of the provisioining quota.
6813 pub location: std::string::String,
6814
6815 /// The available count of the provisioning quota.
6816 pub available_count: i32,
6817
6818 /// The quota of one asset type.
6819 pub quota: std::option::Option<crate::model::provisioning_quota::Quota>,
6820
6821 /// Available quantity based on asset type.
6822 pub availability: std::option::Option<crate::model::provisioning_quota::Availability>,
6823
6824 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6825}
6826
6827impl ProvisioningQuota {
6828 /// Creates a new default instance.
6829 pub fn new() -> Self {
6830 std::default::Default::default()
6831 }
6832
6833 /// Sets the value of [name][crate::model::ProvisioningQuota::name].
6834 ///
6835 /// # Example
6836 /// ```ignore,no_run
6837 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6838 /// # let project_id = "project_id";
6839 /// # let location_id = "location_id";
6840 /// # let provisioning_quota_id = "provisioning_quota_id";
6841 /// let x = ProvisioningQuota::new().set_name(format!("projects/{project_id}/locations/{location_id}/provisioningQuotas/{provisioning_quota_id}"));
6842 /// ```
6843 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6844 self.name = v.into();
6845 self
6846 }
6847
6848 /// Sets the value of [asset_type][crate::model::ProvisioningQuota::asset_type].
6849 ///
6850 /// # Example
6851 /// ```ignore,no_run
6852 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6853 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::AssetType;
6854 /// let x0 = ProvisioningQuota::new().set_asset_type(AssetType::Server);
6855 /// let x1 = ProvisioningQuota::new().set_asset_type(AssetType::Storage);
6856 /// let x2 = ProvisioningQuota::new().set_asset_type(AssetType::Network);
6857 /// ```
6858 pub fn set_asset_type<T: std::convert::Into<crate::model::provisioning_quota::AssetType>>(
6859 mut self,
6860 v: T,
6861 ) -> Self {
6862 self.asset_type = v.into();
6863 self
6864 }
6865
6866 /// Sets the value of [gcp_service][crate::model::ProvisioningQuota::gcp_service].
6867 ///
6868 /// # Example
6869 /// ```ignore,no_run
6870 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6871 /// let x = ProvisioningQuota::new().set_gcp_service("example");
6872 /// ```
6873 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6874 self.gcp_service = v.into();
6875 self
6876 }
6877
6878 /// Sets the value of [location][crate::model::ProvisioningQuota::location].
6879 ///
6880 /// # Example
6881 /// ```ignore,no_run
6882 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6883 /// let x = ProvisioningQuota::new().set_location("example");
6884 /// ```
6885 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6886 self.location = v.into();
6887 self
6888 }
6889
6890 /// Sets the value of [available_count][crate::model::ProvisioningQuota::available_count].
6891 ///
6892 /// # Example
6893 /// ```ignore,no_run
6894 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6895 /// let x = ProvisioningQuota::new().set_available_count(42);
6896 /// ```
6897 pub fn set_available_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6898 self.available_count = v.into();
6899 self
6900 }
6901
6902 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota].
6903 ///
6904 /// Note that all the setters affecting `quota` are mutually
6905 /// exclusive.
6906 ///
6907 /// # Example
6908 /// ```ignore,no_run
6909 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6910 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6911 /// let x = ProvisioningQuota::new().set_quota(Some(
6912 /// google_cloud_baremetalsolution_v2::model::provisioning_quota::Quota::InstanceQuota(InstanceQuota::default().into())));
6913 /// ```
6914 pub fn set_quota<
6915 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Quota>>,
6916 >(
6917 mut self,
6918 v: T,
6919 ) -> Self {
6920 self.quota = v.into();
6921 self
6922 }
6923
6924 /// The value of [quota][crate::model::ProvisioningQuota::quota]
6925 /// if it holds a `InstanceQuota`, `None` if the field is not set or
6926 /// holds a different branch.
6927 pub fn instance_quota(
6928 &self,
6929 ) -> std::option::Option<&std::boxed::Box<crate::model::InstanceQuota>> {
6930 #[allow(unreachable_patterns)]
6931 self.quota.as_ref().and_then(|v| match v {
6932 crate::model::provisioning_quota::Quota::InstanceQuota(v) => {
6933 std::option::Option::Some(v)
6934 }
6935 _ => std::option::Option::None,
6936 })
6937 }
6938
6939 /// Sets the value of [quota][crate::model::ProvisioningQuota::quota]
6940 /// to hold a `InstanceQuota`.
6941 ///
6942 /// Note that all the setters affecting `quota` are
6943 /// mutually exclusive.
6944 ///
6945 /// # Example
6946 /// ```ignore,no_run
6947 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6948 /// use google_cloud_baremetalsolution_v2::model::InstanceQuota;
6949 /// let x = ProvisioningQuota::new().set_instance_quota(InstanceQuota::default()/* use setters */);
6950 /// assert!(x.instance_quota().is_some());
6951 /// ```
6952 pub fn set_instance_quota<
6953 T: std::convert::Into<std::boxed::Box<crate::model::InstanceQuota>>,
6954 >(
6955 mut self,
6956 v: T,
6957 ) -> Self {
6958 self.quota = std::option::Option::Some(
6959 crate::model::provisioning_quota::Quota::InstanceQuota(v.into()),
6960 );
6961 self
6962 }
6963
6964 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability].
6965 ///
6966 /// Note that all the setters affecting `availability` are mutually
6967 /// exclusive.
6968 ///
6969 /// # Example
6970 /// ```ignore,no_run
6971 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
6972 /// use google_cloud_baremetalsolution_v2::model::provisioning_quota::Availability;
6973 /// let x = ProvisioningQuota::new().set_availability(Some(Availability::ServerCount(42)));
6974 /// ```
6975 pub fn set_availability<
6976 T: std::convert::Into<std::option::Option<crate::model::provisioning_quota::Availability>>,
6977 >(
6978 mut self,
6979 v: T,
6980 ) -> Self {
6981 self.availability = v.into();
6982 self
6983 }
6984
6985 /// The value of [availability][crate::model::ProvisioningQuota::availability]
6986 /// if it holds a `ServerCount`, `None` if the field is not set or
6987 /// holds a different branch.
6988 pub fn server_count(&self) -> std::option::Option<&i64> {
6989 #[allow(unreachable_patterns)]
6990 self.availability.as_ref().and_then(|v| match v {
6991 crate::model::provisioning_quota::Availability::ServerCount(v) => {
6992 std::option::Option::Some(v)
6993 }
6994 _ => std::option::Option::None,
6995 })
6996 }
6997
6998 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
6999 /// to hold a `ServerCount`.
7000 ///
7001 /// Note that all the setters affecting `availability` are
7002 /// mutually exclusive.
7003 ///
7004 /// # Example
7005 /// ```ignore,no_run
7006 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7007 /// let x = ProvisioningQuota::new().set_server_count(42);
7008 /// assert!(x.server_count().is_some());
7009 /// assert!(x.network_bandwidth().is_none());
7010 /// assert!(x.storage_gib().is_none());
7011 /// ```
7012 pub fn set_server_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7013 self.availability = std::option::Option::Some(
7014 crate::model::provisioning_quota::Availability::ServerCount(v.into()),
7015 );
7016 self
7017 }
7018
7019 /// The value of [availability][crate::model::ProvisioningQuota::availability]
7020 /// if it holds a `NetworkBandwidth`, `None` if the field is not set or
7021 /// holds a different branch.
7022 pub fn network_bandwidth(&self) -> std::option::Option<&i64> {
7023 #[allow(unreachable_patterns)]
7024 self.availability.as_ref().and_then(|v| match v {
7025 crate::model::provisioning_quota::Availability::NetworkBandwidth(v) => {
7026 std::option::Option::Some(v)
7027 }
7028 _ => std::option::Option::None,
7029 })
7030 }
7031
7032 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
7033 /// to hold a `NetworkBandwidth`.
7034 ///
7035 /// Note that all the setters affecting `availability` are
7036 /// mutually exclusive.
7037 ///
7038 /// # Example
7039 /// ```ignore,no_run
7040 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7041 /// let x = ProvisioningQuota::new().set_network_bandwidth(42);
7042 /// assert!(x.network_bandwidth().is_some());
7043 /// assert!(x.server_count().is_none());
7044 /// assert!(x.storage_gib().is_none());
7045 /// ```
7046 pub fn set_network_bandwidth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7047 self.availability = std::option::Option::Some(
7048 crate::model::provisioning_quota::Availability::NetworkBandwidth(v.into()),
7049 );
7050 self
7051 }
7052
7053 /// The value of [availability][crate::model::ProvisioningQuota::availability]
7054 /// if it holds a `StorageGib`, `None` if the field is not set or
7055 /// holds a different branch.
7056 pub fn storage_gib(&self) -> std::option::Option<&i64> {
7057 #[allow(unreachable_patterns)]
7058 self.availability.as_ref().and_then(|v| match v {
7059 crate::model::provisioning_quota::Availability::StorageGib(v) => {
7060 std::option::Option::Some(v)
7061 }
7062 _ => std::option::Option::None,
7063 })
7064 }
7065
7066 /// Sets the value of [availability][crate::model::ProvisioningQuota::availability]
7067 /// to hold a `StorageGib`.
7068 ///
7069 /// Note that all the setters affecting `availability` are
7070 /// mutually exclusive.
7071 ///
7072 /// # Example
7073 /// ```ignore,no_run
7074 /// # use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7075 /// let x = ProvisioningQuota::new().set_storage_gib(42);
7076 /// assert!(x.storage_gib().is_some());
7077 /// assert!(x.server_count().is_none());
7078 /// assert!(x.network_bandwidth().is_none());
7079 /// ```
7080 pub fn set_storage_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7081 self.availability = std::option::Option::Some(
7082 crate::model::provisioning_quota::Availability::StorageGib(v.into()),
7083 );
7084 self
7085 }
7086}
7087
7088impl wkt::message::Message for ProvisioningQuota {
7089 fn typename() -> &'static str {
7090 "type.googleapis.com/google.cloud.baremetalsolution.v2.ProvisioningQuota"
7091 }
7092}
7093
7094/// Defines additional types related to [ProvisioningQuota].
7095pub mod provisioning_quota {
7096 #[allow(unused_imports)]
7097 use super::*;
7098
7099 /// The available asset types for intake.
7100 ///
7101 /// # Working with unknown values
7102 ///
7103 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7104 /// additional enum variants at any time. Adding new variants is not considered
7105 /// a breaking change. Applications should write their code in anticipation of:
7106 ///
7107 /// - New values appearing in future releases of the client library, **and**
7108 /// - New values received dynamically, without application changes.
7109 ///
7110 /// Please consult the [Working with enums] section in the user guide for some
7111 /// guidelines.
7112 ///
7113 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7114 #[derive(Clone, Debug, PartialEq)]
7115 #[non_exhaustive]
7116 pub enum AssetType {
7117 /// The unspecified type.
7118 Unspecified,
7119 /// The server asset type.
7120 Server,
7121 /// The storage asset type.
7122 Storage,
7123 /// The network asset type.
7124 Network,
7125 /// If set, the enum was initialized with an unknown value.
7126 ///
7127 /// Applications can examine the value using [AssetType::value] or
7128 /// [AssetType::name].
7129 UnknownValue(asset_type::UnknownValue),
7130 }
7131
7132 #[doc(hidden)]
7133 pub mod asset_type {
7134 #[allow(unused_imports)]
7135 use super::*;
7136 #[derive(Clone, Debug, PartialEq)]
7137 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7138 }
7139
7140 impl AssetType {
7141 /// Gets the enum value.
7142 ///
7143 /// Returns `None` if the enum contains an unknown value deserialized from
7144 /// the string representation of enums.
7145 pub fn value(&self) -> std::option::Option<i32> {
7146 match self {
7147 Self::Unspecified => std::option::Option::Some(0),
7148 Self::Server => std::option::Option::Some(1),
7149 Self::Storage => std::option::Option::Some(2),
7150 Self::Network => std::option::Option::Some(3),
7151 Self::UnknownValue(u) => u.0.value(),
7152 }
7153 }
7154
7155 /// Gets the enum value as a string.
7156 ///
7157 /// Returns `None` if the enum contains an unknown value deserialized from
7158 /// the integer representation of enums.
7159 pub fn name(&self) -> std::option::Option<&str> {
7160 match self {
7161 Self::Unspecified => std::option::Option::Some("ASSET_TYPE_UNSPECIFIED"),
7162 Self::Server => std::option::Option::Some("ASSET_TYPE_SERVER"),
7163 Self::Storage => std::option::Option::Some("ASSET_TYPE_STORAGE"),
7164 Self::Network => std::option::Option::Some("ASSET_TYPE_NETWORK"),
7165 Self::UnknownValue(u) => u.0.name(),
7166 }
7167 }
7168 }
7169
7170 impl std::default::Default for AssetType {
7171 fn default() -> Self {
7172 use std::convert::From;
7173 Self::from(0)
7174 }
7175 }
7176
7177 impl std::fmt::Display for AssetType {
7178 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7179 wkt::internal::display_enum(f, self.name(), self.value())
7180 }
7181 }
7182
7183 impl std::convert::From<i32> for AssetType {
7184 fn from(value: i32) -> Self {
7185 match value {
7186 0 => Self::Unspecified,
7187 1 => Self::Server,
7188 2 => Self::Storage,
7189 3 => Self::Network,
7190 _ => Self::UnknownValue(asset_type::UnknownValue(
7191 wkt::internal::UnknownEnumValue::Integer(value),
7192 )),
7193 }
7194 }
7195 }
7196
7197 impl std::convert::From<&str> for AssetType {
7198 fn from(value: &str) -> Self {
7199 use std::string::ToString;
7200 match value {
7201 "ASSET_TYPE_UNSPECIFIED" => Self::Unspecified,
7202 "ASSET_TYPE_SERVER" => Self::Server,
7203 "ASSET_TYPE_STORAGE" => Self::Storage,
7204 "ASSET_TYPE_NETWORK" => Self::Network,
7205 _ => Self::UnknownValue(asset_type::UnknownValue(
7206 wkt::internal::UnknownEnumValue::String(value.to_string()),
7207 )),
7208 }
7209 }
7210 }
7211
7212 impl serde::ser::Serialize for AssetType {
7213 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7214 where
7215 S: serde::Serializer,
7216 {
7217 match self {
7218 Self::Unspecified => serializer.serialize_i32(0),
7219 Self::Server => serializer.serialize_i32(1),
7220 Self::Storage => serializer.serialize_i32(2),
7221 Self::Network => serializer.serialize_i32(3),
7222 Self::UnknownValue(u) => u.0.serialize(serializer),
7223 }
7224 }
7225 }
7226
7227 impl<'de> serde::de::Deserialize<'de> for AssetType {
7228 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7229 where
7230 D: serde::Deserializer<'de>,
7231 {
7232 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AssetType>::new(
7233 ".google.cloud.baremetalsolution.v2.ProvisioningQuota.AssetType",
7234 ))
7235 }
7236 }
7237
7238 /// The quota of one asset type.
7239 #[derive(Clone, Debug, PartialEq)]
7240 #[non_exhaustive]
7241 pub enum Quota {
7242 /// Instance quota.
7243 InstanceQuota(std::boxed::Box<crate::model::InstanceQuota>),
7244 }
7245
7246 /// Available quantity based on asset type.
7247 #[derive(Clone, Debug, PartialEq)]
7248 #[non_exhaustive]
7249 pub enum Availability {
7250 /// Server count.
7251 ServerCount(i64),
7252 /// Network bandwidth, Gbps
7253 NetworkBandwidth(i64),
7254 /// Storage size (GB).
7255 StorageGib(i64),
7256 }
7257}
7258
7259/// Message for requesting the list of provisioning quotas.
7260#[derive(Clone, Default, PartialEq)]
7261#[non_exhaustive]
7262pub struct ListProvisioningQuotasRequest {
7263 /// Required. Parent value for ListProvisioningQuotasRequest.
7264 pub parent: std::string::String,
7265
7266 /// Requested page size. The server might return fewer items than requested.
7267 /// If unspecified, server will pick an appropriate default.
7268 /// Notice that page_size field is not supported and won't be respected in
7269 /// the API request for now, will be updated when pagination is supported.
7270 pub page_size: i32,
7271
7272 /// A token identifying a page of results from the server.
7273 pub page_token: std::string::String,
7274
7275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7276}
7277
7278impl ListProvisioningQuotasRequest {
7279 /// Creates a new default instance.
7280 pub fn new() -> Self {
7281 std::default::Default::default()
7282 }
7283
7284 /// Sets the value of [parent][crate::model::ListProvisioningQuotasRequest::parent].
7285 ///
7286 /// # Example
7287 /// ```ignore,no_run
7288 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7289 /// let x = ListProvisioningQuotasRequest::new().set_parent("example");
7290 /// ```
7291 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7292 self.parent = v.into();
7293 self
7294 }
7295
7296 /// Sets the value of [page_size][crate::model::ListProvisioningQuotasRequest::page_size].
7297 ///
7298 /// # Example
7299 /// ```ignore,no_run
7300 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7301 /// let x = ListProvisioningQuotasRequest::new().set_page_size(42);
7302 /// ```
7303 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7304 self.page_size = v.into();
7305 self
7306 }
7307
7308 /// Sets the value of [page_token][crate::model::ListProvisioningQuotasRequest::page_token].
7309 ///
7310 /// # Example
7311 /// ```ignore,no_run
7312 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasRequest;
7313 /// let x = ListProvisioningQuotasRequest::new().set_page_token("example");
7314 /// ```
7315 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7316 self.page_token = v.into();
7317 self
7318 }
7319}
7320
7321impl wkt::message::Message for ListProvisioningQuotasRequest {
7322 fn typename() -> &'static str {
7323 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasRequest"
7324 }
7325}
7326
7327/// Response message for the list of provisioning quotas.
7328#[derive(Clone, Default, PartialEq)]
7329#[non_exhaustive]
7330pub struct ListProvisioningQuotasResponse {
7331 /// The provisioning quotas registered in this project.
7332 pub provisioning_quotas: std::vec::Vec<crate::model::ProvisioningQuota>,
7333
7334 /// Token to retrieve the next page of results, or empty if there are no more
7335 /// results in the list.
7336 pub next_page_token: std::string::String,
7337
7338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7339}
7340
7341impl ListProvisioningQuotasResponse {
7342 /// Creates a new default instance.
7343 pub fn new() -> Self {
7344 std::default::Default::default()
7345 }
7346
7347 /// Sets the value of [provisioning_quotas][crate::model::ListProvisioningQuotasResponse::provisioning_quotas].
7348 ///
7349 /// # Example
7350 /// ```ignore,no_run
7351 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7352 /// use google_cloud_baremetalsolution_v2::model::ProvisioningQuota;
7353 /// let x = ListProvisioningQuotasResponse::new()
7354 /// .set_provisioning_quotas([
7355 /// ProvisioningQuota::default()/* use setters */,
7356 /// ProvisioningQuota::default()/* use (different) setters */,
7357 /// ]);
7358 /// ```
7359 pub fn set_provisioning_quotas<T, V>(mut self, v: T) -> Self
7360 where
7361 T: std::iter::IntoIterator<Item = V>,
7362 V: std::convert::Into<crate::model::ProvisioningQuota>,
7363 {
7364 use std::iter::Iterator;
7365 self.provisioning_quotas = v.into_iter().map(|i| i.into()).collect();
7366 self
7367 }
7368
7369 /// Sets the value of [next_page_token][crate::model::ListProvisioningQuotasResponse::next_page_token].
7370 ///
7371 /// # Example
7372 /// ```ignore,no_run
7373 /// # use google_cloud_baremetalsolution_v2::model::ListProvisioningQuotasResponse;
7374 /// let x = ListProvisioningQuotasResponse::new().set_next_page_token("example");
7375 /// ```
7376 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7377 self.next_page_token = v.into();
7378 self
7379 }
7380}
7381
7382impl wkt::message::Message for ListProvisioningQuotasResponse {
7383 fn typename() -> &'static str {
7384 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListProvisioningQuotasResponse"
7385 }
7386}
7387
7388#[doc(hidden)]
7389impl google_cloud_gax::paginator::internal::PageableResponse for ListProvisioningQuotasResponse {
7390 type PageItem = crate::model::ProvisioningQuota;
7391
7392 fn items(self) -> std::vec::Vec<Self::PageItem> {
7393 self.provisioning_quotas
7394 }
7395
7396 fn next_page_token(&self) -> std::string::String {
7397 use std::clone::Clone;
7398 self.next_page_token.clone()
7399 }
7400}
7401
7402/// Configuration parameters for a new instance.
7403#[derive(Clone, Default, PartialEq)]
7404#[non_exhaustive]
7405pub struct InstanceConfig {
7406 /// Output only. The name of the instance config.
7407 pub name: std::string::String,
7408
7409 /// A transient unique identifier to idenfity an instance within an
7410 /// ProvisioningConfig request.
7411 pub id: std::string::String,
7412
7413 /// Instance type.
7414 /// [Available
7415 /// types](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7416 pub instance_type: std::string::String,
7417
7418 /// Whether the instance should be provisioned with Hyperthreading enabled.
7419 pub hyperthreading: bool,
7420
7421 /// OS image to initialize the instance.
7422 /// [Available
7423 /// images](https://cloud.google.com/bare-metal/docs/bms-planning#server_configurations)
7424 pub os_image: std::string::String,
7425
7426 /// Client network address. Filled if InstanceConfig.multivlan_config is false.
7427 #[deprecated]
7428 pub client_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7429
7430 /// Private network address, if any. Filled if InstanceConfig.multivlan_config
7431 /// is false.
7432 #[deprecated]
7433 pub private_network: std::option::Option<crate::model::instance_config::NetworkAddress>,
7434
7435 /// User note field, it can be used by customers to add additional information
7436 /// for the BMS Ops team .
7437 pub user_note: std::string::String,
7438
7439 /// If true networks can be from different projects of the same vendor account.
7440 pub account_networks_enabled: bool,
7441
7442 /// The type of network configuration on the instance.
7443 pub network_config: crate::model::instance_config::NetworkConfig,
7444
7445 /// Server network template name. Filled if InstanceConfig.multivlan_config is
7446 /// true.
7447 pub network_template: std::string::String,
7448
7449 /// List of logical interfaces for the instance. The number of logical
7450 /// interfaces will be the same as number of hardware bond/nic on the chosen
7451 /// network template. Filled if InstanceConfig.multivlan_config is true.
7452 pub logical_interfaces: std::vec::Vec<crate::model::LogicalInterface>,
7453
7454 /// List of names of ssh keys used to provision the instance.
7455 pub ssh_key_names: std::vec::Vec<std::string::String>,
7456
7457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7458}
7459
7460impl InstanceConfig {
7461 /// Creates a new default instance.
7462 pub fn new() -> Self {
7463 std::default::Default::default()
7464 }
7465
7466 /// Sets the value of [name][crate::model::InstanceConfig::name].
7467 ///
7468 /// # Example
7469 /// ```ignore,no_run
7470 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7471 /// # let project_id = "project_id";
7472 /// # let location_id = "location_id";
7473 /// # let instance_config_id = "instance_config_id";
7474 /// let x = InstanceConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/instanceConfigs/{instance_config_id}"));
7475 /// ```
7476 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7477 self.name = v.into();
7478 self
7479 }
7480
7481 /// Sets the value of [id][crate::model::InstanceConfig::id].
7482 ///
7483 /// # Example
7484 /// ```ignore,no_run
7485 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7486 /// let x = InstanceConfig::new().set_id("example");
7487 /// ```
7488 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7489 self.id = v.into();
7490 self
7491 }
7492
7493 /// Sets the value of [instance_type][crate::model::InstanceConfig::instance_type].
7494 ///
7495 /// # Example
7496 /// ```ignore,no_run
7497 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7498 /// let x = InstanceConfig::new().set_instance_type("example");
7499 /// ```
7500 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7501 self.instance_type = v.into();
7502 self
7503 }
7504
7505 /// Sets the value of [hyperthreading][crate::model::InstanceConfig::hyperthreading].
7506 ///
7507 /// # Example
7508 /// ```ignore,no_run
7509 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7510 /// let x = InstanceConfig::new().set_hyperthreading(true);
7511 /// ```
7512 pub fn set_hyperthreading<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7513 self.hyperthreading = v.into();
7514 self
7515 }
7516
7517 /// Sets the value of [os_image][crate::model::InstanceConfig::os_image].
7518 ///
7519 /// # Example
7520 /// ```ignore,no_run
7521 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7522 /// let x = InstanceConfig::new().set_os_image("example");
7523 /// ```
7524 pub fn set_os_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7525 self.os_image = v.into();
7526 self
7527 }
7528
7529 /// Sets the value of [client_network][crate::model::InstanceConfig::client_network].
7530 ///
7531 /// # Example
7532 /// ```ignore,no_run
7533 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7534 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7535 /// let x = InstanceConfig::new().set_client_network(NetworkAddress::default()/* use setters */);
7536 /// ```
7537 #[deprecated]
7538 pub fn set_client_network<T>(mut self, v: T) -> Self
7539 where
7540 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7541 {
7542 self.client_network = std::option::Option::Some(v.into());
7543 self
7544 }
7545
7546 /// Sets or clears the value of [client_network][crate::model::InstanceConfig::client_network].
7547 ///
7548 /// # Example
7549 /// ```ignore,no_run
7550 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7551 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7552 /// let x = InstanceConfig::new().set_or_clear_client_network(Some(NetworkAddress::default()/* use setters */));
7553 /// let x = InstanceConfig::new().set_or_clear_client_network(None::<NetworkAddress>);
7554 /// ```
7555 #[deprecated]
7556 pub fn set_or_clear_client_network<T>(mut self, v: std::option::Option<T>) -> Self
7557 where
7558 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7559 {
7560 self.client_network = v.map(|x| x.into());
7561 self
7562 }
7563
7564 /// Sets the value of [private_network][crate::model::InstanceConfig::private_network].
7565 ///
7566 /// # Example
7567 /// ```ignore,no_run
7568 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7569 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7570 /// let x = InstanceConfig::new().set_private_network(NetworkAddress::default()/* use setters */);
7571 /// ```
7572 #[deprecated]
7573 pub fn set_private_network<T>(mut self, v: T) -> Self
7574 where
7575 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7576 {
7577 self.private_network = std::option::Option::Some(v.into());
7578 self
7579 }
7580
7581 /// Sets or clears the value of [private_network][crate::model::InstanceConfig::private_network].
7582 ///
7583 /// # Example
7584 /// ```ignore,no_run
7585 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7586 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7587 /// let x = InstanceConfig::new().set_or_clear_private_network(Some(NetworkAddress::default()/* use setters */));
7588 /// let x = InstanceConfig::new().set_or_clear_private_network(None::<NetworkAddress>);
7589 /// ```
7590 #[deprecated]
7591 pub fn set_or_clear_private_network<T>(mut self, v: std::option::Option<T>) -> Self
7592 where
7593 T: std::convert::Into<crate::model::instance_config::NetworkAddress>,
7594 {
7595 self.private_network = v.map(|x| x.into());
7596 self
7597 }
7598
7599 /// Sets the value of [user_note][crate::model::InstanceConfig::user_note].
7600 ///
7601 /// # Example
7602 /// ```ignore,no_run
7603 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7604 /// let x = InstanceConfig::new().set_user_note("example");
7605 /// ```
7606 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7607 self.user_note = v.into();
7608 self
7609 }
7610
7611 /// Sets the value of [account_networks_enabled][crate::model::InstanceConfig::account_networks_enabled].
7612 ///
7613 /// # Example
7614 /// ```ignore,no_run
7615 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7616 /// let x = InstanceConfig::new().set_account_networks_enabled(true);
7617 /// ```
7618 pub fn set_account_networks_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7619 self.account_networks_enabled = v.into();
7620 self
7621 }
7622
7623 /// Sets the value of [network_config][crate::model::InstanceConfig::network_config].
7624 ///
7625 /// # Example
7626 /// ```ignore,no_run
7627 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7628 /// use google_cloud_baremetalsolution_v2::model::instance_config::NetworkConfig;
7629 /// let x0 = InstanceConfig::new().set_network_config(NetworkConfig::SingleVlan);
7630 /// let x1 = InstanceConfig::new().set_network_config(NetworkConfig::MultiVlan);
7631 /// ```
7632 pub fn set_network_config<
7633 T: std::convert::Into<crate::model::instance_config::NetworkConfig>,
7634 >(
7635 mut self,
7636 v: T,
7637 ) -> Self {
7638 self.network_config = v.into();
7639 self
7640 }
7641
7642 /// Sets the value of [network_template][crate::model::InstanceConfig::network_template].
7643 ///
7644 /// # Example
7645 /// ```ignore,no_run
7646 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7647 /// let x = InstanceConfig::new().set_network_template("example");
7648 /// ```
7649 pub fn set_network_template<T: std::convert::Into<std::string::String>>(
7650 mut self,
7651 v: T,
7652 ) -> Self {
7653 self.network_template = v.into();
7654 self
7655 }
7656
7657 /// Sets the value of [logical_interfaces][crate::model::InstanceConfig::logical_interfaces].
7658 ///
7659 /// # Example
7660 /// ```ignore,no_run
7661 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7662 /// use google_cloud_baremetalsolution_v2::model::LogicalInterface;
7663 /// let x = InstanceConfig::new()
7664 /// .set_logical_interfaces([
7665 /// LogicalInterface::default()/* use setters */,
7666 /// LogicalInterface::default()/* use (different) setters */,
7667 /// ]);
7668 /// ```
7669 pub fn set_logical_interfaces<T, V>(mut self, v: T) -> Self
7670 where
7671 T: std::iter::IntoIterator<Item = V>,
7672 V: std::convert::Into<crate::model::LogicalInterface>,
7673 {
7674 use std::iter::Iterator;
7675 self.logical_interfaces = v.into_iter().map(|i| i.into()).collect();
7676 self
7677 }
7678
7679 /// Sets the value of [ssh_key_names][crate::model::InstanceConfig::ssh_key_names].
7680 ///
7681 /// # Example
7682 /// ```ignore,no_run
7683 /// # use google_cloud_baremetalsolution_v2::model::InstanceConfig;
7684 /// let x = InstanceConfig::new().set_ssh_key_names(["a", "b", "c"]);
7685 /// ```
7686 pub fn set_ssh_key_names<T, V>(mut self, v: T) -> Self
7687 where
7688 T: std::iter::IntoIterator<Item = V>,
7689 V: std::convert::Into<std::string::String>,
7690 {
7691 use std::iter::Iterator;
7692 self.ssh_key_names = v.into_iter().map(|i| i.into()).collect();
7693 self
7694 }
7695}
7696
7697impl wkt::message::Message for InstanceConfig {
7698 fn typename() -> &'static str {
7699 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig"
7700 }
7701}
7702
7703/// Defines additional types related to [InstanceConfig].
7704pub mod instance_config {
7705 #[allow(unused_imports)]
7706 use super::*;
7707
7708 /// A network.
7709 #[derive(Clone, Default, PartialEq)]
7710 #[non_exhaustive]
7711 pub struct NetworkAddress {
7712 /// Id of the network to use, within the same ProvisioningConfig request.
7713 pub network_id: std::string::String,
7714
7715 /// IPv4 address to be assigned to the server.
7716 pub address: std::string::String,
7717
7718 /// Name of the existing network to use.
7719 pub existing_network_id: std::string::String,
7720
7721 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7722 }
7723
7724 impl NetworkAddress {
7725 /// Creates a new default instance.
7726 pub fn new() -> Self {
7727 std::default::Default::default()
7728 }
7729
7730 /// Sets the value of [network_id][crate::model::instance_config::NetworkAddress::network_id].
7731 ///
7732 /// # Example
7733 /// ```ignore,no_run
7734 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7735 /// let x = NetworkAddress::new().set_network_id("example");
7736 /// ```
7737 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7738 self.network_id = v.into();
7739 self
7740 }
7741
7742 /// Sets the value of [address][crate::model::instance_config::NetworkAddress::address].
7743 ///
7744 /// # Example
7745 /// ```ignore,no_run
7746 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7747 /// let x = NetworkAddress::new().set_address("example");
7748 /// ```
7749 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7750 self.address = v.into();
7751 self
7752 }
7753
7754 /// Sets the value of [existing_network_id][crate::model::instance_config::NetworkAddress::existing_network_id].
7755 ///
7756 /// # Example
7757 /// ```ignore,no_run
7758 /// # use google_cloud_baremetalsolution_v2::model::instance_config::NetworkAddress;
7759 /// let x = NetworkAddress::new().set_existing_network_id("example");
7760 /// ```
7761 pub fn set_existing_network_id<T: std::convert::Into<std::string::String>>(
7762 mut self,
7763 v: T,
7764 ) -> Self {
7765 self.existing_network_id = v.into();
7766 self
7767 }
7768 }
7769
7770 impl wkt::message::Message for NetworkAddress {
7771 fn typename() -> &'static str {
7772 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceConfig.NetworkAddress"
7773 }
7774 }
7775
7776 /// The network configuration of the instance.
7777 ///
7778 /// # Working with unknown values
7779 ///
7780 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7781 /// additional enum variants at any time. Adding new variants is not considered
7782 /// a breaking change. Applications should write their code in anticipation of:
7783 ///
7784 /// - New values appearing in future releases of the client library, **and**
7785 /// - New values received dynamically, without application changes.
7786 ///
7787 /// Please consult the [Working with enums] section in the user guide for some
7788 /// guidelines.
7789 ///
7790 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7791 #[derive(Clone, Debug, PartialEq)]
7792 #[non_exhaustive]
7793 pub enum NetworkConfig {
7794 /// The unspecified network configuration.
7795 NetworkconfigUnspecified,
7796 /// Instance part of single client network and single private network.
7797 SingleVlan,
7798 /// Instance part of multiple (or single) client networks and private
7799 /// networks.
7800 MultiVlan,
7801 /// If set, the enum was initialized with an unknown value.
7802 ///
7803 /// Applications can examine the value using [NetworkConfig::value] or
7804 /// [NetworkConfig::name].
7805 UnknownValue(network_config::UnknownValue),
7806 }
7807
7808 #[doc(hidden)]
7809 pub mod network_config {
7810 #[allow(unused_imports)]
7811 use super::*;
7812 #[derive(Clone, Debug, PartialEq)]
7813 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7814 }
7815
7816 impl NetworkConfig {
7817 /// Gets the enum value.
7818 ///
7819 /// Returns `None` if the enum contains an unknown value deserialized from
7820 /// the string representation of enums.
7821 pub fn value(&self) -> std::option::Option<i32> {
7822 match self {
7823 Self::NetworkconfigUnspecified => std::option::Option::Some(0),
7824 Self::SingleVlan => std::option::Option::Some(1),
7825 Self::MultiVlan => std::option::Option::Some(2),
7826 Self::UnknownValue(u) => u.0.value(),
7827 }
7828 }
7829
7830 /// Gets the enum value as a string.
7831 ///
7832 /// Returns `None` if the enum contains an unknown value deserialized from
7833 /// the integer representation of enums.
7834 pub fn name(&self) -> std::option::Option<&str> {
7835 match self {
7836 Self::NetworkconfigUnspecified => {
7837 std::option::Option::Some("NETWORKCONFIG_UNSPECIFIED")
7838 }
7839 Self::SingleVlan => std::option::Option::Some("SINGLE_VLAN"),
7840 Self::MultiVlan => std::option::Option::Some("MULTI_VLAN"),
7841 Self::UnknownValue(u) => u.0.name(),
7842 }
7843 }
7844 }
7845
7846 impl std::default::Default for NetworkConfig {
7847 fn default() -> Self {
7848 use std::convert::From;
7849 Self::from(0)
7850 }
7851 }
7852
7853 impl std::fmt::Display for NetworkConfig {
7854 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7855 wkt::internal::display_enum(f, self.name(), self.value())
7856 }
7857 }
7858
7859 impl std::convert::From<i32> for NetworkConfig {
7860 fn from(value: i32) -> Self {
7861 match value {
7862 0 => Self::NetworkconfigUnspecified,
7863 1 => Self::SingleVlan,
7864 2 => Self::MultiVlan,
7865 _ => Self::UnknownValue(network_config::UnknownValue(
7866 wkt::internal::UnknownEnumValue::Integer(value),
7867 )),
7868 }
7869 }
7870 }
7871
7872 impl std::convert::From<&str> for NetworkConfig {
7873 fn from(value: &str) -> Self {
7874 use std::string::ToString;
7875 match value {
7876 "NETWORKCONFIG_UNSPECIFIED" => Self::NetworkconfigUnspecified,
7877 "SINGLE_VLAN" => Self::SingleVlan,
7878 "MULTI_VLAN" => Self::MultiVlan,
7879 _ => Self::UnknownValue(network_config::UnknownValue(
7880 wkt::internal::UnknownEnumValue::String(value.to_string()),
7881 )),
7882 }
7883 }
7884 }
7885
7886 impl serde::ser::Serialize for NetworkConfig {
7887 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7888 where
7889 S: serde::Serializer,
7890 {
7891 match self {
7892 Self::NetworkconfigUnspecified => serializer.serialize_i32(0),
7893 Self::SingleVlan => serializer.serialize_i32(1),
7894 Self::MultiVlan => serializer.serialize_i32(2),
7895 Self::UnknownValue(u) => u.0.serialize(serializer),
7896 }
7897 }
7898 }
7899
7900 impl<'de> serde::de::Deserialize<'de> for NetworkConfig {
7901 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7902 where
7903 D: serde::Deserializer<'de>,
7904 {
7905 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NetworkConfig>::new(
7906 ".google.cloud.baremetalsolution.v2.InstanceConfig.NetworkConfig",
7907 ))
7908 }
7909 }
7910}
7911
7912/// Configuration parameters for a new volume.
7913#[derive(Clone, Default, PartialEq)]
7914#[non_exhaustive]
7915pub struct VolumeConfig {
7916 /// Output only. The name of the volume config.
7917 pub name: std::string::String,
7918
7919 /// A transient unique identifier to identify a volume within an
7920 /// ProvisioningConfig request.
7921 pub id: std::string::String,
7922
7923 /// Whether snapshots should be enabled.
7924 pub snapshots_enabled: bool,
7925
7926 /// The type of this Volume.
7927 pub r#type: crate::model::volume_config::Type,
7928
7929 /// Volume protocol.
7930 pub protocol: crate::model::volume_config::Protocol,
7931
7932 /// The requested size of this volume, in GB.
7933 pub size_gb: i32,
7934
7935 /// LUN ranges to be configured. Set only when protocol is PROTOCOL_FC.
7936 pub lun_ranges: std::vec::Vec<crate::model::volume_config::LunRange>,
7937
7938 /// Machine ids connected to this volume. Set only when protocol is
7939 /// PROTOCOL_FC.
7940 pub machine_ids: std::vec::Vec<std::string::String>,
7941
7942 /// NFS exports. Set only when protocol is PROTOCOL_NFS.
7943 pub nfs_exports: std::vec::Vec<crate::model::volume_config::NfsExport>,
7944
7945 /// User note field, it can be used by customers to add additional information
7946 /// for the BMS Ops team .
7947 pub user_note: std::string::String,
7948
7949 /// The GCP service of the storage volume. Available gcp_service are in
7950 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
7951 pub gcp_service: std::string::String,
7952
7953 /// Performance tier of the Volume.
7954 /// Default is SHARED.
7955 pub performance_tier: crate::model::VolumePerformanceTier,
7956
7957 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7958}
7959
7960impl VolumeConfig {
7961 /// Creates a new default instance.
7962 pub fn new() -> Self {
7963 std::default::Default::default()
7964 }
7965
7966 /// Sets the value of [name][crate::model::VolumeConfig::name].
7967 ///
7968 /// # Example
7969 /// ```ignore,no_run
7970 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7971 /// # let project_id = "project_id";
7972 /// # let location_id = "location_id";
7973 /// # let volume_config_id = "volume_config_id";
7974 /// let x = VolumeConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumeConfigs/{volume_config_id}"));
7975 /// ```
7976 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7977 self.name = v.into();
7978 self
7979 }
7980
7981 /// Sets the value of [id][crate::model::VolumeConfig::id].
7982 ///
7983 /// # Example
7984 /// ```ignore,no_run
7985 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7986 /// let x = VolumeConfig::new().set_id("example");
7987 /// ```
7988 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7989 self.id = v.into();
7990 self
7991 }
7992
7993 /// Sets the value of [snapshots_enabled][crate::model::VolumeConfig::snapshots_enabled].
7994 ///
7995 /// # Example
7996 /// ```ignore,no_run
7997 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
7998 /// let x = VolumeConfig::new().set_snapshots_enabled(true);
7999 /// ```
8000 pub fn set_snapshots_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8001 self.snapshots_enabled = v.into();
8002 self
8003 }
8004
8005 /// Sets the value of [r#type][crate::model::VolumeConfig::type].
8006 ///
8007 /// # Example
8008 /// ```ignore,no_run
8009 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8010 /// use google_cloud_baremetalsolution_v2::model::volume_config::Type;
8011 /// let x0 = VolumeConfig::new().set_type(Type::Flash);
8012 /// let x1 = VolumeConfig::new().set_type(Type::Disk);
8013 /// ```
8014 pub fn set_type<T: std::convert::Into<crate::model::volume_config::Type>>(
8015 mut self,
8016 v: T,
8017 ) -> Self {
8018 self.r#type = v.into();
8019 self
8020 }
8021
8022 /// Sets the value of [protocol][crate::model::VolumeConfig::protocol].
8023 ///
8024 /// # Example
8025 /// ```ignore,no_run
8026 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8027 /// use google_cloud_baremetalsolution_v2::model::volume_config::Protocol;
8028 /// let x0 = VolumeConfig::new().set_protocol(Protocol::Fc);
8029 /// let x1 = VolumeConfig::new().set_protocol(Protocol::Nfs);
8030 /// ```
8031 pub fn set_protocol<T: std::convert::Into<crate::model::volume_config::Protocol>>(
8032 mut self,
8033 v: T,
8034 ) -> Self {
8035 self.protocol = v.into();
8036 self
8037 }
8038
8039 /// Sets the value of [size_gb][crate::model::VolumeConfig::size_gb].
8040 ///
8041 /// # Example
8042 /// ```ignore,no_run
8043 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8044 /// let x = VolumeConfig::new().set_size_gb(42);
8045 /// ```
8046 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8047 self.size_gb = v.into();
8048 self
8049 }
8050
8051 /// Sets the value of [lun_ranges][crate::model::VolumeConfig::lun_ranges].
8052 ///
8053 /// # Example
8054 /// ```ignore,no_run
8055 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8056 /// use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8057 /// let x = VolumeConfig::new()
8058 /// .set_lun_ranges([
8059 /// LunRange::default()/* use setters */,
8060 /// LunRange::default()/* use (different) setters */,
8061 /// ]);
8062 /// ```
8063 pub fn set_lun_ranges<T, V>(mut self, v: T) -> Self
8064 where
8065 T: std::iter::IntoIterator<Item = V>,
8066 V: std::convert::Into<crate::model::volume_config::LunRange>,
8067 {
8068 use std::iter::Iterator;
8069 self.lun_ranges = v.into_iter().map(|i| i.into()).collect();
8070 self
8071 }
8072
8073 /// Sets the value of [machine_ids][crate::model::VolumeConfig::machine_ids].
8074 ///
8075 /// # Example
8076 /// ```ignore,no_run
8077 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8078 /// let x = VolumeConfig::new().set_machine_ids(["a", "b", "c"]);
8079 /// ```
8080 pub fn set_machine_ids<T, V>(mut self, v: T) -> Self
8081 where
8082 T: std::iter::IntoIterator<Item = V>,
8083 V: std::convert::Into<std::string::String>,
8084 {
8085 use std::iter::Iterator;
8086 self.machine_ids = v.into_iter().map(|i| i.into()).collect();
8087 self
8088 }
8089
8090 /// Sets the value of [nfs_exports][crate::model::VolumeConfig::nfs_exports].
8091 ///
8092 /// # Example
8093 /// ```ignore,no_run
8094 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8095 /// use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8096 /// let x = VolumeConfig::new()
8097 /// .set_nfs_exports([
8098 /// NfsExport::default()/* use setters */,
8099 /// NfsExport::default()/* use (different) setters */,
8100 /// ]);
8101 /// ```
8102 pub fn set_nfs_exports<T, V>(mut self, v: T) -> Self
8103 where
8104 T: std::iter::IntoIterator<Item = V>,
8105 V: std::convert::Into<crate::model::volume_config::NfsExport>,
8106 {
8107 use std::iter::Iterator;
8108 self.nfs_exports = v.into_iter().map(|i| i.into()).collect();
8109 self
8110 }
8111
8112 /// Sets the value of [user_note][crate::model::VolumeConfig::user_note].
8113 ///
8114 /// # Example
8115 /// ```ignore,no_run
8116 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8117 /// let x = VolumeConfig::new().set_user_note("example");
8118 /// ```
8119 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8120 self.user_note = v.into();
8121 self
8122 }
8123
8124 /// Sets the value of [gcp_service][crate::model::VolumeConfig::gcp_service].
8125 ///
8126 /// # Example
8127 /// ```ignore,no_run
8128 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8129 /// let x = VolumeConfig::new().set_gcp_service("example");
8130 /// ```
8131 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8132 self.gcp_service = v.into();
8133 self
8134 }
8135
8136 /// Sets the value of [performance_tier][crate::model::VolumeConfig::performance_tier].
8137 ///
8138 /// # Example
8139 /// ```ignore,no_run
8140 /// # use google_cloud_baremetalsolution_v2::model::VolumeConfig;
8141 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
8142 /// let x0 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Shared);
8143 /// let x1 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Assigned);
8144 /// let x2 = VolumeConfig::new().set_performance_tier(VolumePerformanceTier::Ht);
8145 /// ```
8146 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
8147 mut self,
8148 v: T,
8149 ) -> Self {
8150 self.performance_tier = v.into();
8151 self
8152 }
8153}
8154
8155impl wkt::message::Message for VolumeConfig {
8156 fn typename() -> &'static str {
8157 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig"
8158 }
8159}
8160
8161/// Defines additional types related to [VolumeConfig].
8162pub mod volume_config {
8163 #[allow(unused_imports)]
8164 use super::*;
8165
8166 /// A LUN(Logical Unit Number) range.
8167 #[derive(Clone, Default, PartialEq)]
8168 #[non_exhaustive]
8169 pub struct LunRange {
8170 /// Number of LUNs to create.
8171 pub quantity: i32,
8172
8173 /// The requested size of each LUN, in GB.
8174 pub size_gb: i32,
8175
8176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8177 }
8178
8179 impl LunRange {
8180 /// Creates a new default instance.
8181 pub fn new() -> Self {
8182 std::default::Default::default()
8183 }
8184
8185 /// Sets the value of [quantity][crate::model::volume_config::LunRange::quantity].
8186 ///
8187 /// # Example
8188 /// ```ignore,no_run
8189 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8190 /// let x = LunRange::new().set_quantity(42);
8191 /// ```
8192 pub fn set_quantity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8193 self.quantity = v.into();
8194 self
8195 }
8196
8197 /// Sets the value of [size_gb][crate::model::volume_config::LunRange::size_gb].
8198 ///
8199 /// # Example
8200 /// ```ignore,no_run
8201 /// # use google_cloud_baremetalsolution_v2::model::volume_config::LunRange;
8202 /// let x = LunRange::new().set_size_gb(42);
8203 /// ```
8204 pub fn set_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8205 self.size_gb = v.into();
8206 self
8207 }
8208 }
8209
8210 impl wkt::message::Message for LunRange {
8211 fn typename() -> &'static str {
8212 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.LunRange"
8213 }
8214 }
8215
8216 /// A NFS export entry.
8217 #[derive(Clone, Default, PartialEq)]
8218 #[non_exhaustive]
8219 pub struct NfsExport {
8220 /// Network to use to publish the export.
8221 pub network_id: std::string::String,
8222
8223 /// Export permissions.
8224 pub permissions: crate::model::volume_config::nfs_export::Permissions,
8225
8226 /// Disable root squashing, which is a feature of NFS.
8227 /// Root squash is a special mapping of the remote superuser (root) identity
8228 /// when using identity authentication.
8229 pub no_root_squash: bool,
8230
8231 /// Allow the setuid flag.
8232 pub allow_suid: bool,
8233
8234 /// Allow dev flag in NfsShare AllowedClientsRequest.
8235 pub allow_dev: bool,
8236
8237 /// A client object.
8238 pub client: std::option::Option<crate::model::volume_config::nfs_export::Client>,
8239
8240 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8241 }
8242
8243 impl NfsExport {
8244 /// Creates a new default instance.
8245 pub fn new() -> Self {
8246 std::default::Default::default()
8247 }
8248
8249 /// Sets the value of [network_id][crate::model::volume_config::NfsExport::network_id].
8250 ///
8251 /// # Example
8252 /// ```ignore,no_run
8253 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8254 /// let x = NfsExport::new().set_network_id("example");
8255 /// ```
8256 pub fn set_network_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8257 self.network_id = v.into();
8258 self
8259 }
8260
8261 /// Sets the value of [permissions][crate::model::volume_config::NfsExport::permissions].
8262 ///
8263 /// # Example
8264 /// ```ignore,no_run
8265 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8266 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Permissions;
8267 /// let x0 = NfsExport::new().set_permissions(Permissions::ReadOnly);
8268 /// let x1 = NfsExport::new().set_permissions(Permissions::ReadWrite);
8269 /// ```
8270 pub fn set_permissions<
8271 T: std::convert::Into<crate::model::volume_config::nfs_export::Permissions>,
8272 >(
8273 mut self,
8274 v: T,
8275 ) -> Self {
8276 self.permissions = v.into();
8277 self
8278 }
8279
8280 /// Sets the value of [no_root_squash][crate::model::volume_config::NfsExport::no_root_squash].
8281 ///
8282 /// # Example
8283 /// ```ignore,no_run
8284 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8285 /// let x = NfsExport::new().set_no_root_squash(true);
8286 /// ```
8287 pub fn set_no_root_squash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8288 self.no_root_squash = v.into();
8289 self
8290 }
8291
8292 /// Sets the value of [allow_suid][crate::model::volume_config::NfsExport::allow_suid].
8293 ///
8294 /// # Example
8295 /// ```ignore,no_run
8296 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8297 /// let x = NfsExport::new().set_allow_suid(true);
8298 /// ```
8299 pub fn set_allow_suid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8300 self.allow_suid = v.into();
8301 self
8302 }
8303
8304 /// Sets the value of [allow_dev][crate::model::volume_config::NfsExport::allow_dev].
8305 ///
8306 /// # Example
8307 /// ```ignore,no_run
8308 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8309 /// let x = NfsExport::new().set_allow_dev(true);
8310 /// ```
8311 pub fn set_allow_dev<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8312 self.allow_dev = v.into();
8313 self
8314 }
8315
8316 /// Sets the value of [client][crate::model::volume_config::NfsExport::client].
8317 ///
8318 /// Note that all the setters affecting `client` are mutually
8319 /// exclusive.
8320 ///
8321 /// # Example
8322 /// ```ignore,no_run
8323 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8324 /// use google_cloud_baremetalsolution_v2::model::volume_config::nfs_export::Client;
8325 /// let x = NfsExport::new().set_client(Some(Client::MachineId("example".to_string())));
8326 /// ```
8327 pub fn set_client<
8328 T: std::convert::Into<
8329 std::option::Option<crate::model::volume_config::nfs_export::Client>,
8330 >,
8331 >(
8332 mut self,
8333 v: T,
8334 ) -> Self {
8335 self.client = v.into();
8336 self
8337 }
8338
8339 /// The value of [client][crate::model::volume_config::NfsExport::client]
8340 /// if it holds a `MachineId`, `None` if the field is not set or
8341 /// holds a different branch.
8342 pub fn machine_id(&self) -> std::option::Option<&std::string::String> {
8343 #[allow(unreachable_patterns)]
8344 self.client.as_ref().and_then(|v| match v {
8345 crate::model::volume_config::nfs_export::Client::MachineId(v) => {
8346 std::option::Option::Some(v)
8347 }
8348 _ => std::option::Option::None,
8349 })
8350 }
8351
8352 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8353 /// to hold a `MachineId`.
8354 ///
8355 /// Note that all the setters affecting `client` are
8356 /// mutually exclusive.
8357 ///
8358 /// # Example
8359 /// ```ignore,no_run
8360 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8361 /// let x = NfsExport::new().set_machine_id("example");
8362 /// assert!(x.machine_id().is_some());
8363 /// assert!(x.cidr().is_none());
8364 /// ```
8365 pub fn set_machine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8366 self.client = std::option::Option::Some(
8367 crate::model::volume_config::nfs_export::Client::MachineId(v.into()),
8368 );
8369 self
8370 }
8371
8372 /// The value of [client][crate::model::volume_config::NfsExport::client]
8373 /// if it holds a `Cidr`, `None` if the field is not set or
8374 /// holds a different branch.
8375 pub fn cidr(&self) -> std::option::Option<&std::string::String> {
8376 #[allow(unreachable_patterns)]
8377 self.client.as_ref().and_then(|v| match v {
8378 crate::model::volume_config::nfs_export::Client::Cidr(v) => {
8379 std::option::Option::Some(v)
8380 }
8381 _ => std::option::Option::None,
8382 })
8383 }
8384
8385 /// Sets the value of [client][crate::model::volume_config::NfsExport::client]
8386 /// to hold a `Cidr`.
8387 ///
8388 /// Note that all the setters affecting `client` are
8389 /// mutually exclusive.
8390 ///
8391 /// # Example
8392 /// ```ignore,no_run
8393 /// # use google_cloud_baremetalsolution_v2::model::volume_config::NfsExport;
8394 /// let x = NfsExport::new().set_cidr("example");
8395 /// assert!(x.cidr().is_some());
8396 /// assert!(x.machine_id().is_none());
8397 /// ```
8398 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8399 self.client = std::option::Option::Some(
8400 crate::model::volume_config::nfs_export::Client::Cidr(v.into()),
8401 );
8402 self
8403 }
8404 }
8405
8406 impl wkt::message::Message for NfsExport {
8407 fn typename() -> &'static str {
8408 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport"
8409 }
8410 }
8411
8412 /// Defines additional types related to [NfsExport].
8413 pub mod nfs_export {
8414 #[allow(unused_imports)]
8415 use super::*;
8416
8417 /// Permissions that can granted for an export.
8418 ///
8419 /// # Working with unknown values
8420 ///
8421 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8422 /// additional enum variants at any time. Adding new variants is not considered
8423 /// a breaking change. Applications should write their code in anticipation of:
8424 ///
8425 /// - New values appearing in future releases of the client library, **and**
8426 /// - New values received dynamically, without application changes.
8427 ///
8428 /// Please consult the [Working with enums] section in the user guide for some
8429 /// guidelines.
8430 ///
8431 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8432 #[derive(Clone, Debug, PartialEq)]
8433 #[non_exhaustive]
8434 pub enum Permissions {
8435 /// Unspecified value.
8436 Unspecified,
8437 /// Read-only permission.
8438 ReadOnly,
8439 /// Read-write permission.
8440 ReadWrite,
8441 /// If set, the enum was initialized with an unknown value.
8442 ///
8443 /// Applications can examine the value using [Permissions::value] or
8444 /// [Permissions::name].
8445 UnknownValue(permissions::UnknownValue),
8446 }
8447
8448 #[doc(hidden)]
8449 pub mod permissions {
8450 #[allow(unused_imports)]
8451 use super::*;
8452 #[derive(Clone, Debug, PartialEq)]
8453 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8454 }
8455
8456 impl Permissions {
8457 /// Gets the enum value.
8458 ///
8459 /// Returns `None` if the enum contains an unknown value deserialized from
8460 /// the string representation of enums.
8461 pub fn value(&self) -> std::option::Option<i32> {
8462 match self {
8463 Self::Unspecified => std::option::Option::Some(0),
8464 Self::ReadOnly => std::option::Option::Some(1),
8465 Self::ReadWrite => std::option::Option::Some(2),
8466 Self::UnknownValue(u) => u.0.value(),
8467 }
8468 }
8469
8470 /// Gets the enum value as a string.
8471 ///
8472 /// Returns `None` if the enum contains an unknown value deserialized from
8473 /// the integer representation of enums.
8474 pub fn name(&self) -> std::option::Option<&str> {
8475 match self {
8476 Self::Unspecified => std::option::Option::Some("PERMISSIONS_UNSPECIFIED"),
8477 Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
8478 Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
8479 Self::UnknownValue(u) => u.0.name(),
8480 }
8481 }
8482 }
8483
8484 impl std::default::Default for Permissions {
8485 fn default() -> Self {
8486 use std::convert::From;
8487 Self::from(0)
8488 }
8489 }
8490
8491 impl std::fmt::Display for Permissions {
8492 fn fmt(
8493 &self,
8494 f: &mut std::fmt::Formatter<'_>,
8495 ) -> std::result::Result<(), std::fmt::Error> {
8496 wkt::internal::display_enum(f, self.name(), self.value())
8497 }
8498 }
8499
8500 impl std::convert::From<i32> for Permissions {
8501 fn from(value: i32) -> Self {
8502 match value {
8503 0 => Self::Unspecified,
8504 1 => Self::ReadOnly,
8505 2 => Self::ReadWrite,
8506 _ => Self::UnknownValue(permissions::UnknownValue(
8507 wkt::internal::UnknownEnumValue::Integer(value),
8508 )),
8509 }
8510 }
8511 }
8512
8513 impl std::convert::From<&str> for Permissions {
8514 fn from(value: &str) -> Self {
8515 use std::string::ToString;
8516 match value {
8517 "PERMISSIONS_UNSPECIFIED" => Self::Unspecified,
8518 "READ_ONLY" => Self::ReadOnly,
8519 "READ_WRITE" => Self::ReadWrite,
8520 _ => Self::UnknownValue(permissions::UnknownValue(
8521 wkt::internal::UnknownEnumValue::String(value.to_string()),
8522 )),
8523 }
8524 }
8525 }
8526
8527 impl serde::ser::Serialize for Permissions {
8528 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8529 where
8530 S: serde::Serializer,
8531 {
8532 match self {
8533 Self::Unspecified => serializer.serialize_i32(0),
8534 Self::ReadOnly => serializer.serialize_i32(1),
8535 Self::ReadWrite => serializer.serialize_i32(2),
8536 Self::UnknownValue(u) => u.0.serialize(serializer),
8537 }
8538 }
8539 }
8540
8541 impl<'de> serde::de::Deserialize<'de> for Permissions {
8542 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8543 where
8544 D: serde::Deserializer<'de>,
8545 {
8546 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Permissions>::new(
8547 ".google.cloud.baremetalsolution.v2.VolumeConfig.NfsExport.Permissions",
8548 ))
8549 }
8550 }
8551
8552 /// A client object.
8553 #[derive(Clone, Debug, PartialEq)]
8554 #[non_exhaustive]
8555 pub enum Client {
8556 /// Either a single machine, identified by an ID, or a comma-separated
8557 /// list of machine IDs.
8558 MachineId(std::string::String),
8559 /// A CIDR range.
8560 Cidr(std::string::String),
8561 }
8562 }
8563
8564 /// The types of Volumes.
8565 ///
8566 /// # Working with unknown values
8567 ///
8568 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8569 /// additional enum variants at any time. Adding new variants is not considered
8570 /// a breaking change. Applications should write their code in anticipation of:
8571 ///
8572 /// - New values appearing in future releases of the client library, **and**
8573 /// - New values received dynamically, without application changes.
8574 ///
8575 /// Please consult the [Working with enums] section in the user guide for some
8576 /// guidelines.
8577 ///
8578 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8579 #[derive(Clone, Debug, PartialEq)]
8580 #[non_exhaustive]
8581 pub enum Type {
8582 /// The unspecified type.
8583 Unspecified,
8584 /// This Volume is on flash.
8585 Flash,
8586 /// This Volume is on disk.
8587 Disk,
8588 /// If set, the enum was initialized with an unknown value.
8589 ///
8590 /// Applications can examine the value using [Type::value] or
8591 /// [Type::name].
8592 UnknownValue(r#type::UnknownValue),
8593 }
8594
8595 #[doc(hidden)]
8596 pub mod r#type {
8597 #[allow(unused_imports)]
8598 use super::*;
8599 #[derive(Clone, Debug, PartialEq)]
8600 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8601 }
8602
8603 impl Type {
8604 /// Gets the enum value.
8605 ///
8606 /// Returns `None` if the enum contains an unknown value deserialized from
8607 /// the string representation of enums.
8608 pub fn value(&self) -> std::option::Option<i32> {
8609 match self {
8610 Self::Unspecified => std::option::Option::Some(0),
8611 Self::Flash => std::option::Option::Some(1),
8612 Self::Disk => std::option::Option::Some(2),
8613 Self::UnknownValue(u) => u.0.value(),
8614 }
8615 }
8616
8617 /// Gets the enum value as a string.
8618 ///
8619 /// Returns `None` if the enum contains an unknown value deserialized from
8620 /// the integer representation of enums.
8621 pub fn name(&self) -> std::option::Option<&str> {
8622 match self {
8623 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8624 Self::Flash => std::option::Option::Some("FLASH"),
8625 Self::Disk => std::option::Option::Some("DISK"),
8626 Self::UnknownValue(u) => u.0.name(),
8627 }
8628 }
8629 }
8630
8631 impl std::default::Default for Type {
8632 fn default() -> Self {
8633 use std::convert::From;
8634 Self::from(0)
8635 }
8636 }
8637
8638 impl std::fmt::Display for Type {
8639 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8640 wkt::internal::display_enum(f, self.name(), self.value())
8641 }
8642 }
8643
8644 impl std::convert::From<i32> for Type {
8645 fn from(value: i32) -> Self {
8646 match value {
8647 0 => Self::Unspecified,
8648 1 => Self::Flash,
8649 2 => Self::Disk,
8650 _ => Self::UnknownValue(r#type::UnknownValue(
8651 wkt::internal::UnknownEnumValue::Integer(value),
8652 )),
8653 }
8654 }
8655 }
8656
8657 impl std::convert::From<&str> for Type {
8658 fn from(value: &str) -> Self {
8659 use std::string::ToString;
8660 match value {
8661 "TYPE_UNSPECIFIED" => Self::Unspecified,
8662 "FLASH" => Self::Flash,
8663 "DISK" => Self::Disk,
8664 _ => Self::UnknownValue(r#type::UnknownValue(
8665 wkt::internal::UnknownEnumValue::String(value.to_string()),
8666 )),
8667 }
8668 }
8669 }
8670
8671 impl serde::ser::Serialize for Type {
8672 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8673 where
8674 S: serde::Serializer,
8675 {
8676 match self {
8677 Self::Unspecified => serializer.serialize_i32(0),
8678 Self::Flash => serializer.serialize_i32(1),
8679 Self::Disk => serializer.serialize_i32(2),
8680 Self::UnknownValue(u) => u.0.serialize(serializer),
8681 }
8682 }
8683 }
8684
8685 impl<'de> serde::de::Deserialize<'de> for Type {
8686 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8687 where
8688 D: serde::Deserializer<'de>,
8689 {
8690 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
8691 ".google.cloud.baremetalsolution.v2.VolumeConfig.Type",
8692 ))
8693 }
8694 }
8695
8696 /// The protocol used to access the volume.
8697 ///
8698 /// # Working with unknown values
8699 ///
8700 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8701 /// additional enum variants at any time. Adding new variants is not considered
8702 /// a breaking change. Applications should write their code in anticipation of:
8703 ///
8704 /// - New values appearing in future releases of the client library, **and**
8705 /// - New values received dynamically, without application changes.
8706 ///
8707 /// Please consult the [Working with enums] section in the user guide for some
8708 /// guidelines.
8709 ///
8710 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8711 #[derive(Clone, Debug, PartialEq)]
8712 #[non_exhaustive]
8713 pub enum Protocol {
8714 /// Unspecified value.
8715 Unspecified,
8716 /// Fibre channel.
8717 Fc,
8718 /// Network file system.
8719 Nfs,
8720 /// If set, the enum was initialized with an unknown value.
8721 ///
8722 /// Applications can examine the value using [Protocol::value] or
8723 /// [Protocol::name].
8724 UnknownValue(protocol::UnknownValue),
8725 }
8726
8727 #[doc(hidden)]
8728 pub mod protocol {
8729 #[allow(unused_imports)]
8730 use super::*;
8731 #[derive(Clone, Debug, PartialEq)]
8732 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8733 }
8734
8735 impl Protocol {
8736 /// Gets the enum value.
8737 ///
8738 /// Returns `None` if the enum contains an unknown value deserialized from
8739 /// the string representation of enums.
8740 pub fn value(&self) -> std::option::Option<i32> {
8741 match self {
8742 Self::Unspecified => std::option::Option::Some(0),
8743 Self::Fc => std::option::Option::Some(1),
8744 Self::Nfs => std::option::Option::Some(2),
8745 Self::UnknownValue(u) => u.0.value(),
8746 }
8747 }
8748
8749 /// Gets the enum value as a string.
8750 ///
8751 /// Returns `None` if the enum contains an unknown value deserialized from
8752 /// the integer representation of enums.
8753 pub fn name(&self) -> std::option::Option<&str> {
8754 match self {
8755 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
8756 Self::Fc => std::option::Option::Some("PROTOCOL_FC"),
8757 Self::Nfs => std::option::Option::Some("PROTOCOL_NFS"),
8758 Self::UnknownValue(u) => u.0.name(),
8759 }
8760 }
8761 }
8762
8763 impl std::default::Default for Protocol {
8764 fn default() -> Self {
8765 use std::convert::From;
8766 Self::from(0)
8767 }
8768 }
8769
8770 impl std::fmt::Display for Protocol {
8771 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8772 wkt::internal::display_enum(f, self.name(), self.value())
8773 }
8774 }
8775
8776 impl std::convert::From<i32> for Protocol {
8777 fn from(value: i32) -> Self {
8778 match value {
8779 0 => Self::Unspecified,
8780 1 => Self::Fc,
8781 2 => Self::Nfs,
8782 _ => Self::UnknownValue(protocol::UnknownValue(
8783 wkt::internal::UnknownEnumValue::Integer(value),
8784 )),
8785 }
8786 }
8787 }
8788
8789 impl std::convert::From<&str> for Protocol {
8790 fn from(value: &str) -> Self {
8791 use std::string::ToString;
8792 match value {
8793 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
8794 "PROTOCOL_FC" => Self::Fc,
8795 "PROTOCOL_NFS" => Self::Nfs,
8796 _ => Self::UnknownValue(protocol::UnknownValue(
8797 wkt::internal::UnknownEnumValue::String(value.to_string()),
8798 )),
8799 }
8800 }
8801 }
8802
8803 impl serde::ser::Serialize for Protocol {
8804 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8805 where
8806 S: serde::Serializer,
8807 {
8808 match self {
8809 Self::Unspecified => serializer.serialize_i32(0),
8810 Self::Fc => serializer.serialize_i32(1),
8811 Self::Nfs => serializer.serialize_i32(2),
8812 Self::UnknownValue(u) => u.0.serialize(serializer),
8813 }
8814 }
8815 }
8816
8817 impl<'de> serde::de::Deserialize<'de> for Protocol {
8818 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8819 where
8820 D: serde::Deserializer<'de>,
8821 {
8822 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
8823 ".google.cloud.baremetalsolution.v2.VolumeConfig.Protocol",
8824 ))
8825 }
8826 }
8827}
8828
8829/// Configuration parameters for a new network.
8830#[derive(Clone, Default, PartialEq)]
8831#[non_exhaustive]
8832pub struct NetworkConfig {
8833 /// Output only. The name of the network config.
8834 pub name: std::string::String,
8835
8836 /// A transient unique identifier to identify a volume within an
8837 /// ProvisioningConfig request.
8838 pub id: std::string::String,
8839
8840 /// The type of this network, either Client or Private.
8841 pub r#type: crate::model::network_config::Type,
8842
8843 /// Interconnect bandwidth. Set only when type is CLIENT.
8844 pub bandwidth: crate::model::network_config::Bandwidth,
8845
8846 /// List of VLAN attachments. As of now there are always 2 attachments, but it
8847 /// is going to change in the future (multi vlan).
8848 pub vlan_attachments: std::vec::Vec<crate::model::network_config::IntakeVlanAttachment>,
8849
8850 /// CIDR range of the network.
8851 pub cidr: std::string::String,
8852
8853 /// Service CIDR, if any.
8854 pub service_cidr: crate::model::network_config::ServiceCidr,
8855
8856 /// User note field, it can be used by customers to add additional information
8857 /// for the BMS Ops team .
8858 pub user_note: std::string::String,
8859
8860 /// The GCP service of the network. Available gcp_service are in
8861 /// <https://cloud.google.com/bare-metal/docs/bms-planning>.
8862 pub gcp_service: std::string::String,
8863
8864 /// Whether the VLAN attachment pair is located in the same project.
8865 pub vlan_same_project: bool,
8866
8867 /// The JumboFramesEnabled option for customer to set.
8868 pub jumbo_frames_enabled: bool,
8869
8870 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8871}
8872
8873impl NetworkConfig {
8874 /// Creates a new default instance.
8875 pub fn new() -> Self {
8876 std::default::Default::default()
8877 }
8878
8879 /// Sets the value of [name][crate::model::NetworkConfig::name].
8880 ///
8881 /// # Example
8882 /// ```ignore,no_run
8883 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8884 /// # let project_id = "project_id";
8885 /// # let location_id = "location_id";
8886 /// # let network_config_id = "network_config_id";
8887 /// let x = NetworkConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/networkConfigs/{network_config_id}"));
8888 /// ```
8889 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8890 self.name = v.into();
8891 self
8892 }
8893
8894 /// Sets the value of [id][crate::model::NetworkConfig::id].
8895 ///
8896 /// # Example
8897 /// ```ignore,no_run
8898 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8899 /// let x = NetworkConfig::new().set_id("example");
8900 /// ```
8901 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8902 self.id = v.into();
8903 self
8904 }
8905
8906 /// Sets the value of [r#type][crate::model::NetworkConfig::type].
8907 ///
8908 /// # Example
8909 /// ```ignore,no_run
8910 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8911 /// use google_cloud_baremetalsolution_v2::model::network_config::Type;
8912 /// let x0 = NetworkConfig::new().set_type(Type::Client);
8913 /// let x1 = NetworkConfig::new().set_type(Type::Private);
8914 /// ```
8915 pub fn set_type<T: std::convert::Into<crate::model::network_config::Type>>(
8916 mut self,
8917 v: T,
8918 ) -> Self {
8919 self.r#type = v.into();
8920 self
8921 }
8922
8923 /// Sets the value of [bandwidth][crate::model::NetworkConfig::bandwidth].
8924 ///
8925 /// # Example
8926 /// ```ignore,no_run
8927 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8928 /// use google_cloud_baremetalsolution_v2::model::network_config::Bandwidth;
8929 /// let x0 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw1Gbps);
8930 /// let x1 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw2Gbps);
8931 /// let x2 = NetworkConfig::new().set_bandwidth(Bandwidth::Bw5Gbps);
8932 /// ```
8933 pub fn set_bandwidth<T: std::convert::Into<crate::model::network_config::Bandwidth>>(
8934 mut self,
8935 v: T,
8936 ) -> Self {
8937 self.bandwidth = v.into();
8938 self
8939 }
8940
8941 /// Sets the value of [vlan_attachments][crate::model::NetworkConfig::vlan_attachments].
8942 ///
8943 /// # Example
8944 /// ```ignore,no_run
8945 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8946 /// use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
8947 /// let x = NetworkConfig::new()
8948 /// .set_vlan_attachments([
8949 /// IntakeVlanAttachment::default()/* use setters */,
8950 /// IntakeVlanAttachment::default()/* use (different) setters */,
8951 /// ]);
8952 /// ```
8953 pub fn set_vlan_attachments<T, V>(mut self, v: T) -> Self
8954 where
8955 T: std::iter::IntoIterator<Item = V>,
8956 V: std::convert::Into<crate::model::network_config::IntakeVlanAttachment>,
8957 {
8958 use std::iter::Iterator;
8959 self.vlan_attachments = v.into_iter().map(|i| i.into()).collect();
8960 self
8961 }
8962
8963 /// Sets the value of [cidr][crate::model::NetworkConfig::cidr].
8964 ///
8965 /// # Example
8966 /// ```ignore,no_run
8967 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8968 /// let x = NetworkConfig::new().set_cidr("example");
8969 /// ```
8970 pub fn set_cidr<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8971 self.cidr = v.into();
8972 self
8973 }
8974
8975 /// Sets the value of [service_cidr][crate::model::NetworkConfig::service_cidr].
8976 ///
8977 /// # Example
8978 /// ```ignore,no_run
8979 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8980 /// use google_cloud_baremetalsolution_v2::model::network_config::ServiceCidr;
8981 /// let x0 = NetworkConfig::new().set_service_cidr(ServiceCidr::Disabled);
8982 /// let x1 = NetworkConfig::new().set_service_cidr(ServiceCidr::High26);
8983 /// let x2 = NetworkConfig::new().set_service_cidr(ServiceCidr::High27);
8984 /// ```
8985 pub fn set_service_cidr<T: std::convert::Into<crate::model::network_config::ServiceCidr>>(
8986 mut self,
8987 v: T,
8988 ) -> Self {
8989 self.service_cidr = v.into();
8990 self
8991 }
8992
8993 /// Sets the value of [user_note][crate::model::NetworkConfig::user_note].
8994 ///
8995 /// # Example
8996 /// ```ignore,no_run
8997 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
8998 /// let x = NetworkConfig::new().set_user_note("example");
8999 /// ```
9000 pub fn set_user_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9001 self.user_note = v.into();
9002 self
9003 }
9004
9005 /// Sets the value of [gcp_service][crate::model::NetworkConfig::gcp_service].
9006 ///
9007 /// # Example
9008 /// ```ignore,no_run
9009 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
9010 /// let x = NetworkConfig::new().set_gcp_service("example");
9011 /// ```
9012 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9013 self.gcp_service = v.into();
9014 self
9015 }
9016
9017 /// Sets the value of [vlan_same_project][crate::model::NetworkConfig::vlan_same_project].
9018 ///
9019 /// # Example
9020 /// ```ignore,no_run
9021 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
9022 /// let x = NetworkConfig::new().set_vlan_same_project(true);
9023 /// ```
9024 pub fn set_vlan_same_project<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9025 self.vlan_same_project = v.into();
9026 self
9027 }
9028
9029 /// Sets the value of [jumbo_frames_enabled][crate::model::NetworkConfig::jumbo_frames_enabled].
9030 ///
9031 /// # Example
9032 /// ```ignore,no_run
9033 /// # use google_cloud_baremetalsolution_v2::model::NetworkConfig;
9034 /// let x = NetworkConfig::new().set_jumbo_frames_enabled(true);
9035 /// ```
9036 pub fn set_jumbo_frames_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9037 self.jumbo_frames_enabled = v.into();
9038 self
9039 }
9040}
9041
9042impl wkt::message::Message for NetworkConfig {
9043 fn typename() -> &'static str {
9044 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig"
9045 }
9046}
9047
9048/// Defines additional types related to [NetworkConfig].
9049pub mod network_config {
9050 #[allow(unused_imports)]
9051 use super::*;
9052
9053 /// A GCP vlan attachment.
9054 #[derive(Clone, Default, PartialEq)]
9055 #[non_exhaustive]
9056 pub struct IntakeVlanAttachment {
9057 /// Identifier of the VLAN attachment.
9058 pub id: std::string::String,
9059
9060 /// Attachment pairing key.
9061 pub pairing_key: std::string::String,
9062
9063 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9064 }
9065
9066 impl IntakeVlanAttachment {
9067 /// Creates a new default instance.
9068 pub fn new() -> Self {
9069 std::default::Default::default()
9070 }
9071
9072 /// Sets the value of [id][crate::model::network_config::IntakeVlanAttachment::id].
9073 ///
9074 /// # Example
9075 /// ```ignore,no_run
9076 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
9077 /// let x = IntakeVlanAttachment::new().set_id("example");
9078 /// ```
9079 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9080 self.id = v.into();
9081 self
9082 }
9083
9084 /// Sets the value of [pairing_key][crate::model::network_config::IntakeVlanAttachment::pairing_key].
9085 ///
9086 /// # Example
9087 /// ```ignore,no_run
9088 /// # use google_cloud_baremetalsolution_v2::model::network_config::IntakeVlanAttachment;
9089 /// let x = IntakeVlanAttachment::new().set_pairing_key("example");
9090 /// ```
9091 pub fn set_pairing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9092 self.pairing_key = v.into();
9093 self
9094 }
9095 }
9096
9097 impl wkt::message::Message for IntakeVlanAttachment {
9098 fn typename() -> &'static str {
9099 "type.googleapis.com/google.cloud.baremetalsolution.v2.NetworkConfig.IntakeVlanAttachment"
9100 }
9101 }
9102
9103 /// Network type.
9104 ///
9105 /// # Working with unknown values
9106 ///
9107 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9108 /// additional enum variants at any time. Adding new variants is not considered
9109 /// a breaking change. Applications should write their code in anticipation of:
9110 ///
9111 /// - New values appearing in future releases of the client library, **and**
9112 /// - New values received dynamically, without application changes.
9113 ///
9114 /// Please consult the [Working with enums] section in the user guide for some
9115 /// guidelines.
9116 ///
9117 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9118 #[derive(Clone, Debug, PartialEq)]
9119 #[non_exhaustive]
9120 pub enum Type {
9121 /// Unspecified value.
9122 Unspecified,
9123 /// Client network, that is a network peered to a GCP VPC.
9124 Client,
9125 /// Private network, that is a network local to the BMS POD.
9126 Private,
9127 /// If set, the enum was initialized with an unknown value.
9128 ///
9129 /// Applications can examine the value using [Type::value] or
9130 /// [Type::name].
9131 UnknownValue(r#type::UnknownValue),
9132 }
9133
9134 #[doc(hidden)]
9135 pub mod r#type {
9136 #[allow(unused_imports)]
9137 use super::*;
9138 #[derive(Clone, Debug, PartialEq)]
9139 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9140 }
9141
9142 impl Type {
9143 /// Gets the enum value.
9144 ///
9145 /// Returns `None` if the enum contains an unknown value deserialized from
9146 /// the string representation of enums.
9147 pub fn value(&self) -> std::option::Option<i32> {
9148 match self {
9149 Self::Unspecified => std::option::Option::Some(0),
9150 Self::Client => std::option::Option::Some(1),
9151 Self::Private => std::option::Option::Some(2),
9152 Self::UnknownValue(u) => u.0.value(),
9153 }
9154 }
9155
9156 /// Gets the enum value as a string.
9157 ///
9158 /// Returns `None` if the enum contains an unknown value deserialized from
9159 /// the integer representation of enums.
9160 pub fn name(&self) -> std::option::Option<&str> {
9161 match self {
9162 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
9163 Self::Client => std::option::Option::Some("CLIENT"),
9164 Self::Private => std::option::Option::Some("PRIVATE"),
9165 Self::UnknownValue(u) => u.0.name(),
9166 }
9167 }
9168 }
9169
9170 impl std::default::Default for Type {
9171 fn default() -> Self {
9172 use std::convert::From;
9173 Self::from(0)
9174 }
9175 }
9176
9177 impl std::fmt::Display for Type {
9178 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9179 wkt::internal::display_enum(f, self.name(), self.value())
9180 }
9181 }
9182
9183 impl std::convert::From<i32> for Type {
9184 fn from(value: i32) -> Self {
9185 match value {
9186 0 => Self::Unspecified,
9187 1 => Self::Client,
9188 2 => Self::Private,
9189 _ => Self::UnknownValue(r#type::UnknownValue(
9190 wkt::internal::UnknownEnumValue::Integer(value),
9191 )),
9192 }
9193 }
9194 }
9195
9196 impl std::convert::From<&str> for Type {
9197 fn from(value: &str) -> Self {
9198 use std::string::ToString;
9199 match value {
9200 "TYPE_UNSPECIFIED" => Self::Unspecified,
9201 "CLIENT" => Self::Client,
9202 "PRIVATE" => Self::Private,
9203 _ => Self::UnknownValue(r#type::UnknownValue(
9204 wkt::internal::UnknownEnumValue::String(value.to_string()),
9205 )),
9206 }
9207 }
9208 }
9209
9210 impl serde::ser::Serialize for Type {
9211 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9212 where
9213 S: serde::Serializer,
9214 {
9215 match self {
9216 Self::Unspecified => serializer.serialize_i32(0),
9217 Self::Client => serializer.serialize_i32(1),
9218 Self::Private => serializer.serialize_i32(2),
9219 Self::UnknownValue(u) => u.0.serialize(serializer),
9220 }
9221 }
9222 }
9223
9224 impl<'de> serde::de::Deserialize<'de> for Type {
9225 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9226 where
9227 D: serde::Deserializer<'de>,
9228 {
9229 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
9230 ".google.cloud.baremetalsolution.v2.NetworkConfig.Type",
9231 ))
9232 }
9233 }
9234
9235 /// Interconnect bandwidth.
9236 ///
9237 /// # Working with unknown values
9238 ///
9239 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9240 /// additional enum variants at any time. Adding new variants is not considered
9241 /// a breaking change. Applications should write their code in anticipation of:
9242 ///
9243 /// - New values appearing in future releases of the client library, **and**
9244 /// - New values received dynamically, without application changes.
9245 ///
9246 /// Please consult the [Working with enums] section in the user guide for some
9247 /// guidelines.
9248 ///
9249 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9250 #[derive(Clone, Debug, PartialEq)]
9251 #[non_exhaustive]
9252 pub enum Bandwidth {
9253 /// Unspecified value.
9254 Unspecified,
9255 /// 1 Gbps.
9256 Bw1Gbps,
9257 /// 2 Gbps.
9258 Bw2Gbps,
9259 /// 5 Gbps.
9260 Bw5Gbps,
9261 /// 10 Gbps.
9262 Bw10Gbps,
9263 /// If set, the enum was initialized with an unknown value.
9264 ///
9265 /// Applications can examine the value using [Bandwidth::value] or
9266 /// [Bandwidth::name].
9267 UnknownValue(bandwidth::UnknownValue),
9268 }
9269
9270 #[doc(hidden)]
9271 pub mod bandwidth {
9272 #[allow(unused_imports)]
9273 use super::*;
9274 #[derive(Clone, Debug, PartialEq)]
9275 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9276 }
9277
9278 impl Bandwidth {
9279 /// Gets the enum value.
9280 ///
9281 /// Returns `None` if the enum contains an unknown value deserialized from
9282 /// the string representation of enums.
9283 pub fn value(&self) -> std::option::Option<i32> {
9284 match self {
9285 Self::Unspecified => std::option::Option::Some(0),
9286 Self::Bw1Gbps => std::option::Option::Some(1),
9287 Self::Bw2Gbps => std::option::Option::Some(2),
9288 Self::Bw5Gbps => std::option::Option::Some(3),
9289 Self::Bw10Gbps => std::option::Option::Some(4),
9290 Self::UnknownValue(u) => u.0.value(),
9291 }
9292 }
9293
9294 /// Gets the enum value as a string.
9295 ///
9296 /// Returns `None` if the enum contains an unknown value deserialized from
9297 /// the integer representation of enums.
9298 pub fn name(&self) -> std::option::Option<&str> {
9299 match self {
9300 Self::Unspecified => std::option::Option::Some("BANDWIDTH_UNSPECIFIED"),
9301 Self::Bw1Gbps => std::option::Option::Some("BW_1_GBPS"),
9302 Self::Bw2Gbps => std::option::Option::Some("BW_2_GBPS"),
9303 Self::Bw5Gbps => std::option::Option::Some("BW_5_GBPS"),
9304 Self::Bw10Gbps => std::option::Option::Some("BW_10_GBPS"),
9305 Self::UnknownValue(u) => u.0.name(),
9306 }
9307 }
9308 }
9309
9310 impl std::default::Default for Bandwidth {
9311 fn default() -> Self {
9312 use std::convert::From;
9313 Self::from(0)
9314 }
9315 }
9316
9317 impl std::fmt::Display for Bandwidth {
9318 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9319 wkt::internal::display_enum(f, self.name(), self.value())
9320 }
9321 }
9322
9323 impl std::convert::From<i32> for Bandwidth {
9324 fn from(value: i32) -> Self {
9325 match value {
9326 0 => Self::Unspecified,
9327 1 => Self::Bw1Gbps,
9328 2 => Self::Bw2Gbps,
9329 3 => Self::Bw5Gbps,
9330 4 => Self::Bw10Gbps,
9331 _ => Self::UnknownValue(bandwidth::UnknownValue(
9332 wkt::internal::UnknownEnumValue::Integer(value),
9333 )),
9334 }
9335 }
9336 }
9337
9338 impl std::convert::From<&str> for Bandwidth {
9339 fn from(value: &str) -> Self {
9340 use std::string::ToString;
9341 match value {
9342 "BANDWIDTH_UNSPECIFIED" => Self::Unspecified,
9343 "BW_1_GBPS" => Self::Bw1Gbps,
9344 "BW_2_GBPS" => Self::Bw2Gbps,
9345 "BW_5_GBPS" => Self::Bw5Gbps,
9346 "BW_10_GBPS" => Self::Bw10Gbps,
9347 _ => Self::UnknownValue(bandwidth::UnknownValue(
9348 wkt::internal::UnknownEnumValue::String(value.to_string()),
9349 )),
9350 }
9351 }
9352 }
9353
9354 impl serde::ser::Serialize for Bandwidth {
9355 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9356 where
9357 S: serde::Serializer,
9358 {
9359 match self {
9360 Self::Unspecified => serializer.serialize_i32(0),
9361 Self::Bw1Gbps => serializer.serialize_i32(1),
9362 Self::Bw2Gbps => serializer.serialize_i32(2),
9363 Self::Bw5Gbps => serializer.serialize_i32(3),
9364 Self::Bw10Gbps => serializer.serialize_i32(4),
9365 Self::UnknownValue(u) => u.0.serialize(serializer),
9366 }
9367 }
9368 }
9369
9370 impl<'de> serde::de::Deserialize<'de> for Bandwidth {
9371 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9372 where
9373 D: serde::Deserializer<'de>,
9374 {
9375 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Bandwidth>::new(
9376 ".google.cloud.baremetalsolution.v2.NetworkConfig.Bandwidth",
9377 ))
9378 }
9379 }
9380
9381 /// Service network block.
9382 ///
9383 /// # Working with unknown values
9384 ///
9385 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9386 /// additional enum variants at any time. Adding new variants is not considered
9387 /// a breaking change. Applications should write their code in anticipation of:
9388 ///
9389 /// - New values appearing in future releases of the client library, **and**
9390 /// - New values received dynamically, without application changes.
9391 ///
9392 /// Please consult the [Working with enums] section in the user guide for some
9393 /// guidelines.
9394 ///
9395 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9396 #[derive(Clone, Debug, PartialEq)]
9397 #[non_exhaustive]
9398 pub enum ServiceCidr {
9399 /// Unspecified value.
9400 Unspecified,
9401 /// Services are disabled for the given network.
9402 Disabled,
9403 /// Use the highest /26 block of the network to host services.
9404 High26,
9405 /// Use the highest /27 block of the network to host services.
9406 High27,
9407 /// Use the highest /28 block of the network to host services.
9408 High28,
9409 /// If set, the enum was initialized with an unknown value.
9410 ///
9411 /// Applications can examine the value using [ServiceCidr::value] or
9412 /// [ServiceCidr::name].
9413 UnknownValue(service_cidr::UnknownValue),
9414 }
9415
9416 #[doc(hidden)]
9417 pub mod service_cidr {
9418 #[allow(unused_imports)]
9419 use super::*;
9420 #[derive(Clone, Debug, PartialEq)]
9421 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9422 }
9423
9424 impl ServiceCidr {
9425 /// Gets the enum value.
9426 ///
9427 /// Returns `None` if the enum contains an unknown value deserialized from
9428 /// the string representation of enums.
9429 pub fn value(&self) -> std::option::Option<i32> {
9430 match self {
9431 Self::Unspecified => std::option::Option::Some(0),
9432 Self::Disabled => std::option::Option::Some(1),
9433 Self::High26 => std::option::Option::Some(2),
9434 Self::High27 => std::option::Option::Some(3),
9435 Self::High28 => std::option::Option::Some(4),
9436 Self::UnknownValue(u) => u.0.value(),
9437 }
9438 }
9439
9440 /// Gets the enum value as a string.
9441 ///
9442 /// Returns `None` if the enum contains an unknown value deserialized from
9443 /// the integer representation of enums.
9444 pub fn name(&self) -> std::option::Option<&str> {
9445 match self {
9446 Self::Unspecified => std::option::Option::Some("SERVICE_CIDR_UNSPECIFIED"),
9447 Self::Disabled => std::option::Option::Some("DISABLED"),
9448 Self::High26 => std::option::Option::Some("HIGH_26"),
9449 Self::High27 => std::option::Option::Some("HIGH_27"),
9450 Self::High28 => std::option::Option::Some("HIGH_28"),
9451 Self::UnknownValue(u) => u.0.name(),
9452 }
9453 }
9454 }
9455
9456 impl std::default::Default for ServiceCidr {
9457 fn default() -> Self {
9458 use std::convert::From;
9459 Self::from(0)
9460 }
9461 }
9462
9463 impl std::fmt::Display for ServiceCidr {
9464 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9465 wkt::internal::display_enum(f, self.name(), self.value())
9466 }
9467 }
9468
9469 impl std::convert::From<i32> for ServiceCidr {
9470 fn from(value: i32) -> Self {
9471 match value {
9472 0 => Self::Unspecified,
9473 1 => Self::Disabled,
9474 2 => Self::High26,
9475 3 => Self::High27,
9476 4 => Self::High28,
9477 _ => Self::UnknownValue(service_cidr::UnknownValue(
9478 wkt::internal::UnknownEnumValue::Integer(value),
9479 )),
9480 }
9481 }
9482 }
9483
9484 impl std::convert::From<&str> for ServiceCidr {
9485 fn from(value: &str) -> Self {
9486 use std::string::ToString;
9487 match value {
9488 "SERVICE_CIDR_UNSPECIFIED" => Self::Unspecified,
9489 "DISABLED" => Self::Disabled,
9490 "HIGH_26" => Self::High26,
9491 "HIGH_27" => Self::High27,
9492 "HIGH_28" => Self::High28,
9493 _ => Self::UnknownValue(service_cidr::UnknownValue(
9494 wkt::internal::UnknownEnumValue::String(value.to_string()),
9495 )),
9496 }
9497 }
9498 }
9499
9500 impl serde::ser::Serialize for ServiceCidr {
9501 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9502 where
9503 S: serde::Serializer,
9504 {
9505 match self {
9506 Self::Unspecified => serializer.serialize_i32(0),
9507 Self::Disabled => serializer.serialize_i32(1),
9508 Self::High26 => serializer.serialize_i32(2),
9509 Self::High27 => serializer.serialize_i32(3),
9510 Self::High28 => serializer.serialize_i32(4),
9511 Self::UnknownValue(u) => u.0.serialize(serializer),
9512 }
9513 }
9514 }
9515
9516 impl<'de> serde::de::Deserialize<'de> for ServiceCidr {
9517 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9518 where
9519 D: serde::Deserializer<'de>,
9520 {
9521 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceCidr>::new(
9522 ".google.cloud.baremetalsolution.v2.NetworkConfig.ServiceCidr",
9523 ))
9524 }
9525 }
9526}
9527
9528/// A resource budget.
9529#[derive(Clone, Default, PartialEq)]
9530#[non_exhaustive]
9531pub struct InstanceQuota {
9532 /// Output only. The name of the instance quota.
9533 pub name: std::string::String,
9534
9535 /// Instance type.
9536 /// Deprecated: use gcp_service.
9537 #[deprecated]
9538 pub instance_type: std::string::String,
9539
9540 /// The gcp service of the provisioning quota.
9541 pub gcp_service: std::string::String,
9542
9543 /// Location where the quota applies.
9544 pub location: std::string::String,
9545
9546 /// Number of machines than can be created for the given location and
9547 /// instance_type.
9548 pub available_machine_count: i32,
9549
9550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9551}
9552
9553impl InstanceQuota {
9554 /// Creates a new default instance.
9555 pub fn new() -> Self {
9556 std::default::Default::default()
9557 }
9558
9559 /// Sets the value of [name][crate::model::InstanceQuota::name].
9560 ///
9561 /// # Example
9562 /// ```ignore,no_run
9563 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9564 /// # let project_id = "project_id";
9565 /// # let location_id = "location_id";
9566 /// # let instance_quota_id = "instance_quota_id";
9567 /// let x = InstanceQuota::new().set_name(format!("projects/{project_id}/locations/{location_id}/instanceQuotas/{instance_quota_id}"));
9568 /// ```
9569 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9570 self.name = v.into();
9571 self
9572 }
9573
9574 /// Sets the value of [instance_type][crate::model::InstanceQuota::instance_type].
9575 ///
9576 /// # Example
9577 /// ```ignore,no_run
9578 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9579 /// let x = InstanceQuota::new().set_instance_type("example");
9580 /// ```
9581 #[deprecated]
9582 pub fn set_instance_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9583 self.instance_type = v.into();
9584 self
9585 }
9586
9587 /// Sets the value of [gcp_service][crate::model::InstanceQuota::gcp_service].
9588 ///
9589 /// # Example
9590 /// ```ignore,no_run
9591 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9592 /// let x = InstanceQuota::new().set_gcp_service("example");
9593 /// ```
9594 pub fn set_gcp_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9595 self.gcp_service = v.into();
9596 self
9597 }
9598
9599 /// Sets the value of [location][crate::model::InstanceQuota::location].
9600 ///
9601 /// # Example
9602 /// ```ignore,no_run
9603 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9604 /// let x = InstanceQuota::new().set_location("example");
9605 /// ```
9606 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9607 self.location = v.into();
9608 self
9609 }
9610
9611 /// Sets the value of [available_machine_count][crate::model::InstanceQuota::available_machine_count].
9612 ///
9613 /// # Example
9614 /// ```ignore,no_run
9615 /// # use google_cloud_baremetalsolution_v2::model::InstanceQuota;
9616 /// let x = InstanceQuota::new().set_available_machine_count(42);
9617 /// ```
9618 pub fn set_available_machine_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9619 self.available_machine_count = v.into();
9620 self
9621 }
9622}
9623
9624impl wkt::message::Message for InstanceQuota {
9625 fn typename() -> &'static str {
9626 "type.googleapis.com/google.cloud.baremetalsolution.v2.InstanceQuota"
9627 }
9628}
9629
9630/// Request for GetProvisioningConfig.
9631#[derive(Clone, Default, PartialEq)]
9632#[non_exhaustive]
9633pub struct GetProvisioningConfigRequest {
9634 /// Required. Name of the ProvisioningConfig.
9635 pub name: std::string::String,
9636
9637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9638}
9639
9640impl GetProvisioningConfigRequest {
9641 /// Creates a new default instance.
9642 pub fn new() -> Self {
9643 std::default::Default::default()
9644 }
9645
9646 /// Sets the value of [name][crate::model::GetProvisioningConfigRequest::name].
9647 ///
9648 /// # Example
9649 /// ```ignore,no_run
9650 /// # use google_cloud_baremetalsolution_v2::model::GetProvisioningConfigRequest;
9651 /// # let project_id = "project_id";
9652 /// # let location_id = "location_id";
9653 /// # let provisioning_config_id = "provisioning_config_id";
9654 /// let x = GetProvisioningConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/provisioningConfigs/{provisioning_config_id}"));
9655 /// ```
9656 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9657 self.name = v.into();
9658 self
9659 }
9660}
9661
9662impl wkt::message::Message for GetProvisioningConfigRequest {
9663 fn typename() -> &'static str {
9664 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetProvisioningConfigRequest"
9665 }
9666}
9667
9668/// Request for CreateProvisioningConfig.
9669#[derive(Clone, Default, PartialEq)]
9670#[non_exhaustive]
9671pub struct CreateProvisioningConfigRequest {
9672 /// Required. The parent project and location containing the
9673 /// ProvisioningConfig.
9674 pub parent: std::string::String,
9675
9676 /// Required. The ProvisioningConfig to create.
9677 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9678
9679 /// Optional. Email provided to send a confirmation with provisioning config
9680 /// to.
9681 pub email: std::string::String,
9682
9683 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9684}
9685
9686impl CreateProvisioningConfigRequest {
9687 /// Creates a new default instance.
9688 pub fn new() -> Self {
9689 std::default::Default::default()
9690 }
9691
9692 /// Sets the value of [parent][crate::model::CreateProvisioningConfigRequest::parent].
9693 ///
9694 /// # Example
9695 /// ```ignore,no_run
9696 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9697 /// let x = CreateProvisioningConfigRequest::new().set_parent("example");
9698 /// ```
9699 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9700 self.parent = v.into();
9701 self
9702 }
9703
9704 /// Sets the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9705 ///
9706 /// # Example
9707 /// ```ignore,no_run
9708 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9709 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9710 /// let x = CreateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9711 /// ```
9712 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9713 where
9714 T: std::convert::Into<crate::model::ProvisioningConfig>,
9715 {
9716 self.provisioning_config = std::option::Option::Some(v.into());
9717 self
9718 }
9719
9720 /// Sets or clears the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
9721 ///
9722 /// # Example
9723 /// ```ignore,no_run
9724 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9725 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9726 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9727 /// let x = CreateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9728 /// ```
9729 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9730 where
9731 T: std::convert::Into<crate::model::ProvisioningConfig>,
9732 {
9733 self.provisioning_config = v.map(|x| x.into());
9734 self
9735 }
9736
9737 /// Sets the value of [email][crate::model::CreateProvisioningConfigRequest::email].
9738 ///
9739 /// # Example
9740 /// ```ignore,no_run
9741 /// # use google_cloud_baremetalsolution_v2::model::CreateProvisioningConfigRequest;
9742 /// let x = CreateProvisioningConfigRequest::new().set_email("example");
9743 /// ```
9744 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9745 self.email = v.into();
9746 self
9747 }
9748}
9749
9750impl wkt::message::Message for CreateProvisioningConfigRequest {
9751 fn typename() -> &'static str {
9752 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateProvisioningConfigRequest"
9753 }
9754}
9755
9756/// Message for updating a ProvisioningConfig.
9757#[derive(Clone, Default, PartialEq)]
9758#[non_exhaustive]
9759pub struct UpdateProvisioningConfigRequest {
9760 /// Required. The ProvisioningConfig to update.
9761 pub provisioning_config: std::option::Option<crate::model::ProvisioningConfig>,
9762
9763 /// Required. The list of fields to update.
9764 pub update_mask: std::option::Option<wkt::FieldMask>,
9765
9766 /// Optional. Email provided to send a confirmation with provisioning config
9767 /// to.
9768 pub email: std::string::String,
9769
9770 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9771}
9772
9773impl UpdateProvisioningConfigRequest {
9774 /// Creates a new default instance.
9775 pub fn new() -> Self {
9776 std::default::Default::default()
9777 }
9778
9779 /// Sets the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9780 ///
9781 /// # Example
9782 /// ```ignore,no_run
9783 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9784 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9785 /// let x = UpdateProvisioningConfigRequest::new().set_provisioning_config(ProvisioningConfig::default()/* use setters */);
9786 /// ```
9787 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
9788 where
9789 T: std::convert::Into<crate::model::ProvisioningConfig>,
9790 {
9791 self.provisioning_config = std::option::Option::Some(v.into());
9792 self
9793 }
9794
9795 /// Sets or clears the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
9796 ///
9797 /// # Example
9798 /// ```ignore,no_run
9799 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9800 /// use google_cloud_baremetalsolution_v2::model::ProvisioningConfig;
9801 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(Some(ProvisioningConfig::default()/* use setters */));
9802 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_provisioning_config(None::<ProvisioningConfig>);
9803 /// ```
9804 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
9805 where
9806 T: std::convert::Into<crate::model::ProvisioningConfig>,
9807 {
9808 self.provisioning_config = v.map(|x| x.into());
9809 self
9810 }
9811
9812 /// Sets the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9813 ///
9814 /// # Example
9815 /// ```ignore,no_run
9816 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9817 /// use wkt::FieldMask;
9818 /// let x = UpdateProvisioningConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9819 /// ```
9820 pub fn set_update_mask<T>(mut self, v: T) -> Self
9821 where
9822 T: std::convert::Into<wkt::FieldMask>,
9823 {
9824 self.update_mask = std::option::Option::Some(v.into());
9825 self
9826 }
9827
9828 /// Sets or clears the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
9829 ///
9830 /// # Example
9831 /// ```ignore,no_run
9832 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9833 /// use wkt::FieldMask;
9834 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9835 /// let x = UpdateProvisioningConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9836 /// ```
9837 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9838 where
9839 T: std::convert::Into<wkt::FieldMask>,
9840 {
9841 self.update_mask = v.map(|x| x.into());
9842 self
9843 }
9844
9845 /// Sets the value of [email][crate::model::UpdateProvisioningConfigRequest::email].
9846 ///
9847 /// # Example
9848 /// ```ignore,no_run
9849 /// # use google_cloud_baremetalsolution_v2::model::UpdateProvisioningConfigRequest;
9850 /// let x = UpdateProvisioningConfigRequest::new().set_email("example");
9851 /// ```
9852 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9853 self.email = v.into();
9854 self
9855 }
9856}
9857
9858impl wkt::message::Message for UpdateProvisioningConfigRequest {
9859 fn typename() -> &'static str {
9860 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateProvisioningConfigRequest"
9861 }
9862}
9863
9864/// An SSH key, used for authorizing with the interactive serial console feature.
9865#[derive(Clone, Default, PartialEq)]
9866#[non_exhaustive]
9867pub struct SSHKey {
9868 /// Output only. The name of this SSH key.
9869 /// Currently, the only valid value for the location is "global".
9870 pub name: std::string::String,
9871
9872 /// The public SSH key. This must be in OpenSSH .authorized_keys format.
9873 pub public_key: std::string::String,
9874
9875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9876}
9877
9878impl SSHKey {
9879 /// Creates a new default instance.
9880 pub fn new() -> Self {
9881 std::default::Default::default()
9882 }
9883
9884 /// Sets the value of [name][crate::model::SSHKey::name].
9885 ///
9886 /// # Example
9887 /// ```ignore,no_run
9888 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9889 /// # let project_id = "project_id";
9890 /// # let location_id = "location_id";
9891 /// # let ssh_key_id = "ssh_key_id";
9892 /// let x = SSHKey::new().set_name(format!("projects/{project_id}/locations/{location_id}/sshKeys/{ssh_key_id}"));
9893 /// ```
9894 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9895 self.name = v.into();
9896 self
9897 }
9898
9899 /// Sets the value of [public_key][crate::model::SSHKey::public_key].
9900 ///
9901 /// # Example
9902 /// ```ignore,no_run
9903 /// # use google_cloud_baremetalsolution_v2::model::SSHKey;
9904 /// let x = SSHKey::new().set_public_key("example");
9905 /// ```
9906 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9907 self.public_key = v.into();
9908 self
9909 }
9910}
9911
9912impl wkt::message::Message for SSHKey {
9913 fn typename() -> &'static str {
9914 "type.googleapis.com/google.cloud.baremetalsolution.v2.SSHKey"
9915 }
9916}
9917
9918/// Message for listing the public SSH keys in a project.
9919#[derive(Clone, Default, PartialEq)]
9920#[non_exhaustive]
9921pub struct ListSSHKeysRequest {
9922 /// Required. The parent containing the SSH keys.
9923 /// Currently, the only valid value for the location is "global".
9924 pub parent: std::string::String,
9925
9926 /// The maximum number of items to return.
9927 pub page_size: i32,
9928
9929 /// The next_page_token value returned from a previous List request, if any.
9930 pub page_token: std::string::String,
9931
9932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9933}
9934
9935impl ListSSHKeysRequest {
9936 /// Creates a new default instance.
9937 pub fn new() -> Self {
9938 std::default::Default::default()
9939 }
9940
9941 /// Sets the value of [parent][crate::model::ListSSHKeysRequest::parent].
9942 ///
9943 /// # Example
9944 /// ```ignore,no_run
9945 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9946 /// let x = ListSSHKeysRequest::new().set_parent("example");
9947 /// ```
9948 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9949 self.parent = v.into();
9950 self
9951 }
9952
9953 /// Sets the value of [page_size][crate::model::ListSSHKeysRequest::page_size].
9954 ///
9955 /// # Example
9956 /// ```ignore,no_run
9957 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9958 /// let x = ListSSHKeysRequest::new().set_page_size(42);
9959 /// ```
9960 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9961 self.page_size = v.into();
9962 self
9963 }
9964
9965 /// Sets the value of [page_token][crate::model::ListSSHKeysRequest::page_token].
9966 ///
9967 /// # Example
9968 /// ```ignore,no_run
9969 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysRequest;
9970 /// let x = ListSSHKeysRequest::new().set_page_token("example");
9971 /// ```
9972 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9973 self.page_token = v.into();
9974 self
9975 }
9976}
9977
9978impl wkt::message::Message for ListSSHKeysRequest {
9979 fn typename() -> &'static str {
9980 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysRequest"
9981 }
9982}
9983
9984/// Message for response of ListSSHKeys.
9985#[derive(Clone, Default, PartialEq)]
9986#[non_exhaustive]
9987pub struct ListSSHKeysResponse {
9988 /// The SSH keys registered in the project.
9989 pub ssh_keys: std::vec::Vec<crate::model::SSHKey>,
9990
9991 /// Token to retrieve the next page of results, or empty if there are no more
9992 /// results in the list.
9993 pub next_page_token: std::string::String,
9994
9995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9996}
9997
9998impl ListSSHKeysResponse {
9999 /// Creates a new default instance.
10000 pub fn new() -> Self {
10001 std::default::Default::default()
10002 }
10003
10004 /// Sets the value of [ssh_keys][crate::model::ListSSHKeysResponse::ssh_keys].
10005 ///
10006 /// # Example
10007 /// ```ignore,no_run
10008 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
10009 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
10010 /// let x = ListSSHKeysResponse::new()
10011 /// .set_ssh_keys([
10012 /// SSHKey::default()/* use setters */,
10013 /// SSHKey::default()/* use (different) setters */,
10014 /// ]);
10015 /// ```
10016 pub fn set_ssh_keys<T, V>(mut self, v: T) -> Self
10017 where
10018 T: std::iter::IntoIterator<Item = V>,
10019 V: std::convert::Into<crate::model::SSHKey>,
10020 {
10021 use std::iter::Iterator;
10022 self.ssh_keys = v.into_iter().map(|i| i.into()).collect();
10023 self
10024 }
10025
10026 /// Sets the value of [next_page_token][crate::model::ListSSHKeysResponse::next_page_token].
10027 ///
10028 /// # Example
10029 /// ```ignore,no_run
10030 /// # use google_cloud_baremetalsolution_v2::model::ListSSHKeysResponse;
10031 /// let x = ListSSHKeysResponse::new().set_next_page_token("example");
10032 /// ```
10033 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10034 self.next_page_token = v.into();
10035 self
10036 }
10037}
10038
10039impl wkt::message::Message for ListSSHKeysResponse {
10040 fn typename() -> &'static str {
10041 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListSSHKeysResponse"
10042 }
10043}
10044
10045#[doc(hidden)]
10046impl google_cloud_gax::paginator::internal::PageableResponse for ListSSHKeysResponse {
10047 type PageItem = crate::model::SSHKey;
10048
10049 fn items(self) -> std::vec::Vec<Self::PageItem> {
10050 self.ssh_keys
10051 }
10052
10053 fn next_page_token(&self) -> std::string::String {
10054 use std::clone::Clone;
10055 self.next_page_token.clone()
10056 }
10057}
10058
10059/// Message for registering a public SSH key in a project.
10060#[derive(Clone, Default, PartialEq)]
10061#[non_exhaustive]
10062pub struct CreateSSHKeyRequest {
10063 /// Required. The parent containing the SSH keys.
10064 pub parent: std::string::String,
10065
10066 /// Required. The SSH key to register.
10067 pub ssh_key: std::option::Option<crate::model::SSHKey>,
10068
10069 /// Required. The ID to use for the key, which will become the final component
10070 /// of the key's resource name.
10071 ///
10072 /// This value must match the regex:
10073 /// [a-zA-Z0-9@.\-_]{1,64}
10074 pub ssh_key_id: std::string::String,
10075
10076 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10077}
10078
10079impl CreateSSHKeyRequest {
10080 /// Creates a new default instance.
10081 pub fn new() -> Self {
10082 std::default::Default::default()
10083 }
10084
10085 /// Sets the value of [parent][crate::model::CreateSSHKeyRequest::parent].
10086 ///
10087 /// # Example
10088 /// ```ignore,no_run
10089 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10090 /// let x = CreateSSHKeyRequest::new().set_parent("example");
10091 /// ```
10092 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10093 self.parent = v.into();
10094 self
10095 }
10096
10097 /// Sets the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
10098 ///
10099 /// # Example
10100 /// ```ignore,no_run
10101 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10102 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
10103 /// let x = CreateSSHKeyRequest::new().set_ssh_key(SSHKey::default()/* use setters */);
10104 /// ```
10105 pub fn set_ssh_key<T>(mut self, v: T) -> Self
10106 where
10107 T: std::convert::Into<crate::model::SSHKey>,
10108 {
10109 self.ssh_key = std::option::Option::Some(v.into());
10110 self
10111 }
10112
10113 /// Sets or clears the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
10114 ///
10115 /// # Example
10116 /// ```ignore,no_run
10117 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10118 /// use google_cloud_baremetalsolution_v2::model::SSHKey;
10119 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(Some(SSHKey::default()/* use setters */));
10120 /// let x = CreateSSHKeyRequest::new().set_or_clear_ssh_key(None::<SSHKey>);
10121 /// ```
10122 pub fn set_or_clear_ssh_key<T>(mut self, v: std::option::Option<T>) -> Self
10123 where
10124 T: std::convert::Into<crate::model::SSHKey>,
10125 {
10126 self.ssh_key = v.map(|x| x.into());
10127 self
10128 }
10129
10130 /// Sets the value of [ssh_key_id][crate::model::CreateSSHKeyRequest::ssh_key_id].
10131 ///
10132 /// # Example
10133 /// ```ignore,no_run
10134 /// # use google_cloud_baremetalsolution_v2::model::CreateSSHKeyRequest;
10135 /// let x = CreateSSHKeyRequest::new().set_ssh_key_id("example");
10136 /// ```
10137 pub fn set_ssh_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10138 self.ssh_key_id = v.into();
10139 self
10140 }
10141}
10142
10143impl wkt::message::Message for CreateSSHKeyRequest {
10144 fn typename() -> &'static str {
10145 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateSSHKeyRequest"
10146 }
10147}
10148
10149/// Message for deleting an SSH key from a project.
10150#[derive(Clone, Default, PartialEq)]
10151#[non_exhaustive]
10152pub struct DeleteSSHKeyRequest {
10153 /// Required. The name of the SSH key to delete.
10154 /// Currently, the only valid value for the location is "global".
10155 pub name: std::string::String,
10156
10157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10158}
10159
10160impl DeleteSSHKeyRequest {
10161 /// Creates a new default instance.
10162 pub fn new() -> Self {
10163 std::default::Default::default()
10164 }
10165
10166 /// Sets the value of [name][crate::model::DeleteSSHKeyRequest::name].
10167 ///
10168 /// # Example
10169 /// ```ignore,no_run
10170 /// # use google_cloud_baremetalsolution_v2::model::DeleteSSHKeyRequest;
10171 /// # let project_id = "project_id";
10172 /// # let location_id = "location_id";
10173 /// # let ssh_key_id = "ssh_key_id";
10174 /// let x = DeleteSSHKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sshKeys/{ssh_key_id}"));
10175 /// ```
10176 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10177 self.name = v.into();
10178 self
10179 }
10180}
10181
10182impl wkt::message::Message for DeleteSSHKeyRequest {
10183 fn typename() -> &'static str {
10184 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteSSHKeyRequest"
10185 }
10186}
10187
10188/// A storage volume.
10189#[derive(Clone, Default, PartialEq)]
10190#[non_exhaustive]
10191pub struct Volume {
10192 /// Output only. The resource name of this `Volume`.
10193 /// Resource names are schemeless URIs that follow the conventions in
10194 /// <https://cloud.google.com/apis/design/resource_names>.
10195 /// Format:
10196 /// `projects/{project}/locations/{location}/volumes/{volume}`
10197 pub name: std::string::String,
10198
10199 /// An identifier for the `Volume`, generated by the backend.
10200 pub id: std::string::String,
10201
10202 /// The storage type for this volume.
10203 pub storage_type: crate::model::volume::StorageType,
10204
10205 /// The state of this storage volume.
10206 pub state: crate::model::volume::State,
10207
10208 /// The requested size of this storage volume, in GiB.
10209 pub requested_size_gib: i64,
10210
10211 /// Originally requested size, in GiB.
10212 pub originally_requested_size_gib: i64,
10213
10214 /// The current size of this storage volume, in GiB, including space reserved
10215 /// for snapshots. This size might be different than the requested size if the
10216 /// storage volume has been configured with auto grow or auto shrink.
10217 pub current_size_gib: i64,
10218
10219 /// Additional emergency size that was requested for this Volume, in GiB.
10220 /// current_size_gib includes this value.
10221 pub emergency_size_gib: i64,
10222
10223 /// Maximum size volume can be expanded to in case of evergency, in GiB.
10224 pub max_size_gib: i64,
10225
10226 /// The size, in GiB, that this storage volume has expanded as a result of an
10227 /// auto grow policy. In the absence of auto-grow, the value is 0.
10228 pub auto_grown_size_gib: i64,
10229
10230 /// The space remaining in the storage volume for new LUNs, in GiB, excluding
10231 /// space reserved for snapshots.
10232 pub remaining_space_gib: i64,
10233
10234 /// Details about snapshot space reservation and usage on the storage volume.
10235 pub snapshot_reservation_detail:
10236 std::option::Option<crate::model::volume::SnapshotReservationDetail>,
10237
10238 /// The behavior to use when snapshot reserved space is full.
10239 pub snapshot_auto_delete_behavior: crate::model::volume::SnapshotAutoDeleteBehavior,
10240
10241 /// Labels as key value pairs.
10242 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10243
10244 /// Whether snapshots are enabled.
10245 pub snapshot_enabled: bool,
10246
10247 /// Immutable. Pod name.
10248 pub pod: std::string::String,
10249
10250 /// Output only. Storage protocol for the Volume.
10251 pub protocol: crate::model::volume::Protocol,
10252
10253 /// Output only. Whether this volume is a boot volume. A boot volume is one
10254 /// which contains a boot LUN.
10255 pub boot_volume: bool,
10256
10257 /// Immutable. Performance tier of the Volume.
10258 /// Default is SHARED.
10259 pub performance_tier: crate::model::VolumePerformanceTier,
10260
10261 /// Input only. User-specified notes for new Volume.
10262 /// Used to provision Volumes that require manual intervention.
10263 pub notes: std::string::String,
10264
10265 /// The workload profile for the volume.
10266 pub workload_profile: crate::model::volume::WorkloadProfile,
10267
10268 /// Output only. Time after which volume will be fully deleted.
10269 /// It is filled only for volumes in COOLOFF state.
10270 pub expire_time: std::option::Option<wkt::Timestamp>,
10271
10272 /// Output only. Instances this Volume is attached to.
10273 /// This field is set only in Get requests.
10274 pub instances: std::vec::Vec<std::string::String>,
10275
10276 /// Output only. Is the Volume attached at at least one instance.
10277 /// This field is a lightweight counterpart of `instances` field.
10278 /// It is filled in List responses as well.
10279 pub attached: bool,
10280
10281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10282}
10283
10284impl Volume {
10285 /// Creates a new default instance.
10286 pub fn new() -> Self {
10287 std::default::Default::default()
10288 }
10289
10290 /// Sets the value of [name][crate::model::Volume::name].
10291 ///
10292 /// # Example
10293 /// ```ignore,no_run
10294 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10295 /// # let project_id = "project_id";
10296 /// # let location_id = "location_id";
10297 /// # let volume_id = "volume_id";
10298 /// let x = Volume::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
10299 /// ```
10300 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10301 self.name = v.into();
10302 self
10303 }
10304
10305 /// Sets the value of [id][crate::model::Volume::id].
10306 ///
10307 /// # Example
10308 /// ```ignore,no_run
10309 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10310 /// let x = Volume::new().set_id("example");
10311 /// ```
10312 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10313 self.id = v.into();
10314 self
10315 }
10316
10317 /// Sets the value of [storage_type][crate::model::Volume::storage_type].
10318 ///
10319 /// # Example
10320 /// ```ignore,no_run
10321 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10322 /// use google_cloud_baremetalsolution_v2::model::volume::StorageType;
10323 /// let x0 = Volume::new().set_storage_type(StorageType::Ssd);
10324 /// let x1 = Volume::new().set_storage_type(StorageType::Hdd);
10325 /// ```
10326 pub fn set_storage_type<T: std::convert::Into<crate::model::volume::StorageType>>(
10327 mut self,
10328 v: T,
10329 ) -> Self {
10330 self.storage_type = v.into();
10331 self
10332 }
10333
10334 /// Sets the value of [state][crate::model::Volume::state].
10335 ///
10336 /// # Example
10337 /// ```ignore,no_run
10338 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10339 /// use google_cloud_baremetalsolution_v2::model::volume::State;
10340 /// let x0 = Volume::new().set_state(State::Creating);
10341 /// let x1 = Volume::new().set_state(State::Ready);
10342 /// let x2 = Volume::new().set_state(State::Deleting);
10343 /// ```
10344 pub fn set_state<T: std::convert::Into<crate::model::volume::State>>(mut self, v: T) -> Self {
10345 self.state = v.into();
10346 self
10347 }
10348
10349 /// Sets the value of [requested_size_gib][crate::model::Volume::requested_size_gib].
10350 ///
10351 /// # Example
10352 /// ```ignore,no_run
10353 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10354 /// let x = Volume::new().set_requested_size_gib(42);
10355 /// ```
10356 pub fn set_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10357 self.requested_size_gib = v.into();
10358 self
10359 }
10360
10361 /// Sets the value of [originally_requested_size_gib][crate::model::Volume::originally_requested_size_gib].
10362 ///
10363 /// # Example
10364 /// ```ignore,no_run
10365 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10366 /// let x = Volume::new().set_originally_requested_size_gib(42);
10367 /// ```
10368 pub fn set_originally_requested_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10369 self.originally_requested_size_gib = v.into();
10370 self
10371 }
10372
10373 /// Sets the value of [current_size_gib][crate::model::Volume::current_size_gib].
10374 ///
10375 /// # Example
10376 /// ```ignore,no_run
10377 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10378 /// let x = Volume::new().set_current_size_gib(42);
10379 /// ```
10380 pub fn set_current_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10381 self.current_size_gib = v.into();
10382 self
10383 }
10384
10385 /// Sets the value of [emergency_size_gib][crate::model::Volume::emergency_size_gib].
10386 ///
10387 /// # Example
10388 /// ```ignore,no_run
10389 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10390 /// let x = Volume::new().set_emergency_size_gib(42);
10391 /// ```
10392 pub fn set_emergency_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10393 self.emergency_size_gib = v.into();
10394 self
10395 }
10396
10397 /// Sets the value of [max_size_gib][crate::model::Volume::max_size_gib].
10398 ///
10399 /// # Example
10400 /// ```ignore,no_run
10401 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10402 /// let x = Volume::new().set_max_size_gib(42);
10403 /// ```
10404 pub fn set_max_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10405 self.max_size_gib = v.into();
10406 self
10407 }
10408
10409 /// Sets the value of [auto_grown_size_gib][crate::model::Volume::auto_grown_size_gib].
10410 ///
10411 /// # Example
10412 /// ```ignore,no_run
10413 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10414 /// let x = Volume::new().set_auto_grown_size_gib(42);
10415 /// ```
10416 pub fn set_auto_grown_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10417 self.auto_grown_size_gib = v.into();
10418 self
10419 }
10420
10421 /// Sets the value of [remaining_space_gib][crate::model::Volume::remaining_space_gib].
10422 ///
10423 /// # Example
10424 /// ```ignore,no_run
10425 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10426 /// let x = Volume::new().set_remaining_space_gib(42);
10427 /// ```
10428 pub fn set_remaining_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10429 self.remaining_space_gib = v.into();
10430 self
10431 }
10432
10433 /// Sets the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10434 ///
10435 /// # Example
10436 /// ```ignore,no_run
10437 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10438 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10439 /// let x = Volume::new().set_snapshot_reservation_detail(SnapshotReservationDetail::default()/* use setters */);
10440 /// ```
10441 pub fn set_snapshot_reservation_detail<T>(mut self, v: T) -> Self
10442 where
10443 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10444 {
10445 self.snapshot_reservation_detail = std::option::Option::Some(v.into());
10446 self
10447 }
10448
10449 /// Sets or clears the value of [snapshot_reservation_detail][crate::model::Volume::snapshot_reservation_detail].
10450 ///
10451 /// # Example
10452 /// ```ignore,no_run
10453 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10454 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10455 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(Some(SnapshotReservationDetail::default()/* use setters */));
10456 /// let x = Volume::new().set_or_clear_snapshot_reservation_detail(None::<SnapshotReservationDetail>);
10457 /// ```
10458 pub fn set_or_clear_snapshot_reservation_detail<T>(mut self, v: std::option::Option<T>) -> Self
10459 where
10460 T: std::convert::Into<crate::model::volume::SnapshotReservationDetail>,
10461 {
10462 self.snapshot_reservation_detail = v.map(|x| x.into());
10463 self
10464 }
10465
10466 /// Sets the value of [snapshot_auto_delete_behavior][crate::model::Volume::snapshot_auto_delete_behavior].
10467 ///
10468 /// # Example
10469 /// ```ignore,no_run
10470 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10471 /// use google_cloud_baremetalsolution_v2::model::volume::SnapshotAutoDeleteBehavior;
10472 /// let x0 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::Disabled);
10473 /// let x1 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::OldestFirst);
10474 /// let x2 = Volume::new().set_snapshot_auto_delete_behavior(SnapshotAutoDeleteBehavior::NewestFirst);
10475 /// ```
10476 pub fn set_snapshot_auto_delete_behavior<
10477 T: std::convert::Into<crate::model::volume::SnapshotAutoDeleteBehavior>,
10478 >(
10479 mut self,
10480 v: T,
10481 ) -> Self {
10482 self.snapshot_auto_delete_behavior = v.into();
10483 self
10484 }
10485
10486 /// Sets the value of [labels][crate::model::Volume::labels].
10487 ///
10488 /// # Example
10489 /// ```ignore,no_run
10490 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10491 /// let x = Volume::new().set_labels([
10492 /// ("key0", "abc"),
10493 /// ("key1", "xyz"),
10494 /// ]);
10495 /// ```
10496 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10497 where
10498 T: std::iter::IntoIterator<Item = (K, V)>,
10499 K: std::convert::Into<std::string::String>,
10500 V: std::convert::Into<std::string::String>,
10501 {
10502 use std::iter::Iterator;
10503 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10504 self
10505 }
10506
10507 /// Sets the value of [snapshot_enabled][crate::model::Volume::snapshot_enabled].
10508 ///
10509 /// # Example
10510 /// ```ignore,no_run
10511 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10512 /// let x = Volume::new().set_snapshot_enabled(true);
10513 /// ```
10514 pub fn set_snapshot_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10515 self.snapshot_enabled = v.into();
10516 self
10517 }
10518
10519 /// Sets the value of [pod][crate::model::Volume::pod].
10520 ///
10521 /// # Example
10522 /// ```ignore,no_run
10523 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10524 /// let x = Volume::new().set_pod("example");
10525 /// ```
10526 pub fn set_pod<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10527 self.pod = v.into();
10528 self
10529 }
10530
10531 /// Sets the value of [protocol][crate::model::Volume::protocol].
10532 ///
10533 /// # Example
10534 /// ```ignore,no_run
10535 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10536 /// use google_cloud_baremetalsolution_v2::model::volume::Protocol;
10537 /// let x0 = Volume::new().set_protocol(Protocol::FibreChannel);
10538 /// let x1 = Volume::new().set_protocol(Protocol::Nfs);
10539 /// ```
10540 pub fn set_protocol<T: std::convert::Into<crate::model::volume::Protocol>>(
10541 mut self,
10542 v: T,
10543 ) -> Self {
10544 self.protocol = v.into();
10545 self
10546 }
10547
10548 /// Sets the value of [boot_volume][crate::model::Volume::boot_volume].
10549 ///
10550 /// # Example
10551 /// ```ignore,no_run
10552 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10553 /// let x = Volume::new().set_boot_volume(true);
10554 /// ```
10555 pub fn set_boot_volume<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10556 self.boot_volume = v.into();
10557 self
10558 }
10559
10560 /// Sets the value of [performance_tier][crate::model::Volume::performance_tier].
10561 ///
10562 /// # Example
10563 /// ```ignore,no_run
10564 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10565 /// use google_cloud_baremetalsolution_v2::model::VolumePerformanceTier;
10566 /// let x0 = Volume::new().set_performance_tier(VolumePerformanceTier::Shared);
10567 /// let x1 = Volume::new().set_performance_tier(VolumePerformanceTier::Assigned);
10568 /// let x2 = Volume::new().set_performance_tier(VolumePerformanceTier::Ht);
10569 /// ```
10570 pub fn set_performance_tier<T: std::convert::Into<crate::model::VolumePerformanceTier>>(
10571 mut self,
10572 v: T,
10573 ) -> Self {
10574 self.performance_tier = v.into();
10575 self
10576 }
10577
10578 /// Sets the value of [notes][crate::model::Volume::notes].
10579 ///
10580 /// # Example
10581 /// ```ignore,no_run
10582 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10583 /// let x = Volume::new().set_notes("example");
10584 /// ```
10585 pub fn set_notes<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10586 self.notes = v.into();
10587 self
10588 }
10589
10590 /// Sets the value of [workload_profile][crate::model::Volume::workload_profile].
10591 ///
10592 /// # Example
10593 /// ```ignore,no_run
10594 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10595 /// use google_cloud_baremetalsolution_v2::model::volume::WorkloadProfile;
10596 /// let x0 = Volume::new().set_workload_profile(WorkloadProfile::Generic);
10597 /// let x1 = Volume::new().set_workload_profile(WorkloadProfile::Hana);
10598 /// ```
10599 pub fn set_workload_profile<T: std::convert::Into<crate::model::volume::WorkloadProfile>>(
10600 mut self,
10601 v: T,
10602 ) -> Self {
10603 self.workload_profile = v.into();
10604 self
10605 }
10606
10607 /// Sets the value of [expire_time][crate::model::Volume::expire_time].
10608 ///
10609 /// # Example
10610 /// ```ignore,no_run
10611 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10612 /// use wkt::Timestamp;
10613 /// let x = Volume::new().set_expire_time(Timestamp::default()/* use setters */);
10614 /// ```
10615 pub fn set_expire_time<T>(mut self, v: T) -> Self
10616 where
10617 T: std::convert::Into<wkt::Timestamp>,
10618 {
10619 self.expire_time = std::option::Option::Some(v.into());
10620 self
10621 }
10622
10623 /// Sets or clears the value of [expire_time][crate::model::Volume::expire_time].
10624 ///
10625 /// # Example
10626 /// ```ignore,no_run
10627 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10628 /// use wkt::Timestamp;
10629 /// let x = Volume::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10630 /// let x = Volume::new().set_or_clear_expire_time(None::<Timestamp>);
10631 /// ```
10632 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10633 where
10634 T: std::convert::Into<wkt::Timestamp>,
10635 {
10636 self.expire_time = v.map(|x| x.into());
10637 self
10638 }
10639
10640 /// Sets the value of [instances][crate::model::Volume::instances].
10641 ///
10642 /// # Example
10643 /// ```ignore,no_run
10644 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10645 /// let x = Volume::new().set_instances(["a", "b", "c"]);
10646 /// ```
10647 pub fn set_instances<T, V>(mut self, v: T) -> Self
10648 where
10649 T: std::iter::IntoIterator<Item = V>,
10650 V: std::convert::Into<std::string::String>,
10651 {
10652 use std::iter::Iterator;
10653 self.instances = v.into_iter().map(|i| i.into()).collect();
10654 self
10655 }
10656
10657 /// Sets the value of [attached][crate::model::Volume::attached].
10658 ///
10659 /// # Example
10660 /// ```ignore,no_run
10661 /// # use google_cloud_baremetalsolution_v2::model::Volume;
10662 /// let x = Volume::new().set_attached(true);
10663 /// ```
10664 pub fn set_attached<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10665 self.attached = v.into();
10666 self
10667 }
10668}
10669
10670impl wkt::message::Message for Volume {
10671 fn typename() -> &'static str {
10672 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume"
10673 }
10674}
10675
10676/// Defines additional types related to [Volume].
10677pub mod volume {
10678 #[allow(unused_imports)]
10679 use super::*;
10680
10681 /// Details about snapshot space reservation and usage on the storage volume.
10682 #[derive(Clone, Default, PartialEq)]
10683 #[non_exhaustive]
10684 pub struct SnapshotReservationDetail {
10685 /// The space on this storage volume reserved for snapshots, shown in GiB.
10686 pub reserved_space_gib: i64,
10687
10688 /// The percent of snapshot space on this storage volume actually being used
10689 /// by the snapshot copies. This value might be higher than 100% if the
10690 /// snapshot copies have overflowed into the data portion of the storage
10691 /// volume.
10692 pub reserved_space_used_percent: i32,
10693
10694 /// The amount, in GiB, of available space in this storage volume's reserved
10695 /// snapshot space.
10696 pub reserved_space_remaining_gib: i64,
10697
10698 /// Percent of the total Volume size reserved for snapshot copies.
10699 /// Enabling snapshots requires reserving 20% or more of
10700 /// the storage volume space for snapshots. Maximum reserved space for
10701 /// snapshots is 40%.
10702 /// Setting this field will effectively set snapshot_enabled to true.
10703 pub reserved_space_percent: i32,
10704
10705 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10706 }
10707
10708 impl SnapshotReservationDetail {
10709 /// Creates a new default instance.
10710 pub fn new() -> Self {
10711 std::default::Default::default()
10712 }
10713
10714 /// Sets the value of [reserved_space_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_gib].
10715 ///
10716 /// # Example
10717 /// ```ignore,no_run
10718 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10719 /// let x = SnapshotReservationDetail::new().set_reserved_space_gib(42);
10720 /// ```
10721 pub fn set_reserved_space_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10722 self.reserved_space_gib = v.into();
10723 self
10724 }
10725
10726 /// Sets the value of [reserved_space_used_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_used_percent].
10727 ///
10728 /// # Example
10729 /// ```ignore,no_run
10730 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10731 /// let x = SnapshotReservationDetail::new().set_reserved_space_used_percent(42);
10732 /// ```
10733 pub fn set_reserved_space_used_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10734 self.reserved_space_used_percent = v.into();
10735 self
10736 }
10737
10738 /// Sets the value of [reserved_space_remaining_gib][crate::model::volume::SnapshotReservationDetail::reserved_space_remaining_gib].
10739 ///
10740 /// # Example
10741 /// ```ignore,no_run
10742 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10743 /// let x = SnapshotReservationDetail::new().set_reserved_space_remaining_gib(42);
10744 /// ```
10745 pub fn set_reserved_space_remaining_gib<T: std::convert::Into<i64>>(
10746 mut self,
10747 v: T,
10748 ) -> Self {
10749 self.reserved_space_remaining_gib = v.into();
10750 self
10751 }
10752
10753 /// Sets the value of [reserved_space_percent][crate::model::volume::SnapshotReservationDetail::reserved_space_percent].
10754 ///
10755 /// # Example
10756 /// ```ignore,no_run
10757 /// # use google_cloud_baremetalsolution_v2::model::volume::SnapshotReservationDetail;
10758 /// let x = SnapshotReservationDetail::new().set_reserved_space_percent(42);
10759 /// ```
10760 pub fn set_reserved_space_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10761 self.reserved_space_percent = v.into();
10762 self
10763 }
10764 }
10765
10766 impl wkt::message::Message for SnapshotReservationDetail {
10767 fn typename() -> &'static str {
10768 "type.googleapis.com/google.cloud.baremetalsolution.v2.Volume.SnapshotReservationDetail"
10769 }
10770 }
10771
10772 /// The storage type for a volume.
10773 ///
10774 /// # Working with unknown values
10775 ///
10776 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10777 /// additional enum variants at any time. Adding new variants is not considered
10778 /// a breaking change. Applications should write their code in anticipation of:
10779 ///
10780 /// - New values appearing in future releases of the client library, **and**
10781 /// - New values received dynamically, without application changes.
10782 ///
10783 /// Please consult the [Working with enums] section in the user guide for some
10784 /// guidelines.
10785 ///
10786 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10787 #[derive(Clone, Debug, PartialEq)]
10788 #[non_exhaustive]
10789 pub enum StorageType {
10790 /// The storage type for this volume is unknown.
10791 Unspecified,
10792 /// The storage type for this volume is SSD.
10793 Ssd,
10794 /// This storage type for this volume is HDD.
10795 Hdd,
10796 /// If set, the enum was initialized with an unknown value.
10797 ///
10798 /// Applications can examine the value using [StorageType::value] or
10799 /// [StorageType::name].
10800 UnknownValue(storage_type::UnknownValue),
10801 }
10802
10803 #[doc(hidden)]
10804 pub mod storage_type {
10805 #[allow(unused_imports)]
10806 use super::*;
10807 #[derive(Clone, Debug, PartialEq)]
10808 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10809 }
10810
10811 impl StorageType {
10812 /// Gets the enum value.
10813 ///
10814 /// Returns `None` if the enum contains an unknown value deserialized from
10815 /// the string representation of enums.
10816 pub fn value(&self) -> std::option::Option<i32> {
10817 match self {
10818 Self::Unspecified => std::option::Option::Some(0),
10819 Self::Ssd => std::option::Option::Some(1),
10820 Self::Hdd => std::option::Option::Some(2),
10821 Self::UnknownValue(u) => u.0.value(),
10822 }
10823 }
10824
10825 /// Gets the enum value as a string.
10826 ///
10827 /// Returns `None` if the enum contains an unknown value deserialized from
10828 /// the integer representation of enums.
10829 pub fn name(&self) -> std::option::Option<&str> {
10830 match self {
10831 Self::Unspecified => std::option::Option::Some("STORAGE_TYPE_UNSPECIFIED"),
10832 Self::Ssd => std::option::Option::Some("SSD"),
10833 Self::Hdd => std::option::Option::Some("HDD"),
10834 Self::UnknownValue(u) => u.0.name(),
10835 }
10836 }
10837 }
10838
10839 impl std::default::Default for StorageType {
10840 fn default() -> Self {
10841 use std::convert::From;
10842 Self::from(0)
10843 }
10844 }
10845
10846 impl std::fmt::Display for StorageType {
10847 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10848 wkt::internal::display_enum(f, self.name(), self.value())
10849 }
10850 }
10851
10852 impl std::convert::From<i32> for StorageType {
10853 fn from(value: i32) -> Self {
10854 match value {
10855 0 => Self::Unspecified,
10856 1 => Self::Ssd,
10857 2 => Self::Hdd,
10858 _ => Self::UnknownValue(storage_type::UnknownValue(
10859 wkt::internal::UnknownEnumValue::Integer(value),
10860 )),
10861 }
10862 }
10863 }
10864
10865 impl std::convert::From<&str> for StorageType {
10866 fn from(value: &str) -> Self {
10867 use std::string::ToString;
10868 match value {
10869 "STORAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
10870 "SSD" => Self::Ssd,
10871 "HDD" => Self::Hdd,
10872 _ => Self::UnknownValue(storage_type::UnknownValue(
10873 wkt::internal::UnknownEnumValue::String(value.to_string()),
10874 )),
10875 }
10876 }
10877 }
10878
10879 impl serde::ser::Serialize for StorageType {
10880 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10881 where
10882 S: serde::Serializer,
10883 {
10884 match self {
10885 Self::Unspecified => serializer.serialize_i32(0),
10886 Self::Ssd => serializer.serialize_i32(1),
10887 Self::Hdd => serializer.serialize_i32(2),
10888 Self::UnknownValue(u) => u.0.serialize(serializer),
10889 }
10890 }
10891 }
10892
10893 impl<'de> serde::de::Deserialize<'de> for StorageType {
10894 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10895 where
10896 D: serde::Deserializer<'de>,
10897 {
10898 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageType>::new(
10899 ".google.cloud.baremetalsolution.v2.Volume.StorageType",
10900 ))
10901 }
10902 }
10903
10904 /// The possible states for a storage volume.
10905 ///
10906 /// # Working with unknown values
10907 ///
10908 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10909 /// additional enum variants at any time. Adding new variants is not considered
10910 /// a breaking change. Applications should write their code in anticipation of:
10911 ///
10912 /// - New values appearing in future releases of the client library, **and**
10913 /// - New values received dynamically, without application changes.
10914 ///
10915 /// Please consult the [Working with enums] section in the user guide for some
10916 /// guidelines.
10917 ///
10918 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10919 #[derive(Clone, Debug, PartialEq)]
10920 #[non_exhaustive]
10921 pub enum State {
10922 /// The storage volume is in an unknown state.
10923 Unspecified,
10924 /// The storage volume is being created.
10925 Creating,
10926 /// The storage volume is ready for use.
10927 Ready,
10928 /// The storage volume has been requested to be deleted.
10929 Deleting,
10930 /// The storage volume is being updated.
10931 Updating,
10932 /// The storage volume is in cool off state. It will be deleted after
10933 /// `expire_time`.
10934 CoolOff,
10935 /// If set, the enum was initialized with an unknown value.
10936 ///
10937 /// Applications can examine the value using [State::value] or
10938 /// [State::name].
10939 UnknownValue(state::UnknownValue),
10940 }
10941
10942 #[doc(hidden)]
10943 pub mod state {
10944 #[allow(unused_imports)]
10945 use super::*;
10946 #[derive(Clone, Debug, PartialEq)]
10947 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10948 }
10949
10950 impl State {
10951 /// Gets the enum value.
10952 ///
10953 /// Returns `None` if the enum contains an unknown value deserialized from
10954 /// the string representation of enums.
10955 pub fn value(&self) -> std::option::Option<i32> {
10956 match self {
10957 Self::Unspecified => std::option::Option::Some(0),
10958 Self::Creating => std::option::Option::Some(1),
10959 Self::Ready => std::option::Option::Some(2),
10960 Self::Deleting => std::option::Option::Some(3),
10961 Self::Updating => std::option::Option::Some(4),
10962 Self::CoolOff => std::option::Option::Some(5),
10963 Self::UnknownValue(u) => u.0.value(),
10964 }
10965 }
10966
10967 /// Gets the enum value as a string.
10968 ///
10969 /// Returns `None` if the enum contains an unknown value deserialized from
10970 /// the integer representation of enums.
10971 pub fn name(&self) -> std::option::Option<&str> {
10972 match self {
10973 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10974 Self::Creating => std::option::Option::Some("CREATING"),
10975 Self::Ready => std::option::Option::Some("READY"),
10976 Self::Deleting => std::option::Option::Some("DELETING"),
10977 Self::Updating => std::option::Option::Some("UPDATING"),
10978 Self::CoolOff => std::option::Option::Some("COOL_OFF"),
10979 Self::UnknownValue(u) => u.0.name(),
10980 }
10981 }
10982 }
10983
10984 impl std::default::Default for State {
10985 fn default() -> Self {
10986 use std::convert::From;
10987 Self::from(0)
10988 }
10989 }
10990
10991 impl std::fmt::Display for State {
10992 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10993 wkt::internal::display_enum(f, self.name(), self.value())
10994 }
10995 }
10996
10997 impl std::convert::From<i32> for State {
10998 fn from(value: i32) -> Self {
10999 match value {
11000 0 => Self::Unspecified,
11001 1 => Self::Creating,
11002 2 => Self::Ready,
11003 3 => Self::Deleting,
11004 4 => Self::Updating,
11005 5 => Self::CoolOff,
11006 _ => Self::UnknownValue(state::UnknownValue(
11007 wkt::internal::UnknownEnumValue::Integer(value),
11008 )),
11009 }
11010 }
11011 }
11012
11013 impl std::convert::From<&str> for State {
11014 fn from(value: &str) -> Self {
11015 use std::string::ToString;
11016 match value {
11017 "STATE_UNSPECIFIED" => Self::Unspecified,
11018 "CREATING" => Self::Creating,
11019 "READY" => Self::Ready,
11020 "DELETING" => Self::Deleting,
11021 "UPDATING" => Self::Updating,
11022 "COOL_OFF" => Self::CoolOff,
11023 _ => Self::UnknownValue(state::UnknownValue(
11024 wkt::internal::UnknownEnumValue::String(value.to_string()),
11025 )),
11026 }
11027 }
11028 }
11029
11030 impl serde::ser::Serialize for State {
11031 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11032 where
11033 S: serde::Serializer,
11034 {
11035 match self {
11036 Self::Unspecified => serializer.serialize_i32(0),
11037 Self::Creating => serializer.serialize_i32(1),
11038 Self::Ready => serializer.serialize_i32(2),
11039 Self::Deleting => serializer.serialize_i32(3),
11040 Self::Updating => serializer.serialize_i32(4),
11041 Self::CoolOff => serializer.serialize_i32(5),
11042 Self::UnknownValue(u) => u.0.serialize(serializer),
11043 }
11044 }
11045 }
11046
11047 impl<'de> serde::de::Deserialize<'de> for State {
11048 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11049 where
11050 D: serde::Deserializer<'de>,
11051 {
11052 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11053 ".google.cloud.baremetalsolution.v2.Volume.State",
11054 ))
11055 }
11056 }
11057
11058 /// The kinds of auto delete behavior to use when snapshot reserved space is
11059 /// full.
11060 ///
11061 /// # Working with unknown values
11062 ///
11063 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11064 /// additional enum variants at any time. Adding new variants is not considered
11065 /// a breaking change. Applications should write their code in anticipation of:
11066 ///
11067 /// - New values appearing in future releases of the client library, **and**
11068 /// - New values received dynamically, without application changes.
11069 ///
11070 /// Please consult the [Working with enums] section in the user guide for some
11071 /// guidelines.
11072 ///
11073 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11074 #[derive(Clone, Debug, PartialEq)]
11075 #[non_exhaustive]
11076 pub enum SnapshotAutoDeleteBehavior {
11077 /// The unspecified behavior.
11078 Unspecified,
11079 /// Don't delete any snapshots. This disables new snapshot creation, as
11080 /// long as the snapshot reserved space is full.
11081 Disabled,
11082 /// Delete the oldest snapshots first.
11083 OldestFirst,
11084 /// Delete the newest snapshots first.
11085 NewestFirst,
11086 /// If set, the enum was initialized with an unknown value.
11087 ///
11088 /// Applications can examine the value using [SnapshotAutoDeleteBehavior::value] or
11089 /// [SnapshotAutoDeleteBehavior::name].
11090 UnknownValue(snapshot_auto_delete_behavior::UnknownValue),
11091 }
11092
11093 #[doc(hidden)]
11094 pub mod snapshot_auto_delete_behavior {
11095 #[allow(unused_imports)]
11096 use super::*;
11097 #[derive(Clone, Debug, PartialEq)]
11098 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11099 }
11100
11101 impl SnapshotAutoDeleteBehavior {
11102 /// Gets the enum value.
11103 ///
11104 /// Returns `None` if the enum contains an unknown value deserialized from
11105 /// the string representation of enums.
11106 pub fn value(&self) -> std::option::Option<i32> {
11107 match self {
11108 Self::Unspecified => std::option::Option::Some(0),
11109 Self::Disabled => std::option::Option::Some(1),
11110 Self::OldestFirst => std::option::Option::Some(2),
11111 Self::NewestFirst => std::option::Option::Some(3),
11112 Self::UnknownValue(u) => u.0.value(),
11113 }
11114 }
11115
11116 /// Gets the enum value as a string.
11117 ///
11118 /// Returns `None` if the enum contains an unknown value deserialized from
11119 /// the integer representation of enums.
11120 pub fn name(&self) -> std::option::Option<&str> {
11121 match self {
11122 Self::Unspecified => {
11123 std::option::Option::Some("SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED")
11124 }
11125 Self::Disabled => std::option::Option::Some("DISABLED"),
11126 Self::OldestFirst => std::option::Option::Some("OLDEST_FIRST"),
11127 Self::NewestFirst => std::option::Option::Some("NEWEST_FIRST"),
11128 Self::UnknownValue(u) => u.0.name(),
11129 }
11130 }
11131 }
11132
11133 impl std::default::Default for SnapshotAutoDeleteBehavior {
11134 fn default() -> Self {
11135 use std::convert::From;
11136 Self::from(0)
11137 }
11138 }
11139
11140 impl std::fmt::Display for SnapshotAutoDeleteBehavior {
11141 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11142 wkt::internal::display_enum(f, self.name(), self.value())
11143 }
11144 }
11145
11146 impl std::convert::From<i32> for SnapshotAutoDeleteBehavior {
11147 fn from(value: i32) -> Self {
11148 match value {
11149 0 => Self::Unspecified,
11150 1 => Self::Disabled,
11151 2 => Self::OldestFirst,
11152 3 => Self::NewestFirst,
11153 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
11154 wkt::internal::UnknownEnumValue::Integer(value),
11155 )),
11156 }
11157 }
11158 }
11159
11160 impl std::convert::From<&str> for SnapshotAutoDeleteBehavior {
11161 fn from(value: &str) -> Self {
11162 use std::string::ToString;
11163 match value {
11164 "SNAPSHOT_AUTO_DELETE_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11165 "DISABLED" => Self::Disabled,
11166 "OLDEST_FIRST" => Self::OldestFirst,
11167 "NEWEST_FIRST" => Self::NewestFirst,
11168 _ => Self::UnknownValue(snapshot_auto_delete_behavior::UnknownValue(
11169 wkt::internal::UnknownEnumValue::String(value.to_string()),
11170 )),
11171 }
11172 }
11173 }
11174
11175 impl serde::ser::Serialize for SnapshotAutoDeleteBehavior {
11176 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11177 where
11178 S: serde::Serializer,
11179 {
11180 match self {
11181 Self::Unspecified => serializer.serialize_i32(0),
11182 Self::Disabled => serializer.serialize_i32(1),
11183 Self::OldestFirst => serializer.serialize_i32(2),
11184 Self::NewestFirst => serializer.serialize_i32(3),
11185 Self::UnknownValue(u) => u.0.serialize(serializer),
11186 }
11187 }
11188 }
11189
11190 impl<'de> serde::de::Deserialize<'de> for SnapshotAutoDeleteBehavior {
11191 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11192 where
11193 D: serde::Deserializer<'de>,
11194 {
11195 deserializer.deserialize_any(
11196 wkt::internal::EnumVisitor::<SnapshotAutoDeleteBehavior>::new(
11197 ".google.cloud.baremetalsolution.v2.Volume.SnapshotAutoDeleteBehavior",
11198 ),
11199 )
11200 }
11201 }
11202
11203 /// Storage protocol.
11204 ///
11205 /// # Working with unknown values
11206 ///
11207 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11208 /// additional enum variants at any time. Adding new variants is not considered
11209 /// a breaking change. Applications should write their code in anticipation of:
11210 ///
11211 /// - New values appearing in future releases of the client library, **and**
11212 /// - New values received dynamically, without application changes.
11213 ///
11214 /// Please consult the [Working with enums] section in the user guide for some
11215 /// guidelines.
11216 ///
11217 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11218 #[derive(Clone, Debug, PartialEq)]
11219 #[non_exhaustive]
11220 pub enum Protocol {
11221 /// Value is not specified.
11222 Unspecified,
11223 /// Fibre Channel protocol.
11224 FibreChannel,
11225 /// NFS protocol means Volume is a NFS Share volume.
11226 /// Such volumes cannot be manipulated via Volumes API.
11227 Nfs,
11228 /// If set, the enum was initialized with an unknown value.
11229 ///
11230 /// Applications can examine the value using [Protocol::value] or
11231 /// [Protocol::name].
11232 UnknownValue(protocol::UnknownValue),
11233 }
11234
11235 #[doc(hidden)]
11236 pub mod protocol {
11237 #[allow(unused_imports)]
11238 use super::*;
11239 #[derive(Clone, Debug, PartialEq)]
11240 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11241 }
11242
11243 impl Protocol {
11244 /// Gets the enum value.
11245 ///
11246 /// Returns `None` if the enum contains an unknown value deserialized from
11247 /// the string representation of enums.
11248 pub fn value(&self) -> std::option::Option<i32> {
11249 match self {
11250 Self::Unspecified => std::option::Option::Some(0),
11251 Self::FibreChannel => std::option::Option::Some(1),
11252 Self::Nfs => std::option::Option::Some(2),
11253 Self::UnknownValue(u) => u.0.value(),
11254 }
11255 }
11256
11257 /// Gets the enum value as a string.
11258 ///
11259 /// Returns `None` if the enum contains an unknown value deserialized from
11260 /// the integer representation of enums.
11261 pub fn name(&self) -> std::option::Option<&str> {
11262 match self {
11263 Self::Unspecified => std::option::Option::Some("PROTOCOL_UNSPECIFIED"),
11264 Self::FibreChannel => std::option::Option::Some("FIBRE_CHANNEL"),
11265 Self::Nfs => std::option::Option::Some("NFS"),
11266 Self::UnknownValue(u) => u.0.name(),
11267 }
11268 }
11269 }
11270
11271 impl std::default::Default for Protocol {
11272 fn default() -> Self {
11273 use std::convert::From;
11274 Self::from(0)
11275 }
11276 }
11277
11278 impl std::fmt::Display for Protocol {
11279 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11280 wkt::internal::display_enum(f, self.name(), self.value())
11281 }
11282 }
11283
11284 impl std::convert::From<i32> for Protocol {
11285 fn from(value: i32) -> Self {
11286 match value {
11287 0 => Self::Unspecified,
11288 1 => Self::FibreChannel,
11289 2 => Self::Nfs,
11290 _ => Self::UnknownValue(protocol::UnknownValue(
11291 wkt::internal::UnknownEnumValue::Integer(value),
11292 )),
11293 }
11294 }
11295 }
11296
11297 impl std::convert::From<&str> for Protocol {
11298 fn from(value: &str) -> Self {
11299 use std::string::ToString;
11300 match value {
11301 "PROTOCOL_UNSPECIFIED" => Self::Unspecified,
11302 "FIBRE_CHANNEL" => Self::FibreChannel,
11303 "NFS" => Self::Nfs,
11304 _ => Self::UnknownValue(protocol::UnknownValue(
11305 wkt::internal::UnknownEnumValue::String(value.to_string()),
11306 )),
11307 }
11308 }
11309 }
11310
11311 impl serde::ser::Serialize for Protocol {
11312 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11313 where
11314 S: serde::Serializer,
11315 {
11316 match self {
11317 Self::Unspecified => serializer.serialize_i32(0),
11318 Self::FibreChannel => serializer.serialize_i32(1),
11319 Self::Nfs => serializer.serialize_i32(2),
11320 Self::UnknownValue(u) => u.0.serialize(serializer),
11321 }
11322 }
11323 }
11324
11325 impl<'de> serde::de::Deserialize<'de> for Protocol {
11326 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11327 where
11328 D: serde::Deserializer<'de>,
11329 {
11330 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Protocol>::new(
11331 ".google.cloud.baremetalsolution.v2.Volume.Protocol",
11332 ))
11333 }
11334 }
11335
11336 /// The possible values for a workload profile.
11337 ///
11338 /// # Working with unknown values
11339 ///
11340 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11341 /// additional enum variants at any time. Adding new variants is not considered
11342 /// a breaking change. Applications should write their code in anticipation of:
11343 ///
11344 /// - New values appearing in future releases of the client library, **and**
11345 /// - New values received dynamically, without application changes.
11346 ///
11347 /// Please consult the [Working with enums] section in the user guide for some
11348 /// guidelines.
11349 ///
11350 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11351 #[derive(Clone, Debug, PartialEq)]
11352 #[non_exhaustive]
11353 pub enum WorkloadProfile {
11354 /// The workload profile is in an unknown state.
11355 Unspecified,
11356 /// The workload profile is generic.
11357 Generic,
11358 /// The workload profile is hana.
11359 Hana,
11360 /// If set, the enum was initialized with an unknown value.
11361 ///
11362 /// Applications can examine the value using [WorkloadProfile::value] or
11363 /// [WorkloadProfile::name].
11364 UnknownValue(workload_profile::UnknownValue),
11365 }
11366
11367 #[doc(hidden)]
11368 pub mod workload_profile {
11369 #[allow(unused_imports)]
11370 use super::*;
11371 #[derive(Clone, Debug, PartialEq)]
11372 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11373 }
11374
11375 impl WorkloadProfile {
11376 /// Gets the enum value.
11377 ///
11378 /// Returns `None` if the enum contains an unknown value deserialized from
11379 /// the string representation of enums.
11380 pub fn value(&self) -> std::option::Option<i32> {
11381 match self {
11382 Self::Unspecified => std::option::Option::Some(0),
11383 Self::Generic => std::option::Option::Some(1),
11384 Self::Hana => std::option::Option::Some(2),
11385 Self::UnknownValue(u) => u.0.value(),
11386 }
11387 }
11388
11389 /// Gets the enum value as a string.
11390 ///
11391 /// Returns `None` if the enum contains an unknown value deserialized from
11392 /// the integer representation of enums.
11393 pub fn name(&self) -> std::option::Option<&str> {
11394 match self {
11395 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
11396 Self::Generic => std::option::Option::Some("GENERIC"),
11397 Self::Hana => std::option::Option::Some("HANA"),
11398 Self::UnknownValue(u) => u.0.name(),
11399 }
11400 }
11401 }
11402
11403 impl std::default::Default for WorkloadProfile {
11404 fn default() -> Self {
11405 use std::convert::From;
11406 Self::from(0)
11407 }
11408 }
11409
11410 impl std::fmt::Display for WorkloadProfile {
11411 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11412 wkt::internal::display_enum(f, self.name(), self.value())
11413 }
11414 }
11415
11416 impl std::convert::From<i32> for WorkloadProfile {
11417 fn from(value: i32) -> Self {
11418 match value {
11419 0 => Self::Unspecified,
11420 1 => Self::Generic,
11421 2 => Self::Hana,
11422 _ => Self::UnknownValue(workload_profile::UnknownValue(
11423 wkt::internal::UnknownEnumValue::Integer(value),
11424 )),
11425 }
11426 }
11427 }
11428
11429 impl std::convert::From<&str> for WorkloadProfile {
11430 fn from(value: &str) -> Self {
11431 use std::string::ToString;
11432 match value {
11433 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
11434 "GENERIC" => Self::Generic,
11435 "HANA" => Self::Hana,
11436 _ => Self::UnknownValue(workload_profile::UnknownValue(
11437 wkt::internal::UnknownEnumValue::String(value.to_string()),
11438 )),
11439 }
11440 }
11441 }
11442
11443 impl serde::ser::Serialize for WorkloadProfile {
11444 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11445 where
11446 S: serde::Serializer,
11447 {
11448 match self {
11449 Self::Unspecified => serializer.serialize_i32(0),
11450 Self::Generic => serializer.serialize_i32(1),
11451 Self::Hana => serializer.serialize_i32(2),
11452 Self::UnknownValue(u) => u.0.serialize(serializer),
11453 }
11454 }
11455 }
11456
11457 impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
11458 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11459 where
11460 D: serde::Deserializer<'de>,
11461 {
11462 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
11463 ".google.cloud.baremetalsolution.v2.Volume.WorkloadProfile",
11464 ))
11465 }
11466 }
11467}
11468
11469/// Message for requesting storage volume information.
11470#[derive(Clone, Default, PartialEq)]
11471#[non_exhaustive]
11472pub struct GetVolumeRequest {
11473 /// Required. Name of the resource.
11474 pub name: std::string::String,
11475
11476 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11477}
11478
11479impl GetVolumeRequest {
11480 /// Creates a new default instance.
11481 pub fn new() -> Self {
11482 std::default::Default::default()
11483 }
11484
11485 /// Sets the value of [name][crate::model::GetVolumeRequest::name].
11486 ///
11487 /// # Example
11488 /// ```ignore,no_run
11489 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeRequest;
11490 /// # let project_id = "project_id";
11491 /// # let location_id = "location_id";
11492 /// # let volume_id = "volume_id";
11493 /// let x = GetVolumeRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
11494 /// ```
11495 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11496 self.name = v.into();
11497 self
11498 }
11499}
11500
11501impl wkt::message::Message for GetVolumeRequest {
11502 fn typename() -> &'static str {
11503 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeRequest"
11504 }
11505}
11506
11507/// Message for requesting a list of storage volumes.
11508#[derive(Clone, Default, PartialEq)]
11509#[non_exhaustive]
11510pub struct ListVolumesRequest {
11511 /// Required. Parent value for ListVolumesRequest.
11512 pub parent: std::string::String,
11513
11514 /// Requested page size. The server might return fewer items than requested.
11515 /// If unspecified, server will pick an appropriate default.
11516 pub page_size: i32,
11517
11518 /// A token identifying a page of results from the server.
11519 pub page_token: std::string::String,
11520
11521 /// List filter.
11522 pub filter: std::string::String,
11523
11524 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11525}
11526
11527impl ListVolumesRequest {
11528 /// Creates a new default instance.
11529 pub fn new() -> Self {
11530 std::default::Default::default()
11531 }
11532
11533 /// Sets the value of [parent][crate::model::ListVolumesRequest::parent].
11534 ///
11535 /// # Example
11536 /// ```ignore,no_run
11537 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11538 /// let x = ListVolumesRequest::new().set_parent("example");
11539 /// ```
11540 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11541 self.parent = v.into();
11542 self
11543 }
11544
11545 /// Sets the value of [page_size][crate::model::ListVolumesRequest::page_size].
11546 ///
11547 /// # Example
11548 /// ```ignore,no_run
11549 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11550 /// let x = ListVolumesRequest::new().set_page_size(42);
11551 /// ```
11552 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11553 self.page_size = v.into();
11554 self
11555 }
11556
11557 /// Sets the value of [page_token][crate::model::ListVolumesRequest::page_token].
11558 ///
11559 /// # Example
11560 /// ```ignore,no_run
11561 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11562 /// let x = ListVolumesRequest::new().set_page_token("example");
11563 /// ```
11564 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11565 self.page_token = v.into();
11566 self
11567 }
11568
11569 /// Sets the value of [filter][crate::model::ListVolumesRequest::filter].
11570 ///
11571 /// # Example
11572 /// ```ignore,no_run
11573 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesRequest;
11574 /// let x = ListVolumesRequest::new().set_filter("example");
11575 /// ```
11576 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11577 self.filter = v.into();
11578 self
11579 }
11580}
11581
11582impl wkt::message::Message for ListVolumesRequest {
11583 fn typename() -> &'static str {
11584 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesRequest"
11585 }
11586}
11587
11588/// Response message containing the list of storage volumes.
11589#[derive(Clone, Default, PartialEq)]
11590#[non_exhaustive]
11591pub struct ListVolumesResponse {
11592 /// The list of storage volumes.
11593 pub volumes: std::vec::Vec<crate::model::Volume>,
11594
11595 /// A token identifying a page of results from the server.
11596 pub next_page_token: std::string::String,
11597
11598 /// Locations that could not be reached.
11599 pub unreachable: std::vec::Vec<std::string::String>,
11600
11601 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11602}
11603
11604impl ListVolumesResponse {
11605 /// Creates a new default instance.
11606 pub fn new() -> Self {
11607 std::default::Default::default()
11608 }
11609
11610 /// Sets the value of [volumes][crate::model::ListVolumesResponse::volumes].
11611 ///
11612 /// # Example
11613 /// ```ignore,no_run
11614 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11615 /// use google_cloud_baremetalsolution_v2::model::Volume;
11616 /// let x = ListVolumesResponse::new()
11617 /// .set_volumes([
11618 /// Volume::default()/* use setters */,
11619 /// Volume::default()/* use (different) setters */,
11620 /// ]);
11621 /// ```
11622 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11623 where
11624 T: std::iter::IntoIterator<Item = V>,
11625 V: std::convert::Into<crate::model::Volume>,
11626 {
11627 use std::iter::Iterator;
11628 self.volumes = v.into_iter().map(|i| i.into()).collect();
11629 self
11630 }
11631
11632 /// Sets the value of [next_page_token][crate::model::ListVolumesResponse::next_page_token].
11633 ///
11634 /// # Example
11635 /// ```ignore,no_run
11636 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11637 /// let x = ListVolumesResponse::new().set_next_page_token("example");
11638 /// ```
11639 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11640 self.next_page_token = v.into();
11641 self
11642 }
11643
11644 /// Sets the value of [unreachable][crate::model::ListVolumesResponse::unreachable].
11645 ///
11646 /// # Example
11647 /// ```ignore,no_run
11648 /// # use google_cloud_baremetalsolution_v2::model::ListVolumesResponse;
11649 /// let x = ListVolumesResponse::new().set_unreachable(["a", "b", "c"]);
11650 /// ```
11651 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
11652 where
11653 T: std::iter::IntoIterator<Item = V>,
11654 V: std::convert::Into<std::string::String>,
11655 {
11656 use std::iter::Iterator;
11657 self.unreachable = v.into_iter().map(|i| i.into()).collect();
11658 self
11659 }
11660}
11661
11662impl wkt::message::Message for ListVolumesResponse {
11663 fn typename() -> &'static str {
11664 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumesResponse"
11665 }
11666}
11667
11668#[doc(hidden)]
11669impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumesResponse {
11670 type PageItem = crate::model::Volume;
11671
11672 fn items(self) -> std::vec::Vec<Self::PageItem> {
11673 self.volumes
11674 }
11675
11676 fn next_page_token(&self) -> std::string::String {
11677 use std::clone::Clone;
11678 self.next_page_token.clone()
11679 }
11680}
11681
11682/// Message for updating a volume.
11683#[derive(Clone, Default, PartialEq)]
11684#[non_exhaustive]
11685pub struct UpdateVolumeRequest {
11686 /// Required. The volume to update.
11687 ///
11688 /// The `name` field is used to identify the volume to update.
11689 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11690 pub volume: std::option::Option<crate::model::Volume>,
11691
11692 /// The list of fields to update.
11693 /// The only currently supported fields are:
11694 /// 'labels'
11695 pub update_mask: std::option::Option<wkt::FieldMask>,
11696
11697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11698}
11699
11700impl UpdateVolumeRequest {
11701 /// Creates a new default instance.
11702 pub fn new() -> Self {
11703 std::default::Default::default()
11704 }
11705
11706 /// Sets the value of [volume][crate::model::UpdateVolumeRequest::volume].
11707 ///
11708 /// # Example
11709 /// ```ignore,no_run
11710 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11711 /// use google_cloud_baremetalsolution_v2::model::Volume;
11712 /// let x = UpdateVolumeRequest::new().set_volume(Volume::default()/* use setters */);
11713 /// ```
11714 pub fn set_volume<T>(mut self, v: T) -> Self
11715 where
11716 T: std::convert::Into<crate::model::Volume>,
11717 {
11718 self.volume = std::option::Option::Some(v.into());
11719 self
11720 }
11721
11722 /// Sets or clears the value of [volume][crate::model::UpdateVolumeRequest::volume].
11723 ///
11724 /// # Example
11725 /// ```ignore,no_run
11726 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11727 /// use google_cloud_baremetalsolution_v2::model::Volume;
11728 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(Some(Volume::default()/* use setters */));
11729 /// let x = UpdateVolumeRequest::new().set_or_clear_volume(None::<Volume>);
11730 /// ```
11731 pub fn set_or_clear_volume<T>(mut self, v: std::option::Option<T>) -> Self
11732 where
11733 T: std::convert::Into<crate::model::Volume>,
11734 {
11735 self.volume = v.map(|x| x.into());
11736 self
11737 }
11738
11739 /// Sets the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11740 ///
11741 /// # Example
11742 /// ```ignore,no_run
11743 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11744 /// use wkt::FieldMask;
11745 /// let x = UpdateVolumeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11746 /// ```
11747 pub fn set_update_mask<T>(mut self, v: T) -> Self
11748 where
11749 T: std::convert::Into<wkt::FieldMask>,
11750 {
11751 self.update_mask = std::option::Option::Some(v.into());
11752 self
11753 }
11754
11755 /// Sets or clears the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
11756 ///
11757 /// # Example
11758 /// ```ignore,no_run
11759 /// # use google_cloud_baremetalsolution_v2::model::UpdateVolumeRequest;
11760 /// use wkt::FieldMask;
11761 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11762 /// let x = UpdateVolumeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11763 /// ```
11764 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11765 where
11766 T: std::convert::Into<wkt::FieldMask>,
11767 {
11768 self.update_mask = v.map(|x| x.into());
11769 self
11770 }
11771}
11772
11773impl wkt::message::Message for UpdateVolumeRequest {
11774 fn typename() -> &'static str {
11775 "type.googleapis.com/google.cloud.baremetalsolution.v2.UpdateVolumeRequest"
11776 }
11777}
11778
11779/// Message requesting rename of a server.
11780#[derive(Clone, Default, PartialEq)]
11781#[non_exhaustive]
11782pub struct RenameVolumeRequest {
11783 /// Required. The `name` field is used to identify the volume.
11784 /// Format: projects/{project}/locations/{location}/volumes/{volume}
11785 pub name: std::string::String,
11786
11787 /// Required. The new `id` of the volume.
11788 pub new_volume_id: std::string::String,
11789
11790 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11791}
11792
11793impl RenameVolumeRequest {
11794 /// Creates a new default instance.
11795 pub fn new() -> Self {
11796 std::default::Default::default()
11797 }
11798
11799 /// Sets the value of [name][crate::model::RenameVolumeRequest::name].
11800 ///
11801 /// # Example
11802 /// ```ignore,no_run
11803 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11804 /// # let project_id = "project_id";
11805 /// # let location_id = "location_id";
11806 /// # let volume_id = "volume_id";
11807 /// let x = RenameVolumeRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
11808 /// ```
11809 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11810 self.name = v.into();
11811 self
11812 }
11813
11814 /// Sets the value of [new_volume_id][crate::model::RenameVolumeRequest::new_volume_id].
11815 ///
11816 /// # Example
11817 /// ```ignore,no_run
11818 /// # use google_cloud_baremetalsolution_v2::model::RenameVolumeRequest;
11819 /// let x = RenameVolumeRequest::new().set_new_volume_id("example");
11820 /// ```
11821 pub fn set_new_volume_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11822 self.new_volume_id = v.into();
11823 self
11824 }
11825}
11826
11827impl wkt::message::Message for RenameVolumeRequest {
11828 fn typename() -> &'static str {
11829 "type.googleapis.com/google.cloud.baremetalsolution.v2.RenameVolumeRequest"
11830 }
11831}
11832
11833/// Request for skip volume cooloff and delete it.
11834#[derive(Clone, Default, PartialEq)]
11835#[non_exhaustive]
11836pub struct EvictVolumeRequest {
11837 /// Required. The name of the Volume.
11838 pub name: std::string::String,
11839
11840 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11841}
11842
11843impl EvictVolumeRequest {
11844 /// Creates a new default instance.
11845 pub fn new() -> Self {
11846 std::default::Default::default()
11847 }
11848
11849 /// Sets the value of [name][crate::model::EvictVolumeRequest::name].
11850 ///
11851 /// # Example
11852 /// ```ignore,no_run
11853 /// # use google_cloud_baremetalsolution_v2::model::EvictVolumeRequest;
11854 /// # let project_id = "project_id";
11855 /// # let location_id = "location_id";
11856 /// # let volume_id = "volume_id";
11857 /// let x = EvictVolumeRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
11858 /// ```
11859 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11860 self.name = v.into();
11861 self
11862 }
11863}
11864
11865impl wkt::message::Message for EvictVolumeRequest {
11866 fn typename() -> &'static str {
11867 "type.googleapis.com/google.cloud.baremetalsolution.v2.EvictVolumeRequest"
11868 }
11869}
11870
11871/// Request for emergency resize Volume.
11872#[derive(Clone, Default, PartialEq)]
11873#[non_exhaustive]
11874pub struct ResizeVolumeRequest {
11875 /// Required. Volume to resize.
11876 pub volume: std::string::String,
11877
11878 /// New Volume size, in GiB.
11879 pub size_gib: i64,
11880
11881 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11882}
11883
11884impl ResizeVolumeRequest {
11885 /// Creates a new default instance.
11886 pub fn new() -> Self {
11887 std::default::Default::default()
11888 }
11889
11890 /// Sets the value of [volume][crate::model::ResizeVolumeRequest::volume].
11891 ///
11892 /// # Example
11893 /// ```ignore,no_run
11894 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11895 /// # let project_id = "project_id";
11896 /// # let location_id = "location_id";
11897 /// # let volume_id = "volume_id";
11898 /// let x = ResizeVolumeRequest::new().set_volume(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
11899 /// ```
11900 pub fn set_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11901 self.volume = v.into();
11902 self
11903 }
11904
11905 /// Sets the value of [size_gib][crate::model::ResizeVolumeRequest::size_gib].
11906 ///
11907 /// # Example
11908 /// ```ignore,no_run
11909 /// # use google_cloud_baremetalsolution_v2::model::ResizeVolumeRequest;
11910 /// let x = ResizeVolumeRequest::new().set_size_gib(42);
11911 /// ```
11912 pub fn set_size_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11913 self.size_gib = v.into();
11914 self
11915 }
11916}
11917
11918impl wkt::message::Message for ResizeVolumeRequest {
11919 fn typename() -> &'static str {
11920 "type.googleapis.com/google.cloud.baremetalsolution.v2.ResizeVolumeRequest"
11921 }
11922}
11923
11924/// A snapshot of a volume. Only boot volumes can have snapshots.
11925#[derive(Clone, Default, PartialEq)]
11926#[non_exhaustive]
11927pub struct VolumeSnapshot {
11928 /// The name of the snapshot.
11929 pub name: std::string::String,
11930
11931 /// Output only. An identifier for the snapshot, generated by the backend.
11932 pub id: std::string::String,
11933
11934 /// The description of the snapshot.
11935 pub description: std::string::String,
11936
11937 /// Output only. The creation time of the snapshot.
11938 pub create_time: std::option::Option<wkt::Timestamp>,
11939
11940 /// Output only. The name of the volume which this snapshot belongs to.
11941 pub storage_volume: std::string::String,
11942
11943 /// Output only. The type of the snapshot which indicates whether it was
11944 /// scheduled or manual/ad-hoc.
11945 pub r#type: crate::model::volume_snapshot::SnapshotType,
11946
11947 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11948}
11949
11950impl VolumeSnapshot {
11951 /// Creates a new default instance.
11952 pub fn new() -> Self {
11953 std::default::Default::default()
11954 }
11955
11956 /// Sets the value of [name][crate::model::VolumeSnapshot::name].
11957 ///
11958 /// # Example
11959 /// ```ignore,no_run
11960 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11961 /// # let project_id = "project_id";
11962 /// # let location_id = "location_id";
11963 /// # let volume_id = "volume_id";
11964 /// # let snapshot_id = "snapshot_id";
11965 /// let x = VolumeSnapshot::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/snapshots/{snapshot_id}"));
11966 /// ```
11967 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11968 self.name = v.into();
11969 self
11970 }
11971
11972 /// Sets the value of [id][crate::model::VolumeSnapshot::id].
11973 ///
11974 /// # Example
11975 /// ```ignore,no_run
11976 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11977 /// let x = VolumeSnapshot::new().set_id("example");
11978 /// ```
11979 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11980 self.id = v.into();
11981 self
11982 }
11983
11984 /// Sets the value of [description][crate::model::VolumeSnapshot::description].
11985 ///
11986 /// # Example
11987 /// ```ignore,no_run
11988 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
11989 /// let x = VolumeSnapshot::new().set_description("example");
11990 /// ```
11991 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11992 self.description = v.into();
11993 self
11994 }
11995
11996 /// Sets the value of [create_time][crate::model::VolumeSnapshot::create_time].
11997 ///
11998 /// # Example
11999 /// ```ignore,no_run
12000 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12001 /// use wkt::Timestamp;
12002 /// let x = VolumeSnapshot::new().set_create_time(Timestamp::default()/* use setters */);
12003 /// ```
12004 pub fn set_create_time<T>(mut self, v: T) -> Self
12005 where
12006 T: std::convert::Into<wkt::Timestamp>,
12007 {
12008 self.create_time = std::option::Option::Some(v.into());
12009 self
12010 }
12011
12012 /// Sets or clears the value of [create_time][crate::model::VolumeSnapshot::create_time].
12013 ///
12014 /// # Example
12015 /// ```ignore,no_run
12016 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12017 /// use wkt::Timestamp;
12018 /// let x = VolumeSnapshot::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12019 /// let x = VolumeSnapshot::new().set_or_clear_create_time(None::<Timestamp>);
12020 /// ```
12021 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12022 where
12023 T: std::convert::Into<wkt::Timestamp>,
12024 {
12025 self.create_time = v.map(|x| x.into());
12026 self
12027 }
12028
12029 /// Sets the value of [storage_volume][crate::model::VolumeSnapshot::storage_volume].
12030 ///
12031 /// # Example
12032 /// ```ignore,no_run
12033 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12034 /// # let project_id = "project_id";
12035 /// # let location_id = "location_id";
12036 /// # let volume_id = "volume_id";
12037 /// let x = VolumeSnapshot::new().set_storage_volume(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
12038 /// ```
12039 pub fn set_storage_volume<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12040 self.storage_volume = v.into();
12041 self
12042 }
12043
12044 /// Sets the value of [r#type][crate::model::VolumeSnapshot::type].
12045 ///
12046 /// # Example
12047 /// ```ignore,no_run
12048 /// # use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12049 /// use google_cloud_baremetalsolution_v2::model::volume_snapshot::SnapshotType;
12050 /// let x0 = VolumeSnapshot::new().set_type(SnapshotType::AdHoc);
12051 /// let x1 = VolumeSnapshot::new().set_type(SnapshotType::Scheduled);
12052 /// ```
12053 pub fn set_type<T: std::convert::Into<crate::model::volume_snapshot::SnapshotType>>(
12054 mut self,
12055 v: T,
12056 ) -> Self {
12057 self.r#type = v.into();
12058 self
12059 }
12060}
12061
12062impl wkt::message::Message for VolumeSnapshot {
12063 fn typename() -> &'static str {
12064 "type.googleapis.com/google.cloud.baremetalsolution.v2.VolumeSnapshot"
12065 }
12066}
12067
12068/// Defines additional types related to [VolumeSnapshot].
12069pub mod volume_snapshot {
12070 #[allow(unused_imports)]
12071 use super::*;
12072
12073 /// Represents the type of a snapshot.
12074 ///
12075 /// # Working with unknown values
12076 ///
12077 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12078 /// additional enum variants at any time. Adding new variants is not considered
12079 /// a breaking change. Applications should write their code in anticipation of:
12080 ///
12081 /// - New values appearing in future releases of the client library, **and**
12082 /// - New values received dynamically, without application changes.
12083 ///
12084 /// Please consult the [Working with enums] section in the user guide for some
12085 /// guidelines.
12086 ///
12087 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12088 #[derive(Clone, Debug, PartialEq)]
12089 #[non_exhaustive]
12090 pub enum SnapshotType {
12091 /// Type is not specified.
12092 Unspecified,
12093 /// Snapshot was taken manually by user.
12094 AdHoc,
12095 /// Snapshot was taken automatically as a part of a snapshot schedule.
12096 Scheduled,
12097 /// If set, the enum was initialized with an unknown value.
12098 ///
12099 /// Applications can examine the value using [SnapshotType::value] or
12100 /// [SnapshotType::name].
12101 UnknownValue(snapshot_type::UnknownValue),
12102 }
12103
12104 #[doc(hidden)]
12105 pub mod snapshot_type {
12106 #[allow(unused_imports)]
12107 use super::*;
12108 #[derive(Clone, Debug, PartialEq)]
12109 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12110 }
12111
12112 impl SnapshotType {
12113 /// Gets the enum value.
12114 ///
12115 /// Returns `None` if the enum contains an unknown value deserialized from
12116 /// the string representation of enums.
12117 pub fn value(&self) -> std::option::Option<i32> {
12118 match self {
12119 Self::Unspecified => std::option::Option::Some(0),
12120 Self::AdHoc => std::option::Option::Some(1),
12121 Self::Scheduled => std::option::Option::Some(2),
12122 Self::UnknownValue(u) => u.0.value(),
12123 }
12124 }
12125
12126 /// Gets the enum value as a string.
12127 ///
12128 /// Returns `None` if the enum contains an unknown value deserialized from
12129 /// the integer representation of enums.
12130 pub fn name(&self) -> std::option::Option<&str> {
12131 match self {
12132 Self::Unspecified => std::option::Option::Some("SNAPSHOT_TYPE_UNSPECIFIED"),
12133 Self::AdHoc => std::option::Option::Some("AD_HOC"),
12134 Self::Scheduled => std::option::Option::Some("SCHEDULED"),
12135 Self::UnknownValue(u) => u.0.name(),
12136 }
12137 }
12138 }
12139
12140 impl std::default::Default for SnapshotType {
12141 fn default() -> Self {
12142 use std::convert::From;
12143 Self::from(0)
12144 }
12145 }
12146
12147 impl std::fmt::Display for SnapshotType {
12148 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12149 wkt::internal::display_enum(f, self.name(), self.value())
12150 }
12151 }
12152
12153 impl std::convert::From<i32> for SnapshotType {
12154 fn from(value: i32) -> Self {
12155 match value {
12156 0 => Self::Unspecified,
12157 1 => Self::AdHoc,
12158 2 => Self::Scheduled,
12159 _ => Self::UnknownValue(snapshot_type::UnknownValue(
12160 wkt::internal::UnknownEnumValue::Integer(value),
12161 )),
12162 }
12163 }
12164 }
12165
12166 impl std::convert::From<&str> for SnapshotType {
12167 fn from(value: &str) -> Self {
12168 use std::string::ToString;
12169 match value {
12170 "SNAPSHOT_TYPE_UNSPECIFIED" => Self::Unspecified,
12171 "AD_HOC" => Self::AdHoc,
12172 "SCHEDULED" => Self::Scheduled,
12173 _ => Self::UnknownValue(snapshot_type::UnknownValue(
12174 wkt::internal::UnknownEnumValue::String(value.to_string()),
12175 )),
12176 }
12177 }
12178 }
12179
12180 impl serde::ser::Serialize for SnapshotType {
12181 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12182 where
12183 S: serde::Serializer,
12184 {
12185 match self {
12186 Self::Unspecified => serializer.serialize_i32(0),
12187 Self::AdHoc => serializer.serialize_i32(1),
12188 Self::Scheduled => serializer.serialize_i32(2),
12189 Self::UnknownValue(u) => u.0.serialize(serializer),
12190 }
12191 }
12192 }
12193
12194 impl<'de> serde::de::Deserialize<'de> for SnapshotType {
12195 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12196 where
12197 D: serde::Deserializer<'de>,
12198 {
12199 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotType>::new(
12200 ".google.cloud.baremetalsolution.v2.VolumeSnapshot.SnapshotType",
12201 ))
12202 }
12203 }
12204}
12205
12206/// Message for requesting volume snapshot information.
12207#[derive(Clone, Default, PartialEq)]
12208#[non_exhaustive]
12209pub struct GetVolumeSnapshotRequest {
12210 /// Required. The name of the snapshot.
12211 pub name: std::string::String,
12212
12213 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12214}
12215
12216impl GetVolumeSnapshotRequest {
12217 /// Creates a new default instance.
12218 pub fn new() -> Self {
12219 std::default::Default::default()
12220 }
12221
12222 /// Sets the value of [name][crate::model::GetVolumeSnapshotRequest::name].
12223 ///
12224 /// # Example
12225 /// ```ignore,no_run
12226 /// # use google_cloud_baremetalsolution_v2::model::GetVolumeSnapshotRequest;
12227 /// # let project_id = "project_id";
12228 /// # let location_id = "location_id";
12229 /// # let volume_id = "volume_id";
12230 /// # let snapshot_id = "snapshot_id";
12231 /// let x = GetVolumeSnapshotRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/snapshots/{snapshot_id}"));
12232 /// ```
12233 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12234 self.name = v.into();
12235 self
12236 }
12237}
12238
12239impl wkt::message::Message for GetVolumeSnapshotRequest {
12240 fn typename() -> &'static str {
12241 "type.googleapis.com/google.cloud.baremetalsolution.v2.GetVolumeSnapshotRequest"
12242 }
12243}
12244
12245/// Message for requesting a list of volume snapshots.
12246#[derive(Clone, Default, PartialEq)]
12247#[non_exhaustive]
12248pub struct ListVolumeSnapshotsRequest {
12249 /// Required. Parent value for ListVolumesRequest.
12250 pub parent: std::string::String,
12251
12252 /// Requested page size. The server might return fewer items than requested.
12253 /// If unspecified, server will pick an appropriate default.
12254 pub page_size: i32,
12255
12256 /// A token identifying a page of results from the server.
12257 pub page_token: std::string::String,
12258
12259 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12260}
12261
12262impl ListVolumeSnapshotsRequest {
12263 /// Creates a new default instance.
12264 pub fn new() -> Self {
12265 std::default::Default::default()
12266 }
12267
12268 /// Sets the value of [parent][crate::model::ListVolumeSnapshotsRequest::parent].
12269 ///
12270 /// # Example
12271 /// ```ignore,no_run
12272 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12273 /// # let project_id = "project_id";
12274 /// # let location_id = "location_id";
12275 /// # let volume_id = "volume_id";
12276 /// let x = ListVolumeSnapshotsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
12277 /// ```
12278 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12279 self.parent = v.into();
12280 self
12281 }
12282
12283 /// Sets the value of [page_size][crate::model::ListVolumeSnapshotsRequest::page_size].
12284 ///
12285 /// # Example
12286 /// ```ignore,no_run
12287 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12288 /// let x = ListVolumeSnapshotsRequest::new().set_page_size(42);
12289 /// ```
12290 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12291 self.page_size = v.into();
12292 self
12293 }
12294
12295 /// Sets the value of [page_token][crate::model::ListVolumeSnapshotsRequest::page_token].
12296 ///
12297 /// # Example
12298 /// ```ignore,no_run
12299 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsRequest;
12300 /// let x = ListVolumeSnapshotsRequest::new().set_page_token("example");
12301 /// ```
12302 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12303 self.page_token = v.into();
12304 self
12305 }
12306}
12307
12308impl wkt::message::Message for ListVolumeSnapshotsRequest {
12309 fn typename() -> &'static str {
12310 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsRequest"
12311 }
12312}
12313
12314/// Response message containing the list of volume snapshots.
12315#[derive(Clone, Default, PartialEq)]
12316#[non_exhaustive]
12317pub struct ListVolumeSnapshotsResponse {
12318 /// The list of snapshots.
12319 pub volume_snapshots: std::vec::Vec<crate::model::VolumeSnapshot>,
12320
12321 /// A token identifying a page of results from the server.
12322 pub next_page_token: std::string::String,
12323
12324 /// Locations that could not be reached.
12325 pub unreachable: std::vec::Vec<std::string::String>,
12326
12327 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12328}
12329
12330impl ListVolumeSnapshotsResponse {
12331 /// Creates a new default instance.
12332 pub fn new() -> Self {
12333 std::default::Default::default()
12334 }
12335
12336 /// Sets the value of [volume_snapshots][crate::model::ListVolumeSnapshotsResponse::volume_snapshots].
12337 ///
12338 /// # Example
12339 /// ```ignore,no_run
12340 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12341 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12342 /// let x = ListVolumeSnapshotsResponse::new()
12343 /// .set_volume_snapshots([
12344 /// VolumeSnapshot::default()/* use setters */,
12345 /// VolumeSnapshot::default()/* use (different) setters */,
12346 /// ]);
12347 /// ```
12348 pub fn set_volume_snapshots<T, V>(mut self, v: T) -> Self
12349 where
12350 T: std::iter::IntoIterator<Item = V>,
12351 V: std::convert::Into<crate::model::VolumeSnapshot>,
12352 {
12353 use std::iter::Iterator;
12354 self.volume_snapshots = v.into_iter().map(|i| i.into()).collect();
12355 self
12356 }
12357
12358 /// Sets the value of [next_page_token][crate::model::ListVolumeSnapshotsResponse::next_page_token].
12359 ///
12360 /// # Example
12361 /// ```ignore,no_run
12362 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12363 /// let x = ListVolumeSnapshotsResponse::new().set_next_page_token("example");
12364 /// ```
12365 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12366 self.next_page_token = v.into();
12367 self
12368 }
12369
12370 /// Sets the value of [unreachable][crate::model::ListVolumeSnapshotsResponse::unreachable].
12371 ///
12372 /// # Example
12373 /// ```ignore,no_run
12374 /// # use google_cloud_baremetalsolution_v2::model::ListVolumeSnapshotsResponse;
12375 /// let x = ListVolumeSnapshotsResponse::new().set_unreachable(["a", "b", "c"]);
12376 /// ```
12377 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
12378 where
12379 T: std::iter::IntoIterator<Item = V>,
12380 V: std::convert::Into<std::string::String>,
12381 {
12382 use std::iter::Iterator;
12383 self.unreachable = v.into_iter().map(|i| i.into()).collect();
12384 self
12385 }
12386}
12387
12388impl wkt::message::Message for ListVolumeSnapshotsResponse {
12389 fn typename() -> &'static str {
12390 "type.googleapis.com/google.cloud.baremetalsolution.v2.ListVolumeSnapshotsResponse"
12391 }
12392}
12393
12394#[doc(hidden)]
12395impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumeSnapshotsResponse {
12396 type PageItem = crate::model::VolumeSnapshot;
12397
12398 fn items(self) -> std::vec::Vec<Self::PageItem> {
12399 self.volume_snapshots
12400 }
12401
12402 fn next_page_token(&self) -> std::string::String {
12403 use std::clone::Clone;
12404 self.next_page_token.clone()
12405 }
12406}
12407
12408/// Message for deleting named Volume snapshot.
12409#[derive(Clone, Default, PartialEq)]
12410#[non_exhaustive]
12411pub struct DeleteVolumeSnapshotRequest {
12412 /// Required. The name of the snapshot to delete.
12413 pub name: std::string::String,
12414
12415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12416}
12417
12418impl DeleteVolumeSnapshotRequest {
12419 /// Creates a new default instance.
12420 pub fn new() -> Self {
12421 std::default::Default::default()
12422 }
12423
12424 /// Sets the value of [name][crate::model::DeleteVolumeSnapshotRequest::name].
12425 ///
12426 /// # Example
12427 /// ```ignore,no_run
12428 /// # use google_cloud_baremetalsolution_v2::model::DeleteVolumeSnapshotRequest;
12429 /// # let project_id = "project_id";
12430 /// # let location_id = "location_id";
12431 /// # let volume_id = "volume_id";
12432 /// # let snapshot_id = "snapshot_id";
12433 /// let x = DeleteVolumeSnapshotRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/snapshots/{snapshot_id}"));
12434 /// ```
12435 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12436 self.name = v.into();
12437 self
12438 }
12439}
12440
12441impl wkt::message::Message for DeleteVolumeSnapshotRequest {
12442 fn typename() -> &'static str {
12443 "type.googleapis.com/google.cloud.baremetalsolution.v2.DeleteVolumeSnapshotRequest"
12444 }
12445}
12446
12447/// Message for creating a volume snapshot.
12448#[derive(Clone, Default, PartialEq)]
12449#[non_exhaustive]
12450pub struct CreateVolumeSnapshotRequest {
12451 /// Required. The volume to snapshot.
12452 pub parent: std::string::String,
12453
12454 /// Required. The snapshot to create.
12455 pub volume_snapshot: std::option::Option<crate::model::VolumeSnapshot>,
12456
12457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12458}
12459
12460impl CreateVolumeSnapshotRequest {
12461 /// Creates a new default instance.
12462 pub fn new() -> Self {
12463 std::default::Default::default()
12464 }
12465
12466 /// Sets the value of [parent][crate::model::CreateVolumeSnapshotRequest::parent].
12467 ///
12468 /// # Example
12469 /// ```ignore,no_run
12470 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12471 /// # let project_id = "project_id";
12472 /// # let location_id = "location_id";
12473 /// # let volume_id = "volume_id";
12474 /// let x = CreateVolumeSnapshotRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}"));
12475 /// ```
12476 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12477 self.parent = v.into();
12478 self
12479 }
12480
12481 /// Sets the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12482 ///
12483 /// # Example
12484 /// ```ignore,no_run
12485 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12486 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12487 /// let x = CreateVolumeSnapshotRequest::new().set_volume_snapshot(VolumeSnapshot::default()/* use setters */);
12488 /// ```
12489 pub fn set_volume_snapshot<T>(mut self, v: T) -> Self
12490 where
12491 T: std::convert::Into<crate::model::VolumeSnapshot>,
12492 {
12493 self.volume_snapshot = std::option::Option::Some(v.into());
12494 self
12495 }
12496
12497 /// Sets or clears the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
12498 ///
12499 /// # Example
12500 /// ```ignore,no_run
12501 /// # use google_cloud_baremetalsolution_v2::model::CreateVolumeSnapshotRequest;
12502 /// use google_cloud_baremetalsolution_v2::model::VolumeSnapshot;
12503 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(Some(VolumeSnapshot::default()/* use setters */));
12504 /// let x = CreateVolumeSnapshotRequest::new().set_or_clear_volume_snapshot(None::<VolumeSnapshot>);
12505 /// ```
12506 pub fn set_or_clear_volume_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
12507 where
12508 T: std::convert::Into<crate::model::VolumeSnapshot>,
12509 {
12510 self.volume_snapshot = v.map(|x| x.into());
12511 self
12512 }
12513}
12514
12515impl wkt::message::Message for CreateVolumeSnapshotRequest {
12516 fn typename() -> &'static str {
12517 "type.googleapis.com/google.cloud.baremetalsolution.v2.CreateVolumeSnapshotRequest"
12518 }
12519}
12520
12521/// Message for restoring a volume snapshot.
12522#[derive(Clone, Default, PartialEq)]
12523#[non_exhaustive]
12524pub struct RestoreVolumeSnapshotRequest {
12525 /// Required. Name of the snapshot which will be used to restore its parent
12526 /// volume.
12527 pub volume_snapshot: std::string::String,
12528
12529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12530}
12531
12532impl RestoreVolumeSnapshotRequest {
12533 /// Creates a new default instance.
12534 pub fn new() -> Self {
12535 std::default::Default::default()
12536 }
12537
12538 /// Sets the value of [volume_snapshot][crate::model::RestoreVolumeSnapshotRequest::volume_snapshot].
12539 ///
12540 /// # Example
12541 /// ```ignore,no_run
12542 /// # use google_cloud_baremetalsolution_v2::model::RestoreVolumeSnapshotRequest;
12543 /// # let project_id = "project_id";
12544 /// # let location_id = "location_id";
12545 /// # let volume_id = "volume_id";
12546 /// # let snapshot_id = "snapshot_id";
12547 /// let x = RestoreVolumeSnapshotRequest::new().set_volume_snapshot(format!("projects/{project_id}/locations/{location_id}/volumes/{volume_id}/snapshots/{snapshot_id}"));
12548 /// ```
12549 pub fn set_volume_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12550 self.volume_snapshot = v.into();
12551 self
12552 }
12553}
12554
12555impl wkt::message::Message for RestoreVolumeSnapshotRequest {
12556 fn typename() -> &'static str {
12557 "type.googleapis.com/google.cloud.baremetalsolution.v2.RestoreVolumeSnapshotRequest"
12558 }
12559}
12560
12561/// Performance tier of the Volume.
12562///
12563/// # Working with unknown values
12564///
12565/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12566/// additional enum variants at any time. Adding new variants is not considered
12567/// a breaking change. Applications should write their code in anticipation of:
12568///
12569/// - New values appearing in future releases of the client library, **and**
12570/// - New values received dynamically, without application changes.
12571///
12572/// Please consult the [Working with enums] section in the user guide for some
12573/// guidelines.
12574///
12575/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12576#[derive(Clone, Debug, PartialEq)]
12577#[non_exhaustive]
12578pub enum VolumePerformanceTier {
12579 /// Value is not specified.
12580 Unspecified,
12581 /// Regular volumes, shared aggregates.
12582 Shared,
12583 /// Assigned aggregates.
12584 Assigned,
12585 /// High throughput aggregates.
12586 Ht,
12587 /// If set, the enum was initialized with an unknown value.
12588 ///
12589 /// Applications can examine the value using [VolumePerformanceTier::value] or
12590 /// [VolumePerformanceTier::name].
12591 UnknownValue(volume_performance_tier::UnknownValue),
12592}
12593
12594#[doc(hidden)]
12595pub mod volume_performance_tier {
12596 #[allow(unused_imports)]
12597 use super::*;
12598 #[derive(Clone, Debug, PartialEq)]
12599 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12600}
12601
12602impl VolumePerformanceTier {
12603 /// Gets the enum value.
12604 ///
12605 /// Returns `None` if the enum contains an unknown value deserialized from
12606 /// the string representation of enums.
12607 pub fn value(&self) -> std::option::Option<i32> {
12608 match self {
12609 Self::Unspecified => std::option::Option::Some(0),
12610 Self::Shared => std::option::Option::Some(1),
12611 Self::Assigned => std::option::Option::Some(2),
12612 Self::Ht => std::option::Option::Some(3),
12613 Self::UnknownValue(u) => u.0.value(),
12614 }
12615 }
12616
12617 /// Gets the enum value as a string.
12618 ///
12619 /// Returns `None` if the enum contains an unknown value deserialized from
12620 /// the integer representation of enums.
12621 pub fn name(&self) -> std::option::Option<&str> {
12622 match self {
12623 Self::Unspecified => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_UNSPECIFIED"),
12624 Self::Shared => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_SHARED"),
12625 Self::Assigned => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_ASSIGNED"),
12626 Self::Ht => std::option::Option::Some("VOLUME_PERFORMANCE_TIER_HT"),
12627 Self::UnknownValue(u) => u.0.name(),
12628 }
12629 }
12630}
12631
12632impl std::default::Default for VolumePerformanceTier {
12633 fn default() -> Self {
12634 use std::convert::From;
12635 Self::from(0)
12636 }
12637}
12638
12639impl std::fmt::Display for VolumePerformanceTier {
12640 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12641 wkt::internal::display_enum(f, self.name(), self.value())
12642 }
12643}
12644
12645impl std::convert::From<i32> for VolumePerformanceTier {
12646 fn from(value: i32) -> Self {
12647 match value {
12648 0 => Self::Unspecified,
12649 1 => Self::Shared,
12650 2 => Self::Assigned,
12651 3 => Self::Ht,
12652 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12653 wkt::internal::UnknownEnumValue::Integer(value),
12654 )),
12655 }
12656 }
12657}
12658
12659impl std::convert::From<&str> for VolumePerformanceTier {
12660 fn from(value: &str) -> Self {
12661 use std::string::ToString;
12662 match value {
12663 "VOLUME_PERFORMANCE_TIER_UNSPECIFIED" => Self::Unspecified,
12664 "VOLUME_PERFORMANCE_TIER_SHARED" => Self::Shared,
12665 "VOLUME_PERFORMANCE_TIER_ASSIGNED" => Self::Assigned,
12666 "VOLUME_PERFORMANCE_TIER_HT" => Self::Ht,
12667 _ => Self::UnknownValue(volume_performance_tier::UnknownValue(
12668 wkt::internal::UnknownEnumValue::String(value.to_string()),
12669 )),
12670 }
12671 }
12672}
12673
12674impl serde::ser::Serialize for VolumePerformanceTier {
12675 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12676 where
12677 S: serde::Serializer,
12678 {
12679 match self {
12680 Self::Unspecified => serializer.serialize_i32(0),
12681 Self::Shared => serializer.serialize_i32(1),
12682 Self::Assigned => serializer.serialize_i32(2),
12683 Self::Ht => serializer.serialize_i32(3),
12684 Self::UnknownValue(u) => u.0.serialize(serializer),
12685 }
12686 }
12687}
12688
12689impl<'de> serde::de::Deserialize<'de> for VolumePerformanceTier {
12690 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12691 where
12692 D: serde::Deserializer<'de>,
12693 {
12694 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumePerformanceTier>::new(
12695 ".google.cloud.baremetalsolution.v2.VolumePerformanceTier",
12696 ))
12697 }
12698}
12699
12700/// The possible values for a workload profile.
12701///
12702/// # Working with unknown values
12703///
12704/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12705/// additional enum variants at any time. Adding new variants is not considered
12706/// a breaking change. Applications should write their code in anticipation of:
12707///
12708/// - New values appearing in future releases of the client library, **and**
12709/// - New values received dynamically, without application changes.
12710///
12711/// Please consult the [Working with enums] section in the user guide for some
12712/// guidelines.
12713///
12714/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12715#[derive(Clone, Debug, PartialEq)]
12716#[non_exhaustive]
12717pub enum WorkloadProfile {
12718 /// The workload profile is in an unknown state.
12719 Unspecified,
12720 /// The workload profile is generic.
12721 Generic,
12722 /// The workload profile is hana.
12723 Hana,
12724 /// If set, the enum was initialized with an unknown value.
12725 ///
12726 /// Applications can examine the value using [WorkloadProfile::value] or
12727 /// [WorkloadProfile::name].
12728 UnknownValue(workload_profile::UnknownValue),
12729}
12730
12731#[doc(hidden)]
12732pub mod workload_profile {
12733 #[allow(unused_imports)]
12734 use super::*;
12735 #[derive(Clone, Debug, PartialEq)]
12736 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12737}
12738
12739impl WorkloadProfile {
12740 /// Gets the enum value.
12741 ///
12742 /// Returns `None` if the enum contains an unknown value deserialized from
12743 /// the string representation of enums.
12744 pub fn value(&self) -> std::option::Option<i32> {
12745 match self {
12746 Self::Unspecified => std::option::Option::Some(0),
12747 Self::Generic => std::option::Option::Some(1),
12748 Self::Hana => std::option::Option::Some(2),
12749 Self::UnknownValue(u) => u.0.value(),
12750 }
12751 }
12752
12753 /// Gets the enum value as a string.
12754 ///
12755 /// Returns `None` if the enum contains an unknown value deserialized from
12756 /// the integer representation of enums.
12757 pub fn name(&self) -> std::option::Option<&str> {
12758 match self {
12759 Self::Unspecified => std::option::Option::Some("WORKLOAD_PROFILE_UNSPECIFIED"),
12760 Self::Generic => std::option::Option::Some("WORKLOAD_PROFILE_GENERIC"),
12761 Self::Hana => std::option::Option::Some("WORKLOAD_PROFILE_HANA"),
12762 Self::UnknownValue(u) => u.0.name(),
12763 }
12764 }
12765}
12766
12767impl std::default::Default for WorkloadProfile {
12768 fn default() -> Self {
12769 use std::convert::From;
12770 Self::from(0)
12771 }
12772}
12773
12774impl std::fmt::Display for WorkloadProfile {
12775 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12776 wkt::internal::display_enum(f, self.name(), self.value())
12777 }
12778}
12779
12780impl std::convert::From<i32> for WorkloadProfile {
12781 fn from(value: i32) -> Self {
12782 match value {
12783 0 => Self::Unspecified,
12784 1 => Self::Generic,
12785 2 => Self::Hana,
12786 _ => Self::UnknownValue(workload_profile::UnknownValue(
12787 wkt::internal::UnknownEnumValue::Integer(value),
12788 )),
12789 }
12790 }
12791}
12792
12793impl std::convert::From<&str> for WorkloadProfile {
12794 fn from(value: &str) -> Self {
12795 use std::string::ToString;
12796 match value {
12797 "WORKLOAD_PROFILE_UNSPECIFIED" => Self::Unspecified,
12798 "WORKLOAD_PROFILE_GENERIC" => Self::Generic,
12799 "WORKLOAD_PROFILE_HANA" => Self::Hana,
12800 _ => Self::UnknownValue(workload_profile::UnknownValue(
12801 wkt::internal::UnknownEnumValue::String(value.to_string()),
12802 )),
12803 }
12804 }
12805}
12806
12807impl serde::ser::Serialize for WorkloadProfile {
12808 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12809 where
12810 S: serde::Serializer,
12811 {
12812 match self {
12813 Self::Unspecified => serializer.serialize_i32(0),
12814 Self::Generic => serializer.serialize_i32(1),
12815 Self::Hana => serializer.serialize_i32(2),
12816 Self::UnknownValue(u) => u.0.serialize(serializer),
12817 }
12818 }
12819}
12820
12821impl<'de> serde::de::Deserialize<'de> for WorkloadProfile {
12822 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12823 where
12824 D: serde::Deserializer<'de>,
12825 {
12826 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WorkloadProfile>::new(
12827 ".google.cloud.baremetalsolution.v2.WorkloadProfile",
12828 ))
12829 }
12830}