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
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/cloudstack_client/cli.rb', line 80 def console cs_client = client() print "cloudstack_client version #{CloudstackClient::VERSION}" puts " (CloudStack API version #{cs_client.api.api_version})" puts " try: list_virtual_machines state: \"running\"" ARGV.clear env = [:env] ? [:env] : load_configuration.last Ripl.config[:prompt] = "#{env} >> " Ripl.start binding: cs_client.instance_eval{ binding } end |
#list_apis ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/cloudstack_client/cli.rb', line 52 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 "yaml" apis.to_yaml else [:pretty_print] ? JSON.pretty_generate(apis) : JSON.generate(apis) end end |
#version ⇒ Object
38 39 40 |
# File 'lib/cloudstack_client/cli.rb', line 38 def version say "cloudstack_client version #{CloudstackClient::VERSION}" end |