class Fluent::Plugin::MonitorAgentInput::APIHandler

def build_object(opts)

def build_object(opts)
  qs = opts[:query]
  if tag = qs['tag'.freeze].first
    # ?tag= to search an output plugin by match pattern
    if obj = @agent.plugin_info_by_tag(tag, opts)
      list = [obj]
    else
      list = []
    end
  elsif plugin_id = (qs['@id'.freeze].first || qs['id'.freeze].first)
    # ?@id= to search a plugin by 'id <plugin_id>' config param
    if obj = @agent.plugin_info_by_id(plugin_id, opts)
      list = [obj]
    else
      list = []
    end
  elsif plugin_type = (qs['@type'.freeze].first || qs['type'.freeze].first)
    # ?@type= to search plugins by 'type <type>' config param
    list = @agent.plugins_info_by_type(plugin_type, opts)
  else
    # otherwise show all plugins
    list = @agent.plugins_info_all(opts)
  end
  list
end