class Fog::Compute::VirtualBox::Medium

Public Instance Methods

destroy() click to toggle source
# File lib/fog/virtual_box/models/compute/medium.rb, line 33
def destroy
  requires :raw
  raw.close
  true
end
medium_format() click to toggle source
# File lib/fog/virtual_box/models/compute/medium.rb, line 40
def medium_format
  Fog::Compute::VirtualBox::MediumFormat.new(
    :connection => connection,
    :raw        => raw.medium_format
  )
end
save() click to toggle source
# File lib/fog/virtual_box/models/compute/medium.rb, line 47
def save
  requires :device_type, :location, :read_only

  if File.exists?(location)

    access_mode = if read_only
      :access_mode_read_only
    else
      :access_mode_read_write
    end

    self.raw = connection.open_medium(location, device_type, access_mode)

  else

    raise Fog::Errors::Error.new('Creating a new medium is not yet implemented. Contributions welcome!')

  end
end

Private Instance Methods

raw() click to toggle source
# File lib/fog/virtual_box/models/compute/medium.rb, line 69
def raw
  @raw
end
raw=(new_raw) click to toggle source
# File lib/fog/virtual_box/models/compute/medium.rb, line 73
def raw=(new_raw)
  @raw = new_raw
  raw_attributes = {}
  for key in [:auto_reset, :base, :children, :description, :device_type, :format, :host_drive, :id, :last_access_error, :location, :logical_size, :machine_ids, :medium_format, :name, :parent, :read_only, :size, :state, :type, :variant]
    raw_attributes[key] = @raw.send(key)
  end
  merge_attributes(raw_attributes)
end