proxmox_api/generated/cluster/metrics/server/
id.rs

1pub struct IdClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> IdClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str, id: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}/{}", parent_path, id),
13        }
14    }
15}
16impl<T> IdClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Remove Metric server."]
21    pub fn delete(&self) -> Result<(), T::Error> {
22        let path = self.path.to_string();
23        self.client.delete(&path, &())
24    }
25}
26impl<T> IdClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Read metric server configuration."]
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> IdClient<T>
37where
38    T: crate::client::Client,
39{
40    #[doc = "Create a new external metric server config"]
41    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
42        let path = self.path.to_string();
43        self.client.post(&path, &params)
44    }
45}
46impl<T> IdClient<T>
47where
48    T: crate::client::Client,
49{
50    #[doc = "Update metric server configuration."]
51    pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
52        let path = self.path.to_string();
53        self.client.put(&path, &params)
54    }
55}
56#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
57pub struct GetOutput {
58    #[serde(
59        flatten,
60        default,
61        skip_serializing_if = "::std::collections::HashMap::is_empty"
62    )]
63    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
64}
65impl PostParams {
66    pub fn new(port: u64, server: String, ty: Type) -> Self {
67        Self {
68            port,
69            server,
70            ty,
71            api_path_prefix: Default::default(),
72            bucket: Default::default(),
73            disable: Default::default(),
74            influxdbproto: Default::default(),
75            max_body_size: Default::default(),
76            mtu: Default::default(),
77            organization: Default::default(),
78            path: Default::default(),
79            proto: Default::default(),
80            timeout: Default::default(),
81            token: Default::default(),
82            verify_certificate: Default::default(),
83            additional_properties: Default::default(),
84        }
85    }
86}
87#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
88pub struct PostParams {
89    #[serde(rename = "api-path-prefix")]
90    #[serde(skip_serializing_if = "Option::is_none", default)]
91    #[doc = "An API path prefix inserted between '\\<host\\>:\\<port\\>/' and '/api2/'. Can be useful if the InfluxDB service runs behind a reverse proxy."]
92    pub api_path_prefix: Option<String>,
93    #[serde(skip_serializing_if = "Option::is_none", default)]
94    #[doc = "The InfluxDB bucket/db. Only necessary when using the http v2 api."]
95    pub bucket: Option<String>,
96    #[serde(
97        serialize_with = "crate::types::serialize_bool_optional",
98        deserialize_with = "crate::types::deserialize_bool_optional"
99    )]
100    #[serde(skip_serializing_if = "Option::is_none", default)]
101    #[doc = "Flag to disable the plugin."]
102    pub disable: Option<bool>,
103    #[serde(skip_serializing_if = "Option::is_none", default)]
104    pub influxdbproto: Option<Influxdbproto>,
105    #[serde(rename = "max-body-size")]
106    #[serde(
107        serialize_with = "crate::types::serialize_int_optional",
108        deserialize_with = "crate::types::deserialize_int_optional"
109    )]
110    #[serde(skip_serializing_if = "Option::is_none", default)]
111    #[doc = "InfluxDB max-body-size in bytes. Requests are batched up to this size."]
112    pub max_body_size: Option<u64>,
113    #[serde(
114        serialize_with = "crate::types::serialize_int_optional",
115        deserialize_with = "crate::types::deserialize_int_optional"
116    )]
117    #[serde(skip_serializing_if = "Option::is_none", default)]
118    #[doc = "MTU for metrics transmission over UDP"]
119    pub mtu: Option<u64>,
120    #[serde(skip_serializing_if = "Option::is_none", default)]
121    #[doc = "The InfluxDB organization. Only necessary when using the http v2 api. Has no meaning when using v2 compatibility api."]
122    pub organization: Option<String>,
123    #[serde(skip_serializing_if = "Option::is_none", default)]
124    #[doc = "root graphite path (ex: proxmox.mycluster.mykey)"]
125    pub path: Option<String>,
126    #[serde(
127        serialize_with = "crate::types::serialize_int",
128        deserialize_with = "crate::types::deserialize_int"
129    )]
130    #[doc = "server network port"]
131    pub port: u64,
132    #[serde(skip_serializing_if = "Option::is_none", default)]
133    #[doc = "Protocol to send graphite data. TCP or UDP (default)"]
134    pub proto: Option<Proto>,
135    #[doc = "server dns name or IP address"]
136    pub server: String,
137    #[serde(
138        serialize_with = "crate::types::serialize_int_optional",
139        deserialize_with = "crate::types::deserialize_int_optional"
140    )]
141    #[serde(skip_serializing_if = "Option::is_none", default)]
142    #[doc = "graphite TCP socket timeout (default=1)"]
143    pub timeout: Option<u64>,
144    #[serde(skip_serializing_if = "Option::is_none", default)]
145    #[doc = "The InfluxDB access token. Only necessary when using the http v2 api. If the v2 compatibility api is used, use 'user:password' instead."]
146    pub token: Option<String>,
147    #[serde(rename = "type")]
148    #[doc = "Plugin type."]
149    pub ty: Type,
150    #[serde(rename = "verify-certificate")]
151    #[serde(
152        serialize_with = "crate::types::serialize_bool_optional",
153        deserialize_with = "crate::types::deserialize_bool_optional"
154    )]
155    #[serde(skip_serializing_if = "Option::is_none", default)]
156    #[doc = "Set to 0 to disable certificate verification for https endpoints."]
157    pub verify_certificate: Option<bool>,
158    #[serde(
159        flatten,
160        default,
161        skip_serializing_if = "::std::collections::HashMap::is_empty"
162    )]
163    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
164}
165impl PutParams {
166    pub fn new(port: u64, server: String) -> Self {
167        Self {
168            port,
169            server,
170            api_path_prefix: Default::default(),
171            bucket: Default::default(),
172            delete: Default::default(),
173            digest: Default::default(),
174            disable: Default::default(),
175            influxdbproto: Default::default(),
176            max_body_size: Default::default(),
177            mtu: Default::default(),
178            organization: Default::default(),
179            path: Default::default(),
180            proto: Default::default(),
181            timeout: Default::default(),
182            token: Default::default(),
183            verify_certificate: Default::default(),
184            additional_properties: Default::default(),
185        }
186    }
187}
188#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
189pub struct PutParams {
190    #[serde(rename = "api-path-prefix")]
191    #[serde(skip_serializing_if = "Option::is_none", default)]
192    #[doc = "An API path prefix inserted between '\\<host\\>:\\<port\\>/' and '/api2/'. Can be useful if the InfluxDB service runs behind a reverse proxy."]
193    pub api_path_prefix: Option<String>,
194    #[serde(skip_serializing_if = "Option::is_none", default)]
195    #[doc = "The InfluxDB bucket/db. Only necessary when using the http v2 api."]
196    pub bucket: Option<String>,
197    #[serde(skip_serializing_if = "Option::is_none", default)]
198    #[doc = "A list of settings you want to delete."]
199    pub delete: Option<String>,
200    #[serde(skip_serializing_if = "Option::is_none", default)]
201    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
202    pub digest: Option<String>,
203    #[serde(
204        serialize_with = "crate::types::serialize_bool_optional",
205        deserialize_with = "crate::types::deserialize_bool_optional"
206    )]
207    #[serde(skip_serializing_if = "Option::is_none", default)]
208    #[doc = "Flag to disable the plugin."]
209    pub disable: Option<bool>,
210    #[serde(skip_serializing_if = "Option::is_none", default)]
211    pub influxdbproto: Option<Influxdbproto>,
212    #[serde(rename = "max-body-size")]
213    #[serde(
214        serialize_with = "crate::types::serialize_int_optional",
215        deserialize_with = "crate::types::deserialize_int_optional"
216    )]
217    #[serde(skip_serializing_if = "Option::is_none", default)]
218    #[doc = "InfluxDB max-body-size in bytes. Requests are batched up to this size."]
219    pub max_body_size: Option<u64>,
220    #[serde(
221        serialize_with = "crate::types::serialize_int_optional",
222        deserialize_with = "crate::types::deserialize_int_optional"
223    )]
224    #[serde(skip_serializing_if = "Option::is_none", default)]
225    #[doc = "MTU for metrics transmission over UDP"]
226    pub mtu: Option<u64>,
227    #[serde(skip_serializing_if = "Option::is_none", default)]
228    #[doc = "The InfluxDB organization. Only necessary when using the http v2 api. Has no meaning when using v2 compatibility api."]
229    pub organization: Option<String>,
230    #[serde(skip_serializing_if = "Option::is_none", default)]
231    #[doc = "root graphite path (ex: proxmox.mycluster.mykey)"]
232    pub path: Option<String>,
233    #[serde(
234        serialize_with = "crate::types::serialize_int",
235        deserialize_with = "crate::types::deserialize_int"
236    )]
237    #[doc = "server network port"]
238    pub port: u64,
239    #[serde(skip_serializing_if = "Option::is_none", default)]
240    #[doc = "Protocol to send graphite data. TCP or UDP (default)"]
241    pub proto: Option<Proto>,
242    #[doc = "server dns name or IP address"]
243    pub server: String,
244    #[serde(
245        serialize_with = "crate::types::serialize_int_optional",
246        deserialize_with = "crate::types::deserialize_int_optional"
247    )]
248    #[serde(skip_serializing_if = "Option::is_none", default)]
249    #[doc = "graphite TCP socket timeout (default=1)"]
250    pub timeout: Option<u64>,
251    #[serde(skip_serializing_if = "Option::is_none", default)]
252    #[doc = "The InfluxDB access token. Only necessary when using the http v2 api. If the v2 compatibility api is used, use 'user:password' instead."]
253    pub token: Option<String>,
254    #[serde(rename = "verify-certificate")]
255    #[serde(
256        serialize_with = "crate::types::serialize_bool_optional",
257        deserialize_with = "crate::types::deserialize_bool_optional"
258    )]
259    #[serde(skip_serializing_if = "Option::is_none", default)]
260    #[doc = "Set to 0 to disable certificate verification for https endpoints."]
261    pub verify_certificate: Option<bool>,
262    #[serde(
263        flatten,
264        default,
265        skip_serializing_if = "::std::collections::HashMap::is_empty"
266    )]
267    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
268}
269#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
270pub enum Influxdbproto {
271    #[serde(rename = "http")]
272    Http,
273    #[serde(rename = "https")]
274    Https,
275    #[serde(rename = "udp")]
276    Udp,
277}
278impl Default for Influxdbproto {
279    fn default() -> Self {
280        Self::Udp
281    }
282}
283#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
284pub enum Proto {
285    #[serde(rename = "tcp")]
286    Tcp,
287    #[serde(rename = "udp")]
288    Udp,
289}
290#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
291pub enum Type {
292    #[serde(rename = "graphite")]
293    Graphite,
294    #[serde(rename = "influxdb")]
295    Influxdb,
296}