lib/cloudstack-cli/helper.rb in cloudstack-cli-0.0.1 vs lib/cloudstack-cli/helper.rb in cloudstack-cli-0.0.2
- old
+ new
@@ -2,15 +2,16 @@
class Helper
include CommandLineReporter
attr_reader :cs
- def initialize
+ def initialize(config_file)
+ @config_file = config_file
@cs = CloudstackClient::Connection.new(
- options[:cloudstack_url],
- options[:cloudstack_api_key],
- options[:cloudstack_secret_key]
+ options[:url],
+ options[:api_key],
+ options[:secret_key]
)
end
def remove_publicip(id)
@cs.disassociate_ip_address(id)
@@ -173,11 +174,19 @@
def destroy_router(id)
@cs.destroy_router(id)
end
+ def start_router(id)
+ @cs.start_router(id)
+ end
+
+ def stop_router(id)
+ @cs.stop_router(id)
+ end
+
def options
- @options ||= CloudstackClient::ConnectionHelper.load_configuration()
+ @options ||= CloudstackClient::ConnectionHelper.load_configuration(@config_file)
end
def print_options(options, attr = 'name')
options.to_enum.with_index(1).each do |option, i|
puts "#{i}: #{option[attr]}"
\ No newline at end of file