pub enum PreparedEngine {
SchemaFree(PolicyEngine<SchemaFree>),
SchemaEnforcing(PolicyEngine<SchemaEnforcing>),
}Expand description
A prepared engine retaining the bundle’s schema validation capability.
Match the variant to access mode-specific Core operations. A schema-free engine cannot be represented as schema-enforcing:
use treetop_bundle::PreparedEngine;
use treetop_core::PolicyEngine;
let free = PolicyEngine::new_from_str("").unwrap();
let enforcing = PreparedEngine::SchemaEnforcing(free);Variants§
SchemaFree(PolicyEngine<SchemaFree>)
A bundle without an enforcing Cedar schema.
SchemaEnforcing(PolicyEngine<SchemaEnforcing>)
A bundle with a fully validated, enforcing Cedar schema.
Implementations§
Source§impl PreparedEngine
impl PreparedEngine
Sourcepub fn with_label_registry(self, registry: LabelRegistry) -> Self
pub fn with_label_registry(self, registry: LabelRegistry) -> Self
Install a validated registry while retaining the engine’s schema mode.
Sourcepub fn session(&self) -> PreparedEvaluationSession
pub fn session(&self) -> PreparedEvaluationSession
Capture one complete generation for all evaluations and version reporting.
Sourcepub fn current_version(&self) -> PolicyVersion
pub fn current_version(&self) -> PolicyVersion
Return the current complete authorization-state version.
Sourcepub fn policy_store_ids(&self) -> Option<Vec<PolicyStoreId>>
pub fn policy_store_ids(&self) -> Option<Vec<PolicyStoreId>>
Return configured store IDs, or None for a monolithic engine.
Sourcepub fn list_policies_for_user(
&self,
user: &str,
groups: &[&str],
namespace: &[&str],
) -> Result<PolicyCandidates, PolicyError>
pub fn list_policies_for_user( &self, user: &str, groups: &[&str], namespace: &[&str], ) -> Result<PolicyCandidates, PolicyError>
List structural permit-policy candidates; these do not authorize operations.
Returns Core validation errors for malformed principal inputs.
Sourcepub fn evaluate(&self, request: &Request) -> Result<Decision, PolicyError>
pub fn evaluate(&self, request: &Request) -> Result<Decision, PolicyError>
Evaluate a request, returning Core errors for invalid request data.
Sourcepub fn evaluate_with_context(
&self,
request: &Request,
context: &RequestContext,
) -> Result<Decision, PolicyError>
pub fn evaluate_with_context( &self, request: &Request, context: &RequestContext, ) -> Result<Decision, PolicyError>
Evaluate with explicit context, returning Core validation/evaluation errors.
Trait Implementations§
Source§impl Clone for PreparedEngine
impl Clone for PreparedEngine
Source§fn clone(&self) -> PreparedEngine
fn clone(&self) -> PreparedEngine
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl From<PolicyEngine<SchemaEnforcing>> for PreparedEngine
impl From<PolicyEngine<SchemaEnforcing>> for PreparedEngine
Source§fn from(engine: PolicyEngine<SchemaEnforcing>) -> Self
fn from(engine: PolicyEngine<SchemaEnforcing>) -> Self
Source§impl From<PolicyEngine> for PreparedEngine
impl From<PolicyEngine> for PreparedEngine
Source§fn from(engine: PolicyEngine<SchemaFree>) -> Self
fn from(engine: PolicyEngine<SchemaFree>) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for PreparedEngine
impl !UnwindSafe for PreparedEngine
impl Freeze for PreparedEngine
impl Send for PreparedEngine
impl Sync for PreparedEngine
impl Unpin for PreparedEngine
impl UnsafeUnpin for PreparedEngine
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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