pub enum Action {
Log {
level: LogLevel,
message: String,
},
Emit {
event_type: String,
payload: Value,
},
SetContext {
key: String,
value: Value,
},
IncrementCounter {
name: String,
amount: i64,
},
Alert {
severity: AlertSeverity,
title: String,
message: String,
},
Throttle {
key: String,
max_per_second: f64,
},
Reject {
reason: String,
code: u32,
},
Redirect {
target_node: Option<NodeId>,
target_tags: Vec<String>,
},
Scale {
resource: String,
direction: ScaleDirection,
amount: u32,
},
Custom {
action_type: String,
params: HashMap<String, Value>,
},
Chain(Vec<Action>),
Noop,
}Expand description
Action types that can be executed when rules match
Variants§
Log
Log a message
Fields
Emit
Emit an event
Fields
SetContext
Set a context value
IncrementCounter
Increment a counter
Fields
Alert
Send alert/notification
Fields
§
severity: AlertSeveritySeverity level of the alert
Throttle
Throttle/rate limit
Fields
Reject
Reject request
Fields
Redirect
Redirect to another node
Fields
Tags used to select a target node when no specific node is given
Scale
Scale resources
Fields
§
direction: ScaleDirectionWhether to scale up or down
Custom
Execute custom action
Fields
Chain(Vec<Action>)
Chain multiple actions
Noop
No action (useful for monitoring rules)
Implementations§
Source§impl Action
impl Action
Sourcepub fn set_context(key: impl Into<String>, value: Value) -> Self
pub fn set_context(key: impl Into<String>, value: Value) -> Self
Create a set context action
Sourcepub fn alert(
severity: AlertSeverity,
title: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn alert( severity: AlertSeverity, title: impl Into<String>, message: impl Into<String>, ) -> Self
Create an alert action
Create a redirect action
Sourcepub fn action_count(&self) -> usize
pub fn action_count(&self) -> usize
Count total actions (including nested)
Trait Implementations§
impl StructuralPartialEq for Action
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnsafeUnpin for Action
impl UnwindSafe for Action
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
Mutably borrows from an owned value. Read more