From 68dc5a941e94063fe33662558e2daf43efb98f61 Mon Sep 17 00:00:00 2001 From: Sean Handley Date: Fri, 27 Apr 2012 13:25:40 +0100 Subject: [PATCH] Adding server love disk model. Not all attributes included/named properly yet. --- lib/fog/serverlove/models/compute/disk.rb | 34 ++++++++++++++++++++++ lib/fog/serverlove/models/compute/disks.rb | 25 ++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 lib/fog/serverlove/models/compute/disk.rb create mode 100644 lib/fog/serverlove/models/compute/disks.rb diff --git a/lib/fog/serverlove/models/compute/disk.rb b/lib/fog/serverlove/models/compute/disk.rb new file mode 100644 index 000000000..d8881f22c --- /dev/null +++ b/lib/fog/serverlove/models/compute/disk.rb @@ -0,0 +1,34 @@ +require 'fog/core/model' + +module Fog + module Compute + class Serverlove + + class Disk < Fog::Model + + identity :id + + attribute :name + attribute :user + attribute :status + attribute :tags + attribute :size + attribute :claimed? + attribute :claim_type + attribute :imaging? + attribute :readers + attribute :encryption_cipher + + def save + # TODO + end + + def destroy + requires :identity + connection.destroy_disk(identity) + true + end + end + end + end +end diff --git a/lib/fog/serverlove/models/compute/disks.rb b/lib/fog/serverlove/models/compute/disks.rb new file mode 100644 index 000000000..0095fb0ec --- /dev/null +++ b/lib/fog/serverlove/models/compute/disks.rb @@ -0,0 +1,25 @@ +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