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)]
pub struct NodesConfigSetOptionsRequest {


    /// Node specific ACME settings.
    pub acme: Option<Box<models::PveNodesConfigAcmeField>>,

    /// RAM usage target for ballooning (in percent of total memory)
    pub ballooning_target: Option<i32>,

    /// A list of settings you want to delete.
    pub delete: Option<String>,

    /// Description for the Node. Shown in the web-interface node notes panel. This is saved as comment inside the configuration file.
    pub description: Option<String>,

    /// Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.
    pub digest: Option<String>,

    /// The location of the node. Overrides the default from the datacenter config.
    pub location: Option<Box<models::PveLocationField>>,

    /// Initial delay in seconds, before starting all the Virtual Guests with on-boot enabled.
    pub startall_onboot_delay: Option<i32>,

    /// Node specific wake on LAN settings.
    pub wakeonlan: Option<Box<models::PveNodesConfigWakeonlanField>>,

    /// Acmedomains family. Wire form: `acmedomain0..acmedomain8`. Serialised by the manual impls below.
    pub acmedomains: Option<std::collections::HashMap<u32, models::PveNodesConfigAcmedomainField>>,
}

impl NodesConfigSetOptionsRequest {
    pub fn new() -> NodesConfigSetOptionsRequest {
        NodesConfigSetOptionsRequest {
            
            acme: None,
            
            ballooning_target: None,
            
            delete: None,
            
            description: None,
            
            digest: None,
            
            location: None,
            
            startall_onboot_delay: None,
            
            wakeonlan: None,
            
            acmedomains: None,
        }
    }
}


// Flattens indexed-family maps to/from `<base><idx>` wire keys.
impl serde::Serialize for NodesConfigSetOptionsRequest {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        use serde::ser::Error;
        let mut map = serde_json::Map::new();
        
        {
            let _v = serde_json::to_value(&self.acme).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("acme".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.ballooning_target).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("ballooning-target".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.delete).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("delete".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.description).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("description".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.digest).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("digest".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.location).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("location".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.startall_onboot_delay).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("startall-onboot-delay".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.wakeonlan).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("wakeonlan".to_string(), _v);
            }
        }
        
        if let Some(ref _m) = self.acmedomains {
            for (_idx, _val) in _m.iter() {
                map.insert(format!("acmedomain{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
            }
        }
        serde_json::Value::Object(map).serialize(serializer)
    }
}

impl<'de> serde::Deserialize<'de> for NodesConfigSetOptionsRequest {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        use serde::de::Error;
        let mut raw: serde_json::Map<String, serde_json::Value> =
            serde::Deserialize::deserialize(deserializer)?;
        let mut __acmedomains: std::collections::HashMap<u32, models::PveNodesConfigAcmedomainField> = std::collections::HashMap::new();
        {
            let _prefix = "acmedomain";
            let _keys: Vec<String> = raw.keys()
                .filter(|k| {
                    if let Some(_suffix) = k.strip_prefix(_prefix) {
                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
                    } else {
                        false
                    }
                })
                .cloned()
                .collect();
            for _key in _keys {
                let _suffix = _key.strip_prefix(_prefix).unwrap();
                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
                let _value = raw.remove(&_key).unwrap();
                let _item: models::PveNodesConfigAcmedomainField = serde_json::from_value(_value).map_err(Error::custom)?;
                __acmedomains.insert(_idx, _item);
            }
        }
        Ok(NodesConfigSetOptionsRequest {
            
            acme: serde_json::from_value(raw.remove("acme").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            ballooning_target: serde_json::from_value(raw.remove("ballooning-target").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            delete: serde_json::from_value(raw.remove("delete").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            description: serde_json::from_value(raw.remove("description").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            digest: serde_json::from_value(raw.remove("digest").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            location: serde_json::from_value(raw.remove("location").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            startall_onboot_delay: serde_json::from_value(raw.remove("startall-onboot-delay").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            wakeonlan: serde_json::from_value(raw.remove("wakeonlan").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            acmedomains: if __acmedomains.is_empty() { None } else { Some(__acmedomains) },
        })
    }
}