pub struct PolicyEngine { /* private fields */ }Expand description
Cedar-based policy engine for Converge gate decisions.
Implementations§
Source§impl PolicyEngine
impl PolicyEngine
Sourcepub fn from_policy_str(policy_text: &str) -> Result<Self, EngineError>
pub fn from_policy_str(policy_text: &str) -> Result<Self, EngineError>
Create an engine from a Cedar policy source string.
§Errors
Returns Err if the Cedar policy text fails to parse.
Sourcepub fn evaluate(
&self,
req: &DecideRequest,
) -> Result<PolicyDecision, EngineError>
pub fn evaluate( &self, req: &DecideRequest, ) -> Result<PolicyDecision, EngineError>
Evaluate a policy decision.
Builds Cedar principal (Suggestor::Persona), resource (Flow::Commitment),
and context from the request, then evaluates the loaded policies.
§Errors
Returns Err if entity or context construction fails.
Source§impl PolicyEngine
impl PolicyEngine
Sourcepub fn evaluate_flow(
&self,
input: &FlowGateInput,
) -> Result<PolicyDecision, EngineError>
pub fn evaluate_flow( &self, input: &FlowGateInput, ) -> Result<PolicyDecision, EngineError>
Evaluate a policy decision from the canonical flow-facing input.
This is the preferred path for converging flows and application runtimes.
Trait Implementations§
Source§impl FlowGateAuthorizer for PolicyEngine
impl FlowGateAuthorizer for PolicyEngine
Source§fn decide(
&self,
input: &FlowGateInput,
) -> Result<FlowGateDecision, FlowGateError>
fn decide( &self, input: &FlowGateInput, ) -> Result<FlowGateDecision, FlowGateError>
Decide whether the attempted flow action should promote, reject, or escalate.
Auto Trait Implementations§
impl !RefUnwindSafe for PolicyEngine
impl !UnwindSafe for PolicyEngine
impl Freeze for PolicyEngine
impl Send for PolicyEngine
impl Sync for PolicyEngine
impl Unpin for PolicyEngine
impl UnsafeUnpin for PolicyEngine
Blanket Implementations§
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more