final conf structs and +creds struct to contain refs on existing values
parent
8630827118
commit
0fe75be43b
|
|
@ -183,6 +183,42 @@ pub mod v3 {
|
|||
config : Vec<ConfigEndpoint>,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
config : Vec::new()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub async fn is_default(&self) -> bool {
|
||||
self.config.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Credentials<'a> {
|
||||
ip : &'a str,
|
||||
login : &'a str,
|
||||
password : &'a str,
|
||||
api_key : &'a str,
|
||||
period : &'a str,
|
||||
timeout : &'a str,
|
||||
}
|
||||
|
||||
impl<'a> Credentials<'a> {
|
||||
pub fn from_config_endpoint(endpoint: &'a ConfigEndpoint) -> Credentials<'a> {
|
||||
Self {
|
||||
ip : &endpoint.ip,
|
||||
login : &endpoint.login,
|
||||
password : &endpoint.password,
|
||||
api_key : &endpoint.api_key,
|
||||
period : &endpoint.period,
|
||||
timeout : &endpoint.timeout,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// to prometheus and nmns
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct MetricOutput {
|
||||
|
|
|
|||
Loading…
Reference in New Issue