PluginService

Trait PluginService 

Source
pub trait PluginService:
    Send
    + Sync
    + 'static {
    type GetQuerySchemasStream: Stream<Item = Result<GetQuerySchemasResponse, Status>> + Send + 'static;
    type InitiateQueryProtocolStream: Stream<Item = Result<InitiateQueryProtocolResponse, Status>> + Send + 'static;

    // Required methods
    fn get_query_schemas<'life0, 'async_trait>(
        &'life0 self,
        request: Request<GetQuerySchemasRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::GetQuerySchemasStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_configuration<'life0, 'async_trait>(
        &'life0 self,
        request: Request<SetConfigurationRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<SetConfigurationResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_default_policy_expression<'life0, 'async_trait>(
        &'life0 self,
        request: Request<GetDefaultPolicyExpressionRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<GetDefaultPolicyExpressionResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn explain_default_query<'life0, 'async_trait>(
        &'life0 self,
        request: Request<ExplainDefaultQueryRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<ExplainDefaultQueryResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn initiate_query_protocol<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Streaming<InitiateQueryProtocolRequest>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::InitiateQueryProtocolStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with PluginServiceServer.

Required Associated Types§

Source

type GetQuerySchemasStream: Stream<Item = Result<GetQuerySchemasResponse, Status>> + Send + 'static

Server streaming response type for the GetQuerySchemas method.

Source

type InitiateQueryProtocolStream: Stream<Item = Result<InitiateQueryProtocolResponse, Status>> + Send + 'static

Server streaming response type for the InitiateQueryProtocol method.

Required Methods§

Source

fn get_query_schemas<'life0, 'async_trait>( &'life0 self, request: Request<GetQuerySchemasRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::GetQuerySchemasStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get schemas for all supported queries by the plugin.

This is used by Hipcheck to validate that:

  • The plugin supports a default query taking a target type if used as a top-level plugin in the user’s policy file.
  • That requests sent to the plugin and data returned by the plugin match the schema during execution.
Source

fn set_configuration<'life0, 'async_trait>( &'life0 self, request: Request<SetConfigurationRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SetConfigurationResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Hipcheck sends all child nodes for the plugin from the user’s policy file to configure the plugin.

Source

fn get_default_policy_expression<'life0, 'async_trait>( &'life0 self, request: Request<GetDefaultPolicyExpressionRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<GetDefaultPolicyExpressionResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the default policy for a plugin, which may additionally depend on the plugin’s configuration.

Source

fn explain_default_query<'life0, 'async_trait>( &'life0 self, request: Request<ExplainDefaultQueryRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<ExplainDefaultQueryResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get an explanation of what the default query returns, to use when reporting analysis results to users.

Note that, because users can specify their own policy expression, this explanation should not assume the user has used the default policy expression, if one is provided by the plugin.

Source

fn initiate_query_protocol<'life0, 'async_trait>( &'life0 self, request: Request<Streaming<InitiateQueryProtocolRequest>>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::InitiateQueryProtocolStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Open a bidirectional streaming RPC to enable a request/response protocol between Hipcheck and a plugin, where Hipcheck can issue queries to the plugin, and the plugin may issue queries to other plugins through Hipcheck.

Queries are cached by the publisher name, plugin name, query name, and key, and if a match is found for those four values, then Hipcheck will respond with the cached result of that prior matching query rather than running the query again.

Implementors§