Sha256: 81b01f7257da9ccfa27e37af0db2abc2d73fa2146e377c6ae4bec549323c3c03

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

module Mihari
  module Schemas
    #
    # Emitter schemas
    #
    module Emitters
      extend Schemas::Mixins

      Database = Dry::Schema.Params do
        required(:emitter).value(Types::String.enum(*Mihari::Emitters::Database.class_keys))
        optional(:options).hash(Options)
      end

      MISP = Dry::Schema.Params do
        required(:emitter).value(Types::String.enum(*Mihari::Emitters::MISP.class_keys))
        optional(:url).value(:string)
        optional(:api_key).value(:string)
        optional(:options).hash(Options)
      end

      TheHive = Dry::Schema.Params do
        required(:emitter).value(Types::String.enum(*Mihari::Emitters::TheHive.class_keys))
        optional(:url).value(:string)
        optional(:api_key).value(:string)
        optional(:api_version).value(Types::String.enum("v4", "v5")).default("v4")
        optional(:options).hash(Options)
      end

      Slack = Dry::Schema.Params do
        required(:emitter).value(Types::String.enum(*Mihari::Emitters::Slack.class_keys))
        optional(:webhook_url).value(:string)
        optional(:channel).value(:string)
        optional(:options).hash(Options)
      end

      Webhook = Dry::Schema.Params do
        required(:emitter).value(Types::String.enum(*Mihari::Emitters::Webhook.class_keys))
        required(:url).value(:string)
        optional(:method).value(Types::HTTPRequestMethods).default("POST")
        optional(:headers).value(:hash).default({})
        optional(:template).value(:string)
        optional(:options).hash(Options)
      end
    end

    Emitter = Schemas::Emitters.get_or_composition
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mihari-6.3.0 lib/mihari/schemas/emitter.rb
mihari-6.2.0 lib/mihari/schemas/emitter.rb
mihari-6.1.0 lib/mihari/schemas/emitter.rb
mihari-6.0.0 lib/mihari/schemas/emitter.rb
mihari-5.7.2 lib/mihari/schemas/emitter.rb
mihari-5.7.1 lib/mihari/schemas/emitter.rb
mihari-5.7.0 lib/mihari/schemas/emitter.rb