mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-29 17:15:57 +00:00
move MetricServerInfo definition to pbs-api-types
And derive Clone, Eq and Ord so that we can sort the list in the GUI. Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
ee4d9a5567
commit
3b42bca410
@ -146,3 +146,46 @@ pub struct InfluxDbHttp {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub comment: Option<String>,
|
pub comment: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[api]
|
||||||
|
#[derive(Copy, Clone, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
|
/// Type of the metric server
|
||||||
|
pub enum MetricServerType {
|
||||||
|
/// InfluxDB HTTP
|
||||||
|
#[serde(rename = "influxdb-http")]
|
||||||
|
InfluxDbHttp,
|
||||||
|
/// InfluxDB UDP
|
||||||
|
#[serde(rename = "influxdb-udp")]
|
||||||
|
InfluxDbUdp,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[api(
|
||||||
|
properties: {
|
||||||
|
name: {
|
||||||
|
schema: METRIC_SERVER_ID_SCHEMA,
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
type: MetricServerType,
|
||||||
|
},
|
||||||
|
comment: {
|
||||||
|
optional: true,
|
||||||
|
schema: SINGLE_LINE_COMMENT_SCHEMA,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)]
|
||||||
|
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
|
/// Basic information about a metric server thats available for all types
|
||||||
|
pub struct MetricServerInfo {
|
||||||
|
pub name: String,
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
pub ty: MetricServerType,
|
||||||
|
/// Enables or disables the metrics server
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub enable: Option<bool>,
|
||||||
|
/// The target server
|
||||||
|
pub server: String,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub comment: Option<String>,
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user