Struct cedar_policy_core::ast::TemplateBody
source · pub struct TemplateBody { /* private fields */ }
Expand description
Policy datatype.
This will also represent the serialized form of policies on disk and on the network.
Implementations§
source§impl TemplateBody
impl TemplateBody
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
) -> Self
pub fn new( id: PolicyID, annotations: BTreeMap<Id, SmolStr>, effect: Effect, principal_constraint: PrincipalConstraint, action_constraint: ActionConstraint, resource_constraint: ResourceConstraint, non_head_constraints: Expr ) -> Self
Construct a Policy
from its components
Trait Implementations§
source§impl Clone for TemplateBody
impl Clone for TemplateBody
source§fn clone(&self) -> TemplateBody
fn clone(&self) -> TemplateBody
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TemplateBody
impl Debug for TemplateBody
source§impl<'de> Deserialize<'de> for TemplateBody
impl<'de> Deserialize<'de> for TemplateBody
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 TemplateBody
impl Display for TemplateBody
source§impl From<StaticPolicy> for TemplateBody
impl From<StaticPolicy> for TemplateBody
source§fn from(p: StaticPolicy) -> Self
fn from(p: StaticPolicy) -> Self
source§impl From<Template> for TemplateBody
impl From<Template> for TemplateBody
source§impl From<TemplateBody> for Template
impl From<TemplateBody> for Template
source§fn from(body: TemplateBody) -> Self
fn from(body: TemplateBody) -> Self
source§impl Hash for TemplateBody
impl Hash for TemplateBody
source§impl PartialEq<TemplateBody> for TemplateBody
impl PartialEq<TemplateBody> for TemplateBody
source§fn eq(&self, other: &TemplateBody) -> bool
fn eq(&self, other: &TemplateBody) -> bool
self
and other
values to be equal, and is used
by ==
.