Class: Fog::VirtualBox::Compute::StorageController

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/models/virtual_box/storage_controller.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Model

Instance Attribute Details

#machineObject

Returns the value of attribute machine.



21
22
23
# File 'lib/fog/compute/models/virtual_box/storage_controller.rb', line 21

def machine
  @machine
end

Instance Method Details

#attach(medium, port, device = 0) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/fog/compute/models/virtual_box/storage_controller.rb', line 23

def attach(medium, port, device = 0)
  requires :identity, :machine
  with_session do |session|
    session.machine.attach_device(identity, port, device, medium.device_type, medium.instance_variable_get(:@raw))
    session.machine.save_settings
  end
  true
end

#destroyObject



32
33
34
35
36
37
38
39
# File 'lib/fog/compute/models/virtual_box/storage_controller.rb', line 32

def destroy
  requires :identity, :machine
  with_session do |session|
    session.machine.remove_storage_controller(identity)
    session.machine.save_settings
  end
  true
end

#saveObject



41
42
43
44
45
46
47
48
49
# File 'lib/fog/compute/models/virtual_box/storage_controller.rb', line 41

def save
  requires :bus, :identity, :machine
  with_session do |session|
    self.raw = session.machine.add_storage_controller(identity, bus)
    raw.port_count = 1
    session.machine.save_settings
  end
  true
end