Share via


RateLimitRule Class

public final class RateLimitRule
extends CustomRule

Defines a rate limiting rule that can be included in a waf policy.

Constructor Summary

Constructor Description
RateLimitRule()

Creates an instance of RateLimitRule class.

Method Summary

Modifier and Type Method and Description
static RateLimitRule fromJson(JsonReader jsonReader)

Reads an instance of RateLimitRule from the JsonReader.

int rateLimitDurationInMinutes()

Get the rateLimitDurationInMinutes property: Defines rate limit duration.

int rateLimitThreshold()

Get the rateLimitThreshold property: Defines rate limit threshold.

JsonWriter toJson(JsonWriter jsonWriter)
void validate()

Validates the instance.

RateLimitRule withAction(ActionType action)

Set the action property: Describes what action to be applied when rule matches.

RateLimitRule withEnabledState(CustomRuleEnabledState enabledState)

Set the enabledState property: Describes if the custom rule is in enabled or disabled state.

RateLimitRule withMatchConditions(List<MatchCondition> matchConditions)

Set the matchConditions property: List of match conditions.

RateLimitRule withName(String name)

Set the name property: Defines the name of the custom rule.

RateLimitRule withPriority(int priority)

Set the priority property: Defines in what order this rule be evaluated in the overall list of custom rules.

RateLimitRule withRateLimitDurationInMinutes(int rateLimitDurationInMinutes)

Set the rateLimitDurationInMinutes property: Defines rate limit duration.

RateLimitRule withRateLimitThreshold(int rateLimitThreshold)

Set the rateLimitThreshold property: Defines rate limit threshold.

Methods inherited from CustomRule

Methods inherited from java.lang.Object

Constructor Details

RateLimitRule

public RateLimitRule()

Creates an instance of RateLimitRule class.

Method Details

fromJson

public static RateLimitRule fromJson(JsonReader jsonReader)

Reads an instance of RateLimitRule from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of RateLimitRule if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

rateLimitDurationInMinutes

public int rateLimitDurationInMinutes()

Get the rateLimitDurationInMinutes property: Defines rate limit duration. Default is 1 minute.

Returns:

the rateLimitDurationInMinutes value.

rateLimitThreshold

public int rateLimitThreshold()

Get the rateLimitThreshold property: Defines rate limit threshold.

Returns:

the rateLimitThreshold value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

RateLimitRule.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

validate

public void validate()

Validates the instance.

Overrides:

RateLimitRule.validate()

withAction

public RateLimitRule withAction(ActionType action)

Set the action property: Describes what action to be applied when rule matches.

Overrides:

RateLimitRule.withAction(ActionType action)

Parameters:

action

withEnabledState

public RateLimitRule withEnabledState(CustomRuleEnabledState enabledState)

Set the enabledState property: Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified.

Overrides:

RateLimitRule.withEnabledState(CustomRuleEnabledState enabledState)

Parameters:

enabledState

withMatchConditions

public RateLimitRule withMatchConditions(List<MatchCondition> matchConditions)

Set the matchConditions property: List of match conditions.

Overrides:

RateLimitRule.withMatchConditions(List<MatchCondition> matchConditions)

Parameters:

matchConditions

withName

public RateLimitRule withName(String name)

Set the name property: Defines the name of the custom rule.

Overrides:

RateLimitRule.withName(String name)

Parameters:

name

withPriority

public RateLimitRule withPriority(int priority)

Set the priority property: Defines in what order this rule be evaluated in the overall list of custom rules.

Overrides:

RateLimitRule.withPriority(int priority)

Parameters:

priority

withRateLimitDurationInMinutes

public RateLimitRule withRateLimitDurationInMinutes(int rateLimitDurationInMinutes)

Set the rateLimitDurationInMinutes property: Defines rate limit duration. Default is 1 minute.

Parameters:

rateLimitDurationInMinutes - the rateLimitDurationInMinutes value to set.

Returns:

the RateLimitRule object itself.

withRateLimitThreshold

public RateLimitRule withRateLimitThreshold(int rateLimitThreshold)

Set the rateLimitThreshold property: Defines rate limit threshold.

Parameters:

rateLimitThreshold - the rateLimitThreshold value to set.

Returns:

the RateLimitRule object itself.

Applies to