proxmox_api/generated/cluster/notifications/matchers/
name.rs

1pub struct NameClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> NameClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str, name: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}/{}", parent_path, name),
13        }
14    }
15}
16impl<T> NameClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Remove matcher"]
21    pub fn delete(&self) -> Result<(), T::Error> {
22        let path = self.path.to_string();
23        self.client.delete(&path, &())
24    }
25}
26impl<T> NameClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Return a specific matcher"]
31    pub fn get(&self) -> Result<GetOutput, T::Error> {
32        let path = self.path.to_string();
33        self.client.get(&path, &())
34    }
35}
36impl<T> NameClient<T>
37where
38    T: crate::client::Client,
39{
40    #[doc = "Update existing matcher"]
41    pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
42        let path = self.path.to_string();
43        self.client.put(&path, &params)
44    }
45}
46impl GetOutput {
47    pub fn new(name: String) -> Self {
48        Self {
49            name,
50            comment: Default::default(),
51            digest: Default::default(),
52            disable: Default::default(),
53            invert_match: Default::default(),
54            match_calendar: Default::default(),
55            match_field: Default::default(),
56            match_severity: Default::default(),
57            mode: Default::default(),
58            target: Default::default(),
59            additional_properties: Default::default(),
60        }
61    }
62}
63#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
64pub struct GetOutput {
65    #[serde(skip_serializing_if = "Option::is_none", default)]
66    #[doc = "Comment"]
67    pub comment: Option<String>,
68    #[serde(skip_serializing_if = "Option::is_none", default)]
69    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
70    pub digest: Option<String>,
71    #[serde(
72        serialize_with = "crate::types::serialize_bool_optional",
73        deserialize_with = "crate::types::deserialize_bool_optional"
74    )]
75    #[serde(skip_serializing_if = "Option::is_none", default)]
76    #[doc = "Disable this matcher"]
77    pub disable: Option<bool>,
78    #[serde(rename = "invert-match")]
79    #[serde(
80        serialize_with = "crate::types::serialize_bool_optional",
81        deserialize_with = "crate::types::deserialize_bool_optional"
82    )]
83    #[serde(skip_serializing_if = "Option::is_none", default)]
84    #[doc = "Invert match of the whole matcher"]
85    pub invert_match: Option<bool>,
86    #[serde(rename = "match-calendar")]
87    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
88    #[doc = "Match notification timestamp"]
89    pub match_calendar: Vec<String>,
90    #[serde(rename = "match-field")]
91    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
92    #[doc = "Metadata fields to match (regex or exact match). Must be in the form (regex|exact):\\<field\\>=\\<value\\>"]
93    pub match_field: Vec<String>,
94    #[serde(rename = "match-severity")]
95    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
96    #[doc = "Notification severities to match"]
97    pub match_severity: Vec<String>,
98    #[serde(skip_serializing_if = "Option::is_none", default)]
99    #[doc = "Choose between 'all' and 'any' for when multiple properties are specified"]
100    pub mode: Option<Mode>,
101    #[doc = "Name of the matcher."]
102    pub name: String,
103    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
104    #[doc = "Targets to notify on match"]
105    pub target: Vec<String>,
106    #[serde(
107        flatten,
108        default,
109        skip_serializing_if = "::std::collections::HashMap::is_empty"
110    )]
111    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
112}
113#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
114pub struct PutParams {
115    #[serde(skip_serializing_if = "Option::is_none", default)]
116    #[doc = "Comment"]
117    pub comment: Option<String>,
118    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
119    #[doc = "A list of settings you want to delete."]
120    pub delete: Vec<String>,
121    #[serde(skip_serializing_if = "Option::is_none", default)]
122    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
123    pub digest: Option<String>,
124    #[serde(
125        serialize_with = "crate::types::serialize_bool_optional",
126        deserialize_with = "crate::types::deserialize_bool_optional"
127    )]
128    #[serde(skip_serializing_if = "Option::is_none", default)]
129    #[doc = "Disable this matcher"]
130    pub disable: Option<bool>,
131    #[serde(rename = "invert-match")]
132    #[serde(
133        serialize_with = "crate::types::serialize_bool_optional",
134        deserialize_with = "crate::types::deserialize_bool_optional"
135    )]
136    #[serde(skip_serializing_if = "Option::is_none", default)]
137    #[doc = "Invert match of the whole matcher"]
138    pub invert_match: Option<bool>,
139    #[serde(rename = "match-calendar")]
140    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
141    #[doc = "Match notification timestamp"]
142    pub match_calendar: Vec<String>,
143    #[serde(rename = "match-field")]
144    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
145    #[doc = "Metadata fields to match (regex or exact match). Must be in the form (regex|exact):\\<field\\>=\\<value\\>"]
146    pub match_field: Vec<String>,
147    #[serde(rename = "match-severity")]
148    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
149    #[doc = "Notification severities to match"]
150    pub match_severity: Vec<String>,
151    #[serde(skip_serializing_if = "Option::is_none", default)]
152    #[doc = "Choose between 'all' and 'any' for when multiple properties are specified"]
153    pub mode: Option<Mode>,
154    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
155    #[doc = "Targets to notify on match"]
156    pub target: Vec<String>,
157    #[serde(
158        flatten,
159        default,
160        skip_serializing_if = "::std::collections::HashMap::is_empty"
161    )]
162    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
163}
164#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
165pub enum Mode {
166    #[serde(rename = "all")]
167    All,
168    #[serde(rename = "any")]
169    Any,
170}
171impl Default for Mode {
172    fn default() -> Self {
173        Self::All
174    }
175}