Sha256: 3893a25d9350f65aab26ddc260a1a8e4a485a5b5b49106ae03b667fc5da2107e

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require "date"
require "securerandom"

module Hachi
  module Clients
    class Alert < Base
      def list
        get("/api/alert") { |json| json }
      end

      def get_by_id(id)
        get("/api/alert/#{id}") { |json| json }
      end

      def delete_by_id(id)
        delete("/api/alert/#{id}") { |json| json }
      end

      def create(title:, description:, severity: nil, date: nil, tags: nil, tlp: nil, status: nil, type:, source:, source_ref: nil, artifacts: nil, follow: nil)
        alert = Models::Alert.new(
          title: title,
          description: description,
          severity: severity,
          date: date,
          tags: tags,
          tlp: tlp,
          status: status,
          type: type,
          source: source,
          source_ref: source_ref,
          artifacts: artifacts,
          follow: follow,
        )
        post("/api/alert", alert.payload) { |json| json }
      end

      def search(attributes, range: "all")
        _search("/api/alert/_search", attributes: attributes, range: range) { |json| json }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hachi-0.2.3 lib/hachi/clients/alert.rb
hachi-0.2.2 lib/hachi/clients/alert.rb