pub struct PolicyEngine { /* private fields */ }
Expand description
The state of the policy engine.
Contains compiled policies and their triggers.
Implementations§
Source§impl PolicyEngine
impl PolicyEngine
Sourcepub fn add_policy(
&mut self,
id: PolicyId,
class: PolicyValue,
bytecode: Vec<u8>,
)
pub fn add_policy( &mut self, id: PolicyId, class: PolicyValue, bytecode: Vec<u8>, )
Adds a new policy to the engine.
Sourcepub fn add_trigger(
&mut self,
attr_matcher: impl Into<BTreeSet<AttrId>>,
policy_ids: impl Into<BTreeSet<PolicyId>>,
)
pub fn add_trigger( &mut self, attr_matcher: impl Into<BTreeSet<AttrId>>, policy_ids: impl Into<BTreeSet<PolicyId>>, )
Adds a new policy trigger to the engine.
Sourcepub fn get_policy_count(&self) -> usize
pub fn get_policy_count(&self) -> usize
Get the number of policies currently in the engine.
Sourcepub fn get_trigger_count(&self) -> usize
pub fn get_trigger_count(&self) -> usize
Get the number of policy triggers currently in the engine.
Sourcepub fn eval(
&self,
params: &AccessControlParams,
tracer: &mut impl PolicyTracer,
) -> Result<PolicyValue, EvalError>
pub fn eval( &self, params: &AccessControlParams, tracer: &mut impl PolicyTracer, ) -> Result<PolicyValue, EvalError>
Perform an access control evalution of the given parameters within this engine.
Trait Implementations§
Source§impl Debug for PolicyEngine
impl Debug for PolicyEngine
Source§impl Default for PolicyEngine
impl Default for PolicyEngine
Source§fn default() -> PolicyEngine
fn default() -> PolicyEngine
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PolicyEngine
impl RefUnwindSafe for PolicyEngine
impl Send for PolicyEngine
impl Sync for PolicyEngine
impl Unpin for PolicyEngine
impl UnwindSafe for PolicyEngine
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request