pub trait Query: Send {
// Required methods
fn input_schema(&self) -> JsonSchema;
fn output_schema(&self) -> JsonSchema;
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
engine: &'life1 mut PluginEngine,
input: JsonValue,
) -> Pin<Box<dyn Future<Output = Result<JsonValue>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Defines a single query endpoint for the plugin.
Required Methods§
Sourcefn input_schema(&self) -> JsonSchema
fn input_schema(&self) -> JsonSchema
Get the input schema for the query as a schemars::schema::SchemaObject
.
Sourcefn output_schema(&self) -> JsonSchema
fn output_schema(&self) -> JsonSchema
Get the output schema for the query as a schemars::schema::SchemaObject
.
Sourcefn run<'life0, 'life1, 'async_trait>(
&'life0 self,
engine: &'life1 mut PluginEngine,
input: JsonValue,
) -> Pin<Box<dyn Future<Output = Result<JsonValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
engine: &'life1 mut PluginEngine,
input: JsonValue,
) -> Pin<Box<dyn Future<Output = Result<JsonValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run the query endpoint logic on input
, returning a JSONified return value on success.
The PluginEngine
reference allows the endpoint to query other Hipcheck plugins by
calling engine::query()
.