Skip to main content

clientapi_pve/models/
pve_draid_config.rs

1/*
2 * Proxmox Virtual Environment API
3 *
4 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
5 *
6 * The version of the OpenAPI document: 9.x
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct PveDraidConfig {
16
17    /// The number of data devices per redundancy group. (dRAID)
18    #[serde(rename = "data")]
19    pub data: i64,
20
21    /// Number of dRAID spares.
22    #[serde(rename = "spares")]
23    pub spares: i64,
24
25
26}
27
28impl PveDraidConfig {
29    pub fn new(data: i64, spares: i64) -> PveDraidConfig {
30        PveDraidConfig {
31            
32            data,
33            
34            spares,
35            
36        }
37    }
38}
39
40
41impl PveDraidConfig {
42    /// Serialise this PveDraidConfig into Proxmox's CLI-style shorthand
43    /// string (`key=value,…`). The property marked `x-pve-default-key`
44    /// is emitted positionally without a `key=` prefix; aliases collapse
45    /// multiple property names to the same wire key.
46    ///
47    /// Example: `PveDraidConfig `
48    /// → `"virtio,bridge=vmbr0"`
49    pub fn to_shorthand(&self) -> String {
50        let mut parts: Vec<String> = Vec::new();
51        
52        
53        
54        parts.push(format!("data={}", self.data));
55        
56        
57        
58        parts.push(format!("spares={}", self.spares));
59        
60        
61        parts.join(",")
62    }
63}
64