Class: GraylogAPI::System::Inputs::Types

Inherits:
Object
  • Object
show all
Defined in:
lib/graylogapi/system/inputs/types.rb

Overview

class for getting info about input types

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Types

Returns a new instance of Types.



6
7
8
# File 'lib/graylogapi/system/inputs/types.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#allGraylogAPI::Client::Response

get all input types



20
21
22
# File 'lib/graylogapi/system/inputs/types.rb', line 20

def all
  @client.request(:get, '/system/inputs/types/all')
end

#by_type(type) ⇒ GraylogAPI::Client::Response

get info about input type



27
28
29
# File 'lib/graylogapi/system/inputs/types.rb', line 27

def by_type(type)
  @client.request(:get, "/system/inputs/types/#{type}")
end

#name_to_type(name) ⇒ String

convert type name to type

Returns:

  • (String)


34
35
36
# File 'lib/graylogapi/system/inputs/types.rb', line 34

def name_to_type(name)
  all.body.find { |_, type| type['name'].casecmp(name).zero? }.first
end

#nodeGraylogAPI::Client::Response

get input types of current node



13
14
15
# File 'lib/graylogapi/system/inputs/types.rb', line 13

def node
  @client.request(:get, '/system/inputs/types')
end

#type_to_name(type_id) ⇒ String

converg type_id to type name

Returns:

  • (String)


41
42
43
# File 'lib/graylogapi/system/inputs/types.rb', line 41

def type_to_name(type_id)
  all.body.find { |_, type| type['type'].casecmp(type_id).zero? }.last['name']
end