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

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 single rule, which you can use in a * WebACL or RuleGroup to identify web requests that you want to * allow, block, or count. Each rule includes one top-level Statement that * AWS WAF uses to identify matching web requests, and parameters that govern how * AWS WAF handles them.

See Also:

AWS API * Reference

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

The name of the rule. You can't change the name of a Rule after * you create it.

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

The name of the rule. You can't change the name of a Rule after * you create it.

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

The name of the rule. You can't change the name of a Rule after * you create it.

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

The name of the rule. You can't change the name of a Rule after * you create it.

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

The name of the rule. You can't change the name of a Rule after * you create it.

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

The name of the rule. You can't change the name of a Rule after * you create it.

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

The name of the rule. You can't change the name of a Rule after * you create it.

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

The name of the rule. You can't change the name of a Rule after * you create it.

*/ inline Rule& WithName(const char* value) { SetName(value); return *this;} /** *

If you define more than one Rule in a WebACL, AWS * WAF evaluates each request against the Rules in order based on the * value of Priority. AWS WAF processes rules with lower priority * first. The priorities don't need to be consecutive, but they must all be * different.

*/ inline int GetPriority() const{ return m_priority; } /** *

If you define more than one Rule in a WebACL, AWS * WAF evaluates each request against the Rules in order based on the * value of Priority. AWS WAF processes rules with lower priority * first. The priorities don't need to be consecutive, but they must all be * different.

*/ inline bool PriorityHasBeenSet() const { return m_priorityHasBeenSet; } /** *

If you define more than one Rule in a WebACL, AWS * WAF evaluates each request against the Rules in order based on the * value of Priority. AWS WAF processes rules with lower priority * first. The priorities don't need to be consecutive, but they must all be * different.

*/ inline void SetPriority(int value) { m_priorityHasBeenSet = true; m_priority = value; } /** *

If you define more than one Rule in a WebACL, AWS * WAF evaluates each request against the Rules in order based on the * value of Priority. AWS WAF processes rules with lower priority * first. The priorities don't need to be consecutive, but they must all be * different.

*/ inline Rule& WithPriority(int value) { SetPriority(value); return *this;} /** *

The AWS WAF processing statement for the rule, for example * ByteMatchStatement or SizeConstraintStatement.

*/ inline const Statement& GetStatement() const{ return m_statement; } /** *

The AWS WAF processing statement for the rule, for example * ByteMatchStatement or SizeConstraintStatement.

*/ inline bool StatementHasBeenSet() const { return m_statementHasBeenSet; } /** *

The AWS WAF processing statement for the rule, for example * ByteMatchStatement or SizeConstraintStatement.

*/ inline void SetStatement(const Statement& value) { m_statementHasBeenSet = true; m_statement = value; } /** *

The AWS WAF processing statement for the rule, for example * ByteMatchStatement or SizeConstraintStatement.

*/ inline void SetStatement(Statement&& value) { m_statementHasBeenSet = true; m_statement = std::move(value); } /** *

The AWS WAF processing statement for the rule, for example * ByteMatchStatement or SizeConstraintStatement.

*/ inline Rule& WithStatement(const Statement& value) { SetStatement(value); return *this;} /** *

The AWS WAF processing statement for the rule, for example * ByteMatchStatement or SizeConstraintStatement.

*/ inline Rule& WithStatement(Statement&& value) { SetStatement(std::move(value)); return *this;} /** *

The action that AWS WAF should take on a web request when it matches the rule * statement. Settings at the web ACL level can override the rule action setting. *

This is used only for rules whose statements do not reference a rule * group. Rule statements that reference a rule group include * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

You must specify either this * Action setting or the rule OverrideAction setting, but * not both:

  • If the rule statement does not reference a rule * group, use this rule action setting and not the rule override action setting. *

  • If the rule statement references a rule group, use the * override action setting and not this action setting.

*/ inline const RuleAction& GetAction() const{ return m_action; } /** *

The action that AWS WAF should take on a web request when it matches the rule * statement. Settings at the web ACL level can override the rule action setting. *

This is used only for rules whose statements do not reference a rule * group. Rule statements that reference a rule group include * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

You must specify either this * Action setting or the rule OverrideAction setting, but * not both:

  • If the rule statement does not reference a rule * group, use this rule action setting and not the rule override action setting. *

  • If the rule statement references a rule group, use the * override action setting and not this action setting.

*/ inline bool ActionHasBeenSet() const { return m_actionHasBeenSet; } /** *

The action that AWS WAF should take on a web request when it matches the rule * statement. Settings at the web ACL level can override the rule action setting. *

This is used only for rules whose statements do not reference a rule * group. Rule statements that reference a rule group include * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

You must specify either this * Action setting or the rule OverrideAction setting, but * not both:

  • If the rule statement does not reference a rule * group, use this rule action setting and not the rule override action setting. *

  • If the rule statement references a rule group, use the * override action setting and not this action setting.

*/ inline void SetAction(const RuleAction& value) { m_actionHasBeenSet = true; m_action = value; } /** *

The action that AWS WAF should take on a web request when it matches the rule * statement. Settings at the web ACL level can override the rule action setting. *

This is used only for rules whose statements do not reference a rule * group. Rule statements that reference a rule group include * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

You must specify either this * Action setting or the rule OverrideAction setting, but * not both:

  • If the rule statement does not reference a rule * group, use this rule action setting and not the rule override action setting. *

  • If the rule statement references a rule group, use the * override action setting and not this action setting.

*/ inline void SetAction(RuleAction&& value) { m_actionHasBeenSet = true; m_action = std::move(value); } /** *

The action that AWS WAF should take on a web request when it matches the rule * statement. Settings at the web ACL level can override the rule action setting. *

This is used only for rules whose statements do not reference a rule * group. Rule statements that reference a rule group include * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

You must specify either this * Action setting or the rule OverrideAction setting, but * not both:

  • If the rule statement does not reference a rule * group, use this rule action setting and not the rule override action setting. *

  • If the rule statement references a rule group, use the * override action setting and not this action setting.

*/ inline Rule& WithAction(const RuleAction& value) { SetAction(value); return *this;} /** *

The action that AWS WAF should take on a web request when it matches the rule * statement. Settings at the web ACL level can override the rule action setting. *

This is used only for rules whose statements do not reference a rule * group. Rule statements that reference a rule group include * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

You must specify either this * Action setting or the rule OverrideAction setting, but * not both:

  • If the rule statement does not reference a rule * group, use this rule action setting and not the rule override action setting. *

  • If the rule statement references a rule group, use the * override action setting and not this action setting.

*/ inline Rule& WithAction(RuleAction&& value) { SetAction(std::move(value)); return *this;} /** *

The override action to apply to the rules in a rule group. Used only for rule * statements that reference a rule group, like * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

Set the override action to none * to leave the rule actions in effect. Set it to count to only count matches, * regardless of the rule action settings.

In a Rule, you must * specify either this OverrideAction setting or the rule * Action setting, but not both:

  • If the rule * statement references a rule group, use this override action setting and not the * action setting.

  • If the rule statement does not reference a * rule group, use the rule action setting and not this rule override action * setting.

*/ inline const OverrideAction& GetOverrideAction() const{ return m_overrideAction; } /** *

The override action to apply to the rules in a rule group. Used only for rule * statements that reference a rule group, like * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

Set the override action to none * to leave the rule actions in effect. Set it to count to only count matches, * regardless of the rule action settings.

In a Rule, you must * specify either this OverrideAction setting or the rule * Action setting, but not both:

  • If the rule * statement references a rule group, use this override action setting and not the * action setting.

  • If the rule statement does not reference a * rule group, use the rule action setting and not this rule override action * setting.

*/ inline bool OverrideActionHasBeenSet() const { return m_overrideActionHasBeenSet; } /** *

The override action to apply to the rules in a rule group. Used only for rule * statements that reference a rule group, like * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

Set the override action to none * to leave the rule actions in effect. Set it to count to only count matches, * regardless of the rule action settings.

In a Rule, you must * specify either this OverrideAction setting or the rule * Action setting, but not both:

  • If the rule * statement references a rule group, use this override action setting and not the * action setting.

  • If the rule statement does not reference a * rule group, use the rule action setting and not this rule override action * setting.

*/ inline void SetOverrideAction(const OverrideAction& value) { m_overrideActionHasBeenSet = true; m_overrideAction = value; } /** *

The override action to apply to the rules in a rule group. Used only for rule * statements that reference a rule group, like * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

Set the override action to none * to leave the rule actions in effect. Set it to count to only count matches, * regardless of the rule action settings.

In a Rule, you must * specify either this OverrideAction setting or the rule * Action setting, but not both:

  • If the rule * statement references a rule group, use this override action setting and not the * action setting.

  • If the rule statement does not reference a * rule group, use the rule action setting and not this rule override action * setting.

*/ inline void SetOverrideAction(OverrideAction&& value) { m_overrideActionHasBeenSet = true; m_overrideAction = std::move(value); } /** *

The override action to apply to the rules in a rule group. Used only for rule * statements that reference a rule group, like * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

Set the override action to none * to leave the rule actions in effect. Set it to count to only count matches, * regardless of the rule action settings.

In a Rule, you must * specify either this OverrideAction setting or the rule * Action setting, but not both:

  • If the rule * statement references a rule group, use this override action setting and not the * action setting.

  • If the rule statement does not reference a * rule group, use the rule action setting and not this rule override action * setting.

*/ inline Rule& WithOverrideAction(const OverrideAction& value) { SetOverrideAction(value); return *this;} /** *

The override action to apply to the rules in a rule group. Used only for rule * statements that reference a rule group, like * RuleGroupReferenceStatement and * ManagedRuleGroupStatement.

Set the override action to none * to leave the rule actions in effect. Set it to count to only count matches, * regardless of the rule action settings.

In a Rule, you must * specify either this OverrideAction setting or the rule * Action setting, but not both:

  • If the rule * statement references a rule group, use this override action setting and not the * action setting.

  • If the rule statement does not reference a * rule group, use the rule action setting and not this rule override action * setting.

*/ inline Rule& WithOverrideAction(OverrideAction&& value) { SetOverrideAction(std::move(value)); return *this;} /** *

Defines and enables Amazon CloudWatch metrics and web request sample * collection.

*/ inline const VisibilityConfig& GetVisibilityConfig() const{ return m_visibilityConfig; } /** *

Defines and enables Amazon CloudWatch metrics and web request sample * collection.

*/ inline bool VisibilityConfigHasBeenSet() const { return m_visibilityConfigHasBeenSet; } /** *

Defines and enables Amazon CloudWatch metrics and web request sample * collection.

*/ inline void SetVisibilityConfig(const VisibilityConfig& value) { m_visibilityConfigHasBeenSet = true; m_visibilityConfig = value; } /** *

Defines and enables Amazon CloudWatch metrics and web request sample * collection.

*/ inline void SetVisibilityConfig(VisibilityConfig&& value) { m_visibilityConfigHasBeenSet = true; m_visibilityConfig = std::move(value); } /** *

Defines and enables Amazon CloudWatch metrics and web request sample * collection.

*/ inline Rule& WithVisibilityConfig(const VisibilityConfig& value) { SetVisibilityConfig(value); return *this;} /** *

Defines and enables Amazon CloudWatch metrics and web request sample * collection.

*/ inline Rule& WithVisibilityConfig(VisibilityConfig&& value) { SetVisibilityConfig(std::move(value)); return *this;} private: Aws::String m_name; bool m_nameHasBeenSet; int m_priority; bool m_priorityHasBeenSet; Statement m_statement; bool m_statementHasBeenSet; RuleAction m_action; bool m_actionHasBeenSet; OverrideAction m_overrideAction; bool m_overrideActionHasBeenSet; VisibilityConfig m_visibilityConfig; bool m_visibilityConfigHasBeenSet; }; } // namespace Model } // namespace WAFV2 } // namespace Aws