Class: GraylogAPI::System::Inputs::Types
- Inherits:
-
Object
- Object
- GraylogAPI::System::Inputs::Types
- Defined in:
- lib/graylogapi/system/inputs/types.rb
Overview
class for getting info about input types
Instance Method Summary collapse
-
#all ⇒ GraylogAPI::Client::Response
get all input types.
-
#by_type(type) ⇒ GraylogAPI::Client::Response
get info about input type.
-
#initialize(client) ⇒ Types
constructor
A new instance of Types.
-
#name_to_type(name) ⇒ String
convert type name to type.
-
#node ⇒ GraylogAPI::Client::Response
get input types of current node.
-
#type_to_name(type_id) ⇒ String
converg type_id to type name.
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
#all ⇒ GraylogAPI::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
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 |
#node ⇒ GraylogAPI::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
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 |