@Generated(value="com.amazonaws:aws-java-sdk-code-generator") public class RateBasedStatement extends Object implements Serializable, Cloneable, StructuredPojo
This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
A rate-based rule tracks the rate of requests for each originating IP address, and triggers the rule action when the rate exceeds a limit that you specify on the number of requests in any 5-minute time span. You can use this to put a temporary block on requests from an IP address that is sending excessive requests.
When the rule action triggers, AWS WAF blocks additional requests from the IP address until the request rate falls below the limit.
You can optionally nest another statement inside the rate-based statement, to narrow the scope of the rule so that it only counts requests that match the nested statement. For example, based on recent requests that you have seen from an attacker, you might create a rate-based rule with a nested AND rule statement that contains the following nested statements:
An IP match statement with an IP set that specified the address 192.0.2.44.
A string match statement that searches in the User-Agent header for the string BadBot.
In this rate-based rule, you also define a rate limit. For this example, the rate limit is 1,000. Requests that meet both of the conditions in the statements are counted. If the count exceeds 1,000 requests per five minutes, the rule action triggers. Requests that do not meet both conditions are not counted towards the rate limit and are not affected by this rule.
You cannot nest a RateBasedStatement
, for example for use inside a NotStatement
or
OrStatement
. It can only be referenced as a top-level statement within a rule.
Constructor and Description |
---|
RateBasedStatement() |
Modifier and Type | Method and Description |
---|---|
RateBasedStatement |
clone() |
boolean |
equals(Object obj) |
String |
getAggregateKeyType()
Setting that indicates how to aggregate the request counts.
|
Long |
getLimit()
The limit on requests per 5-minute period for a single originating IP address.
|
Statement |
getScopeDownStatement()
An optional nested statement that narrows the scope of the rate-based statement to matching web requests.
|
int |
hashCode() |
void |
marshall(ProtocolMarshaller protocolMarshaller)
Marshalls this structured data using the given
ProtocolMarshaller . |
void |
setAggregateKeyType(String aggregateKeyType)
Setting that indicates how to aggregate the request counts.
|
void |
setLimit(Long limit)
The limit on requests per 5-minute period for a single originating IP address.
|
void |
setScopeDownStatement(Statement scopeDownStatement)
An optional nested statement that narrows the scope of the rate-based statement to matching web requests.
|
String |
toString()
Returns a string representation of this object.
|
RateBasedStatement |
withAggregateKeyType(RateBasedStatementAggregateKeyType aggregateKeyType)
Setting that indicates how to aggregate the request counts.
|
RateBasedStatement |
withAggregateKeyType(String aggregateKeyType)
Setting that indicates how to aggregate the request counts.
|
RateBasedStatement |
withLimit(Long limit)
The limit on requests per 5-minute period for a single originating IP address.
|
RateBasedStatement |
withScopeDownStatement(Statement scopeDownStatement)
An optional nested statement that narrows the scope of the rate-based statement to matching web requests.
|
public void setLimit(Long limit)
The limit on requests per 5-minute period for a single originating IP address. If the statement includes a
ScopDownStatement
, this limit is applied only to the requests that match the statement.
limit
- The limit on requests per 5-minute period for a single originating IP address. If the statement includes a
ScopDownStatement
, this limit is applied only to the requests that match the statement.public Long getLimit()
The limit on requests per 5-minute period for a single originating IP address. If the statement includes a
ScopDownStatement
, this limit is applied only to the requests that match the statement.
ScopDownStatement
, this limit is applied only to the requests that match the statement.public RateBasedStatement withLimit(Long limit)
The limit on requests per 5-minute period for a single originating IP address. If the statement includes a
ScopDownStatement
, this limit is applied only to the requests that match the statement.
limit
- The limit on requests per 5-minute period for a single originating IP address. If the statement includes a
ScopDownStatement
, this limit is applied only to the requests that match the statement.public void setAggregateKeyType(String aggregateKeyType)
Setting that indicates how to aggregate the request counts. Currently, you must set this to IP
. The
request counts are aggregated on IP addresses.
aggregateKeyType
- Setting that indicates how to aggregate the request counts. Currently, you must set this to
IP
. The request counts are aggregated on IP addresses.RateBasedStatementAggregateKeyType
public String getAggregateKeyType()
Setting that indicates how to aggregate the request counts. Currently, you must set this to IP
. The
request counts are aggregated on IP addresses.
IP
. The request counts are aggregated on IP addresses.RateBasedStatementAggregateKeyType
public RateBasedStatement withAggregateKeyType(String aggregateKeyType)
Setting that indicates how to aggregate the request counts. Currently, you must set this to IP
. The
request counts are aggregated on IP addresses.
aggregateKeyType
- Setting that indicates how to aggregate the request counts. Currently, you must set this to
IP
. The request counts are aggregated on IP addresses.RateBasedStatementAggregateKeyType
public RateBasedStatement withAggregateKeyType(RateBasedStatementAggregateKeyType aggregateKeyType)
Setting that indicates how to aggregate the request counts. Currently, you must set this to IP
. The
request counts are aggregated on IP addresses.
aggregateKeyType
- Setting that indicates how to aggregate the request counts. Currently, you must set this to
IP
. The request counts are aggregated on IP addresses.RateBasedStatementAggregateKeyType
public void setScopeDownStatement(Statement scopeDownStatement)
An optional nested statement that narrows the scope of the rate-based statement to matching web requests. This can be any nestable statement, and you can nest statements at any level below this scope-down statement.
scopeDownStatement
- An optional nested statement that narrows the scope of the rate-based statement to matching web requests.
This can be any nestable statement, and you can nest statements at any level below this scope-down
statement.public Statement getScopeDownStatement()
An optional nested statement that narrows the scope of the rate-based statement to matching web requests. This can be any nestable statement, and you can nest statements at any level below this scope-down statement.
public RateBasedStatement withScopeDownStatement(Statement scopeDownStatement)
An optional nested statement that narrows the scope of the rate-based statement to matching web requests. This can be any nestable statement, and you can nest statements at any level below this scope-down statement.
scopeDownStatement
- An optional nested statement that narrows the scope of the rate-based statement to matching web requests.
This can be any nestable statement, and you can nest statements at any level below this scope-down
statement.public String toString()
toString
in class Object
Object.toString()
public RateBasedStatement clone()
public void marshall(ProtocolMarshaller protocolMarshaller)
StructuredPojo
ProtocolMarshaller
.marshall
in interface StructuredPojo
protocolMarshaller
- Implementation of ProtocolMarshaller
used to marshall this object's data.Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.