Class: AWSCDK::WAFRegional::CfnRateBasedRuleProps

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

Overview

Properties for defining a CfnRateBasedRule.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric_name:, name:, rate_key:, rate_limit:, match_predicates: nil) ⇒ CfnRateBasedRuleProps

Returns a new instance of CfnRateBasedRuleProps.

Parameters:

  • metric_name (String)

    A name for the metrics for a RateBasedRule .

  • name (String)

    A friendly name or description for a RateBasedRule .

  • rate_key (String)

    The field that AWS WAF uses to determine if requests are likely arriving from single source and thus subject to rate monitoring.

  • rate_limit (Numeric)

    The maximum number of requests, which have an identical value in the field specified by the RateKey , allowed in a five-minute period.

  • match_predicates (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::WAFRegional::CfnRateBasedRule::PredicateProperty>, nil) (defaults to: nil)

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



14
15
16
17
18
19
20
21
22
23
24
25
# File 'waf_regional/cfn_rate_based_rule_props.rb', line 14

def initialize(metric_name:, name:, rate_key:, rate_limit:, match_predicates: nil)
  @metric_name = metric_name
  Jsii::Type.check_type(@metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @rate_key = rate_key
  Jsii::Type.check_type(@rate_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "rateKey")
  @rate_limit = rate_limit
  Jsii::Type.check_type(@rate_limit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "rateLimit")
  @match_predicates = match_predicates
  Jsii::Type.check_type(@match_predicates, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfd2FmcmVnaW9uYWwuQ2ZuUmF0ZUJhc2VkUnVsZS5QcmVkaWNhdGVQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "matchPredicates") unless @match_predicates.nil?
end

Instance Attribute Details

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

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



59
60
61
# File 'waf_regional/cfn_rate_based_rule_props.rb', line 59

def match_predicates
  @match_predicates
end

#metric_nameString (readonly)

A name 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 .



33
34
35
# File 'waf_regional/cfn_rate_based_rule_props.rb', line 33

def metric_name
  @metric_name
end

#nameString (readonly)

A friendly name or description for a RateBasedRule .

You can't change the name of a RateBasedRule after you create it.



40
41
42
# File 'waf_regional/cfn_rate_based_rule_props.rb', line 40

def name
  @name
end

#rate_keyString (readonly)

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 .



47
48
49
# File 'waf_regional/cfn_rate_based_rule_props.rb', line 47

def rate_key
  @rate_key
end

#rate_limitNumeric (readonly)

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.



54
55
56
# File 'waf_regional/cfn_rate_based_rule_props.rb', line 54

def rate_limit
  @rate_limit
end

Class Method Details

.jsii_propertiesObject



61
62
63
64
65
66
67
68
69
# File 'waf_regional/cfn_rate_based_rule_props.rb', line 61

def self.jsii_properties
  {
    :metric_name => "metricName",
    :name => "name",
    :rate_key => "rateKey",
    :rate_limit => "rateLimit",
    :match_predicates => "matchPredicates",
  }
end

Instance Method Details

#to_jsiiObject



71
72
73
74
75
76
77
78
79
80
81
# File 'waf_regional/cfn_rate_based_rule_props.rb', line 71

def to_jsii
  result = {}
  result.merge!({
    "metricName" => @metric_name,
    "name" => @name,
    "rateKey" => @rate_key,
    "rateLimit" => @rate_limit,
    "matchPredicates" => @match_predicates,
  })
  result.compact
end