Skip to main content

CpiExtension

Trait CpiExtension 

Source
pub trait CpiExtension: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn provider_type(&self) -> &str;
    fn list_actions(&self) -> Vec<String>;
    fn get_action_definition(&self, action: &str) -> Option<ActionDefinition>;
    fn execute_action(
        &self,
        action: &str,
        params: &HashMap<String, Value>,
    ) -> ActionResult;

    // Provided methods
    fn default_settings(&self) -> HashMap<String, Value> { ... }
    fn test_install(&self) -> ActionResult { ... }
    fn version(&self) -> String { ... }
}
Expand description

Main trait that must be implemented by CPI extensions

Required Methods§

Source

fn name(&self) -> &str

Returns the name of the extension

Source

fn provider_type(&self) -> &str

Returns the provider type

Source

fn list_actions(&self) -> Vec<String>

Returns all available actions

Source

fn get_action_definition(&self, action: &str) -> Option<ActionDefinition>

Returns the definition of a specific action

Source

fn execute_action( &self, action: &str, params: &HashMap<String, Value>, ) -> ActionResult

Executes an action with the given parameters

Provided Methods§

Source

fn default_settings(&self) -> HashMap<String, Value>

Optional method that returns default parameter values for the provider

Source

fn test_install(&self) -> ActionResult

Test if the extension is properly installed

Source

fn version(&self) -> String

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§