class Daino::Clients::Analyzer
Public Instance Methods
get_by_id(id)
click to toggle source
# File lib/daino/clients/analyzer.rb, line 14 def get_by_id(id) get("/api/analyzer/#{id}") { |json| json } end
get_by_name(name)
click to toggle source
# File lib/daino/clients/analyzer.rb, line 18 def get_by_name(name) search(name: name)&.first end
get_by_type(type)
click to toggle source
# File lib/daino/clients/analyzer.rb, line 22 def get_by_type(type) get("/api/analyzer/type/#{type}") { |json| json } end
list()
click to toggle source
# File lib/daino/clients/analyzer.rb, line 6 def list get("/api/analyzer") { |json| json } end
run_by_id(id, data:, data_type:, tlp: 0, message: nil, parameters: nil, force: nil)
click to toggle source
# File lib/daino/clients/analyzer.rb, line 26 def run_by_id(id, data:, data_type:, tlp: 0, message: nil, parameters: nil, force: nil) payload = { data: data, dataType: data_type, tlp: tlp, message: message, parameters: parameters }.compact options = force.nil? ? {} : { force: force } post("/api/analyzer/#{id}/run", payload, options) { |json| json } end
run_by_name(name, data:, data_type:, tlp: 0, message: nil, parameters: nil, force: nil)
click to toggle source
# File lib/daino/clients/analyzer.rb, line 40 def run_by_name(name, data:, data_type:, tlp: 0, message: nil, parameters: nil, force: nil) analyzer = get_by_name(name) raise ArgumentError, "#{name} does not exist." unless analyzer id = analyzer.dig("id") run_by_id(id, data: data, data_type: data_type, tlp: tlp, message: message, parameters: parameters, force: force) end
search(attributes)
click to toggle source
# File lib/daino/clients/analyzer.rb, line 10 def search(attributes) post("/api/analyzer/_search", query: attributes) { |json| json } end