2012-05-15 14:54:20 -04:00
|
|
|
require 'fog/virtual_box'
|
2011-08-31 16:52:53 -04:00
|
|
|
require 'fog/compute'
|
|
|
|
|
2011-03-09 20:03:15 -05:00
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class VirtualBox < Fog::Service
|
2011-03-09 20:03:15 -05:00
|
|
|
|
2011-08-24 21:07:28 -04:00
|
|
|
model_path 'fog/virtual_box/models/compute'
|
2011-03-09 20:03:15 -05:00
|
|
|
model :medium
|
|
|
|
collection :mediums
|
|
|
|
model :medium_format
|
|
|
|
model :nat_engine
|
|
|
|
model :nat_redirect
|
|
|
|
collection :nat_redirects
|
|
|
|
model :network_adapter
|
|
|
|
collection :network_adapters
|
|
|
|
model :server
|
|
|
|
collection :servers
|
|
|
|
model :storage_controller
|
|
|
|
collection :storage_controllers
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
|
|
|
|
def initialize(options={})
|
|
|
|
Fog::Mock.not_implemented
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Real
|
|
|
|
|
|
|
|
def initialize(options={})
|
|
|
|
require 'virtualbox'
|
|
|
|
@connection = ::VirtualBox::Global.global.lib.virtualbox
|
|
|
|
end
|
|
|
|
|
2012-01-12 10:40:11 -05:00
|
|
|
def respond_to?(method, *)
|
|
|
|
super or @connection.respond_to? method
|
|
|
|
end
|
|
|
|
|
2011-03-09 20:03:15 -05:00
|
|
|
# hack to provide 'requests'
|
|
|
|
def method_missing(method_sym, *arguments, &block)
|
|
|
|
if @connection.respond_to?(method_sym)
|
|
|
|
@connection.send(method_sym, *arguments)
|
|
|
|
else
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|