class Fastly::LegacyWafOwasp

Attributes

allowed_http_versions[RW]

Allowed HTTP versions.

allowed_methods[RW]

A space-separated list of HTTP method names.

allowed_request_content_type[RW]

Allowed request content types.

arg_length[RW]

The maximum allowed length of an argument.

arg_name_length[RW]

The maximum allowed argument name length.

combined_file_sizes[RW]

The maximum allowed size of all files (in bytes).

created_at[RW]

Date and time that the settings object was created.

critical_anomaly_score[RW]

Score value to add for critical anomalies.

crs_validate_utf8_encoding[RW]

CRS validate UTF8 encoding.

error_anomaly_score[RW]

Score value to add for error anomalies.

high_risk_country_codes[RW]

A space-separated list of country codes in ISO 3166-1 (two-letter) format.

http_violation_score_threshold[RW]

HTTP violation threshold.

inbound_anomaly_score_threshold[RW]

Inbound anomaly threshold.

lfi_score_threshold[RW]

Local file inclusion attack threshold.

max_file_size[RW]

The maximum allowed file size (in bytes).

max_num_args[RW]

The maximum number of arguments allowed.

notice_anomaly_score[RW]

Score value to add for notice anomalies.

paranoia_level[RW]

The configured paranoia level.

php_injection_score_threshold[RW]

PHP injection threshold.

rce_score_threshold[RW]

Remote code execution threshold.

restricted_extensions[RW]

A space-separated list of disallowed file extensions.

restricted_headers[RW]

A space-separated list of disallowed header names.

rfi_score_threshold[RW]

Remote file inclusion attack threshold.

session_fixation_score_threshold[RW]

Session fixation attack threshold.

sql_injection_score_threshold[RW]

SQL injection attack threshold.

total_arg_length[RW]

The maximum size of argument names and values.

updated_at[RW]

Date and time that the settings object was last updated.

warning_anomaly_score[RW]

Score value to add for warning anomalies.

xss_score_threshold[RW]

XSS attack threshold.

Public Class Methods

acceptable_attributes() click to toggle source

Returns all the JSON keys this model knows about

# File lib/fastly/models/legacy_waf_owasp.rb, line 139
def self.acceptable_attributes
  attribute_map.values
end
attribute_map() click to toggle source

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

# File lib/fastly/models/legacy_waf_owasp.rb, line 104
def self.attribute_map
  {
    :'allowed_http_versions' => :'allowed_http_versions',
    :'allowed_methods' => :'allowed_methods',
    :'allowed_request_content_type' => :'allowed_request_content_type',
    :'arg_length' => :'arg_length',
    :'arg_name_length' => :'arg_name_length',
    :'combined_file_sizes' => :'combined_file_sizes',
    :'created_at' => :'created_at',
    :'critical_anomaly_score' => :'critical_anomaly_score',
    :'crs_validate_utf8_encoding' => :'crs_validate_utf8_encoding',
    :'error_anomaly_score' => :'error_anomaly_score',
    :'high_risk_country_codes' => :'high_risk_country_codes',
    :'http_violation_score_threshold' => :'http_violation_score_threshold',
    :'inbound_anomaly_score_threshold' => :'inbound_anomaly_score_threshold',
    :'lfi_score_threshold' => :'lfi_score_threshold',
    :'max_file_size' => :'max_file_size',
    :'max_num_args' => :'max_num_args',
    :'notice_anomaly_score' => :'notice_anomaly_score',
    :'paranoia_level' => :'paranoia_level',
    :'php_injection_score_threshold' => :'php_injection_score_threshold',
    :'rce_score_threshold' => :'rce_score_threshold',
    :'restricted_extensions' => :'restricted_extensions',
    :'restricted_headers' => :'restricted_headers',
    :'rfi_score_threshold' => :'rfi_score_threshold',
    :'session_fixation_score_threshold' => :'session_fixation_score_threshold',
    :'sql_injection_score_threshold' => :'sql_injection_score_threshold',
    :'total_arg_length' => :'total_arg_length',
    :'updated_at' => :'updated_at',
    :'warning_anomaly_score' => :'warning_anomaly_score',
    :'xss_score_threshold' => :'xss_score_threshold'
  }
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/fastly/models/legacy_waf_owasp.rb, line 410
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
fastly_nullable() click to toggle source

List of attributes with nullable: true

# File lib/fastly/models/legacy_waf_owasp.rb, line 179
def self.fastly_nullable
  Set.new([
  ])
end
fastly_types() click to toggle source

Attribute type mapping.

