proxmox_api/generated/nodes/node/disks/
directory.rs1pub mod name;
2pub struct DirectoryClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> DirectoryClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}{}", parent_path, "/directory"),
14 }
15 }
16}
17impl<T> DirectoryClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "PVE Managed Directory storages."]
22 pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
23 let path = self.path.to_string();
24 self.client.get(&path, &())
25 }
26}
27impl<T> DirectoryClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Create a Filesystem on an unused disk. Will be mounted under '/mnt/pve/NAME'."]
32 pub fn post(&self, params: PostParams) -> Result<String, T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38 pub fn new(
39 device: String,
40 options: String,
41 path: String,
42 ty: String,
43 unitfile: String,
44 ) -> Self {
45 Self {
46 device,
47 options,
48 path,
49 ty,
50 unitfile,
51 additional_properties: Default::default(),
52 }
53 }
54}
55#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
56pub struct GetOutputItems {
57 #[doc = "The mounted device."]
58 pub device: String,
59 #[doc = "The mount options."]
60 pub options: String,
61 #[doc = "The mount path."]
62 pub path: String,
63 #[serde(rename = "type")]
64 #[doc = "The filesystem type."]
65 pub ty: String,
66 #[doc = "The path of the mount unit."]
67 pub unitfile: String,
68 #[serde(
69 flatten,
70 default,
71 skip_serializing_if = "::std::collections::HashMap::is_empty"
72 )]
73 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
74}
75impl PostParams {
76 pub fn new(device: String, name: String) -> Self {
77 Self {
78 device,
79 name,
80 add_storage: Default::default(),
81 filesystem: Default::default(),
82 additional_properties: Default::default(),
83 }
84 }
85}
86#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
87pub struct PostParams {
88 #[serde(
89 serialize_with = "crate::types::serialize_bool_optional",
90 deserialize_with = "crate::types::deserialize_bool_optional"
91 )]
92 #[serde(skip_serializing_if = "Option::is_none", default)]
93 #[doc = "Configure storage using the directory."]
94 pub add_storage: Option<bool>,
95 #[doc = "The block device you want to create the filesystem on."]
96 pub device: String,
97 #[serde(skip_serializing_if = "Option::is_none", default)]
98 #[doc = "The desired filesystem."]
99 pub filesystem: Option<Filesystem>,
100 #[doc = "The storage identifier."]
101 pub name: String,
102 #[serde(
103 flatten,
104 default,
105 skip_serializing_if = "::std::collections::HashMap::is_empty"
106 )]
107 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
108}
109#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
110pub enum Filesystem {
111 #[serde(rename = "ext4")]
112 Ext4,
113 #[serde(rename = "xfs")]
114 Xfs,
115}
116impl Default for Filesystem {
117 fn default() -> Self {
118 Self::Ext4
119 }
120}
121impl<T> DirectoryClient<T>
122where
123 T: crate::client::Client,
124{
125 pub fn name(&self, name: &str) -> name::NameClient<T> {
126 name::NameClient::<T>::new(self.client.clone(), &self.path, name)
127 }
128}