/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include #include #include namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace WAF { namespace Model { /** *

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 Also:

AWS * API Reference

*/ class RateBasedRule { public: AWS_WAF_API RateBasedRule(); AWS_WAF_API RateBasedRule(Aws::Utils::Json::JsonView jsonValue); AWS_WAF_API RateBasedRule& operator=(Aws::Utils::Json::JsonView jsonValue); AWS_WAF_API Aws::Utils::Json::JsonValue Jsonize() const; /** *

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).

*/ inline const Aws::String& GetRuleId() const{ return m_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).

*/ inline bool RuleIdHasBeenSet() const { return m_ruleIdHasBeenSet; } /** *

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).

*/ inline void SetRuleId(const Aws::String& value) { m_ruleIdHasBeenSet = true; m_ruleId = value; } /** *

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).

*/ inline void SetRuleId(Aws::String&& value) { m_ruleIdHasBeenSet = true; m_ruleId = std::move(value); } /** *

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).

*/ inline void SetRuleId(const char* value) { m_ruleIdHasBeenSet = true; m_ruleId.assign(value); } /** *

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).

*/ inline RateBasedRule& WithRuleId(const Aws::String& value) { SetRuleId(value); return *this;} /** *

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).

*/ inline RateBasedRule& WithRuleId(Aws::String&& value) { SetRuleId(std::move(value)); return *this;} /** *

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).

*/ inline RateBasedRule& WithRuleId(const char* value) { SetRuleId(value); return *this;} /** *

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

*/ inline const Aws::String& GetName() const{ return m_name; } /** *

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

*/ inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } /** *

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

*/ inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } /** *

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

*/ inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } /** *

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

*/ inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } /** *

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

*/ inline RateBasedRule& WithName(const Aws::String& value) { SetName(value); return *this;} /** *

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

*/ inline RateBasedRule& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} /** *

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

*/ inline RateBasedRule& WithName(const char* value) { SetName(value); 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.

*/ inline const Aws::String& GetMetricName() const{ return m_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.

*/ inline bool MetricNameHasBeenSet() const { return m_metricNameHasBeenSet; } /** *

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.

*/ inline void SetMetricName(const Aws::String& value) { m_metricNameHasBeenSet = true; m_metricName = value; } /** *

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.

*/ inline void SetMetricName(Aws::String&& value) { m_metricNameHasBeenSet = true; m_metricName = std::move(value); } /** *

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.

*/ inline void SetMetricName(const char* value) { m_metricNameHasBeenSet = true; m_metricName.assign(value); } /** *

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.

*/ inline RateBasedRule& WithMetricName(const Aws::String& value) { SetMetricName(value); 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.

*/ inline RateBasedRule& WithMetricName(Aws::String&& value) { SetMetricName(std::move(value)); 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.

*/ inline RateBasedRule& WithMetricName(const char* value) { SetMetricName(value); return *this;} /** *

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

*/ inline const Aws::Vector& GetMatchPredicates() const{ return m_matchPredicates; } /** *

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

*/ inline bool MatchPredicatesHasBeenSet() const { return m_matchPredicatesHasBeenSet; } /** *

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

*/ inline void SetMatchPredicates(const Aws::Vector& value) { m_matchPredicatesHasBeenSet = true; m_matchPredicates = value; } /** *

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

*/ inline void SetMatchPredicates(Aws::Vector&& value) { m_matchPredicatesHasBeenSet = true; m_matchPredicates = std::move(value); } /** *

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

*/ inline RateBasedRule& WithMatchPredicates(const Aws::Vector& value) { SetMatchPredicates(value); return *this;} /** *

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

*/ inline RateBasedRule& WithMatchPredicates(Aws::Vector&& value) { SetMatchPredicates(std::move(value)); return *this;} /** *

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

*/ inline RateBasedRule& AddMatchPredicates(const Predicate& value) { m_matchPredicatesHasBeenSet = true; m_matchPredicates.push_back(value); return *this; } /** *

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

*/ inline RateBasedRule& AddMatchPredicates(Predicate&& value) { m_matchPredicatesHasBeenSet = true; m_matchPredicates.push_back(std::move(value)); 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.

*/ inline const RateKey& GetRateKey() const{ return m_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.

*/ inline bool RateKeyHasBeenSet() const { return m_rateKeyHasBeenSet; } /** *

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.

*/ inline void SetRateKey(const RateKey& value) { m_rateKeyHasBeenSet = true; m_rateKey = value; } /** *

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.

*/ inline void SetRateKey(RateKey&& value) { m_rateKeyHasBeenSet = true; m_rateKey = std::move(value); } /** *

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.

*/ inline RateBasedRule& WithRateKey(const RateKey& value) { SetRateKey(value); 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.

*/ inline RateBasedRule& WithRateKey(RateKey&& value) { SetRateKey(std::move(value)); 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.

*/ inline long long GetRateLimit() const{ return m_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.

*/ inline bool RateLimitHasBeenSet() const { return m_rateLimitHasBeenSet; } /** *

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.

*/ inline void SetRateLimit(long long value) { m_rateLimitHasBeenSet = true; m_rateLimit = value; } /** *

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.

*/ inline RateBasedRule& WithRateLimit(long long value) { SetRateLimit(value); return *this;} private: Aws::String m_ruleId; bool m_ruleIdHasBeenSet = false; Aws::String m_name; bool m_nameHasBeenSet = false; Aws::String m_metricName; bool m_metricNameHasBeenSet = false; Aws::Vector m_matchPredicates; bool m_matchPredicatesHasBeenSet = false; RateKey m_rateKey; bool m_rateKeyHasBeenSet = false; long long m_rateLimit; bool m_rateLimitHasBeenSet = false; }; } // namespace Model } // namespace WAF } // namespace Aws