class Ey::Core::Cli::Servers

Public Instance Methods

handle() click to toggle source
# File lib/ey-core/cli/servers.rb, line 28
def handle
  puts TablePrint::Printer.new(
    servers,
    [
      { id: { width: 10 } },
      :role,
      :provisioned_id,
      { public_hostname: { width: 50 } },
      :name,
    ]
  ).table_print
end

Private Instance Methods

servers() click to toggle source
# File lib/ey-core/cli/servers.rb, line 42
def servers
  filter_opts = {}

  operator =
    if option(:environment)
      core_account.environments.first(name: option(:environment))
    else
      filter_opts[:account] = core_account.id if option(:account)
      core_client
    end

  filter_opts[:role] = option(:role).split(',') if option(:role)
  operator ? operator.servers.all(filter_opts) : nil
end