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 for TemplateBody
impl PartialEq for TemplateBody
source§impl Serialize for TemplateBody
impl Serialize for TemplateBody
impl Eq for TemplateBody
impl StructuralPartialEq for TemplateBody
Auto Trait Implementations§
impl Freeze for TemplateBody
impl RefUnwindSafe for TemplateBody
impl Send for TemplateBody
impl Sync for TemplateBody
impl Unpin for TemplateBody
impl UnwindSafe for TemplateBody
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