Skip to main content

PolicyEngine

Trait PolicyEngine 

Source
pub trait PolicyEngine: Send + Sync {
    // Required methods
    fn evaluate_policy<'life0, 'async_trait>(
        &'life0 self,
        request: PolicyRequest,
    ) -> Pin<Box<dyn Future<Output = Result<PolicyDecision, PolicyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn register_policy<'life0, 'async_trait>(
        &'life0 self,
        policy: Policy,
    ) -> Pin<Box<dyn Future<Output = Result<PolicyId, PolicyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_policy<'life0, 'async_trait>(
        &'life0 self,
        policy_id: PolicyId,
        policy: Policy,
    ) -> Pin<Box<dyn Future<Output = Result<(), PolicyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_policy<'life0, 'async_trait>(
        &'life0 self,
        policy_id: PolicyId,
    ) -> Pin<Box<dyn Future<Output = Result<(), PolicyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_policies<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PolicyInfo>, PolicyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_policy<'life0, 'async_trait>(
        &'life0 self,
        policy_id: PolicyId,
    ) -> Pin<Box<dyn Future<Output = Result<Policy, PolicyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn validate_policy<'life0, 'life1, 'async_trait>(
        &'life0 self,
        policy: &'life1 Policy,
    ) -> Pin<Box<dyn Future<Output = Result<ValidationResult, PolicyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_policy_stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<PolicyStatistics, PolicyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Policy engine trait for external policy enforcement

Required Methods§

Source

fn evaluate_policy<'life0, 'async_trait>( &'life0 self, request: PolicyRequest, ) -> Pin<Box<dyn Future<Output = Result<PolicyDecision, PolicyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Evaluate a policy for an agent action

Source

fn register_policy<'life0, 'async_trait>( &'life0 self, policy: Policy, ) -> Pin<Box<dyn Future<Output = Result<PolicyId, PolicyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Register a new policy

Source

fn update_policy<'life0, 'async_trait>( &'life0 self, policy_id: PolicyId, policy: Policy, ) -> Pin<Box<dyn Future<Output = Result<(), PolicyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update an existing policy

Source

fn delete_policy<'life0, 'async_trait>( &'life0 self, policy_id: PolicyId, ) -> Pin<Box<dyn Future<Output = Result<(), PolicyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete a policy

Source

fn list_policies<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PolicyInfo>, PolicyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all policies

Source

fn get_policy<'life0, 'async_trait>( &'life0 self, policy_id: PolicyId, ) -> Pin<Box<dyn Future<Output = Result<Policy, PolicyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get policy by ID

Source

fn validate_policy<'life0, 'life1, 'async_trait>( &'life0 self, policy: &'life1 Policy, ) -> Pin<Box<dyn Future<Output = Result<ValidationResult, PolicyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate policy syntax

Source

fn get_policy_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PolicyStatistics, PolicyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get policy evaluation statistics

Implementors§