Sha256: 167d59d5d441de49aca3031544f31178c85d684baaef6a2147f9e96db2896ce9

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 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.1 lib/hachi/clients/alert.rb
hachi-0.2.0 lib/hachi/clients/alert.rb