Skip to main content

clientapi_pve/models/
pve_notify_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 PveNotifyConfig {
16
17    /// UNUSED - Use datacenter notification settings instead.
18    #[serde(rename = "fencing", skip_serializing_if = "Option::is_none")]
19    pub fencing: Option<models::PveFencingEnum>,
20
21    /// DEPRECATED: Use datacenter notification settings instead. Control how often the daily update job should send out notifications: * 'auto' daily for systems with a valid subscription, as those are assumed to be  production-ready and thus should know about pending updates. * 'always' every update, if there are new pending updates. * 'never' never send a notification for new pending updates. 
22    #[serde(rename = "package-updates", skip_serializing_if = "Option::is_none")]
23    pub package_updates: Option<models::PveClusterOptionsPackageUpdatesEnum>,
24
25    /// UNUSED - Use datacenter notification settings instead.
26    #[serde(rename = "replication", skip_serializing_if = "Option::is_none")]
27    pub replication: Option<models::PveFencingEnum>,
28
29    /// UNUSED - Use datacenter notification settings instead.
30    #[serde(rename = "target-fencing", skip_serializing_if = "Option::is_none")]
31    pub target_fencing: Option<String>,
32
33    /// UNUSED - Use datacenter notification settings instead.
34    #[serde(rename = "target-package-updates", skip_serializing_if = "Option::is_none")]
35    pub target_package_updates: Option<String>,
36
37    /// UNUSED - Use datacenter notification settings instead.
38    #[serde(rename = "target-replication", skip_serializing_if = "Option::is_none")]
39    pub target_replication: Option<String>,
40
41
42}
43
44impl PveNotifyConfig {
45    pub fn new() -> PveNotifyConfig {
46        PveNotifyConfig {
47            
48            fencing: None,
49            
50            package_updates: None,
51            
52            replication: None,
53            
54            target_fencing: None,
55            
56            target_package_updates: None,
57            
58            target_replication: None,
59            
60        }
61    }
62}
63
64
65impl PveNotifyConfig {
66    /// Serialise this PveNotifyConfig into Proxmox's CLI-style shorthand
67    /// string (`key=value,…`). The property marked `x-pve-default-key`
68    /// is emitted positionally without a `key=` prefix; aliases collapse
69    /// multiple property names to the same wire key.
70    ///
71    /// Example: `PveNotifyConfig `
72    /// → `"virtio,bridge=vmbr0"`
73    pub fn to_shorthand(&self) -> String {
74        let mut parts: Vec<String> = Vec::new();
75        
76        
77        
78        if let Some(ref v) = self.fencing {
79            parts.push(format!("fencing={}", v));
80        }
81        
82        
83        if let Some(ref v) = self.package_updates {
84            parts.push(format!("package-updates={}", v));
85        }
86        
87        
88        if let Some(ref v) = self.replication {
89            parts.push(format!("replication={}", v));
90        }
91        
92        
93        if let Some(ref v) = self.target_fencing {
94            parts.push(format!("target-fencing={}", v));
95        }
96        
97        
98        if let Some(ref v) = self.target_package_updates {
99            parts.push(format!("target-package-updates={}", v));
100        }
101        
102        
103        if let Some(ref v) = self.target_replication {
104            parts.push(format!("target-replication={}", v));
105        }
106        
107        parts.join(",")
108    }
109}
110