Module: Aspera::Plugins::Xfer::AscpLogsActions::ClassMethods

Defined in:
lib/aspera/plugins/xfer/ascp_logs_actions.rb

Overview

Class-level DSL methods added to the plugin class that includes AscpLogsActions.

Instance Method Summary collapse

Instance Method Details

#ascp_logs_commands(parent, arguments: LOG_FILES) ⇒ Object

DSL class method: declare the logs node and its commands.

Parameters:

  • parent (Symbol, Array<Symbol>) —

    path relative to current scope, e.g. :logs

  • arguments (Array<Hash>) (defaults to: LOG_FILES) —

    argument that gives the log files (default: local files)



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/aspera/plugins/xfer/ascp_logs_actions.rb', line 56

def ascp_logs_commands(parent, arguments: LOG_FILES)
  commands_under(parent, description: 'Analyze ascp log files') do
    command(:summary, description: 'Statistics and findings', arguments: arguments, action: :action_ascp_logs_summary)
    command(:health, description: 'Health check for monitoring', arguments: arguments, action: :action_ascp_logs_health)
    LISTS.each do |name, (description, fields)|
      command(name, description: description, arguments: arguments, action: ->(paths:, **) { Cli::Result::ObjectList.new(analyze_ascp_logs(paths).public_send(name), fields: fields) })
    end
    command(:records, description: 'Log lines parsed into records, with the field names of the log', arguments: [RECORD_KIND] + arguments, action: :action_ascp_logs_records)
    command(:fields, description: 'Description of the fields of records', arguments: [RECORD_KIND], action: :action_ascp_logs_fields)
  end
end