use shep_core::dogs::manifest::{Manifest, Permission};
use shep_core::protocol::PROTOCOL_VERSION;
use super::BuiltInDog;
pub(super) fn manifest_of(dog: BuiltInDog) -> Manifest {
let mut manifest = Manifest::new(dog.name(), env!("CARGO_PKG_VERSION"), PROTOCOL_VERSION);
manifest.permissions = match dog {
BuiltInDog::Metrics => metrics(),
BuiltInDog::Bark => bark(),
};
manifest
}
fn metrics() -> Vec<Permission> {
vec![
Permission::new(
"flock.read",
true,
"lists the flock for each scrape and each export",
),
Permission::new(
"events:channel.metric",
true,
"keeps the samples sheep push over the shepherd channel",
),
Permission::new(
"events:process.",
true,
"learns when a sheep starts, stops or restarts, so its samples go stale",
),
]
}
fn bark() -> Vec<Permission> {
vec![
Permission::new(
"flock.read",
true,
"polls the flock for what the event bus missed",
),
Permission::new(
"events:process.",
true,
"hears sheep start, stop, restart and exit, which most rules fire on",
),
Permission::new(
"events:log.",
false,
"reads the log lines a log rule matches; asked only when a log rule is set",
),
]
}