Struct cedar_policy_core::ast::Policy
source · pub struct Policy { /* private fields */ }
Expand description
A Policy that contains: a pointer to its template an link ID (unless it’s an static policy) the bound values for slots in the template
Policies are not serializable (due to the pointer), and can be serialized by converting to/from LiteralPolicy
Implementations§
source§impl Policy
impl Policy
sourcepub fn from_when_clause(effect: Effect, when: Expr, id: PolicyID) -> Self
pub fn from_when_clause(effect: Effect, when: Expr, id: PolicyID) -> Self
Build a policy with a given effect, given when clause, and unconstrained head variables
sourcepub fn annotation(&self, key: &Id) -> Option<&SmolStr>
pub fn annotation(&self, key: &Id) -> Option<&SmolStr>
Get data from an annotation.
sourcepub fn annotations(&self) -> impl Iterator<Item = (&Id, &SmolStr)>
pub fn annotations(&self) -> impl Iterator<Item = (&Id, &SmolStr)>
Get all annotation data.
sourcepub fn principal_constraint(&self) -> PrincipalConstraint
pub fn principal_constraint(&self) -> PrincipalConstraint
Get the principal constraint for this policy.
By the invariant, this principal constraint will not contain
(unresolved) slots, so you will not get EntityReference::Slot
anywhere
in it.
sourcepub fn action_constraint(&self) -> &ActionConstraint
pub fn action_constraint(&self) -> &ActionConstraint
Get the action constraint for this policy.
sourcepub fn resource_constraint(&self) -> ResourceConstraint
pub fn resource_constraint(&self) -> ResourceConstraint
Get the resource constraint for this policy.
By the invariant, this resource constraint will not contain
(unresolved) slots, so you will not get EntityReference::Slot
anywhere
in it.
sourcepub fn non_head_constraints(&self) -> &Expr
pub fn non_head_constraints(&self) -> &Expr
Get the non-head constraints for the policy
Trait Implementations§
source§impl<'a> From<&'a Policy> for BorrowedLiteralPolicy<'a>
impl<'a> From<&'a Policy> for BorrowedLiteralPolicy<'a>
source§impl From<Policy> for LiteralPolicy
impl From<Policy> for LiteralPolicy
source§impl From<StaticPolicy> for Policy
impl From<StaticPolicy> for Policy
source§fn from(inline: StaticPolicy) -> Policy
fn from(inline: StaticPolicy) -> Policy
impl Eq for Policy
impl StructuralPartialEq for Policy
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnwindSafe for Policy
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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