Class: AWSCDK::WAFRegional::CfnWebACL::RuleProperty

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

Overview

A combination of ByteMatchSet , IPSet , and/or SqlInjectionMatchSet objects that identify the web requests that you want to allow, block, or count.

For example, you might create a Rule that includes the following predicates:

  • An IPSet that causes AWS WAF to search for web requests that originate from the IP address 192.0.2.44
  • A ByteMatchSet that causes AWS WAF to search for web requests for which the value of the User-Agent header is BadBot .

To match the settings in this Rule , a request must originate from 192.0.2.44 AND include a User-Agent header for which the value is BadBot .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action:, priority:, rule_id:) ⇒ RuleProperty

Returns a new instance of RuleProperty.

Parameters:

  • action (AWSCDK::IResolvable, AWSCDK::WAFRegional::CfnWebACL::ActionProperty)

    The action that AWS WAF takes when a web request matches all conditions in the rule, such as allow, block, or count the request.

  • priority (Numeric)

    The order in which AWS WAF evaluates the rules in a web ACL.

  • rule_id (String)

    The ID of an AWS WAF Regional rule to associate with a web ACL.



603
604
605
606
607
608
609
610
# File 'waf_regional/cfn_web_acl.rb', line 603

def initialize(action:, priority:, rule_id:)
  @action = action.is_a?(Hash) ? ::AWSCDK::WAFRegional::CfnWebACL::ActionProperty.new(**action.transform_keys(&:to_sym)) : action
  Jsii::Type.check_type(@action, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c193YWZyZWdpb25hbC5DZm5XZWJBQ0wuQWN0aW9uUHJvcGVydHkifV19fQ==")), "action")
  @priority = priority
  Jsii::Type.check_type(@priority, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "priority")
  @rule_id = rule_id
  Jsii::Type.check_type(@rule_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ruleId")
end

Instance Attribute Details

#actionAWSCDK::IResolvable, AWSCDK::WAFRegional::CfnWebACL::ActionProperty (readonly)

The action that AWS WAF takes when a web request matches all conditions in the rule, such as allow, block, or count the request.



616
617
618
# File 'waf_regional/cfn_web_acl.rb', line 616

def action
  @action
end

#priorityNumeric (readonly)

The order in which AWS WAF evaluates the rules in a web ACL.

AWS WAF evaluates rules with a lower value before rules with a higher value. The value must be a unique integer. If you have multiple rules in a web ACL, the priority numbers do not need to be consecutive.



623
624
625
# File 'waf_regional/cfn_web_acl.rb', line 623

def priority
  @priority
end

#rule_idString (readonly)

The ID of an AWS WAF Regional rule to associate with a web ACL.



628
629
630
# File 'waf_regional/cfn_web_acl.rb', line 628

def rule_id
  @rule_id
end

Class Method Details

.jsii_propertiesObject



630
631
632
633
634
635
636
# File 'waf_regional/cfn_web_acl.rb', line 630

def self.jsii_properties
  {
    :action => "action",
    :priority => "priority",
    :rule_id => "ruleId",
  }
end

Instance Method Details

#to_jsiiObject



638
639
640
641
642
643
644
645
646
# File 'waf_regional/cfn_web_acl.rb', line 638

def to_jsii
  result = {}
  result.merge!({
    "action" => @action,
    "priority" => @priority,
    "ruleId" => @rule_id,
  })
  result.compact
end