new valid structs for sharing between services
parent
ab75252e6b
commit
d3fcfae15b
|
|
@ -1,4 +1,7 @@
|
||||||
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
|
use serde_json::Value;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
|
@ -22,3 +25,35 @@ impl Default for ApiConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// v2
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
pub struct ApiConfigV2 {
|
||||||
|
id : u64,
|
||||||
|
#[serde(default)]
|
||||||
|
template : Vec<Template>,
|
||||||
|
ip_address : String,
|
||||||
|
login : Option<String>,
|
||||||
|
pass : Option<String>,
|
||||||
|
api_key : Option<String>,
|
||||||
|
period : u32, // if "0" -> inf
|
||||||
|
timeout : u32, // if "0" -> no-delay
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
pub struct Template {
|
||||||
|
id : String,
|
||||||
|
name : String,
|
||||||
|
url : String,
|
||||||
|
#[serde(default)]
|
||||||
|
measure : Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
pub struct ProcessedEndpoint {
|
||||||
|
id : String,
|
||||||
|
name : String,
|
||||||
|
url : String,
|
||||||
|
#[serde(default)]
|
||||||
|
metrics : HashMap<String, Value>
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue