Skip to main content

PolicyClient

Trait PolicyClient 

Source
pub trait PolicyClient:
    Send
    + Sync
    + 'static {
    // Required method
    fn evaluate<'a>(
        &'a self,
        path: &'a str,
        input: JsonValue,
    ) -> BoxFuture<'a, Result<JsonValue, PolicyError>>;
}
Expand description

Evaluates policies: a path and a JSON input in, a raw decision document out.

The raw document is normalized by PolicyDecision::normalize (approval) or parse_allowlist (capabilities). Clients return JsonValue::Null when the policy produced no value (an undefined rule), never an error.

Required Methods§

Source

fn evaluate<'a>( &'a self, path: &'a str, input: JsonValue, ) -> BoxFuture<'a, Result<JsonValue, PolicyError>>

Evaluates the policy at path with input.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: PolicyClient + ?Sized> PolicyClient for Arc<T>

Source§

fn evaluate<'a>( &'a self, path: &'a str, input: JsonValue, ) -> BoxFuture<'a, Result<JsonValue, PolicyError>>

Implementors§