clientapi-pve 2026.5.24

Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
Documentation
/*
 * Proxmox Virtual Environment API
 *
 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
 *
 * The version of the OpenAPI document: 9.x
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PveCrsConfig {

    /// Configures how the HA Manager should select nodes to start or recover services:  - with 'basic', only the number of services is used, - with 'static', static CPU and memory configuration of services are considered, - with 'dynamic', static and dynamic CPU and memory usage of services are considered. 
    #[serde(rename = "ha", skip_serializing_if = "Option::is_none")]
    pub ha: Option<models::PveClusterOptionsHaEnum>,

    /// Whether to use CRS for balancing HA resources automatically depending on the current node imbalance.
    #[serde(rename = "ha-auto-rebalance", skip_serializing_if = "Option::is_none")]
    pub ha_auto_rebalance: Option<models::PveBoolean>,

    /// The number of HA rounds for which the cluster node imbalance threshold must be exceeded before triggering an automatic resource balancing migration.
    #[serde(rename = "ha-auto-rebalance-hold-duration", skip_serializing_if = "Option::is_none")]
    pub ha_auto_rebalance_hold_duration: Option<f64>,

    /// The minimum relative improvement in cluster node imbalance, in percent, to commit to a resource balancing migration.
    #[serde(rename = "ha-auto-rebalance-margin", skip_serializing_if = "Option::is_none")]
    pub ha_auto_rebalance_margin: Option<f64>,

    /// The method to use for the scoring of balancing migrations.
    #[serde(rename = "ha-auto-rebalance-method", skip_serializing_if = "Option::is_none")]
    pub ha_auto_rebalance_method: Option<models::PveClusterOptionsHaAutoRebalanceMethodEnum>,

    /// The cluster node imbalance, in percent, which will trigger the automatic resource balancing system if exceeded.
    #[serde(rename = "ha-auto-rebalance-threshold", skip_serializing_if = "Option::is_none")]
    pub ha_auto_rebalance_threshold: Option<f64>,

    /// Set to use CRS for selecting a suited node when a HA services request-state changes from stop to start.
    #[serde(rename = "ha-rebalance-on-start", skip_serializing_if = "Option::is_none")]
    pub ha_rebalance_on_start: Option<models::PveBoolean>,


}

impl PveCrsConfig {
    pub fn new() -> PveCrsConfig {
        PveCrsConfig {
            
            ha: None,
            
            ha_auto_rebalance: None,
            
            ha_auto_rebalance_hold_duration: None,
            
            ha_auto_rebalance_margin: None,
            
            ha_auto_rebalance_method: None,
            
            ha_auto_rebalance_threshold: None,
            
            ha_rebalance_on_start: None,
            
        }
    }
}


impl PveCrsConfig {
    /// Serialise this PveCrsConfig into Proxmox's CLI-style shorthand
    /// string (`key=value,…`). The property marked `x-pve-default-key`
    /// is emitted positionally without a `key=` prefix; aliases collapse
    /// multiple property names to the same wire key.
    ///
    /// Example: `PveCrsConfig `
    /// → `"virtio,bridge=vmbr0"`
    pub fn to_shorthand(&self) -> String {
        let mut parts: Vec<String> = Vec::new();
        
        
        
        if let Some(ref v) = self.ha {
            parts.push(format!("ha={}", v));
        }
        
        
        if let Some(ref v) = self.ha_auto_rebalance {
            parts.push(format!("ha-auto-rebalance={}", v));
        }
        
        
        if let Some(ref v) = self.ha_auto_rebalance_hold_duration {
            parts.push(format!("ha-auto-rebalance-hold-duration={}", v));
        }
        
        
        if let Some(ref v) = self.ha_auto_rebalance_margin {
            parts.push(format!("ha-auto-rebalance-margin={}", v));
        }
        
        
        if let Some(ref v) = self.ha_auto_rebalance_method {
            parts.push(format!("ha-auto-rebalance-method={}", v));
        }
        
        
        if let Some(ref v) = self.ha_auto_rebalance_threshold {
            parts.push(format!("ha-auto-rebalance-threshold={}", v));
        }
        
        
        if let Some(ref v) = self.ha_rebalance_on_start {
            parts.push(format!("ha-rebalance-on-start={}", v));
        }
        
        parts.join(",")
    }
}