Class: AWSCDK::WAFv2::CfnWebACL::RuleProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
wa_fv2/cfn_web_acl.rb

Overview

A single rule, which you can use in a WebACL or RuleGroup to identify web requests that you want to manage in some way.

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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, priority:, statement:, visibility_config:, action: nil, captcha_config: nil, challenge_config: nil, override_action: nil, rule_labels: nil) ⇒ RuleProperty

Returns a new instance of RuleProperty.

Parameters:



5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
# File 'wa_fv2/cfn_web_acl.rb', line 5706

def initialize(name:, priority:, statement:, visibility_config:, action: nil, captcha_config: nil, challenge_config: nil, override_action: nil, rule_labels: nil)
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @priority = priority
  Jsii::Type.check_type(@priority, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "priority")
  @statement = statement.is_a?(Hash) ? ::AWSCDK::WAFv2::CfnWebACL::StatementProperty.new(**statement.transform_keys(&:to_sym)) : statement
  Jsii::Type.check_type(@statement, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c193YWZ2Mi5DZm5XZWJBQ0wuU3RhdGVtZW50UHJvcGVydHkifV19fQ==")), "statement")
  @visibility_config = visibility_config.is_a?(Hash) ? ::AWSCDK::WAFv2::CfnWebACL::VisibilityConfigProperty.new(**visibility_config.transform_keys(&:to_sym)) : visibility_config
  Jsii::Type.check_type(@visibility_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c193YWZ2Mi5DZm5XZWJBQ0wuVmlzaWJpbGl0eUNvbmZpZ1Byb3BlcnR5In1dfX0=")), "visibilityConfig")
  @action = action.is_a?(Hash) ? ::AWSCDK::WAFv2::CfnWebACL::RuleActionProperty.new(**action.transform_keys(&:to_sym)) : action
  Jsii::Type.check_type(@action, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c193YWZ2Mi5DZm5XZWJBQ0wuUnVsZUFjdGlvblByb3BlcnR5In1dfX0=")), "action") unless @action.nil?
  @captcha_config = captcha_config.is_a?(Hash) ? ::AWSCDK::WAFv2::CfnWebACL::CaptchaConfigProperty.new(**captcha_config.transform_keys(&:to_sym)) : captcha_config
  Jsii::Type.check_type(@captcha_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c193YWZ2Mi5DZm5XZWJBQ0wuQ2FwdGNoYUNvbmZpZ1Byb3BlcnR5In1dfX0=")), "captchaConfig") unless @captcha_config.nil?
  @challenge_config = challenge_config.is_a?(Hash) ? ::AWSCDK::WAFv2::CfnWebACL::ChallengeConfigProperty.new(**challenge_config.transform_keys(&:to_sym)) : challenge_config
  Jsii::Type.check_type(@challenge_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c193YWZ2Mi5DZm5XZWJBQ0wuQ2hhbGxlbmdlQ29uZmlnUHJvcGVydHkifV19fQ==")), "challengeConfig") unless @challenge_config.nil?
  @override_action = override_action.is_a?(Hash) ? ::AWSCDK::WAFv2::CfnWebACL::OverrideActionProperty.new(**override_action.transform_keys(&:to_sym)) : override_action
  Jsii::Type.check_type(@override_action, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c193YWZ2Mi5DZm5XZWJBQ0wuT3ZlcnJpZGVBY3Rpb25Qcm9wZXJ0eSJ9XX19")), "overrideAction") unless @override_action.nil?
  @rule_labels = rule_labels
  Jsii::Type.check_type(@rule_labels, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfd2FmdjIuQ2ZuV2ViQUNMLkxhYmVsUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "ruleLabels") unless @rule_labels.nil?
end

Instance Attribute Details

#actionAWSCDK::IResolvable, ... (readonly)

The action that AWS WAF should take on a web request when it matches the rule's statement.

Settings at the web ACL level can override the rule action setting.

This is used only for rules whose statements don't reference a rule group. Rule statements that reference a rule group are RuleGroupReferenceStatement and ManagedRuleGroupStatement .

You must set either this Action setting or the rule's OverrideAction , but not both:

  • If the rule statement doesn't reference a rule group, you must set this rule action setting and you must not set the rule's override action setting.
  • If the rule statement references a rule group, you must not set this action setting, because the actions are already set on the rules inside the rule group. You must set the rule's override action setting to indicate specifically whether to override the actions that are set on the rules in the rule group.


5766
5767
5768
# File 'wa_fv2/cfn_web_acl.rb', line 5766

def action
  @action
end

#captcha_configAWSCDK::IResolvable, ... (readonly)

Specifies how AWS WAF should handle CAPTCHA evaluations.

If you don't specify this, AWS WAF uses the CAPTCHA configuration that's defined for the web ACL.



5773
5774
5775
# File 'wa_fv2/cfn_web_acl.rb', line 5773

def captcha_config
  @captcha_config
end

#challenge_configAWSCDK::IResolvable, ... (readonly)

Specifies how AWS WAF should handle Challenge evaluations.

If you don't specify this, AWS WAF uses the challenge configuration that's defined for the web ACL.



5780
5781
5782
# File 'wa_fv2/cfn_web_acl.rb', line 5780

def challenge_config
  @challenge_config
end

#nameString (readonly)

The name of the rule.

If you change the name of a Rule after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's VisibilityConfig settings. AWS WAF doesn't automatically update the metric name when you update the rule name.



5733
5734
5735
# File 'wa_fv2/cfn_web_acl.rb', line 5733

def name
  @name
end

#override_actionAWSCDK::IResolvable, ... (readonly)

The override action to apply to the rules in a rule group, instead of the individual rule action settings.

This is used only for rules whose statements reference a rule group. Rule statements that reference a rule group are RuleGroupReferenceStatement and ManagedRuleGroupStatement .

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

You must set either this OverrideAction setting or the Action setting, but not both:

  • If the rule statement references a rule group, you must set this override action setting and you must not set the rule's action setting.
  • If the rule statement doesn't reference a rule group, you must set the rule action setting and you must not set the rule's override action setting.


5794
5795
5796
# File 'wa_fv2/cfn_web_acl.rb', line 5794

def override_action
  @override_action
end

#priorityNumeric (readonly)

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.



5740
5741
5742
# File 'wa_fv2/cfn_web_acl.rb', line 5740

def priority
  @priority
end

#rule_labelsAWSCDK::IResolvable, ... (readonly)

Labels to apply to web requests that match the rule match statement.

AWS WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.

Any rule that isn't a rule group reference statement or managed rule group statement can add labels to matching web requests.

Rules that run after this rule in the web ACL can match against these labels using a LabelMatchStatement .

For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:

  • Separate each component of the label with a colon.
  • Each namespace or name can have up to 128 characters.
  • You can specify up to 5 namespaces in a label.
  • Don't use the following reserved words in your label specification: aws , waf , managed , rulegroup , webacl , regexpatternset , or ipset .

For example, my_label_name or nameSpace1:nameSpace2:myLabelName .



5814
5815
5816
# File 'wa_fv2/cfn_web_acl.rb', line 5814

def rule_labels
  @rule_labels
end

#statementAWSCDK::IResolvable, AWSCDK::WAFv2::CfnWebACL::StatementProperty (readonly)

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



5745
5746
5747
# File 'wa_fv2/cfn_web_acl.rb', line 5745

def statement
  @statement
end

#visibility_configAWSCDK::IResolvable, AWSCDK::WAFv2::CfnWebACL::VisibilityConfigProperty (readonly)

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

If you change the name of a Rule after you create it and you want the rule's metric name to reflect the change, update the metric name as well. AWS WAF doesn't automatically update the metric name.



5752
5753
5754
# File 'wa_fv2/cfn_web_acl.rb', line 5752

def visibility_config
  @visibility_config
end

Class Method Details

.jsii_propertiesObject



5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
# File 'wa_fv2/cfn_web_acl.rb', line 5816

def self.jsii_properties
  {
    :name => "name",
    :priority => "priority",
    :statement => "statement",
    :visibility_config => "visibilityConfig",
    :action => "action",
    :captcha_config => "captchaConfig",
    :challenge_config => "challengeConfig",
    :override_action => "overrideAction",
    :rule_labels => "ruleLabels",
  }
end

Instance Method Details

#to_jsiiObject



5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
# File 'wa_fv2/cfn_web_acl.rb', line 5830

def to_jsii
  result = {}
  result.merge!({
    "name" => @name,
    "priority" => @priority,
    "statement" => @statement,
    "visibilityConfig" => @visibility_config,
    "action" => @action,
    "captchaConfig" => @captcha_config,
    "challengeConfig" => @challenge_config,
    "overrideAction" => @override_action,
    "ruleLabels" => @rule_labels,
  })
  result.compact
end