Class: Morpheus::Cli::DashboardCommand
- Inherits:
-
Object
- Object
- Morpheus::Cli::DashboardCommand
show all
- Includes:
- CliCommand
- Defined in:
- lib/morpheus/cli/dashboard_command.rb
Instance Attribute Summary
Attributes included from CliCommand
#no_prompt
Instance Method Summary
collapse
Methods included from CliCommand
#apply_options, #build_common_options, #build_option_type_options, #build_standard_add_options, #build_standard_delete_options, #build_standard_get_options, #build_standard_list_options, #build_standard_post_options, #build_standard_put_options, #build_standard_remove_options, #build_standard_update_options, #command_name, #default_refresh_interval, #default_subcommand, #establish_remote_appliance_connection, #full_command_usage, #get_subcommand_description, #handle_subcommand, included, #interactive?, #my_help_command, #my_terminal, #my_terminal=, #parse_bytes_param, #parse_id_list, #parse_list_options, #parse_list_subtitles, #parse_passed_options, #parse_payload, #parse_query_options, #print, #print_error, #println, #puts, #puts_error, #raise_args_error, #raise_command_error, #render_response, #render_with_format, #run_command_for_each_arg, #subcommand_aliases, #subcommand_description, #subcommand_usage, #subcommands, #verify_args!, #visible_subcommands
Constructor Details
Returns a new instance of DashboardCommand.
10
11
12
|
# File 'lib/morpheus/cli/dashboard_command.rb', line 10
def initialize()
end
|
Instance Method Details
#connect(opts) ⇒ Object
14
15
16
17
|
# File 'lib/morpheus/cli/dashboard_command.rb', line 14
def connect(opts)
@api_client = establish_remote_appliance_connection(opts)
@dashboard_interface = @api_client.dashboard
end
|
#handle(args) ⇒ Object
23
24
25
|
# File 'lib/morpheus/cli/dashboard_command.rb', line 23
def handle(args)
show(args)
end
|
#show(args) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/morpheus/cli/dashboard_command.rb', line 27
def show(args)
options = {}
optparse = Morpheus::Cli::OptionParser.new do |opts|
opts.banner = usage
build_common_options(opts, options, [:json, :dry_run]) end
optparse.parse!(args)
connect(options)
begin
params = {}
@dashboard_interface.setopts(options)
if options[:dry_run]
print_dry_run @dashboard_interface.dry.get(params)
return
end
json_response = @dashboard_interface.get(params)
if options[:json]
print JSON.pretty_generate(json_response)
print "\n"
else
print_h1 "Dashboard"
print cyan
puts "Coming soon... see --json"
print reset,"\n"
end
rescue RestClient::Exception => e
print_rest_exception(e, options)
exit 1
end
end
|
#usage ⇒ Object
19
20
21
|
# File 'lib/morpheus/cli/dashboard_command.rb', line 19
def usage
"Usage: morpheus #{command_name}"
end
|