osquery_rust/plugin/_traits/
osquery_plugin.rs

1use crate::_osquery as osquery;
2use crate::plugin::Registry;
3
4pub trait OsqueryPlugin {
5    // Name is the name used to refer to the plugin (eg. the name of the
6    // table the plugin implements).
7    fn name(&self) -> String;
8
9    // RegistryName is which "registry" the plugin should be added to.
10    // Valid names are ["config", "logger", "table"].
11    fn registry(&self) -> Registry;
12
13    // Routes returns the detailed information about the interface exposed
14    // by the plugin. See the example plugins for samples.
15    fn routes(&self) -> osquery::ExtensionPluginResponse;
16
17    // Ping implements a health check for the plugin. If the plugin is in a
18    // healthy state, StatusOK should be returned.
19    fn ping(&self) -> osquery::ExtensionStatus;
20
21    // Call requests the plugin to perform its defined behavior, returning
22    // a response containing the result.
23    // Request: {"action": "generate", "context": "{\"constraints\":[{\"name\":\"h1\",\"list\":[],\"affinity\":\"TEXT\"},{\"name\":\"h2\",\"list\":[],\"affinity\":\"INTEGER\"},{\"name\":\"h3\",\"list\":[],\"affinity\":\"TEXT\"}],\"colsUsed\":[\"h3\",\"h2\",\"h1\"],\"colsUsedBitset\":7}"}
24    fn call(&self, req: osquery::ExtensionPluginRequest) -> osquery::ExtensionResponse;
25
26    // Shutdown alerts the plugin to stop.
27    fn shutdown(&self);
28}