// HA (High Availability) groups management module // Provides operations for managing Proxmox HA groups use serde::{Deserialize, Serialize}; /// HA group information #[derive(Debug, Clone, Serialize, Deserialize)] pub struct HaGroup { pub group: String, pub nodes: Vec, pub max_failures: u32, pub max_relocate: u32, pub state: String, } /// HA resource information #[derive(Debug, Clone, Serialize, Deserialize)] pub struct HaResource { pub resource: String, pub group: Option, pub node: Option, pub state: String, pub enabled: bool, } /// List HA groups pub async fn list_ha_groups( _client: &crate::proxmox::client::ProxmoxClient, _ticket: &str, ) -> Result, String> { Err("Not implemented yet".to_string()) } /// List HA resources pub async fn list_ha_resources( _client: &crate::proxmox::client::ProxmoxClient, _ticket: &str, ) -> Result, String> { Err("Not implemented yet".to_string()) } #[cfg(test)] mod tests { use super::*; #[test] fn test_ha_group_serialization() { let group = HaGroup { group: "primary".to_string(), nodes: vec!["pve-node-1".to_string(), "pve-node-2".to_string()], max_failures: 2, max_relocate: 1, state: "enabled".to_string(), }; let json = serde_json::to_string(&group).unwrap(); let deserialized: HaGroup = serde_json::from_str(&json).unwrap(); assert_eq!(group.group, deserialized.group); assert_eq!(group.state, "enabled"); } }