# File lib/fastly/models/legacy_waf_owasp.rb, line 144
def self.fastly_types
  {
    :'allowed_http_versions' => :'String',
    :'allowed_methods' => :'String',
    :'allowed_request_content_type' => :'String',
    :'arg_length' => :'Integer',
    :'arg_name_length' => :'Integer',
    :'combined_file_sizes' => :'Integer',
    :'created_at' => :'String',
    :'critical_anomaly_score' => :'Integer',
    :'crs_validate_utf8_encoding' => :'Boolean',
    :'error_anomaly_score' => :'Integer',
    :'high_risk_country_codes' => :'String',
    :'http_violation_score_threshold' => :'Integer',
    :'inbound_anomaly_score_threshold' => :'Integer',
    :'lfi_score_threshold' => :'Integer',
    :'max_file_size' => :'Integer',
    :'max_num_args' => :'Integer',
    :'notice_anomaly_score' => :'Integer',
    :'paranoia_level' => :'Integer',
    :'php_injection_score_threshold' => :'Integer',
    :'rce_score_threshold' => :'Integer',
    :'restricted_extensions' => :'String',
    :'restricted_headers' => :'String',
    :'rfi_score_threshold' => :'Integer',
    :'session_fixation_score_threshold' => :'Integer',
    :'sql_injection_score_threshold' => :'Integer',
    :'total_arg_length' => :'Integer',
    :'updated_at' => :'String',
    :'warning_anomaly_score' => :'Integer',
    :'xss_score_threshold' => :'Integer'
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/fastly/models/legacy_waf_owasp.rb, line 186
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LegacyWafOwasp` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LegacyWafOwasp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'allowed_http_versions')
    self.allowed_http_versions = attributes[:'allowed_http_versions']
  else
    self.allowed_http_versions = 'HTTP/1.0 HTTP/1.1 HTTP/2'
  end

  if attributes.key?(:'allowed_methods')
    self.allowed_methods = attributes[:'allowed_methods']
  else
    self.allowed_methods = 'GET HEAD POST OPTIONS PUT PATCH DELETE'
  end

  if attributes.key?(:'allowed_request_content_type')
    self.allowed_request_content_type = attributes[:'allowed_request_content_type']
  else
    self.allowed_request_content_type = 'application/x-www-form-urlencoded|multipart/form-data|text/xml|application/xml|application/x-amf|application/json|text/plain'
  end

  if attributes.key?(:'arg_length')
    self.arg_length = attributes[:'arg_length']
  else
    self.arg_length = 400
  end

  if attributes.key?(:'arg_name_length')
    self.arg_name_length = attributes[:'arg_name_length']
  else
    self.arg_name_length = 100
  end

  if attributes.key?(:'combined_file_sizes')
    self.combined_file_sizes = attributes[:'combined_file_sizes']
  else
    self.combined_file_sizes = 10000000
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.key?(:'critical_anomaly_score')
    self.critical_anomaly_score = attributes[:'critical_anomaly_score']
  else
    self.critical_anomaly_score = 6
  end

  if attributes.key?(:'crs_validate_utf8_encoding')
    self.crs_validate_utf8_encoding = attributes[:'crs_validate_utf8_encoding']
  end

  if attributes.key?(:'error_anomaly_score')
    self.error_anomaly_score = attributes[:'error_anomaly_score']
  else
    self.error_anomaly_score = 5
  end

  if attributes.key?(:'high_risk_country_codes')
    self.high_risk_country_codes = attributes[:'high_risk_country_codes']
  end

  if attributes.key?(:'http_violation_score_threshold')
    self.http_violation_score_threshold = attributes[:'http_violation_score_threshold']
  end

  if attributes.key?(:'inbound_anomaly_score_threshold')
    self.inbound_anomaly_score_threshold = attributes[:'inbound_anomaly_score_threshold']
  end

  if attributes.key?(:'lfi_score_threshold')
    self.lfi_score_threshold = attributes[:'lfi_score_threshold']
  end

  if attributes.key?(:'max_file_size')
    self.max_file_size = attributes[:'max_file_size']
  else
    self.max_file_size = 10000000
  end

  if attributes.key?(:'max_num_args')
    self.max_num_args = attributes[:'max_num_args']
  else
    self.max_num_args = 255
  end

  if attributes.key?(:'notice_anomaly_score')
    self.notice_anomaly_score = attributes[:'notice_anomaly_score']
  else
    self.notice_anomaly_score = 4
  end

  if attributes.key?(:'paranoia_level')
    self.paranoia_level = attributes[:'paranoia_level']
  else
    self.paranoia_level = 1
  end

  if attributes.key?(:'php_injection_score_threshold')
    self.php_injection_score_threshold = attributes[:'php_injection_score_threshold']
  end

  if attributes.key?(:'rce_score_threshold')
    self.rce_score_threshold = attributes[:'rce_score_threshold']
  end

  if attributes.key?(:'restricted_extensions')
    self.restricted_extensions = attributes[:'restricted_extensions']
  else
    self.restricted_extensions = '.asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .resources/ .resx/ .sql/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx'
  end

  if attributes.key?(:'restricted_headers')
    self.restricted_headers = attributes[:'restricted_headers']
  else
    self.restricted_headers = '/proxy/ /lock-token/ /content-range/ /translate/ /if/'
  end

  if attributes.key?(:'rfi_score_threshold')
    self.rfi_score_threshold = attributes[:'rfi_score_threshold']
  end

  if attributes.key?(:'session_fixation_score_threshold')
    self.session_fixation_score_threshold = attributes[:'session_fixation_score_threshold']
  end

  if attributes.key?(:'sql_injection_score_threshold')
    self.sql_injection_score_threshold = attributes[:'sql_injection_score_threshold']
  end

  if attributes.key?(:'total_arg_length')
    self.total_arg_length = attributes[:'total_arg_length']
  else
    self.total_arg_length = 6400
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  end

  if attributes.key?(:'warning_anomaly_score')
    self.warning_anomaly_score = attributes[:'warning_anomaly_score']
  end

  if attributes.key?(:'xss_score_threshold')
    self.xss_score_threshold = attributes[:'xss_score_threshold']
  end
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/fastly/models/legacy_waf_owasp.rb, line 361
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      allowed_http_versions == o.allowed_http_versions &&
      allowed_methods == o.allowed_methods &&
      allowed_request_content_type == o.allowed_request_content_type &&
      arg_length == o.arg_length &&
      arg_name_length == o.arg_name_length &&
      combined_file_sizes == o.combined_file_sizes &&
      created_at == o.created_at &&
      critical_anomaly_score == o.critical_anomaly_score &&
      crs_validate_utf8_encoding == o.crs_validate_utf8_encoding &&
      error_anomaly_score == o.error_anomaly_score &&
      high_risk_country_codes == o.high_risk_country_codes &&
      http_violation_score_threshold == o.http_violation_score_threshold &&
      inbound_anomaly_score_threshold == o.inbound_anomaly_score_threshold &&
      lfi_score_threshold == o.lfi_score_threshold &&
      max_file_size == o.max_file_size &&
      max_num_args == o.max_num_args &&
      notice_anomaly_score == o.notice_anomaly_score &&
      paranoia_level == o.paranoia_level &&
      php_injection_score_threshold == o.php_injection_score_threshold &&
      rce_score_threshold == o.rce_score_threshold &&
      restricted_extensions == o.restricted_extensions &&
      restricted_headers == o.restricted_headers &&
      rfi_score_threshold == o.rfi_score_threshold &&
      session_fixation_score_threshold == o.session_fixation_score_threshold &&
      sql_injection_score_threshold == o.sql_injection_score_threshold &&
      total_arg_length == o.total_arg_length &&
      updated_at == o.updated_at &&
      warning_anomaly_score == o.warning_anomaly_score &&
      xss_score_threshold == o.xss_score_threshold
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/fastly/models/legacy_waf_owasp.rb, line 440
def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Fastly.const_get(type)
    klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/fastly/models/legacy_waf_owasp.rb, line 511
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/fastly/models/legacy_waf_owasp.rb, line 417
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.fastly_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end
eql?(o) click to toggle source

@see the ‘==` method @param [Object] Object to be compared

# File lib/fastly/models/legacy_waf_owasp.rb, line 397
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/fastly/models/legacy_waf_owasp.rb, line 403
def hash
  [allowed_http_versions, allowed_methods, allowed_request_content_type, arg_length, arg_name_length, combined_file_sizes, created_at, critical_anomaly_score, crs_validate_utf8_encoding, error_anomaly_score, high_risk_country_codes, http_violation_score_threshold, inbound_anomaly_score_threshold, lfi_score_threshold, max_file_size, max_num_args, notice_anomaly_score, paranoia_level, php_injection_score_threshold, rce_score_threshold, restricted_extensions, restricted_headers, rfi_score_threshold, session_fixation_score_threshold, sql_injection_score_threshold, total_arg_length, updated_at, warning_anomaly_score, xss_score_threshold].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/fastly/models/legacy_waf_owasp.rb, line 348
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/fastly/models/legacy_waf_owasp.rb, line 487
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/fastly/models/legacy_waf_owasp.rb, line 493
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.fastly_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/fastly/models/legacy_waf_owasp.rb, line 481
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/fastly/models/legacy_waf_owasp.rb, line 355
def valid?
  true
end