class Nrcmd::Apps::Hosts

Constants

URL

Public Class Methods

banner(task, namespace = false, subcommand = true) click to toggle source
Calls superclass method

Public Instance Methods

list(app_id) click to toggle source
# File lib/nrcmd/apps/hosts/cli.rb, line 22
def list(app_id)
  uri = URL + "/applications/#{app_id}/hosts.json"
  filter_param = ""
  options["filter"].gsub(" ", "").split(',').each do |filter|
    fkv = filter.split('=')
    filter_param << "filter[#{fkv[0]}]=#{fkv[1]}&"
  end
  res = Nrcmd::Http.get(uri, {}, filter_param)
  result = JSON.parse(res.body)
  print JSON[ result["application_hosts"] ]
end
show(app_id, host_id) click to toggle source
# File lib/nrcmd/apps/hosts/cli.rb, line 38
def show(app_id, host_id)
  uri = URL + "/applications/#{app_id}/hosts/#{host_id}.json"
  res = Nrcmd::Http.get(uri)
  result = JSON.parse(res.body)
  print JSON[ result["application_host"]]
end