class Fog::Compute::ProfitBricks::Volume

Attributes

options[RW]

Public Class Methods

new(attributes = {}) click to toggle source
Calls superclass method
# File lib/fog/profitbricks/models/compute/volume.rb, line 44
def initialize(attributes = {})
  super
end

Public Instance Methods

create_snapshot(name, description = '') click to toggle source
# File lib/fog/profitbricks/models/compute/volume.rb, line 100
def create_snapshot(name, description = '')
  requires :datacenter_id, :id

  options = {}
  options[:name] = name if name
  options[:description] = description if description && description != ''

  service.create_volume_snapshot(datacenter_id, id, options)
  true
end
delete() click to toggle source
# File lib/fog/profitbricks/models/compute/volume.rb, line 78
def delete
  requires :datacenter_id, :id
  service.delete_volume(datacenter_id, id)
  true
end
reload() click to toggle source
# File lib/fog/profitbricks/models/compute/volume.rb, line 84
def reload
  requires :datacenter_id, :id

  data = begin
    collection.get(datacenter_id, id)
  rescue Excon::Errors::SocketError
    nil
  end

  return unless data

  new_attributes = data.attributes
  merge_attributes(new_attributes)
  self
end
restore_snapshot(snapshot_id) click to toggle source
# File lib/fog/profitbricks/models/compute/volume.rb, line 111
def restore_snapshot(snapshot_id)
  requires :datacenter_id, :id

  options = {}
  options[:snapshot_id] = snapshot_id if snapshot_id

  service.restore_volume_snapshot(datacenter_id, id, options)
  true
end
save() click to toggle source
# File lib/fog/profitbricks/models/compute/volume.rb, line 48
def save
  requires :datacenter_id, :size, :type

  options = {}
  options[:name]          = name if name
  options[:size]          = size
  options[:bus]           = bus if bus
  options[:image]         = image if image
  options[:type]          = type
  options[:licenceType]   = licence_type if licence_type
  options[:imagePassword] = image_password if image_password
  options[:sshKeys]       = ssh_keys if ssh_keys

  data = service.create_volume(datacenter_id, options)
  merge_attributes(flatten(data.body))
  true
end
update() click to toggle source
# File lib/fog/profitbricks/models/compute/volume.rb, line 66
def update
  requires :datacenter_id, :id

  options = {}
  options[:name] = name if name
  options[:size] = size if size

  data = service.update_volume(datacenter_id, id, options)
  merge_attributes(flatten(data.body))
  true
end