1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Set up drive objects (not disks).

This commit is contained in:
Sean Handley 2012-04-27 14:43:52 +01:00
parent 86ac91ac22
commit 5cc1b4699e
4 changed files with 32 additions and 28 deletions

View file

@ -11,6 +11,10 @@ module Fog
request_path 'fog/serverlove/requests/compute'
request :get_drives
model_path 'fog/serverlove/models/compute'
model :drive
collection :drives
class Mock
def initialize(options)

View file

@ -1,25 +0,0 @@
require 'fog/core/collection'
require 'fog/serverlove/models/compute/disk'
module Fog
module Compute
class Serverlove
class Disks < Fog::Collection
model Fog::Compute::Serverlove::Disk
def all
data = connection.get_disks.body['disks']
load(data)
end
def get(disk_id)
connection.get_disk(image_id)
end
end
end
end
end

View file

@ -4,7 +4,7 @@ module Fog
module Compute
class Serverlove
class Disk < Fog::Model
class Drive < Fog::Model
identity :drive
@ -13,7 +13,7 @@ module Fog
attribute :size
attribute :claimed
attribute :status
attribute :encryption:cipher
attribute :encryption_cipher
def save
# TODO
@ -21,7 +21,7 @@ module Fog
def destroy
requires :identity
connection.destroy_disk(identity)
connection.destroy_drive(identity)
true
end
end

View file

@ -0,0 +1,25 @@
require 'fog/core/collection'
require 'fog/serverlove/models/compute/drive'
module Fog
module Compute
class Serverlove
class Drives < Fog::Collection
model Fog::Compute::Serverlove::Drive
def all
data = connection.get_drives.body
load(data)
end
def get(drive_id)
connection.get_drive(drive_id)
end
end
end
end
end