Class: Pvectl::Repositories::Journal

Inherits:
Base
  • Object
show all
Defined in:
lib/pvectl/repositories/journal.rb,
sig/pvectl/repositories/journal.rbs

Overview

Repository for reading node systemd journal. Uses GET /nodes/node/journal endpoint.

Instance Attribute Summary

Attributes inherited from Base

#connection

Instance Method Summary collapse

Methods inherited from Base

#build_model, #extract_data, #get, #initialize, #models_from, #unwrap

Constructor Details

This class inherits a constructor from Pvectl::Repositories::Base

Instance Method Details

#list(node:, last_entries: 50, since: nil, until_time: nil) ⇒ Array<Models::JournalEntry>



13
14
15
16
17
18
19
20
# File 'lib/pvectl/repositories/journal.rb', line 13

def list(node:, last_entries: 50, since: nil, until_time: nil)
  params = { lastentries: last_entries }
  params[:since] = since if since
  params[:until] = until_time if until_time

  response = connection.client["nodes/#{node}/journal"].get(params: params)
  models_from(response, Models::JournalEntry)
end