class Fog::Storage::IBM::Volume
Constants
- STATES
Public Instance Methods
attach(instance_id)
click to toggle source
# File lib/fog/ibm/models/storage/volume.rb, line 46 def attach(instance_id) requires :id service.attach_volume(instance_id, id).body['success'] end
attached?()
click to toggle source
# File lib/fog/ibm/models/storage/volume.rb, line 42 def attached? state == "Attached" end
created_at()
click to toggle source
# File lib/fog/ibm/models/storage/volume.rb, line 56 def created_at Time.at(attributes[:created_at].to_f / 1000) end
destroy()
click to toggle source
# File lib/fog/ibm/models/storage/volume.rb, line 60 def destroy requires :id service.delete_volume(id) true end
detach(instance_id)
click to toggle source
# File lib/fog/ibm/models/storage/volume.rb, line 51 def detach(instance_id) requires :id service.detach_volume(instance_id, id).body['success'] end
instance()
click to toggle source
# File lib/fog/ibm/models/storage/volume.rb, line 66 def instance return nil if instance_id.nil? || instance_id == "0" || instance_id == "" Fog::Compute[:ibm].servers.get(instance_id) end
location()
click to toggle source
# File lib/fog/ibm/models/storage/volume.rb, line 71 def location requires :location_id Fog::Compute[:ibm].locations.get(location_id) end
ready?()
click to toggle source
Are we ready to be attached to an instance?
# File lib/fog/ibm/models/storage/volume.rb, line 77 def ready? # TODO: Not sure if this is the only state we should be matching. state == "Detached" end
save()
click to toggle source
# File lib/fog/ibm/models/storage/volume.rb, line 82 def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? requires :name, :offering_id, :format, :location_id, :size data = service.create_volume(name, offering_id, format, location_id, size) merge_attributes(data.body) true end
state()
click to toggle source
# File lib/fog/ibm/models/storage/volume.rb, line 90 def state STATES[attributes[:state]] end