proxmox_api/generated/cluster/notifications/
matchers.rs1pub mod name;
2pub struct MatchersClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> MatchersClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}{}", parent_path, "/matchers"),
14 }
15 }
16}
17impl<T> MatchersClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Returns a list of all matchers"]
22 pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
23 let path = self.path.to_string();
24 self.client.get(&path, &())
25 }
26}
27impl<T> MatchersClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Create a new matcher"]
32 pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38 pub fn new(name: String, origin: Origin) -> Self {
39 Self {
40 name,
41 origin,
42 comment: Default::default(),
43 disable: Default::default(),
44 invert_match: Default::default(),
45 match_calendar: Default::default(),
46 match_field: Default::default(),
47 match_severity: Default::default(),
48 mode: Default::default(),
49 target: Default::default(),
50 additional_properties: Default::default(),
51 }
52 }
53}
54#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
55pub struct GetOutputItems {
56 #[serde(skip_serializing_if = "Option::is_none", default)]
57 #[doc = "Comment"]
58 pub comment: Option<String>,
59 #[serde(
60 serialize_with = "crate::types::serialize_bool_optional",
61 deserialize_with = "crate::types::deserialize_bool_optional"
62 )]
63 #[serde(skip_serializing_if = "Option::is_none", default)]
64 #[doc = "Disable this matcher"]
65 pub disable: Option<bool>,
66 #[serde(rename = "invert-match")]
67 #[serde(
68 serialize_with = "crate::types::serialize_bool_optional",
69 deserialize_with = "crate::types::deserialize_bool_optional"
70 )]
71 #[serde(skip_serializing_if = "Option::is_none", default)]
72 #[doc = "Invert match of the whole matcher"]
73 pub invert_match: Option<bool>,
74 #[serde(rename = "match-calendar")]
75 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
76 #[doc = "Match notification timestamp"]
77 pub match_calendar: Vec<String>,
78 #[serde(rename = "match-field")]
79 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
80 #[doc = "Metadata fields to match (regex or exact match). Must be in the form (regex|exact):\\<field\\>=\\<value\\>"]
81 pub match_field: Vec<String>,
82 #[serde(rename = "match-severity")]
83 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
84 #[doc = "Notification severities to match"]
85 pub match_severity: Vec<String>,
86 #[serde(skip_serializing_if = "Option::is_none", default)]
87 #[doc = "Choose between 'all' and 'any' for when multiple properties are specified"]
88 pub mode: Option<Mode>,
89 #[doc = "Name of the matcher."]
90 pub name: String,
91 #[doc = "Show if this entry was created by a user or was built-in"]
92 pub origin: Origin,
93 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
94 #[doc = "Targets to notify on match"]
95 pub target: Vec<String>,
96 #[serde(
97 flatten,
98 default,
99 skip_serializing_if = "::std::collections::HashMap::is_empty"
100 )]
101 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
102}
103impl PostParams {
104 pub fn new(name: String) -> Self {
105 Self {
106 name,
107 comment: Default::default(),
108 disable: Default::default(),
109 invert_match: Default::default(),
110 match_calendar: Default::default(),
111 match_field: Default::default(),
112 match_severity: Default::default(),
113 mode: Default::default(),
114 target: Default::default(),
115 additional_properties: Default::default(),
116 }
117 }
118}
119#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
120pub struct PostParams {
121 #[serde(skip_serializing_if = "Option::is_none", default)]
122 #[doc = "Comment"]
123 pub comment: 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 #[doc = "Name of the matcher."]
155 pub name: String,
156 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
157 #[doc = "Targets to notify on match"]
158 pub target: Vec<String>,
159 #[serde(
160 flatten,
161 default,
162 skip_serializing_if = "::std::collections::HashMap::is_empty"
163 )]
164 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
165}
166#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
167pub enum Mode {
168 #[serde(rename = "all")]
169 All,
170 #[serde(rename = "any")]
171 Any,
172}
173impl Default for Mode {
174 fn default() -> Self {
175 Self::All
176 }
177}
178#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
179pub enum Origin {
180 #[serde(rename = "builtin")]
181 Builtin,
182 #[serde(rename = "modified-builtin")]
183 ModifiedBuiltin,
184 #[serde(rename = "user-created")]
185 UserCreated,
186}
187impl<T> MatchersClient<T>
188where
189 T: crate::client::Client,
190{
191 pub fn name(&self, name: &str) -> name::NameClient<T> {
192 name::NameClient::<T>::new(self.client.clone(), &self.path, name)
193 }
194}