1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/serverlove/models/compute/drive.rb

48 lines
1 KiB
Ruby
Raw Normal View History

require 'fog/core/model'
module Fog
module Compute
class Serverlove
2012-04-27 09:43:52 -04:00
class Drive < Fog::Model
identity :drive
attribute :name
attribute :user
attribute :size
attribute :claimed
attribute :status
2012-04-27 09:55:06 -04:00
attribute :encryption_cipher, :aliases => 'encryption:cipher'
def save
attributes = {}
if(identity)
attributes = connection.update_drive(identity, allowed_attributes).body
else
requires :name
requires :size
attributes = connection.create_drive(allowed_attributes).body
end
merge_attributes(attributes)
self
end
def destroy
requires :identity
2012-04-27 09:43:52 -04:00
connection.destroy_drive(identity)
self
2012-04-29 09:14:17 -04:00
end
def allowed_attributes
allowed = [:name, :size]
attributes.select {|k,v| allowed.include? k}
end
end
end
end
end