2011-03-09 20:03:15 -05:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/compute/models/virtual_box/storage_controller'
|
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class VirtualBox
|
2011-03-09 20:03:15 -05:00
|
|
|
|
|
|
|
class StorageControllers < Fog::Collection
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
model Fog::Compute::VirtualBox::StorageController
|
2011-03-09 20:03:15 -05:00
|
|
|
|
|
|
|
attr_accessor :machine
|
|
|
|
|
|
|
|
def all
|
|
|
|
requires :machine
|
|
|
|
data = machine.instance_variable_get(:@raw).storage_controllers.map do |storage_controller|
|
|
|
|
{:raw => storage_controller}
|
|
|
|
end
|
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(storage_controller_name)
|
|
|
|
requires :machine
|
|
|
|
all.detect do |storage_controller|
|
|
|
|
storage_controller.name == storage_controller_name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def new(attributes = {})
|
|
|
|
requires :machine
|
|
|
|
super({ :machine => machine }.merge!(attributes))
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|