Skip to main content

DynamicRules

Struct DynamicRules 

Source
pub struct DynamicRules {
Show 24 fields pub rule_id: String, pub version: u64, pub timestamp: Option<DateTime<Utc>>, pub expires_at: Option<DateTime<Utc>>, pub ttl: u64, pub ip_blacklist: Vec<String>, pub ip_whitelist: Vec<String>, pub ip_ban_duration: u64, pub blocked_countries: Vec<String>, pub whitelist_countries: Vec<String>, pub global_rate_limit: Option<u64>, pub global_rate_window: Option<u64>, pub endpoint_rate_limits: BTreeMap<String, (u64, u64)>, pub blocked_cloud_providers: BTreeSet<String>, pub blocked_user_agents: Vec<String>, pub suspicious_patterns: Vec<String>, pub enable_penetration_detection: Option<bool>, pub enable_ip_banning: Option<bool>, pub enable_rate_limiting: Option<bool>, pub auto_ban_threshold: Option<u64>, pub auto_ban_duration: Option<u64>, pub enable_rate_limit_auto_ban: Option<bool>, pub emergency_mode: bool, pub emergency_whitelist: Vec<String>,
}
Expand description

The reference DynamicRules wire model, field for field (the same shape the guard-agent models carry).

Eq is unreachable while the model carries a DateTime (chrono answers PartialEq only), hence the pinpointed allowance.

Fields§

§rule_id: String

Unique rule ID.

§version: u64

Rule version number.

§timestamp: Option<DateTime<Utc>>

Rule creation/update timestamp.

§expires_at: Option<DateTime<Utc>>

Rule expiration time.

§ttl: u64

Cache TTL in seconds (drives the client-side rules cache).

§ip_blacklist: Vec<String>

IPs to ban.

§ip_whitelist: Vec<String>

IPs to allow.

§ip_ban_duration: u64

Ban duration in seconds.

§blocked_countries: Vec<String>

Countries to block.

§whitelist_countries: Vec<String>

Countries to allow.

§global_rate_limit: Option<u64>

Global rate limit.

§global_rate_window: Option<u64>

Global rate window in seconds.

§endpoint_rate_limits: BTreeMap<String, (u64, u64)>

Per-endpoint rate limits {endpoint: (requests, window)}.

§blocked_cloud_providers: BTreeSet<String>

Cloud providers to block (the AWS:!region scoping survives).

§blocked_user_agents: Vec<String>

User agents to block.

§suspicious_patterns: Vec<String>

Additional suspicious patterns.

§enable_penetration_detection: Option<bool>

Override penetration detection setting.

§enable_ip_banning: Option<bool>

Override IP banning setting.

§enable_rate_limiting: Option<bool>

Override rate limiting setting.

§auto_ban_threshold: Option<u64>

Override auto-ban threshold setting.

§auto_ban_duration: Option<u64>

Override auto-ban duration setting.

§enable_rate_limit_auto_ban: Option<bool>

Override rate-limit auto-ban setting.

§emergency_mode: bool

Emergency lockdown mode.

§emergency_whitelist: Vec<String>

Emergency whitelist IPs.

Implementations§

Source§

impl DynamicRules

Source

pub fn identity(&self) -> (&str, u64)

The rule identity the gates compare ((rule_id, version)).

Source§

impl DynamicRules

Source

pub const fn auto_ban_overrides_valid(&self) -> bool

The pydantic ge=1 constraints on the auto-ban overrides: the reference rejects the whole delivery when either is zero.

Trait Implementations§

Source§

impl Clone for DynamicRules

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DynamicRules

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DynamicRules

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DynamicRules

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for DynamicRules

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DynamicRules

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DynamicRules

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.