Struct cedar_policy_core::ast::StaticPolicy
source · pub struct StaticPolicy(/* private fields */);
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, UnexpectedSlotError>
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, UnexpectedSlotError>
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 for StaticPolicy
impl PartialEq for StaticPolicy
source§impl Serialize for StaticPolicy
impl Serialize for StaticPolicy
source§impl TryFrom<Template> for StaticPolicy
impl TryFrom<Template> for StaticPolicy
impl Eq for StaticPolicy
impl StructuralPartialEq for StaticPolicy
Auto Trait Implementations§
impl Freeze for StaticPolicy
impl RefUnwindSafe for StaticPolicy
impl Send for StaticPolicy
impl Sync for StaticPolicy
impl Unpin for StaticPolicy
impl UnwindSafe for StaticPolicy
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