Class: ThreeScaleToolbox::Commands::ApplicationCommand::List::ListSubcommand
- Inherits:
-
Cri::CommandRunner
- Object
- Cri::CommandRunner
- ThreeScaleToolbox::Commands::ApplicationCommand::List::ListSubcommand
show all
- Includes:
- ThreeScaleToolbox::Command
- Defined in:
- lib/3scale_toolbox/commands/application_command/list_command.rb
Constant Summary
collapse
- FIELDS_TO_SHOW =
%w[id name state enabled account_id service_id plan_id].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#config, #config_file, #exit_with_message, #fetch_required_option, included, #remotes, #threescale_client, #verbose, #verify_ssl
Class Method Details
.command ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/3scale_toolbox/commands/application_command/list_command.rb', line 10
def self.command
Cri::Command.define do
name 'list'
usage 'list [opts] <remote>'
summary 'list applications'
description 'List applications'
option nil, :account, 'Filter by account', argument: :required
option nil, :service, 'Filter by service', argument: :required
option nil, :plan, 'Filter by application plan. Service option required', argument: :required
ThreeScaleToolbox::CLI.output_flag(self)
param :remote
runner ListSubcommand
end
end
|
Instance Method Details
#run ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/3scale_toolbox/commands/application_command/list_command.rb', line 28
def run
validate_option_params
applications = if option_account
account.applications
elsif option_service && option_plan
plan.applications
elsif option_service
service.applications
else
provider_account_applications
end
printer.print_collection applications.map(&:attrs)
end
|