Class: OCI::Waas::Models::BlockChallengeSettings

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

Overview

The challenge settings if ‘action` is set to `BLOCK`.

Constant Summary collapse

BLOCK_ACTION_ENUM =

rubocop:disable Metrics/LineLength

[
  BLOCK_ACTION_SET_RESPONSE_CODE = 'SET_RESPONSE_CODE'.freeze,
  BLOCK_ACTION_SHOW_ERROR_PAGE = 'SHOW_ERROR_PAGE'.freeze,
  BLOCK_ACTION_SHOW_CAPTCHA = 'SHOW_CAPTCHA'.freeze,
  BLOCK_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 = {}) ⇒ BlockChallengeSettings

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 102

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

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

  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_header = attributes[:'captchaHeader'] if attributes[:'captchaHeader']

  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_footer = attributes[:'captchaFooter'] if attributes[:'captchaFooter']

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

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

  self.captcha_submit_label = attributes[:'captchaSubmitLabel'] if attributes[:'captchaSubmitLabel']

  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']
end

Instance Attribute Details

#block_actionString

The method used to block requests that fail the challenge, if ‘action` is set to `BLOCK`. If unspecified, defaults to `SHOW_ERROR_PAGE`.

Returns:

  • (String)


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

def block_action
  @block_action
end

#block_error_page_codeString

The error code to show on the error page when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE` and the request is blocked. If unspecified, defaults to `403`.

Returns:

  • (String)


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

def block_error_page_code
  @block_error_page_code
end

#block_error_page_descriptionString

The description text to show on the error page when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `Access blocked by website owner. Please contact support.`

Returns:

  • (String)


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

def block_error_page_description
  @block_error_page_description
end

#block_error_page_messageString

The message to show on the error page when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `Access to the website is blocked`.

Returns:

  • (String)


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

def block_error_page_message
  @block_error_page_message
end

#block_response_codeInteger

The response status code to return when ‘action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE` or `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `403`.

Returns:

  • (Integer)


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

def block_response_code
  @block_response_code
end

The text to show in the footer when showing a CAPTCHA challenge when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, default to `Enter the letters and numbers as they are shown in image above`.

Returns:

  • (String)


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

def captcha_footer
  @captcha_footer
end

#captcha_headerString

The text to show in the header when showing a CAPTCHA challenge when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `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.`

Returns:

  • (String)


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

def captcha_header
  @captcha_header
end

#captcha_submit_labelString

The text to show on the label of the CAPTCHA challenge submit button when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `Yes, I am human`.

Returns:

  • (String)


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

def captcha_submit_label
  @captcha_submit_label
end

#captcha_titleString

The title used when showing a CAPTCHA challenge when ‘action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `Are you human?`

Returns:

  • (String)


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

def captcha_title
  @captcha_title
end

Class Method Details

.attribute_mapObject

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



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 54

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'block_action': :'blockAction',
    'block_response_code': :'blockResponseCode',
    'block_error_page_message': :'blockErrorPageMessage',
    'block_error_page_description': :'blockErrorPageDescription',
    'block_error_page_code': :'blockErrorPageCode',
    'captcha_title': :'captchaTitle',
    'captcha_header': :'captchaHeader',
    'captcha_footer': :'captchaFooter',
    'captcha_submit_label': :'captchaSubmitLabel'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 71

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'block_action': :'String',
    'block_response_code': :'Integer',
    'block_error_page_message': :'String',
    'block_error_page_description': :'String',
    'block_error_page_code': :'String',
    'captcha_title': :'String',
    'captcha_header': :'String',
    'captcha_footer': :'String',
    'captcha_submit_label': :'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



185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 185

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

  self.class == other.class &&
    block_action == other.block_action &&
    block_response_code == other.block_response_code &&
    block_error_page_message == other.block_error_page_message &&
    block_error_page_description == other.block_error_page_description &&
    block_error_page_code == other.block_error_page_code &&
    captcha_title == other.captcha_title &&
    captcha_header == other.captcha_header &&
    captcha_footer == other.captcha_footer &&
    captcha_submit_label == other.captcha_submit_label
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



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 223

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


203
204
205
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 203

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



212
213
214
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 212

def hash
  [block_action, block_response_code, block_error_page_message, block_error_page_description, block_error_page_code, captcha_title, captcha_header, captcha_footer, captcha_submit_label].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



256
257
258
259
260
261
262
263
264
265
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 256

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



250
251
252
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 250

def to_s
  to_hash.to_s
end