Trait ConfigPlugin

Source
pub trait ConfigPlugin:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> String;
    fn gen_config(&self) -> Result<HashMap<String, String>, String>;

    // Provided methods
    fn gen_pack(&self, name: &str, _value: &str) -> Result<String, String> { ... }
    fn shutdown(&self) { ... }
}
Expand description

Trait for implementing configuration plugins in osquery-rust.

Configuration plugins provide osquery with its configuration data, which can come from various sources like files, HTTP endpoints, or other custom sources.

Required Methods§

Source

fn name(&self) -> String

The name of the configuration plugin

Source

fn gen_config(&self) -> Result<HashMap<String, String>, String>

Generate configuration data.

Returns a map of config source names to JSON-encoded configuration strings. The map typically contains a “main” key with the primary configuration.

Provided Methods§

Source

fn gen_pack(&self, name: &str, _value: &str) -> Result<String, String>

Generate pack configuration.

Called when pack content is not provided inline with the configuration. The name parameter is the pack name, and value is any additional context.

Source

fn shutdown(&self)

Called when the plugin is shutting down

Implementors§