pub struct Intervention {
pub status: u16,
pub url: Option<String>,
pub log: Option<String>,
pub rule_ids: Vec<String>,
pub phase: Phase,
pub drop_connection: bool,
pub metadata: Vec<RuleMetadata>,
}Expand description
An intervention (blocking decision) from rule processing.
Fields§
§status: u16HTTP status code to return.
url: Option<String>Redirect URL (if applicable).
log: Option<String>Log message.
rule_ids: Vec<String>Rule IDs that triggered the intervention.
phase: PhasePhase in which intervention occurred.
drop_connection: boolWhether to drop the connection.
metadata: Vec<RuleMetadata>Matched rule metadata.
Implementations§
Source§impl Intervention
impl Intervention
Sourcepub fn deny(status: u16, phase: Phase, rule_id: Option<String>) -> Self
pub fn deny(status: u16, phase: Phase, rule_id: Option<String>) -> Self
Create a deny intervention.
Sourcepub fn redirect(url: String, phase: Phase, rule_id: Option<String>) -> Self
pub fn redirect(url: String, phase: Phase, rule_id: Option<String>) -> Self
Create a redirect intervention.
Sourcepub fn add_rule_id(&mut self, id: String)
pub fn add_rule_id(&mut self, id: String)
Add a rule ID.
Sourcepub fn add_metadata(&mut self, metadata: RuleMetadata)
pub fn add_metadata(&mut self, metadata: RuleMetadata)
Add metadata from a matched rule.
Sourcepub fn format_log(&self) -> String
pub fn format_log(&self) -> String
Format as a log entry.
Trait Implementations§
Source§impl Clone for Intervention
impl Clone for Intervention
Source§fn clone(&self) -> Intervention
fn clone(&self) -> Intervention
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Intervention
impl Debug for Intervention
Auto Trait Implementations§
impl Freeze for Intervention
impl RefUnwindSafe for Intervention
impl Send for Intervention
impl Sync for Intervention
impl Unpin for Intervention
impl UnwindSafe for Intervention
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