Class: OCI::Waas::Models::DeviceFingerprintChallenge

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

Overview

The device fingerprint challenge settings. The device fingerprint challenge generates hashed signatures of both virtual and real browsers to identify and block malicious bots.

Constant Summary collapse

ACTION_ENUM =
[
  ACTION_DETECT = 'DETECT'.freeze,
  ACTION_BLOCK = 'BLOCK'.freeze,
  ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DeviceFingerprintChallenge

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



95
96
97
98
99
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 95

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.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?

  raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')

  self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?

  self.action = attributes[:'action'] if attributes[:'action']

  self.failure_threshold = attributes[:'failureThreshold'] if attributes[:'failureThreshold']

  raise 'You cannot provide both :failureThreshold and :failure_threshold' if attributes.key?(:'failureThreshold') && attributes.key?(:'failure_threshold')

  self.failure_threshold = attributes[:'failure_threshold'] if attributes[:'failure_threshold']

  self.action_expiration_in_seconds = attributes[:'actionExpirationInSeconds'] if attributes[:'actionExpirationInSeconds']

  raise 'You cannot provide both :actionExpirationInSeconds and :action_expiration_in_seconds' if attributes.key?(:'actionExpirationInSeconds') && attributes.key?(:'action_expiration_in_seconds')

  self.action_expiration_in_seconds = attributes[:'action_expiration_in_seconds'] if attributes[:'action_expiration_in_seconds']

  self.failure_threshold_expiration_in_seconds = attributes[:'failureThresholdExpirationInSeconds'] if attributes[:'failureThresholdExpirationInSeconds']

  raise 'You cannot provide both :failureThresholdExpirationInSeconds and :failure_threshold_expiration_in_seconds' if attributes.key?(:'failureThresholdExpirationInSeconds') && attributes.key?(:'failure_threshold_expiration_in_seconds')

  self.failure_threshold_expiration_in_seconds = attributes[:'failure_threshold_expiration_in_seconds'] if attributes[:'failure_threshold_expiration_in_seconds']

  self.max_address_count = attributes[:'maxAddressCount'] if attributes[:'maxAddressCount']

  raise 'You cannot provide both :maxAddressCount and :max_address_count' if attributes.key?(:'maxAddressCount') && attributes.key?(:'max_address_count')

  self.max_address_count = attributes[:'max_address_count'] if attributes[:'max_address_count']

  self.max_address_count_expiration_in_seconds = attributes[:'maxAddressCountExpirationInSeconds'] if attributes[:'maxAddressCountExpirationInSeconds']

  raise 'You cannot provide both :maxAddressCountExpirationInSeconds and :max_address_count_expiration_in_seconds' if attributes.key?(:'maxAddressCountExpirationInSeconds') && attributes.key?(:'max_address_count_expiration_in_seconds')

  self.max_address_count_expiration_in_seconds = attributes[:'max_address_count_expiration_in_seconds'] if attributes[:'max_address_count_expiration_in_seconds']

  self.challenge_settings = attributes[:'challengeSettings'] if attributes[:'challengeSettings']

  raise 'You cannot provide both :challengeSettings and :challenge_settings' if attributes.key?(:'challengeSettings') && attributes.key?(:'challenge_settings')

  self.challenge_settings = attributes[:'challenge_settings'] if attributes[:'challenge_settings']
end

Instance Attribute Details

#actionString

The action to take on requests from detected bots. If unspecified, defaults to DETECT.

Returns:

  • (String)


24
25
26
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 24

def action
  @action
end

#action_expiration_in_secondsInteger

The number of seconds between challenges for the same IP address. If unspecified, defaults to 60.

Returns:

  • (Integer)


32
33
34
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 32

def action_expiration_in_seconds
  @action_expiration_in_seconds
end

#challenge_settingsOCI::Waas::Models::BlockChallengeSettings



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

def challenge_settings
  @challenge_settings
end

#failure_thresholdInteger

The number of failed requests allowed before taking action. If unspecified, defaults to 10.

Returns:

  • (Integer)


28
29
30
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 28

def failure_threshold
  @failure_threshold
end

#failure_threshold_expiration_in_secondsInteger

The number of seconds before the failure threshold resets. If unspecified, defaults to 60.

Returns:

  • (Integer)


36
37
38
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 36

def failure_threshold_expiration_in_seconds
  @failure_threshold_expiration_in_seconds
end

#is_enabledBOOLEAN

[Required] Enables or disables the device fingerprint challenge Web Application Firewall feature.

Returns:

  • (BOOLEAN)


20
21
22
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 20

def is_enabled
  @is_enabled
end

#max_address_countInteger

The maximum number of IP addresses permitted with the same device fingerprint. If unspecified, defaults to 20.

Returns:

  • (Integer)


40
41
42
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 40

def max_address_count
  @max_address_count
end

#max_address_count_expiration_in_secondsInteger

The number of seconds before the maximum addresses count resets. If unspecified, defaults to 60.

Returns:

  • (Integer)


44
45
46
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 44

def max_address_count_expiration_in_seconds
  @max_address_count_expiration_in_seconds
end

Class Method Details

.attribute_mapObject

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



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 50

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'is_enabled': :'isEnabled',
    'action': :'action',
    'failure_threshold': :'failureThreshold',
    'action_expiration_in_seconds': :'actionExpirationInSeconds',
    'failure_threshold_expiration_in_seconds': :'failureThresholdExpirationInSeconds',
    'max_address_count': :'maxAddressCount',
    'max_address_count_expiration_in_seconds': :'maxAddressCountExpirationInSeconds',
    'challenge_settings': :'challengeSettings'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 66

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'is_enabled': :'BOOLEAN',
    'action': :'String',
    'failure_threshold': :'Integer',
    'action_expiration_in_seconds': :'Integer',
    'failure_threshold_expiration_in_seconds': :'Integer',
    'max_address_count': :'Integer',
    'max_address_count_expiration_in_seconds': :'Integer',
    'challenge_settings': :'OCI::Waas::Models::BlockChallengeSettings'
    # 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



166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 166

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    is_enabled == other.is_enabled &&
    action == other.action &&
    failure_threshold == other.failure_threshold &&
    action_expiration_in_seconds == other.action_expiration_in_seconds &&
    failure_threshold_expiration_in_seconds == other.failure_threshold_expiration_in_seconds &&
    max_address_count == other.max_address_count &&
    max_address_count_expiration_in_seconds == other.max_address_count_expiration_in_seconds &&
    challenge_settings == other.challenge_settings
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



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 203

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


183
184
185
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 183

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



192
193
194
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 192

def hash
  [is_enabled, action, failure_threshold, action_expiration_in_seconds, failure_threshold_expiration_in_seconds, max_address_count, max_address_count_expiration_in_seconds, challenge_settings].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



236
237
238
239
240
241
242
243
244
245
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 236

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



230
231
232
# File 'lib/oci/waas/models/device_fingerprint_challenge.rb', line 230

def to_s
  to_hash.to_s
end