Class: OCI::Waas::Models::WafConfig

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

Overview

The Web Application Firewall configuration for the WAAS policy.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ WafConfig

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/oci/waas/models/waf_config.rb', line 115

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.access_rules = attributes[:'accessRules'] if attributes[:'accessRules']

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

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

  self.address_rate_limiting = attributes[:'addressRateLimiting'] if attributes[:'addressRateLimiting']

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

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

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

  self.device_fingerprint_challenge = attributes[:'deviceFingerprintChallenge'] if attributes[:'deviceFingerprintChallenge']

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

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

  self.good_bots = attributes[:'goodBots'] if attributes[:'goodBots']

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

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

  self.human_interaction_challenge = attributes[:'humanInteractionChallenge'] if attributes[:'humanInteractionChallenge']

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

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

  self.js_challenge = attributes[:'jsChallenge'] if attributes[:'jsChallenge']

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

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

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

  self.protection_rules = attributes[:'protectionRules'] if attributes[:'protectionRules']

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

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

  self.protection_settings = attributes[:'protectionSettings'] if attributes[:'protectionSettings']

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

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

  self.threat_feeds = attributes[:'threatFeeds'] if attributes[:'threatFeeds']

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

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

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

Instance Attribute Details

#access_rulesArray<OCI::Waas::Models::AccessRule>

The access rules applied to the Web Application Firewall. Used for defining custom access policies with the combination of ‘ALLOW`, `DETECT`, and `BLOCK` rules, based on different criteria.

Returns:



11
12
13
# File 'lib/oci/waas/models/waf_config.rb', line 11

def access_rules
  @access_rules
end

#address_rate_limitingOCI::Waas::Models::AddressRateLimiting

The IP address rate limiting settings used to limit the number of requests from an address.



15
16
17
# File 'lib/oci/waas/models/waf_config.rb', line 15

def address_rate_limiting
  @address_rate_limiting
end

#captchasArray<OCI::Waas::Models::Captcha>

A list of CAPTCHA challenge settings. These are used to challenge requests with a CAPTCHA to block bots.

Returns:



19
20
21
# File 'lib/oci/waas/models/waf_config.rb', line 19

def captchas
  @captchas
end

#device_fingerprint_challengeOCI::Waas::Models::DeviceFingerprintChallenge

The device fingerprint challenge settings. Used to detect unique devices based on the device fingerprint information collected in order to block bots.



23
24
25
# File 'lib/oci/waas/models/waf_config.rb', line 23

def device_fingerprint_challenge
  @device_fingerprint_challenge
end

#good_botsArray<OCI::Waas::Models::GoodBot>

A list of bots allowed to access the web application.

Returns:



27
28
29
# File 'lib/oci/waas/models/waf_config.rb', line 27

def good_bots
  @good_bots
end

#human_interaction_challengeOCI::Waas::Models::HumanInteractionChallenge

The human interaction challenge settings. Used to look for natural human interactions such as mouse movements, time on site, and page scrolling to identify bots.



31
32
33
# File 'lib/oci/waas/models/waf_config.rb', line 31

def human_interaction_challenge
  @human_interaction_challenge
end

#js_challengeOCI::Waas::Models::JsChallenge

The JavaScript challenge settings. Used to challenge requests with a JavaScript challenge and take the action if a browser has no JavaScript support in order to block bots.



35
36
37
# File 'lib/oci/waas/models/waf_config.rb', line 35

def js_challenge
  @js_challenge
end

#originString

The key in the map of origins referencing the origin used for the Web Application Firewall. The origin must already be included in ‘Origins`. Required when creating the `WafConfig` resource, but not on update.

Returns:

  • (String)


39
40
41
# File 'lib/oci/waas/models/waf_config.rb', line 39

def origin
  @origin
end

#protection_rulesArray<OCI::Waas::Models::ProtectionRule>

A list of the protection rules and their details.



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

def protection_rules
  @protection_rules
end

#protection_settingsOCI::Waas::Models::ProtectionSettings

The settings to apply to protection rules.



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

def protection_settings
  @protection_settings
end

#threat_feedsArray<OCI::Waas::Models::ThreatFeed>

A list of threat intelligence feeds and the actions to apply to known malicious traffic based on internet intelligence.

Returns:



51
52
53
# File 'lib/oci/waas/models/waf_config.rb', line 51

def threat_feeds
  @threat_feeds
end

#whitelistsArray<OCI::Waas::Models::Whitelist>

A list of IP addresses that bypass the Web Application Firewall.

Returns:



55
56
57
# File 'lib/oci/waas/models/waf_config.rb', line 55

def whitelists
  @whitelists
end

Class Method Details

.attribute_mapObject

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



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/oci/waas/models/waf_config.rb', line 58

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'access_rules': :'accessRules',
    'address_rate_limiting': :'addressRateLimiting',
    'captchas': :'captchas',
    'device_fingerprint_challenge': :'deviceFingerprintChallenge',
    'good_bots': :'goodBots',
    'human_interaction_challenge': :'humanInteractionChallenge',
    'js_challenge': :'jsChallenge',
    'origin': :'origin',
    'protection_rules': :'protectionRules',
    'protection_settings': :'protectionSettings',
    'threat_feeds': :'threatFeeds',
    'whitelists': :'whitelists'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/oci/waas/models/waf_config.rb', line 78

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'access_rules': :'Array<OCI::Waas::Models::AccessRule>',
    'address_rate_limiting': :'OCI::Waas::Models::AddressRateLimiting',
    'captchas': :'Array<OCI::Waas::Models::Captcha>',
    'device_fingerprint_challenge': :'OCI::Waas::Models::DeviceFingerprintChallenge',
    'good_bots': :'Array<OCI::Waas::Models::GoodBot>',
    'human_interaction_challenge': :'OCI::Waas::Models::HumanInteractionChallenge',
    'js_challenge': :'OCI::Waas::Models::JsChallenge',
    'origin': :'String',
    'protection_rules': :'Array<OCI::Waas::Models::ProtectionRule>',
    'protection_settings': :'OCI::Waas::Models::ProtectionSettings',
    'threat_feeds': :'Array<OCI::Waas::Models::ThreatFeed>',
    'whitelists': :'Array<OCI::Waas::Models::Whitelist>'
    # 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



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/oci/waas/models/waf_config.rb', line 189

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

  self.class == other.class &&
    access_rules == other.access_rules &&
    address_rate_limiting == other.address_rate_limiting &&
    captchas == other.captchas &&
    device_fingerprint_challenge == other.device_fingerprint_challenge &&
    good_bots == other.good_bots &&
    human_interaction_challenge == other.human_interaction_challenge &&
    js_challenge == other.js_challenge &&
    origin == other.origin &&
    protection_rules == other.protection_rules &&
    protection_settings == other.protection_settings &&
    threat_feeds == other.threat_feeds &&
    whitelists == other.whitelists
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



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/oci/waas/models/waf_config.rb', line 230

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


210
211
212
# File 'lib/oci/waas/models/waf_config.rb', line 210

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



219
220
221
# File 'lib/oci/waas/models/waf_config.rb', line 219

def hash
  [access_rules, address_rate_limiting, captchas, device_fingerprint_challenge, good_bots, human_interaction_challenge, js_challenge, origin, protection_rules, protection_settings, threat_feeds, whitelists].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



263
264
265
266
267
268
269
270
271
272
# File 'lib/oci/waas/models/waf_config.rb', line 263

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



257
258
259
# File 'lib/oci/waas/models/waf_config.rb', line 257

def to_s
  to_hash.to_s
end