policy-engine

Crates.iopolicy-engine
lib.rspolicy-engine
version0.1.0
sourcesrc
created_at2023-03-09 06:59:39.910297
updated_at2023-03-09 06:59:39.910297
descriptionPolicy Engine allows to dynamically evaluate and enforce policies easily.
homepagehttps://github.com/SubconsciousCompute/policy-engine
repositoryhttps://github.com/SubconsciousCompute/policy-engine
max_upload_size
id805399
size156,737
Siddharth (sn99)

documentation

https://docs.rs/policy-engine

README

policy engine

Policy Engine allows to dynamically evaluate and enforce rules written in a simple expression-like language.

Note: This is still under development.

Example

extern crate policyengine;

use policyengine::services::Policy;
fn main() {

    let user_policy = "metric_a >= 100 && metric_b = 123";
    let mut policy = Policy::new();

    policy.predicate.rule = user_policy.to_string();

    let user_metric = "metric_a = 456 && metric_b = 123";
    policy.predicate.expression = user_metric.to_string();

    policy.action.on_success.path = "/path/to/success".to_string();
    policy.action.on_failure.path = "/path/to/failure".to_string();

    policy.run(); //returns true
}

See examples for more.

Currently supported operands

>, <, >=, <=, ==, !=

Commit count: 0

cargo fmt