annon_api v0.16.2 Annon.Plugin behaviour
This helper provides abstract interface to define plugin.
Example:
use Annon.Plugin,
plugin_name: :my_plugin
Link to this section Summary
Functions
Returns list of processing pipeline features that Plugin requires to work properly
Updates Annon.Plugin.Request
structure by raising flag on features in features
list
Callbacks
Executes Plugin
Initializes Plugin
Validates JSON Schema that can be used to validate Plugin settings
Validates Plugin settings
Link to this section Functions
Returns list of processing pipeline features that Plugin requires to work properly.
Updates Annon.Plugin.Request
structure by raising flag on features in features
list.
Link to this section Callbacks
execute( conn :: Plug.Conn.t(), plugin_request :: %Annon.Plugin.Request{ api: term(), feature_requirements: term(), plugins: term(), start_time: term() }, plugin_settings :: %Annon.Configuration.Schemas.Plugin{ __meta__: term(), api: term(), api_id: term(), inserted_at: term(), is_enabled: term(), name: term(), settings: term(), updated_at: term() } ) :: %Annon.Plugin.Request{ api: term(), feature_requirements: term(), plugins: term(), start_time: term() }
Executes Plugin.
Receives Annon.Plugin.Request
structure, which allows Plugin to:
- Set properties for upstream request (in
conn.assigns.upstream_request
). - Modify connection if this feature was enabled.
Initializes Plugin.
Receives Annon.Plugin.Request
structure and returns it, which allows Plugin to:
- Remove itself from execution pipeline if it should be disabled. (Eg. plugin that it depends on is not enabled.)
- Set required execution features. (Eg. if it wants log writes to be consistent.)
Connection MUST NOT be changed in a preparation pipeline.
Validates JSON Schema that can be used to validate Plugin settings.
validate_settings(changeset :: Ecto.Changeset.t()) :: Ecto.Changeset.t()
Validates Plugin settings.