Class: OCI::Waas::Models::AccessRuleCriteria
- Inherits:
-
Object
- Object
- OCI::Waas::Models::AccessRuleCriteria
- Defined in:
- lib/oci/waas/models/access_rule_criteria.rb
Overview
AccessRuleCriteria model.
Constant Summary collapse
- CONDITION_ENUM =
[ CONDITION_URL_IS = 'URL_IS'.freeze, CONDITION_URL_IS_NOT = 'URL_IS_NOT'.freeze, CONDITION_URL_STARTS_WITH = 'URL_STARTS_WITH'.freeze, CONDITION_URL_PART_ENDS_WITH = 'URL_PART_ENDS_WITH'.freeze, CONDITION_URL_PART_CONTAINS = 'URL_PART_CONTAINS'.freeze, CONDITION_URL_REGEX = 'URL_REGEX'.freeze, CONDITION_IP_IS = 'IP_IS'.freeze, CONDITION_IP_IS_NOT = 'IP_IS_NOT'.freeze, CONDITION_HTTP_HEADER_CONTAINS = 'HTTP_HEADER_CONTAINS'.freeze, CONDITION_COUNTRY_IS = 'COUNTRY_IS'.freeze, CONDITION_COUNTRY_IS_NOT = 'COUNTRY_IS_NOT'.freeze, CONDITION_USER_AGENT_IS = 'USER_AGENT_IS'.freeze, CONDITION_USER_AGENT_IS_NOT = 'USER_AGENT_IS_NOT'.freeze, CONDITION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#condition ⇒ String
[Required] The criteria the access rule uses to determine if action should be taken on a request.
-
#value ⇒ String
[Required] The criteria value.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.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 = {}) ⇒ AccessRuleCriteria
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 = {}) ⇒ AccessRuleCriteria
Initializes the object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 89 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.condition = attributes[:'condition'] if attributes[:'condition'] self.value = attributes[:'value'] if attributes[:'value'] end |
Instance Attribute Details
#condition ⇒ String
[Required] The criteria the access rule uses to determine if action should be taken on a request.
-
URL_IS: Matches if the concatenation of request URL path and query is identical to the contents of the ‘value` field.
-
URL_IS_NOT: Matches if the concatenation of request URL path and query is not identical to the contents of the ‘value` field.
-
URL_STARTS_WITH: Matches if the concatenation of request URL path and query starts with the contents of the ‘value` field.
-
URL_PART_ENDS_WITH: Matches if the concatenation of request URL path and query ends with the contents of the ‘value` field.
-
URL_PART_CONTAINS: Matches if the concatenation of request URL path and query contains the contents of the ‘value` field.
-
URL_REGEX: Matches if the request is described by the regular expression in the ‘value` field.
-
IP_IS: Matches if the request originates from an IP address in the ‘value` field.
-
IP_IS_NOT: Matches if the request does not originate from an IP address in the ‘value` field.
-
HTTP_HEADER_CONTAINS: The HTTP_HEADER_CONTAINS criteria is defined using a compound value separated by a colon: a header field name and a header field value. ‘host:test.example.com` is an example of a criteria value where `host` is the header field name and `test.example.com` is the header field value. A request matches when the header field name is a case insensitive match and the header field value is a case insensitive, substring match.
Example: With a criteria value of ‘host:test.example.com`, where `host` is the name of the field and `test.example.com` is the value of the host field, a request with the header values, `Host: www.test.example.com` will match, where as a request with header values of `host: www.example.com` or `host: test.sub.example.com` will not match.
-
COUNTRY_IS: Matches if the request originates from a country in the ‘value` field. Country codes are in ISO 3166-1 alpha-2 format. For a list of codes, see [ISO’s website](www.iso.org/obp/ui/#search/code/).
-
COUNTRY_IS_NOT: Matches if the request does not originate from a country in the ‘value` field. Country codes are in ISO 3166-1 alpha-2 format. For a list of codes, see [ISO’s website](www.iso.org/obp/ui/#search/code/).
-
USER_AGENT_IS: Matches if the requesting user agent is identical to the contents of the ‘value` field. Example: `Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0`
-
USER_AGENT_IS_NOT: Matches if the requesting user agent is not identical to the contents of the ‘value` field. Example: `Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0`
55 56 57 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 55 def condition @condition end |
#value ⇒ String
[Required] The criteria value.
59 60 61 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 59 def value @value end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
62 63 64 65 66 67 68 69 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 62 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'condition': :'condition', 'value': :'value' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
72 73 74 75 76 77 78 79 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 72 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'condition': :'String', 'value': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
120 121 122 123 124 125 126 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 120 def ==(other) return true if equal?(other) self.class == other.class && condition == other.condition && value == other.value end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 151 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
131 132 133 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 131 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
140 141 142 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 140 def hash [condition, value].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
184 185 186 187 188 189 190 191 192 193 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 184 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
178 179 180 |
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 178 def to_s to_hash.to_s end |