All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.waf.model.RateBasedRule Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS WAF Service module holds the client classes that are used for communicating with AWS WAF Service

There is a newer version: 1.12.780
Show newest version
/*
 * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.waf.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * 
 * 

* This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the * developer guide. *

*

* For the latest version of AWS WAF, use the AWS WAFV2 API and see the AWS WAF Developer Guide. With the * latest version, AWS WAF has a single set of endpoints for regional and global use. *

*
*

* A RateBasedRule is identical to a regular Rule, with one addition: a RateBasedRule * counts the number of requests that arrive from a specified IP address every five minutes. For example, based on * recent requests that you've seen from an attacker, you might create a RateBasedRule that includes the * following conditions: *

*
    *
  • *

    * The requests come from 192.0.2.44. *

    *
  • *
  • *

    * They contain the value BadBot in the User-Agent header. *

    *
  • *
*

* In the rule, you also define the rate limit as 1,000. *

*

* Requests that meet both of these conditions and exceed 1,000 requests every five minutes trigger the rule's action * (block or count), which is defined in the web ACL. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class RateBasedRule implements Serializable, Cloneable, StructuredPojo { /** *

* A unique identifier for a RateBasedRule. You use RuleId to get more information about a * RateBasedRule (see GetRateBasedRule), update a RateBasedRule (see * UpdateRateBasedRule), insert a RateBasedRule into a WebACL or delete one from a * WebACL (see UpdateWebACL), or delete a RateBasedRule from AWS WAF (see * DeleteRateBasedRule). *

*/ private String ruleId; /** *

* A friendly name or description for a RateBasedRule. You can't change the name of a * RateBasedRule after you create it. *

*/ private String name; /** *

* A friendly name or description for the metrics for a RateBasedRule. The name can contain only * alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain * whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name * of the metric after you create the RateBasedRule. *

*/ private String metricName; /** *

* The Predicates object contains one Predicate element for each ByteMatchSet, * IPSet, or SqlInjectionMatchSet object that you want to include in a RateBasedRule. *

*/ private java.util.List matchPredicates; /** *

* The field that AWS WAF uses to determine if requests are likely arriving from single source and thus subject to * rate monitoring. The only valid value for RateKey is IP. IP indicates that * requests arriving from the same IP address are subject to the RateLimit that is specified in the * RateBasedRule. *

*/ private String rateKey; /** *

* The maximum number of requests, which have an identical value in the field specified by the RateKey, * allowed in a five-minute period. If the number of requests exceeds the RateLimit and the other * predicates specified in the rule are also met, AWS WAF triggers the action that is specified for this rule. *

*/ private Long rateLimit; /** *

* A unique identifier for a RateBasedRule. You use RuleId to get more information about a * RateBasedRule (see GetRateBasedRule), update a RateBasedRule (see * UpdateRateBasedRule), insert a RateBasedRule into a WebACL or delete one from a * WebACL (see UpdateWebACL), or delete a RateBasedRule from AWS WAF (see * DeleteRateBasedRule). *

* * @param ruleId * A unique identifier for a RateBasedRule. You use RuleId to get more information * about a RateBasedRule (see GetRateBasedRule), update a RateBasedRule (see * UpdateRateBasedRule), insert a RateBasedRule into a WebACL or delete one * from a WebACL (see UpdateWebACL), or delete a RateBasedRule from AWS WAF * (see DeleteRateBasedRule). */ public void setRuleId(String ruleId) { this.ruleId = ruleId; } /** *

* A unique identifier for a RateBasedRule. You use RuleId to get more information about a * RateBasedRule (see GetRateBasedRule), update a RateBasedRule (see * UpdateRateBasedRule), insert a RateBasedRule into a WebACL or delete one from a * WebACL (see UpdateWebACL), or delete a RateBasedRule from AWS WAF (see * DeleteRateBasedRule). *

* * @return A unique identifier for a RateBasedRule. You use RuleId to get more information * about a RateBasedRule (see GetRateBasedRule), update a RateBasedRule * (see UpdateRateBasedRule), insert a RateBasedRule into a WebACL or * delete one from a WebACL (see UpdateWebACL), or delete a RateBasedRule * from AWS WAF (see DeleteRateBasedRule). */ public String getRuleId() { return this.ruleId; } /** *

* A unique identifier for a RateBasedRule. You use RuleId to get more information about a * RateBasedRule (see GetRateBasedRule), update a RateBasedRule (see * UpdateRateBasedRule), insert a RateBasedRule into a WebACL or delete one from a * WebACL (see UpdateWebACL), or delete a RateBasedRule from AWS WAF (see * DeleteRateBasedRule). *

* * @param ruleId * A unique identifier for a RateBasedRule. You use RuleId to get more information * about a RateBasedRule (see GetRateBasedRule), update a RateBasedRule (see * UpdateRateBasedRule), insert a RateBasedRule into a WebACL or delete one * from a WebACL (see UpdateWebACL), or delete a RateBasedRule from AWS WAF * (see DeleteRateBasedRule). * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedRule withRuleId(String ruleId) { setRuleId(ruleId); return this; } /** *

* A friendly name or description for a RateBasedRule. You can't change the name of a * RateBasedRule after you create it. *

* * @param name * A friendly name or description for a RateBasedRule. You can't change the name of a * RateBasedRule after you create it. */ public void setName(String name) { this.name = name; } /** *

* A friendly name or description for a RateBasedRule. You can't change the name of a * RateBasedRule after you create it. *

* * @return A friendly name or description for a RateBasedRule. You can't change the name of a * RateBasedRule after you create it. */ public String getName() { return this.name; } /** *

* A friendly name or description for a RateBasedRule. You can't change the name of a * RateBasedRule after you create it. *

* * @param name * A friendly name or description for a RateBasedRule. You can't change the name of a * RateBasedRule after you create it. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedRule withName(String name) { setName(name); return this; } /** *

* A friendly name or description for the metrics for a RateBasedRule. The name can contain only * alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain * whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name * of the metric after you create the RateBasedRule. *

* * @param metricName * A friendly name or description for the metrics for a RateBasedRule. The name can contain only * alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain * whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change * the name of the metric after you create the RateBasedRule. */ public void setMetricName(String metricName) { this.metricName = metricName; } /** *

* A friendly name or description for the metrics for a RateBasedRule. The name can contain only * alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain * whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name * of the metric after you create the RateBasedRule. *

* * @return A friendly name or description for the metrics for a RateBasedRule. The name can contain * only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't * contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't * change the name of the metric after you create the RateBasedRule. */ public String getMetricName() { return this.metricName; } /** *

* A friendly name or description for the metrics for a RateBasedRule. The name can contain only * alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain * whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name * of the metric after you create the RateBasedRule. *

* * @param metricName * A friendly name or description for the metrics for a RateBasedRule. The name can contain only * alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain * whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change * the name of the metric after you create the RateBasedRule. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedRule withMetricName(String metricName) { setMetricName(metricName); return this; } /** *

* The Predicates object contains one Predicate element for each ByteMatchSet, * IPSet, or SqlInjectionMatchSet object that you want to include in a RateBasedRule. *

* * @return The Predicates object contains one Predicate element for each * ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a * RateBasedRule. */ public java.util.List getMatchPredicates() { return matchPredicates; } /** *

* The Predicates object contains one Predicate element for each ByteMatchSet, * IPSet, or SqlInjectionMatchSet object that you want to include in a RateBasedRule. *

* * @param matchPredicates * The Predicates object contains one Predicate element for each * ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a * RateBasedRule. */ public void setMatchPredicates(java.util.Collection matchPredicates) { if (matchPredicates == null) { this.matchPredicates = null; return; } this.matchPredicates = new java.util.ArrayList(matchPredicates); } /** *

* The Predicates object contains one Predicate element for each ByteMatchSet, * IPSet, or SqlInjectionMatchSet object that you want to include in a RateBasedRule. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setMatchPredicates(java.util.Collection)} or {@link #withMatchPredicates(java.util.Collection)} if you * want to override the existing values. *

* * @param matchPredicates * The Predicates object contains one Predicate element for each * ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a * RateBasedRule. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedRule withMatchPredicates(Predicate... matchPredicates) { if (this.matchPredicates == null) { setMatchPredicates(new java.util.ArrayList(matchPredicates.length)); } for (Predicate ele : matchPredicates) { this.matchPredicates.add(ele); } return this; } /** *

* The Predicates object contains one Predicate element for each ByteMatchSet, * IPSet, or SqlInjectionMatchSet object that you want to include in a RateBasedRule. *

* * @param matchPredicates * The Predicates object contains one Predicate element for each * ByteMatchSet, IPSet, or SqlInjectionMatchSet object that you want to include in a * RateBasedRule. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedRule withMatchPredicates(java.util.Collection matchPredicates) { setMatchPredicates(matchPredicates); return this; } /** *

* The field that AWS WAF uses to determine if requests are likely arriving from single source and thus subject to * rate monitoring. The only valid value for RateKey is IP. IP indicates that * requests arriving from the same IP address are subject to the RateLimit that is specified in the * RateBasedRule. *

* * @param rateKey * The field that AWS WAF uses to determine if requests are likely arriving from single source and thus * subject to rate monitoring. The only valid value for RateKey is IP. * IP indicates that requests arriving from the same IP address are subject to the * RateLimit that is specified in the RateBasedRule. * @see RateKey */ public void setRateKey(String rateKey) { this.rateKey = rateKey; } /** *

* The field that AWS WAF uses to determine if requests are likely arriving from single source and thus subject to * rate monitoring. The only valid value for RateKey is IP. IP indicates that * requests arriving from the same IP address are subject to the RateLimit that is specified in the * RateBasedRule. *

* * @return The field that AWS WAF uses to determine if requests are likely arriving from single source and thus * subject to rate monitoring. The only valid value for RateKey is IP. * IP indicates that requests arriving from the same IP address are subject to the * RateLimit that is specified in the RateBasedRule. * @see RateKey */ public String getRateKey() { return this.rateKey; } /** *

* The field that AWS WAF uses to determine if requests are likely arriving from single source and thus subject to * rate monitoring. The only valid value for RateKey is IP. IP indicates that * requests arriving from the same IP address are subject to the RateLimit that is specified in the * RateBasedRule. *

* * @param rateKey * The field that AWS WAF uses to determine if requests are likely arriving from single source and thus * subject to rate monitoring. The only valid value for RateKey is IP. * IP indicates that requests arriving from the same IP address are subject to the * RateLimit that is specified in the RateBasedRule. * @return Returns a reference to this object so that method calls can be chained together. * @see RateKey */ public RateBasedRule withRateKey(String rateKey) { setRateKey(rateKey); return this; } /** *

* The field that AWS WAF uses to determine if requests are likely arriving from single source and thus subject to * rate monitoring. The only valid value for RateKey is IP. IP indicates that * requests arriving from the same IP address are subject to the RateLimit that is specified in the * RateBasedRule. *

* * @param rateKey * The field that AWS WAF uses to determine if requests are likely arriving from single source and thus * subject to rate monitoring. The only valid value for RateKey is IP. * IP indicates that requests arriving from the same IP address are subject to the * RateLimit that is specified in the RateBasedRule. * @see RateKey */ public void setRateKey(RateKey rateKey) { withRateKey(rateKey); } /** *

* The field that AWS WAF uses to determine if requests are likely arriving from single source and thus subject to * rate monitoring. The only valid value for RateKey is IP. IP indicates that * requests arriving from the same IP address are subject to the RateLimit that is specified in the * RateBasedRule. *

* * @param rateKey * The field that AWS WAF uses to determine if requests are likely arriving from single source and thus * subject to rate monitoring. The only valid value for RateKey is IP. * IP indicates that requests arriving from the same IP address are subject to the * RateLimit that is specified in the RateBasedRule. * @return Returns a reference to this object so that method calls can be chained together. * @see RateKey */ public RateBasedRule withRateKey(RateKey rateKey) { this.rateKey = rateKey.toString(); return this; } /** *

* The maximum number of requests, which have an identical value in the field specified by the RateKey, * allowed in a five-minute period. If the number of requests exceeds the RateLimit and the other * predicates specified in the rule are also met, AWS WAF triggers the action that is specified for this rule. *

* * @param rateLimit * The maximum number of requests, which have an identical value in the field specified by the * RateKey, allowed in a five-minute period. If the number of requests exceeds the * RateLimit and the other predicates specified in the rule are also met, AWS WAF triggers the * action that is specified for this rule. */ public void setRateLimit(Long rateLimit) { this.rateLimit = rateLimit; } /** *

* The maximum number of requests, which have an identical value in the field specified by the RateKey, * allowed in a five-minute period. If the number of requests exceeds the RateLimit and the other * predicates specified in the rule are also met, AWS WAF triggers the action that is specified for this rule. *

* * @return The maximum number of requests, which have an identical value in the field specified by the * RateKey, allowed in a five-minute period. If the number of requests exceeds the * RateLimit and the other predicates specified in the rule are also met, AWS WAF triggers the * action that is specified for this rule. */ public Long getRateLimit() { return this.rateLimit; } /** *

* The maximum number of requests, which have an identical value in the field specified by the RateKey, * allowed in a five-minute period. If the number of requests exceeds the RateLimit and the other * predicates specified in the rule are also met, AWS WAF triggers the action that is specified for this rule. *

* * @param rateLimit * The maximum number of requests, which have an identical value in the field specified by the * RateKey, allowed in a five-minute period. If the number of requests exceeds the * RateLimit and the other predicates specified in the rule are also met, AWS WAF triggers the * action that is specified for this rule. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedRule withRateLimit(Long rateLimit) { setRateLimit(rateLimit); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getRuleId() != null) sb.append("RuleId: ").append(getRuleId()).append(","); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getMetricName() != null) sb.append("MetricName: ").append(getMetricName()).append(","); if (getMatchPredicates() != null) sb.append("MatchPredicates: ").append(getMatchPredicates()).append(","); if (getRateKey() != null) sb.append("RateKey: ").append(getRateKey()).append(","); if (getRateLimit() != null) sb.append("RateLimit: ").append(getRateLimit()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof RateBasedRule == false) return false; RateBasedRule other = (RateBasedRule) obj; if (other.getRuleId() == null ^ this.getRuleId() == null) return false; if (other.getRuleId() != null && other.getRuleId().equals(this.getRuleId()) == false) return false; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getMetricName() == null ^ this.getMetricName() == null) return false; if (other.getMetricName() != null && other.getMetricName().equals(this.getMetricName()) == false) return false; if (other.getMatchPredicates() == null ^ this.getMatchPredicates() == null) return false; if (other.getMatchPredicates() != null && other.getMatchPredicates().equals(this.getMatchPredicates()) == false) return false; if (other.getRateKey() == null ^ this.getRateKey() == null) return false; if (other.getRateKey() != null && other.getRateKey().equals(this.getRateKey()) == false) return false; if (other.getRateLimit() == null ^ this.getRateLimit() == null) return false; if (other.getRateLimit() != null && other.getRateLimit().equals(this.getRateLimit()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRuleId() == null) ? 0 : getRuleId().hashCode()); hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getMetricName() == null) ? 0 : getMetricName().hashCode()); hashCode = prime * hashCode + ((getMatchPredicates() == null) ? 0 : getMatchPredicates().hashCode()); hashCode = prime * hashCode + ((getRateKey() == null) ? 0 : getRateKey().hashCode()); hashCode = prime * hashCode + ((getRateLimit() == null) ? 0 : getRateLimit().hashCode()); return hashCode; } @Override public RateBasedRule clone() { try { return (RateBasedRule) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.waf.model.waf_regional.transform.RateBasedRuleMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy