Class: CloudstackClient::Cli
- Inherits:
-
Thor
- Object
- Thor
- CloudstackClient::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/cloudstack_client/cli.rb
Instance Method Summary collapse
Instance Method Details
#console ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/cloudstack_client/cli.rb', line 72 def console puts "cloudstack_client version #{CloudstackClient::VERSION}" puts ' try: list_virtual_machines state: "Started"' ARGV.clear env = [:env] ? [:env] : load_configuration.last Ripl.config[:prompt] = "#{env} >> " Ripl.start binding: client.instance_eval('binding') end |
#list_apis ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cloudstack_client/cli.rb', line 51 def list_apis apis = client(no_api_methods: true).send_request('command' => 'listApis') apis.each do |command| command.delete("response") if [:remove_response] if [:remove_description] command.delete("description") command["params"].each {|param| param.delete("description")} end end print case [:format] when "json" [:pretty_print] ? JSON.pretty_generate(apis) : apis.to_json when "yaml" apis.to_yaml else apis.to_msgpack end end |
#version ⇒ Object
37 38 39 |
# File 'lib/cloudstack_client/cli.rb', line 37 def version say "cloudstack_client version #{CloudstackClient::VERSION}" end |