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