new valid structs for sharing between services

pull/3/head
prplV 2025-01-21 16:31:10 +03:00
parent ab75252e6b
commit d3fcfae15b
1 changed files with 35 additions and 0 deletions

View File

@ -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>
}