Class: OCI::Waas::Models::AccessRuleCriteria

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/waas/models/access_rule_criteria.rb

Overview

AccessRuleCriteria model.

Constant Summary collapse

CONDITION_ENUM =

rubocop:disable Metrics/LineLength

[
  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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AccessRuleCriteria

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :condition (String)

    The value to assign to the #condition property

  • :value (String)

    The value to assign to the #value property



77
78
79
80
81
82
83
84
85
86
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 77

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

#conditionString

[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: Matches if the request includes an HTTP header field whose name and value correspond to data specified in the ‘value` field with a separating colon. Example: `host:test.example.com` where `host` is the name of the field and `test.example.com` is the value of the host field. Comparison is independently applied to every header field whose name is a case insensitive match, and the value is required to be case-sensitive identical.

  • 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`

Returns:

  • (String)


43
44
45
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 43

def condition
  @condition
end

#valueString

[Required] The criteria value.

Returns:

  • (String)


47
48
49
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 47

def value
  @value
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



50
51
52
53
54
55
56
57
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 50

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'condition': :'condition',
    'value': :'value'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



60
61
62
63
64
65
66
67
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 60

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.

Parameters:

  • other (Object)

    the other object to be compared



110
111
112
113
114
115
116
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 110

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 141

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

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


121
122
123
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 121

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



130
131
132
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 130

def hash
  [condition, value].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



174
175
176
177
178
179
180
181
182
183
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 174

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



168
169
170
# File 'lib/oci/waas/models/access_rule_criteria.rb', line 168

def to_s
  to_hash.to_s
end