Sha256: 2f4a9789407c9f61b8e61703a8bad9ac53f3314ad8d5e2ed602c7d51a1e5e641

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

module Mihari
  module Schemas
    #
    # Emitter schemas
    #
    module Emitters
      extend Concerns::Orrable

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

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

      TheHive = Dry::Schema.Params do
        required(:emitter).value(Types::String.enum(*Mihari::Emitters::TheHive.keys))
        optional(:url).filled(:string)
        optional(:api_key).filled(:string)
        optional(:options).hash(EmitterOptions)
      end

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

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

    Emitter = Schemas::Emitters.compose_by_or
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mihari-7.3.2 lib/mihari/schemas/emitter.rb
mihari-7.3.1 lib/mihari/schemas/emitter.rb