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§
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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,
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