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 =
[
  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):



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
162
# File 'lib/oci/waas/models/block_challenge_settings.rb', line 103

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)


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

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)


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

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)


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

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)


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

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. 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.

Returns:

  • (Integer)


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

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)


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

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)


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

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)


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

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)


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

def captcha_title
  @captcha_title
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


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

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

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



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

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



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

def to_s
  to_hash.to_s
end