mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Added create/update functionality.
This commit is contained in:
parent
847712e0ae
commit
a648f9d4eb
1 changed files with 11 additions and 5 deletions
|
@ -16,22 +16,28 @@ module Fog
|
|||
attribute :encryption_cipher, :aliases => 'encryption:cipher'
|
||||
|
||||
def save
|
||||
requires :identity
|
||||
connection.update_drive(identity, attributes)
|
||||
connection.update_drive(identity, allowed_attributes)
|
||||
true
|
||||
end
|
||||
|
||||
def create(attributes)
|
||||
requires :name
|
||||
connection.create_drive(attributes)
|
||||
true
|
||||
requires :size
|
||||
attributes = Fog::Compute::Serverlove::Drive.new(attributes).allowed_attributes
|
||||
Fog::Compute::Serverlove::Drive.new(connection.create_drive(attributes).body)
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :identity
|
||||
connection.destroy_drive(identity)
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def allowed_attributes
|
||||
allowed = [:name, :size]
|
||||
attributes.select {|k,v| allowed.include? k}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue