Skip to main content

oci_rust_sdk/core/models/
device.rs

1use serde::{Deserialize, Serialize};
2
3#[allow(unused_imports)]
4use super::*;
5/// Device Path corresponding to the block devices attached to instances having a name and isAvailable flag.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct Device {
9    /// The device name.
10    pub name: String,
11
12    /// The flag denoting whether device is available.
13    pub is_available: bool,
14}
15
16/// Required fields for Device
17pub struct DeviceRequired {
18    /// The device name.
19    pub name: String,
20
21    /// The flag denoting whether device is available.
22    pub is_available: bool,
23}
24
25impl Device {
26    /// Create a new Device with required fields
27    pub fn new(required: DeviceRequired) -> Self {
28        Self {
29            name: required.name,
30
31            is_available: required.is_available,
32        }
33    }
34
35    /// Set name
36    pub fn set_name(mut self, value: String) -> Self {
37        self.name = value;
38        self
39    }
40
41    /// Set is_available
42    pub fn set_is_available(mut self, value: bool) -> Self {
43        self.is_available = value;
44        self
45    }
46}