mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-05-28 14:46:11 +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
344db2d6f6
commit
4a33ad1ca5
@ -146,3 +146,46 @@ pub struct InfluxDbHttp {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
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>,
|
||||
}
|
||||
|
@ -1,55 +1,12 @@
|
||||
use anyhow::Error;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
use proxmox_router::{Permission, Router, RpcEnvironment};
|
||||
use proxmox_schema::api;
|
||||
|
||||
use pbs_api_types::{METRIC_SERVER_ID_SCHEMA, PRIV_SYS_AUDIT, SINGLE_LINE_COMMENT_SCHEMA};
|
||||
use pbs_api_types::{PRIV_SYS_AUDIT, MetricServerInfo};
|
||||
use pbs_config::metrics;
|
||||
|
||||
#[api]
|
||||
#[derive(Deserialize, Serialize, PartialEq, Eq)]
|
||||
/// 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(Serialize, Deserialize)]
|
||||
#[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>,
|
||||
}
|
||||
|
||||
#[api(
|
||||
input: {
|
||||
properties: {},
|
||||
|
Loading…
Reference in New Issue
Block a user