Struct cedar_policy_core::ast::StaticPolicy
source · pub struct StaticPolicy(_);
Expand description
Static Policies are policy that do not come from templates. They have the same structure as a template definition, but cannot contain slots
Implementations§
source§impl StaticPolicy
impl StaticPolicy
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
head constraint of this policy.
sourcepub fn principal_constraint_expr(&self) -> Expr
pub fn principal_constraint_expr(&self) -> Expr
Get the principal
head constraint as an expression.
This will be a boolean-valued expression: either true
(if the policy
just has principal,
), or an equality or hierarchy constraint
sourcepub fn action_constraint(&self) -> &ActionConstraint
pub fn action_constraint(&self) -> &ActionConstraint
Get the action
head constraint of this policy.
sourcepub fn action_constraint_expr(&self) -> Expr
pub fn action_constraint_expr(&self) -> Expr
Get the action
head constraint of this policy as an expression.
This will be a boolean-valued expression: either true
(if the policy
just has action,
), or an equality or hierarchy constraint
sourcepub fn resource_constraint(&self) -> &ResourceConstraint
pub fn resource_constraint(&self) -> &ResourceConstraint
Get the resource
head constraint of this policy.
sourcepub fn resource_constraint_expr(&self) -> Expr
pub fn resource_constraint_expr(&self) -> Expr
Get the resource
head constraint of this policy as an expression.
This will be a boolean-valued expression: either true
(if the policy
just has resource,
), or an equality or hierarchy constraint
sourcepub fn non_head_constraints(&self) -> &Expr
pub fn non_head_constraints(&self) -> &Expr
Get the non-head constraints of this policy.
This will be a conjunction of the policy’s when
conditions and the
negation of each of the policy’s unless
conditions.
sourcepub fn condition(&self) -> Expr
pub fn condition(&self) -> Expr
Get the condition expression of this policy.
This will be a conjunction of the policy’s head constraints (on principal, resource, and action); the policy’s “when” conditions; and the negation of each of the policy’s “unless” conditions.
sourcepub fn new(
id: PolicyID,
annotations: BTreeMap<Id, SmolStr>,
effect: Effect,
principal_constraint: PrincipalConstraint,
action_constraint: ActionConstraint,
resource_constraint: ResourceConstraint,
non_head_constraints: Expr
) -> Result<Self, ContainsSlot>
pub fn new( id: PolicyID, annotations: BTreeMap<Id, SmolStr>, effect: Effect, principal_constraint: PrincipalConstraint, action_constraint: ActionConstraint, resource_constraint: ResourceConstraint, non_head_constraints: Expr ) -> Result<Self, ContainsSlot>
Construct a Policy
from its components
Trait Implementations§
source§impl Clone for StaticPolicy
impl Clone for StaticPolicy
source§fn clone(&self) -> StaticPolicy
fn clone(&self) -> StaticPolicy
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for StaticPolicy
impl Debug for StaticPolicy
source§impl<'de> Deserialize<'de> for StaticPolicy
impl<'de> Deserialize<'de> for StaticPolicy
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Display for StaticPolicy
impl Display for StaticPolicy
source§impl From<StaticPolicy> for Arc<Template>
impl From<StaticPolicy> for Arc<Template>
source§fn from(p: StaticPolicy) -> Self
fn from(p: StaticPolicy) -> Self
source§impl From<StaticPolicy> for Policy
impl From<StaticPolicy> for Policy
source§fn from(inline: StaticPolicy) -> Policy
fn from(inline: StaticPolicy) -> Policy
source§impl From<StaticPolicy> for TemplateBody
impl From<StaticPolicy> for TemplateBody
source§fn from(p: StaticPolicy) -> Self
fn from(p: StaticPolicy) -> Self
source§impl Hash for StaticPolicy
impl Hash for StaticPolicy
source§impl PartialEq<StaticPolicy> for StaticPolicy
impl PartialEq<StaticPolicy> for StaticPolicy
source§fn eq(&self, other: &StaticPolicy) -> bool
fn eq(&self, other: &StaticPolicy) -> bool
self
and other
values to be equal, and is used
by ==
.