class Fog::Compute::Packet::Volume
Volume
Model
Public Class Methods
new(attributes = {})
click to toggle source
Calls superclass method
# File lib/fog/compute/packet/models/volume.rb, line 28 def initialize(attributes = {}) super end
Public Instance Methods
attach(device_id)
click to toggle source
# File lib/fog/compute/packet/models/volume.rb, line 60 def attach(device_id) requires :id response = service.attach_volume(id, device_id) merge_attributes(response.body) end
destroy()
click to toggle source
# File lib/fog/compute/packet/models/volume.rb, line 74 def destroy requires :id response = service.delete_volume(id) true if response.status == 204 end
detach()
click to toggle source
# File lib/fog/compute/packet/models/volume.rb, line 67 def detach requires :id response = service.detach_volume(id) true if response.status == 204 end
ready?()
click to toggle source
# File lib/fog/compute/packet/models/volume.rb, line 90 def ready? state == "active" end
reload()
click to toggle source
# File lib/fog/compute/packet/models/volume.rb, line 81 def reload requires :id data = service.get_volume(id) return unless data.body merge_attributes(data.body) end
save()
click to toggle source
# File lib/fog/compute/packet/models/volume.rb, line 32 def save requires :project_id, :facility, :plan, :size options = {} options[:size] = size options[:facility] = facility options[:plan] = plan options[:description] = description if description options[:billing_cycle] = billing_cycle if billing_cycle options[:snapshot_policies] = snapshot_policies if snapshot_policies response = service.create_volume(project_id, options) merge_attributes(response.body) end
update()
click to toggle source
# File lib/fog/compute/packet/models/volume.rb, line 47 def update requires :id options = {} options[:description] = description if description options[:billing_cycle] = billing_cycle if billing_cycle options[:size] = size if size options[:locked] = locked if locked response = service.update_volume(id, options) merge_attributes(response.body) end