class ThreeScaleToolbox::Commands::ProxyConfigCommand::List::ListSubcommand

Constants

FIELDS

Public Class Methods

command() click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/list_command.rb, line 10
def self.command
  Cri::Command.define do
    name        'list'
    usage       'list <remote> <service> <environment>'
    summary     'List Proxy Configurations'
    description 'List all defined Proxy Configurations'

    ThreeScaleToolbox::CLI.output_flag(self)
    param   :remote
    param   :service_ref
    param   :environment

    runner ListSubcommand
  end
end

Public Instance Methods

run() click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/list_command.rb, line 26
def run
  printer.print_collection service.proxy_configs(proxy_config_environment).map(&:attrs)
end

Private Instance Methods

find_service() click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/list_command.rb, line 44
def find_service
  Entities::Service.find(remote: remote, ref: service_ref).tap do |svc|
    raise ThreeScaleToolbox::Error, "Service #{service_ref} does not exist" if svc.nil?
  end
end
printer() click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/list_command.rb, line 54
def printer
  # keep backwards compatibility
  options.fetch(:output, CLI::CustomTablePrinter.new(FIELDS))
end
proxy_config_environment() click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/list_command.rb, line 36
def proxy_config_environment
  arguments[:environment]
end
remote() click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/list_command.rb, line 32
def remote
  @remote ||= threescale_client(arguments[:remote])
end
service() click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/list_command.rb, line 50
def service
  @service ||= find_service
end
service_ref() click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/list_command.rb, line 40
def service_ref
  arguments[:service_ref]
end