Sha256: 5cbe242b4d8104ca364ab57ca95b176eedeaef2dd62de7345d0b47ddecdcaf13

Contents?: true

Size: 1.33 KB

Versions: 29

Compression:

Stored size: 1.33 KB

Contents

# typed: ignore

# Copyright (c) 2015 Sqreen. All Rights Reserved.
# Please refer to our terms for more information: https://www.sqreen.com/terms.html

require 'sqreen/kit/signals/point'
require 'sqreen/kit/signals/dto_helper'

# reference: https://github.com/sqreen/SignalsSchemas/blob/master/schemas/payload/attack/2020-01-01T00_00_00_000Z/schema.cue

module Sqreen
  module Kit
    module Signals
      module Specialized
      end
    end
  end
end

class Sqreen::Kit::Signals::Specialized::Attack < Sqreen::Kit::Signals::Point
  add_mandatory_attrs :source, :time, :payload

  validate_str_attr :signal_name, /\Asq\.agent\.attack\..+\z/
  validate_str_attr :source, /\Asqreen:rule:[a-f0-9]{40}:.+\z/

  def initialize(values = {})
    self.payload_schema = Payload::SCHEMA_VERSION
    self.time = values[:time] || Time.now
    super
  end

  def payload=(payload)
    unless payload.is_a?(Payload)
      raise ArgumentError, "Payload should be a #{Payload}"
    end
    super
  end

  class Payload
    include Sqreen::Kit::Signals::DtoHelper

    SCHEMA_VERSION = 'attack/2020-01-01T00:00:00.000Z'.freeze

    add_mandatory_attrs :test, :block, :infos

    # all are mandatory

    # @return [Boolean]
    attr_accessor :test

    # @return [Boolean]
    attr_accessor :block

    # @return [Hash{String|Symbol=>Object}]
    attr_accessor :infos
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
sqreen-1.25.1 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.25.0 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.24.3 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.24.2 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.24.1 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.24.0 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.23.2 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.23.1 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.23.0 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.22.1 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.22.0-java lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.22.0 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.21.1-java lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.21.1 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.21.0-java lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.21.0 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.20.4-java lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.20.4 lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.21.0.beta3-java lib/sqreen/kit/signals/specialized/attack.rb
sqreen-1.21.0.beta3 lib/sqreen/kit/signals/specialized/attack.rb