proxmox_api/generated/storage/
storage.rs

1pub struct StorageClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> StorageClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str, storage: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}/{}", parent_path, storage),
13        }
14    }
15}
16impl<T> StorageClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Delete storage configuration."]
21    pub fn delete(&self) -> Result<(), T::Error> {
22        let path = self.path.to_string();
23        self.client.delete(&path, &())
24    }
25}
26impl<T> StorageClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Read storage configuration."]
31    pub fn get(&self) -> Result<GetOutput, T::Error> {
32        let path = self.path.to_string();
33        self.client.get(&path, &())
34    }
35}
36impl<T> StorageClient<T>
37where
38    T: crate::client::Client,
39{
40    #[doc = "Update storage configuration."]
41    pub fn put(&self, params: PutParams) -> Result<PutOutput, T::Error> {
42        let path = self.path.to_string();
43        self.client.put(&path, &params)
44    }
45}
46#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
47pub struct ConfigPutOutputConfig {
48    #[serde(rename = "encryption-key")]
49    #[serde(skip_serializing_if = "Option::is_none", default)]
50    #[doc = "The, possible auto-generated, encryption-key."]
51    pub encryption_key: Option<String>,
52    #[serde(
53        flatten,
54        default,
55        skip_serializing_if = "::std::collections::HashMap::is_empty"
56    )]
57    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
58}
59#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
60pub struct GetOutput {
61    #[serde(
62        flatten,
63        default,
64        skip_serializing_if = "::std::collections::HashMap::is_empty"
65    )]
66    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
67}
68impl PutOutput {
69    pub fn new(storage: String, ty: Type) -> Self {
70        Self {
71            storage,
72            ty,
73            config: Default::default(),
74            additional_properties: Default::default(),
75        }
76    }
77}
78#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
79pub struct PutOutput {
80    #[serde(skip_serializing_if = "Option::is_none", default)]
81    #[doc = "Partial, possible server generated, configuration properties."]
82    pub config: Option<ConfigPutOutputConfig>,
83    #[doc = "The ID of the created storage."]
84    pub storage: String,
85    #[serde(rename = "type")]
86    #[doc = "The type of the created storage."]
87    pub ty: Type,
88    #[serde(
89        flatten,
90        default,
91        skip_serializing_if = "::std::collections::HashMap::is_empty"
92    )]
93    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
94}
95#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
96pub struct PutParams {
97    #[serde(skip_serializing_if = "Option::is_none", default)]
98    #[doc = "block size"]
99    pub blocksize: Option<String>,
100    #[serde(skip_serializing_if = "Option::is_none", default)]
101    #[doc = "Set I/O bandwidth limit for various operations (in KiB/s)."]
102    pub bwlimit: Option<String>,
103    #[serde(skip_serializing_if = "Option::is_none", default)]
104    #[doc = "host group for comstar views"]
105    pub comstar_hg: Option<String>,
106    #[serde(skip_serializing_if = "Option::is_none", default)]
107    #[doc = "target group for comstar views"]
108    pub comstar_tg: Option<String>,
109    #[serde(skip_serializing_if = "Option::is_none", default)]
110    #[doc = "Allowed content types.\n\nNOTE: the value 'rootdir' is used for Containers, and value 'images' for VMs.\n"]
111    pub content: Option<String>,
112    #[serde(rename = "content-dirs")]
113    #[serde(skip_serializing_if = "Option::is_none", default)]
114    #[doc = "Overrides for default content type directories."]
115    pub content_dirs: Option<String>,
116    #[serde(rename = "create-base-path")]
117    #[serde(skip_serializing_if = "Option::is_none", default)]
118    #[doc = "Create the base directory if it doesn't exist."]
119    pub create_base_path: Option<()>,
120    #[serde(rename = "create-subdirs")]
121    #[serde(skip_serializing_if = "Option::is_none", default)]
122    #[doc = "Populate the directory with the default structure."]
123    pub create_subdirs: Option<()>,
124    #[serde(rename = "data-pool")]
125    #[serde(skip_serializing_if = "Option::is_none", default)]
126    #[doc = "Data Pool (for erasure coding only)"]
127    pub data_pool: Option<String>,
128    #[serde(skip_serializing_if = "Option::is_none", default)]
129    #[doc = "A list of settings you want to delete."]
130    pub delete: Option<String>,
131    #[serde(skip_serializing_if = "Option::is_none", default)]
132    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
133    pub digest: Option<String>,
134    #[serde(
135        serialize_with = "crate::types::serialize_bool_optional",
136        deserialize_with = "crate::types::deserialize_bool_optional"
137    )]
138    #[serde(skip_serializing_if = "Option::is_none", default)]
139    #[doc = "Flag to disable the storage."]
140    pub disable: Option<bool>,
141    #[serde(skip_serializing_if = "Option::is_none", default)]
142    #[doc = "CIFS domain."]
143    pub domain: Option<String>,
144    #[serde(rename = "encryption-key")]
145    #[serde(skip_serializing_if = "Option::is_none", default)]
146    #[doc = "Encryption key. Use 'autogen' to generate one automatically without passphrase."]
147    pub encryption_key: Option<String>,
148    #[serde(skip_serializing_if = "Option::is_none", default)]
149    #[doc = "Certificate SHA 256 fingerprint."]
150    pub fingerprint: Option<String>,
151    #[serde(skip_serializing_if = "Option::is_none", default)]
152    #[doc = "Default image format."]
153    pub format: Option<String>,
154    #[serde(rename = "fs-name")]
155    #[serde(skip_serializing_if = "Option::is_none", default)]
156    #[doc = "The Ceph filesystem name."]
157    pub fs_name: Option<String>,
158    #[serde(
159        serialize_with = "crate::types::serialize_bool_optional",
160        deserialize_with = "crate::types::deserialize_bool_optional"
161    )]
162    #[serde(skip_serializing_if = "Option::is_none", default)]
163    #[doc = "Mount CephFS through FUSE."]
164    pub fuse: Option<bool>,
165    #[serde(skip_serializing_if = "Option::is_none", default)]
166    #[doc = "Assume the given path is an externally managed mountpoint and consider the storage offline if it is not mounted. Using a boolean (yes/no) value serves as a shortcut to using the target path in this field."]
167    pub is_mountpoint: Option<String>,
168    #[serde(skip_serializing_if = "Option::is_none", default)]
169    #[doc = "Client keyring contents (for external clusters)."]
170    pub keyring: Option<String>,
171    #[serde(
172        serialize_with = "crate::types::serialize_bool_optional",
173        deserialize_with = "crate::types::deserialize_bool_optional"
174    )]
175    #[serde(skip_serializing_if = "Option::is_none", default)]
176    #[doc = "Always access rbd through krbd kernel module."]
177    pub krbd: Option<bool>,
178    #[serde(skip_serializing_if = "Option::is_none", default)]
179    #[doc = "target portal group for Linux LIO targets"]
180    pub lio_tpg: Option<String>,
181    #[serde(rename = "master-pubkey")]
182    #[serde(skip_serializing_if = "Option::is_none", default)]
183    #[doc = "Base64-encoded, PEM-formatted public RSA key. Used to encrypt a copy of the encryption-key which will be added to each encrypted backup."]
184    pub master_pubkey: Option<String>,
185    #[serde(rename = "max-protected-backups")]
186    #[serde(skip_serializing_if = "Option::is_none", default)]
187    #[doc = "Maximal number of protected backups per guest. Use '-1' for unlimited."]
188    pub max_protected_backups: Option<()>,
189    #[serde(
190        serialize_with = "crate::types::serialize_int_optional",
191        deserialize_with = "crate::types::deserialize_int_optional"
192    )]
193    #[serde(skip_serializing_if = "Option::is_none", default)]
194    #[doc = "Deprecated: use 'prune-backups' instead. Maximal number of backup files per VM. Use '0' for unlimited."]
195    pub maxfiles: Option<u64>,
196    #[serde(skip_serializing_if = "Option::is_none", default)]
197    #[doc = "Create the directory if it doesn't exist and populate it with default sub-dirs. NOTE: Deprecated, use the 'create-base-path' and 'create-subdirs' options instead."]
198    pub mkdir: Option<()>,
199    #[serde(skip_serializing_if = "Option::is_none", default)]
200    #[doc = "IP addresses of monitors (for external clusters)."]
201    pub monhost: Option<String>,
202    #[serde(skip_serializing_if = "Option::is_none", default)]
203    #[doc = "mount point"]
204    pub mountpoint: Option<String>,
205    #[serde(skip_serializing_if = "Option::is_none", default)]
206    #[doc = "Namespace."]
207    pub namespace: Option<String>,
208    #[serde(
209        serialize_with = "crate::types::serialize_bool_optional",
210        deserialize_with = "crate::types::deserialize_bool_optional"
211    )]
212    #[serde(skip_serializing_if = "Option::is_none", default)]
213    #[doc = "Set the NOCOW flag on files. Disables data checksumming and causes data errors to be unrecoverable from while allowing direct I/O. Only use this if data does not need to be any more safe than on a single ext4 formatted disk with no underlying raid system."]
214    pub nocow: Option<bool>,
215    #[serde(skip_serializing_if = "Option::is_none", default)]
216    #[doc = "List of nodes for which the storage configuration applies."]
217    pub nodes: Option<String>,
218    #[serde(
219        serialize_with = "crate::types::serialize_bool_optional",
220        deserialize_with = "crate::types::deserialize_bool_optional"
221    )]
222    #[serde(skip_serializing_if = "Option::is_none", default)]
223    #[doc = "disable write caching on the target"]
224    pub nowritecache: Option<bool>,
225    #[serde(skip_serializing_if = "Option::is_none", default)]
226    #[doc = "NFS/CIFS mount options (see 'man nfs' or 'man mount.cifs')"]
227    pub options: Option<String>,
228    #[serde(skip_serializing_if = "Option::is_none", default)]
229    #[doc = "Password for accessing the share/datastore."]
230    pub password: Option<String>,
231    #[serde(skip_serializing_if = "Option::is_none", default)]
232    #[doc = "Pool."]
233    pub pool: Option<String>,
234    #[serde(
235        serialize_with = "crate::types::serialize_int_optional",
236        deserialize_with = "crate::types::deserialize_int_optional"
237    )]
238    #[serde(skip_serializing_if = "Option::is_none", default)]
239    #[doc = "For non default port."]
240    pub port: Option<u64>,
241    #[serde(skip_serializing_if = "Option::is_none", default)]
242    #[doc = "Preallocation mode for raw and qcow2 images. Using 'metadata' on raw images results in preallocation=off."]
243    pub preallocation: Option<Preallocation>,
244    #[serde(rename = "prune-backups")]
245    #[serde(skip_serializing_if = "Option::is_none", default)]
246    #[doc = "The retention options with shorter intervals are processed first with --keep-last being the very first one. Each option covers a specific period of time. We say that backups within this period are covered by this option. The next option does not take care of already covered backups and only considers older backups."]
247    pub prune_backups: Option<String>,
248    #[serde(
249        serialize_with = "crate::types::serialize_bool_optional",
250        deserialize_with = "crate::types::deserialize_bool_optional"
251    )]
252    #[serde(skip_serializing_if = "Option::is_none", default)]
253    #[doc = "Zero-out data when removing LVs."]
254    pub saferemove: Option<bool>,
255    #[serde(skip_serializing_if = "Option::is_none", default)]
256    #[doc = "Wipe throughput (cstream -t parameter value)."]
257    pub saferemove_throughput: Option<String>,
258    #[serde(skip_serializing_if = "Option::is_none", default)]
259    #[doc = "Server IP or DNS name."]
260    pub server: Option<String>,
261    #[serde(skip_serializing_if = "Option::is_none", default)]
262    #[doc = "Backup volfile server IP or DNS name."]
263    pub server2: Option<String>,
264    #[serde(
265        serialize_with = "crate::types::serialize_bool_optional",
266        deserialize_with = "crate::types::deserialize_bool_optional"
267    )]
268    #[serde(skip_serializing_if = "Option::is_none", default)]
269    #[doc = "Indicate that this is a single storage with the same contents on all nodes (or all listed in the 'nodes' option). It will not make the contents of a local storage automatically accessible to other nodes, it just marks an already shared storage as such!"]
270    pub shared: Option<bool>,
271    #[serde(rename = "skip-cert-verification")]
272    #[serde(skip_serializing_if = "Option::is_none", default)]
273    #[doc = "Disable TLS certificate verification, only enable on fully trusted networks!"]
274    pub skip_cert_verification: Option<()>,
275    #[serde(skip_serializing_if = "Option::is_none", default)]
276    #[doc = "SMB protocol version. 'default' if not set, negotiates the highest SMB2+ version supported by both the client and server."]
277    pub smbversion: Option<Smbversion>,
278    #[serde(
279        serialize_with = "crate::types::serialize_bool_optional",
280        deserialize_with = "crate::types::deserialize_bool_optional"
281    )]
282    #[serde(skip_serializing_if = "Option::is_none", default)]
283    #[doc = "use sparse volumes"]
284    pub sparse: Option<bool>,
285    #[serde(skip_serializing_if = "Option::is_none", default)]
286    #[doc = "Subdir to mount."]
287    pub subdir: Option<String>,
288    #[serde(
289        serialize_with = "crate::types::serialize_bool_optional",
290        deserialize_with = "crate::types::deserialize_bool_optional"
291    )]
292    #[serde(skip_serializing_if = "Option::is_none", default)]
293    #[doc = "Only use logical volumes tagged with 'pve-vm-ID'."]
294    pub tagged_only: Option<bool>,
295    #[serde(skip_serializing_if = "Option::is_none", default)]
296    #[doc = "Gluster transport: tcp or rdma"]
297    pub transport: Option<Transport>,
298    #[serde(skip_serializing_if = "Option::is_none", default)]
299    #[doc = "RBD Id."]
300    pub username: Option<String>,
301    #[serde(
302        flatten,
303        default,
304        skip_serializing_if = "::std::collections::HashMap::is_empty"
305    )]
306    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
307}
308#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
309pub enum Preallocation {
310    #[serde(rename = "falloc")]
311    Falloc,
312    #[serde(rename = "full")]
313    Full,
314    #[serde(rename = "metadata")]
315    Metadata,
316    #[serde(rename = "off")]
317    Off,
318}
319impl Default for Preallocation {
320    fn default() -> Self {
321        Self::Metadata
322    }
323}
324#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
325pub enum Smbversion {
326    #[serde(rename = "2.0")]
327    _20,
328    #[serde(rename = "2.1")]
329    _21,
330    #[serde(rename = "3")]
331    _3,
332    #[serde(rename = "3.0")]
333    _30,
334    #[serde(rename = "3.11")]
335    _311,
336    #[serde(rename = "default")]
337    Default,
338}
339impl Default for Smbversion {
340    fn default() -> Self {
341        Self::Default
342    }
343}
344#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
345pub enum Transport {
346    #[serde(rename = "rdma")]
347    Rdma,
348    #[serde(rename = "tcp")]
349    Tcp,
350    #[serde(rename = "unix")]
351    Unix,
352}
353#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
354pub enum Type {
355    #[serde(rename = "btrfs")]
356    Btrfs,
357    #[serde(rename = "cephfs")]
358    Cephfs,
359    #[serde(rename = "cifs")]
360    Cifs,
361    #[serde(rename = "dir")]
362    Dir,
363    #[serde(rename = "esxi")]
364    Esxi,
365    #[serde(rename = "glusterfs")]
366    Glusterfs,
367    #[serde(rename = "iscsi")]
368    Iscsi,
369    #[serde(rename = "iscsidirect")]
370    Iscsidirect,
371    #[serde(rename = "lvm")]
372    Lvm,
373    #[serde(rename = "lvmthin")]
374    Lvmthin,
375    #[serde(rename = "nfs")]
376    Nfs,
377    #[serde(rename = "pbs")]
378    Pbs,
379    #[serde(rename = "rbd")]
380    Rbd,
381    #[serde(rename = "zfs")]
382    Zfs,
383    #[serde(rename = "zfspool")]
384    Zfspool,
385}