Class: OCI::Waas::Models::AccessRule
- Inherits:
-
Object
- Object
- OCI::Waas::Models::AccessRule
- Defined in:
- lib/oci/waas/models/access_rule.rb
Overview
A content access rule. An access rule specifies an action to take if a set of criteria is matched by a request.
Constant Summary collapse
- ACTION_ENUM =
[ ACTION_ALLOW = 'ALLOW'.freeze, ACTION_DETECT = 'DETECT'.freeze, ACTION_BLOCK = 'BLOCK'.freeze, ACTION_BYPASS = 'BYPASS'.freeze, ACTION_REDIRECT = 'REDIRECT'.freeze, ACTION_SHOW_CAPTCHA = 'SHOW_CAPTCHA'.freeze, ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- BLOCK_ACTION_ENUM =
[ BLOCK_ACTION_SET_RESPONSE_CODE = 'SET_RESPONSE_CODE'.freeze, BLOCK_ACTION_SHOW_ERROR_PAGE = 'SHOW_ERROR_PAGE'.freeze, BLOCK_ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- BYPASS_CHALLENGES_ENUM =
[ BYPASS_CHALLENGES_JS_CHALLENGE = 'JS_CHALLENGE'.freeze, BYPASS_CHALLENGES_DEVICE_FINGERPRINT_CHALLENGE = 'DEVICE_FINGERPRINT_CHALLENGE'.freeze, BYPASS_CHALLENGES_HUMAN_INTERACTION_CHALLENGE = 'HUMAN_INTERACTION_CHALLENGE'.freeze, BYPASS_CHALLENGES_CAPTCHA = 'CAPTCHA'.freeze, BYPASS_CHALLENGES_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- REDIRECT_RESPONSE_CODE_ENUM =
[ REDIRECT_RESPONSE_CODE_MOVED_PERMANENTLY = 'MOVED_PERMANENTLY'.freeze, REDIRECT_RESPONSE_CODE_FOUND = 'FOUND'.freeze, REDIRECT_RESPONSE_CODE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#action ⇒ String
[Required] The action to take when the access criteria are met for a rule.
-
#block_action ⇒ String
The method used to block requests if ‘action` is set to `BLOCK` and the access criteria are met.
-
#block_error_page_code ⇒ String
The error code to show on the error page when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met.
-
#block_error_page_description ⇒ String
The description text to show on the error page when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met.
-
#block_error_page_message ⇒ String
The message to show on the error page when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met.
-
#block_response_code ⇒ Integer
The response status code to return when ‘action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the access criteria are met.
-
#bypass_challenges ⇒ Array<String>
The list of challenges to bypass when ‘action` is set to `BYPASS`.
-
#captcha_footer ⇒ String
The text to show in the footer when showing a CAPTCHA challenge when ‘action` is set to `SHOW_CAPTCHA` and the request is challenged.
-
#captcha_header ⇒ String
The text to show in the header when showing a CAPTCHA challenge when ‘action` is set to `SHOW_CAPTCHA` and the request is challenged.
-
#captcha_submit_label ⇒ String
The text to show on the label of the CAPTCHA challenge submit button when ‘action` is set to `SHOW_CAPTCHA` and the request is challenged.
-
#captcha_title ⇒ String
The title used when showing a CAPTCHA challenge when ‘action` is set to `SHOW_CAPTCHA` and the request is challenged.
-
#criteria ⇒ Array<OCI::Waas::Models::AccessRuleCriteria>
[Required] The list of access rule criteria.
-
#name ⇒ String
[Required] The unique name of the access rule.
-
#redirect_response_code ⇒ String
The response status code to return when ‘action` is set to `REDIRECT`.
-
#redirect_url ⇒ String
The target to which the request should be redirected, represented as a URI reference.
-
#response_header_manipulation ⇒ Array<OCI::Waas::Models::HeaderManipulationAction>
An object that represents an action to apply to an HTTP response headers if all rule criteria will be matched regardless of ‘action` 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 = {}) ⇒ AccessRule
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 = {}) ⇒ AccessRule
Initializes the object
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/oci/waas/models/access_rule.rb', line 201 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.name = attributes[:'name'] if attributes[:'name'] self.criteria = attributes[:'criteria'] if attributes[:'criteria'] self.action = attributes[:'action'] if attributes[:'action'] self.block_action = attributes[:'blockAction'] if attributes[:'blockAction'] raise 'You cannot provide both :blockAction and :block_action' if attributes.key?(:'blockAction') && attributes.key?(:'block_action') self.block_action = attributes[:'block_action'] if attributes[:'block_action'] self.block_response_code = attributes[:'blockResponseCode'] if attributes[:'blockResponseCode'] raise 'You cannot provide both :blockResponseCode and :block_response_code' if attributes.key?(:'blockResponseCode') && attributes.key?(:'block_response_code') self.block_response_code = attributes[:'block_response_code'] if attributes[:'block_response_code'] self. = attributes[:'blockErrorPageMessage'] if attributes[:'blockErrorPageMessage'] raise 'You cannot provide both :blockErrorPageMessage and :block_error_page_message' if attributes.key?(:'blockErrorPageMessage') && attributes.key?(:'block_error_page_message') self. = attributes[:'block_error_page_message'] if attributes[:'block_error_page_message'] self.block_error_page_code = attributes[:'blockErrorPageCode'] if attributes[:'blockErrorPageCode'] raise 'You cannot provide both :blockErrorPageCode and :block_error_page_code' if attributes.key?(:'blockErrorPageCode') && attributes.key?(:'block_error_page_code') self.block_error_page_code = attributes[:'block_error_page_code'] if attributes[:'block_error_page_code'] self.block_error_page_description = attributes[:'blockErrorPageDescription'] if attributes[:'blockErrorPageDescription'] raise 'You cannot provide both :blockErrorPageDescription and :block_error_page_description' if attributes.key?(:'blockErrorPageDescription') && attributes.key?(:'block_error_page_description') self.block_error_page_description = attributes[:'block_error_page_description'] if attributes[:'block_error_page_description'] self.bypass_challenges = attributes[:'bypassChallenges'] if attributes[:'bypassChallenges'] raise 'You cannot provide both :bypassChallenges and :bypass_challenges' if attributes.key?(:'bypassChallenges') && attributes.key?(:'bypass_challenges') self.bypass_challenges = attributes[:'bypass_challenges'] if attributes[:'bypass_challenges'] self.redirect_url = attributes[:'redirectUrl'] if attributes[:'redirectUrl'] raise 'You cannot provide both :redirectUrl and :redirect_url' if attributes.key?(:'redirectUrl') && attributes.key?(:'redirect_url') self.redirect_url = attributes[:'redirect_url'] if attributes[:'redirect_url'] self.redirect_response_code = attributes[:'redirectResponseCode'] if attributes[:'redirectResponseCode'] self.redirect_response_code = "MOVED_PERMANENTLY" if redirect_response_code.nil? && !attributes.key?(:'redirectResponseCode') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :redirectResponseCode and :redirect_response_code' if attributes.key?(:'redirectResponseCode') && attributes.key?(:'redirect_response_code') self.redirect_response_code = attributes[:'redirect_response_code'] if attributes[:'redirect_response_code'] self.redirect_response_code = "MOVED_PERMANENTLY" if redirect_response_code.nil? && !attributes.key?(:'redirectResponseCode') && !attributes.key?(:'redirect_response_code') # rubocop:disable Style/StringLiterals self.captcha_title = attributes[:'captchaTitle'] if attributes[:'captchaTitle'] self.captcha_title = "Are you human?" if captcha_title.nil? && !attributes.key?(:'captchaTitle') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :captchaTitle and :captcha_title' if attributes.key?(:'captchaTitle') && attributes.key?(:'captcha_title') self.captcha_title = attributes[:'captcha_title'] if attributes[:'captcha_title'] self.captcha_title = "Are you human?" if captcha_title.nil? && !attributes.key?(:'captchaTitle') && !attributes.key?(:'captcha_title') # rubocop:disable Style/StringLiterals self.captcha_header = attributes[:'captchaHeader'] if attributes[:'captchaHeader'] self.captcha_header = "We have detected an increased number of attempts to access this webapp. To help us keep this webapp secure, please let us know that you are not a robot by entering the text from captcha below." if captcha_header.nil? && !attributes.key?(:'captchaHeader') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :captchaHeader and :captcha_header' if attributes.key?(:'captchaHeader') && attributes.key?(:'captcha_header') self.captcha_header = attributes[:'captcha_header'] if attributes[:'captcha_header'] self.captcha_header = "We have detected an increased number of attempts to access this webapp. To help us keep this webapp secure, please let us know that you are not a robot by entering the text from captcha below." if captcha_header.nil? && !attributes.key?(:'captchaHeader') && !attributes.key?(:'captcha_header') # rubocop:disable Style/StringLiterals self. = attributes[:'captchaFooter'] if attributes[:'captchaFooter'] self. = "Enter the letters and numbers as they are shown in image above" if .nil? && !attributes.key?(:'captchaFooter') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :captchaFooter and :captcha_footer' if attributes.key?(:'captchaFooter') && attributes.key?(:'captcha_footer') self. = attributes[:'captcha_footer'] if attributes[:'captcha_footer'] self. = "Enter the letters and numbers as they are shown in image above" if .nil? && !attributes.key?(:'captchaFooter') && !attributes.key?(:'captcha_footer') # rubocop:disable Style/StringLiterals self.captcha_submit_label = attributes[:'captchaSubmitLabel'] if attributes[:'captchaSubmitLabel'] self.captcha_submit_label = "Yes, I am human" if captcha_submit_label.nil? && !attributes.key?(:'captchaSubmitLabel') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :captchaSubmitLabel and :captcha_submit_label' if attributes.key?(:'captchaSubmitLabel') && attributes.key?(:'captcha_submit_label') self.captcha_submit_label = attributes[:'captcha_submit_label'] if attributes[:'captcha_submit_label'] self.captcha_submit_label = "Yes, I am human" if captcha_submit_label.nil? && !attributes.key?(:'captchaSubmitLabel') && !attributes.key?(:'captcha_submit_label') # rubocop:disable Style/StringLiterals self.response_header_manipulation = attributes[:'responseHeaderManipulation'] if attributes[:'responseHeaderManipulation'] raise 'You cannot provide both :responseHeaderManipulation and :response_header_manipulation' if attributes.key?(:'responseHeaderManipulation') && attributes.key?(:'response_header_manipulation') self.response_header_manipulation = attributes[:'response_header_manipulation'] if attributes[:'response_header_manipulation'] end |
Instance Attribute Details
#action ⇒ String
[Required] The action to take when the access criteria are met for a rule. If unspecified, defaults to ‘ALLOW`.
-
ALLOW: Takes no action, just logs the request.
-
DETECT: Takes no action, but creates an alert for the request.
-
BLOCK: Blocks the request by returning specified response code or showing error page.
-
BYPASS: Bypasses some or all challenges.
-
REDIRECT: Redirects the request to the specified URL. These fields are required when ‘REDIRECT` is selected: `redirectUrl`, `redirectResponseCode`.
-
SHOW_CAPTCHA: Show a CAPTCHA Challenge page instead of the requested page.
Regardless of action, no further rules are processed once a rule is matched.
65 66 67 |
# File 'lib/oci/waas/models/access_rule.rb', line 65 def action @action end |
#block_action ⇒ String
The method used to block requests if ‘action` is set to `BLOCK` and the access criteria are met. If unspecified, defaults to `SET_RESPONSE_CODE`.
69 70 71 |
# File 'lib/oci/waas/models/access_rule.rb', line 69 def block_action @block_action end |
#block_error_page_code ⇒ String
The error code to show on the error page when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to ’Access rules’.
81 82 83 |
# File 'lib/oci/waas/models/access_rule.rb', line 81 def block_error_page_code @block_error_page_code end |
#block_error_page_description ⇒ String
The description text to show on the error page when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to ’Access blocked by website owner. Please contact support.‘
85 86 87 |
# File 'lib/oci/waas/models/access_rule.rb', line 85 def block_error_page_description @block_error_page_description end |
#block_error_page_message ⇒ String
The message to show on the error page when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to ’Access to the website is blocked.‘
77 78 79 |
# File 'lib/oci/waas/models/access_rule.rb', line 77 def @block_error_page_message end |
#block_response_code ⇒ Integer
The response status code to return when ‘action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the access criteria are met. If unspecified, defaults to `403`. The list of available response codes: `200`, `201`, `202`, `204`, `206`, `300`, `301`, `302`, `303`, `304`, `307`, `400`, `401`, `403`, `404`, `405`, `408`, `409`, `411`, `412`, `413`, `414`, `415`, `416`, `422`, `444`, `499`, `500`, `501`, `502`, `503`, `504`, `507`.
73 74 75 |
# File 'lib/oci/waas/models/access_rule.rb', line 73 def block_response_code @block_response_code end |
#bypass_challenges ⇒ Array<String>
The list of challenges to bypass when ‘action` is set to `BYPASS`. If unspecified or empty, all challenges are bypassed.
-
JS_CHALLENGE: Bypasses JavaScript Challenge.
-
DEVICE_FINGERPRINT_CHALLENGE: Bypasses Device Fingerprint Challenge.
-
HUMAN_INTERACTION_CHALLENGE: Bypasses Human Interaction Challenge.
-
CAPTCHA: Bypasses CAPTCHA Challenge.
97 98 99 |
# File 'lib/oci/waas/models/access_rule.rb', line 97 def bypass_challenges @bypass_challenges end |
#captcha_footer ⇒ String
The text to show in the footer when showing a CAPTCHA challenge when ‘action` is set to `SHOW_CAPTCHA` and the request is challenged.
121 122 123 |
# File 'lib/oci/waas/models/access_rule.rb', line 121 def @captcha_footer end |
#captcha_header ⇒ String
The text to show in the header when showing a CAPTCHA challenge when ‘action` is set to `SHOW_CAPTCHA` and the request is challenged.
117 118 119 |
# File 'lib/oci/waas/models/access_rule.rb', line 117 def captcha_header @captcha_header end |
#captcha_submit_label ⇒ String
The text to show on the label of the CAPTCHA challenge submit button when ‘action` is set to `SHOW_CAPTCHA` and the request is challenged.
125 126 127 |
# File 'lib/oci/waas/models/access_rule.rb', line 125 def captcha_submit_label @captcha_submit_label end |
#captcha_title ⇒ String
The title used when showing a CAPTCHA challenge when ‘action` is set to `SHOW_CAPTCHA` and the request is challenged.
113 114 115 |
# File 'lib/oci/waas/models/access_rule.rb', line 113 def captcha_title @captcha_title end |
#criteria ⇒ Array<OCI::Waas::Models::AccessRuleCriteria>
[Required] The list of access rule criteria. The rule would be applied only for the requests that matched all the listed conditions.
47 48 49 |
# File 'lib/oci/waas/models/access_rule.rb', line 47 def criteria @criteria end |
#name ⇒ String
[Required] The unique name of the access rule.
43 44 45 |
# File 'lib/oci/waas/models/access_rule.rb', line 43 def name @name end |
#redirect_response_code ⇒ String
The response status code to return when ‘action` is set to `REDIRECT`.
-
MOVED_PERMANENTLY: Used for designating the permanent movement of a page (numerical code - 301).
-
FOUND: Used for designating the temporary movement of a page (numerical code - 302).
109 110 111 |
# File 'lib/oci/waas/models/access_rule.rb', line 109 def redirect_response_code @redirect_response_code end |
#redirect_url ⇒ String
The target to which the request should be redirected, represented as a URI reference. Required when ‘action` is `REDIRECT`.
101 102 103 |
# File 'lib/oci/waas/models/access_rule.rb', line 101 def redirect_url @redirect_url end |
#response_header_manipulation ⇒ Array<OCI::Waas::Models::HeaderManipulationAction>
An object that represents an action to apply to an HTTP response headers if all rule criteria will be matched regardless of ‘action` value.
129 130 131 |
# File 'lib/oci/waas/models/access_rule.rb', line 129 def response_header_manipulation @response_header_manipulation end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/oci/waas/models/access_rule.rb', line 132 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'name': :'name', 'criteria': :'criteria', 'action': :'action', 'block_action': :'blockAction', 'block_response_code': :'blockResponseCode', 'block_error_page_message': :'blockErrorPageMessage', 'block_error_page_code': :'blockErrorPageCode', 'block_error_page_description': :'blockErrorPageDescription', 'bypass_challenges': :'bypassChallenges', 'redirect_url': :'redirectUrl', 'redirect_response_code': :'redirectResponseCode', 'captcha_title': :'captchaTitle', 'captcha_header': :'captchaHeader', 'captcha_footer': :'captchaFooter', 'captcha_submit_label': :'captchaSubmitLabel', 'response_header_manipulation': :'responseHeaderManipulation' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/oci/waas/models/access_rule.rb', line 156 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'name': :'String', 'criteria': :'Array<OCI::Waas::Models::AccessRuleCriteria>', 'action': :'String', 'block_action': :'String', 'block_response_code': :'Integer', 'block_error_page_message': :'String', 'block_error_page_code': :'String', 'block_error_page_description': :'String', 'bypass_challenges': :'Array<String>', 'redirect_url': :'String', 'redirect_response_code': :'String', 'captcha_title': :'String', 'captcha_header': :'String', 'captcha_footer': :'String', 'captcha_submit_label': :'String', 'response_header_manipulation': :'Array<OCI::Waas::Models::HeaderManipulationAction>' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/oci/waas/models/access_rule.rb', line 368 def ==(other) return true if equal?(other) self.class == other.class && name == other.name && criteria == other.criteria && action == other.action && block_action == other.block_action && block_response_code == other.block_response_code && == other. && block_error_page_code == other.block_error_page_code && block_error_page_description == other.block_error_page_description && bypass_challenges == other.bypass_challenges && redirect_url == other.redirect_url && redirect_response_code == other.redirect_response_code && captcha_title == other.captcha_title && captcha_header == other.captcha_header && == other. && captcha_submit_label == other.captcha_submit_label && response_header_manipulation == other.response_header_manipulation end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File 'lib/oci/waas/models/access_rule.rb', line 413 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
393 394 395 |
# File 'lib/oci/waas/models/access_rule.rb', line 393 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
402 403 404 |
# File 'lib/oci/waas/models/access_rule.rb', line 402 def hash [name, criteria, action, block_action, block_response_code, , block_error_page_code, block_error_page_description, bypass_challenges, redirect_url, redirect_response_code, captcha_title, captcha_header, , captcha_submit_label, response_header_manipulation].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
446 447 448 449 450 451 452 453 454 455 |
# File 'lib/oci/waas/models/access_rule.rb', line 446 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
440 441 442 |
# File 'lib/oci/waas/models/access_rule.rb', line 440 def to_s to_hash.to_s end |