use super::{Verdict, VerdictResponse};
impl VerdictResponse {
pub fn allow(event_id: String, latency_ms: f64) -> Self {
Self {
schema_version: "1.0".to_string(),
verdict: Verdict::Allow,
event_id,
latency_ms,
reason: None,
severity: None,
threat_category: None,
rule_id: None,
details_url: None,
}
}
pub fn approve(event_id: String, latency_ms: f64) -> Self {
Self {
schema_version: "1.0".to_string(),
verdict: Verdict::Approve,
event_id,
latency_ms,
reason: None,
severity: None,
threat_category: None,
rule_id: None,
details_url: None,
}
}
}
pub fn new_event_id() -> String {
format!("evt_{}", uuid::Uuid::now_v7())
}
pub fn current_timestamp() -> String {
chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true)
}
pub fn current_time_utc() -> chrono::DateTime<chrono::Utc> {
chrono::Utc::now()
}
pub fn os_string() -> &'static str {
std::env::consts::OS
}
pub fn arch_string() -> &'static str {
std::env::consts::ARCH
}