diff --git a/crates/integr-structs/src/api.rs b/crates/integr-structs/src/api.rs index 4563655..f26850b 100644 --- a/crates/integr-structs/src/api.rs +++ b/crates/integr-structs/src/api.rs @@ -183,6 +183,42 @@ pub mod v3 { config : Vec, } + 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 {