pub struct Policy {
pub name: String,
pub description: Option<String>,
pub stype_patterns: Vec<StypePattern>,
pub operations: HashSet<Operation>,
pub access_control: Option<AccessControlRule>,
pub qom_override: Option<QomOverride>,
pub rate_limit: Option<RateLimit>,
pub constraints: Vec<Constraint>,
pub priority: i32,
pub enabled: bool,
}Expand description
Policy definition
Fields§
§name: StringPolicy name
description: Option<String>Description
stype_patterns: Vec<StypePattern>SType patterns this policy applies to
operations: HashSet<Operation>Operation types this policy applies to
access_control: Option<AccessControlRule>Access control rules
qom_override: Option<QomOverride>QoM profile override
rate_limit: Option<RateLimit>Rate limiting
constraints: Vec<Constraint>Custom constraints
priority: i32Priority (higher = evaluated first)
enabled: boolWhether this policy is enabled
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn with_stype_pattern(self, pattern: StypePattern) -> Self
pub fn with_stype_pattern(self, pattern: StypePattern) -> Self
Add an SType pattern
Sourcepub fn with_operations(self, ops: impl IntoIterator<Item = Operation>) -> Self
pub fn with_operations(self, ops: impl IntoIterator<Item = Operation>) -> Self
Add operations
Sourcepub fn with_access_control(self, rule: AccessControlRule) -> Self
pub fn with_access_control(self, rule: AccessControlRule) -> Self
Set access control
Sourcepub fn with_qom_override(self, profile: impl Into<String>) -> Self
pub fn with_qom_override(self, profile: impl Into<String>) -> Self
Set QoM override
Sourcepub fn matches(&self, context: &PolicyContext) -> bool
pub fn matches(&self, context: &PolicyContext) -> bool
Check if policy matches context
Sourcepub fn matches_stype(&self, stype: &SType) -> bool
pub fn matches_stype(&self, stype: &SType) -> bool
Check if policy matches an SType
Sourcepub fn evaluate(&self, context: &PolicyContext) -> PolicyDecision
pub fn evaluate(&self, context: &PolicyContext) -> PolicyDecision
Evaluate policy against context
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Policy
impl<'de> Deserialize<'de> for Policy
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnwindSafe for Policy
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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
Mutably borrows from an owned value. Read more