Class: OCI::Waf::Models::WebAppFirewallPolicyRule
- Inherits:
-
Object
- Object
- OCI::Waf::Models::WebAppFirewallPolicyRule
- Defined in:
- lib/oci/waf/models/web_app_firewall_policy_rule.rb
Overview
Base schema for WebAppFirewallPolicyRules, including properties common to all of them. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
Direct Known Subclasses
Constant Summary collapse
- TYPE_ENUM =
[ TYPE_ACCESS_CONTROL = 'ACCESS_CONTROL'.freeze, TYPE_PROTECTION = 'PROTECTION'.freeze, TYPE_REQUEST_RATE_LIMITING = 'REQUEST_RATE_LIMITING'.freeze ].freeze
- CONDITION_LANGUAGE_ENUM =
[ CONDITION_LANGUAGE_JMESPATH = 'JMESPATH'.freeze ].freeze
Instance Attribute Summary collapse
-
#action_name ⇒ String
[Required] References action by name from actions defined in WebAppFirewallPolicy.
-
#condition ⇒ String
An expression that determines whether or not the rule action should be executed.
-
#condition_language ⇒ String
The language used to parse condition from field
condition
. -
#name ⇒ String
[Required] Rule name.
-
#type ⇒ String
[Required] Type of WebAppFirewallPolicyRule.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ WebAppFirewallPolicyRule
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ WebAppFirewallPolicyRule
Initializes the object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 100 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.type = attributes[:'type'] if attributes[:'type'] self.name = attributes[:'name'] if attributes[:'name'] self.condition_language = attributes[:'conditionLanguage'] if attributes[:'conditionLanguage'] self.condition_language = "JMESPATH" if condition_language.nil? && !attributes.key?(:'conditionLanguage') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :conditionLanguage and :condition_language' if attributes.key?(:'conditionLanguage') && attributes.key?(:'condition_language') self.condition_language = attributes[:'condition_language'] if attributes[:'condition_language'] self.condition_language = "JMESPATH" if condition_language.nil? && !attributes.key?(:'conditionLanguage') && !attributes.key?(:'condition_language') # rubocop:disable Style/StringLiterals self.condition = attributes[:'condition'] if attributes[:'condition'] self.action_name = attributes[:'actionName'] if attributes[:'actionName'] raise 'You cannot provide both :actionName and :action_name' if attributes.key?(:'actionName') && attributes.key?(:'action_name') self.action_name = attributes[:'action_name'] if attributes[:'action_name'] end |
Instance Attribute Details
#action_name ⇒ String
[Required] References action by name from actions defined in WebAppFirewallPolicy.
44 45 46 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 44 def action_name @action_name end |
#condition ⇒ String
An expression that determines whether or not the rule action should be executed.
40 41 42 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 40 def condition @condition end |
#condition_language ⇒ String
The language used to parse condition from field condition
. Available languages:
-
JMESPATH an extended JMESPath language syntax.
35 36 37 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 35 def condition_language @condition_language end |
#name ⇒ String
[Required] Rule name. Must be unique within the module.
28 29 30 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 28 def name @name end |
#type ⇒ String
[Required] Type of WebAppFirewallPolicyRule.
24 25 26 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 24 def type @type end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 47 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'type': :'type', 'name': :'name', 'condition_language': :'conditionLanguage', 'condition': :'condition', 'action_name': :'actionName' # rubocop:enable Style/SymbolLiteral } end |
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 77 def self.get_subtype(object_hash) type = object_hash[:'type'] # rubocop:disable Style/SymbolLiteral return 'OCI::Waf::Models::ProtectionRule' if type == 'PROTECTION' return 'OCI::Waf::Models::RequestRateLimitingRule' if type == 'REQUEST_RATE_LIMITING' return 'OCI::Waf::Models::AccessControlRule' if type == 'ACCESS_CONTROL' # TODO: Log a warning when the subtype is not found. 'OCI::Waf::Models::WebAppFirewallPolicyRule' end |
.swagger_types ⇒ Object
Attribute type mapping.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 60 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'type': :'String', 'name': :'String', 'condition_language': :'String', 'condition': :'String', 'action_name': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
150 151 152 153 154 155 156 157 158 159 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 150 def ==(other) return true if equal?(other) self.class == other.class && type == other.type && name == other.name && condition_language == other.condition_language && condition == other.condition && action_name == other.action_name end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 184 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(other) ⇒ Boolean
164 165 166 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 164 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
173 174 175 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 173 def hash [type, name, condition_language, condition, action_name].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
217 218 219 220 221 222 223 224 225 226 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 217 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
211 212 213 |
# File 'lib/oci/waf/models/web_app_firewall_policy_rule.rb', line 211 def to_s to_hash.to_s end |