Class: Sumologic::CLI::Commands::ListFieldsCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/sumologic/cli/commands/list_fields_command.rb

Overview

Handles the list-fields command execution

Instance Attribute Summary

Attributes inherited from BaseCommand

#client, #options

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Constructor Details

This class inherits a constructor from Sumologic::CLI::Commands::BaseCommand

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sumologic/cli/commands/list_fields_command.rb', line 10

def execute
  if options[:builtin]
    warn 'Fetching built-in fields...'
    fields = client.list_builtin_fields
  else
    warn 'Fetching custom fields...'
    fields = client.list_fields
  end

  output_json(
    total: fields.size,
    fields: fields
  )
end