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

[voxel|compute] Updates reference to service

This commit is contained in:
Paul Thornthwaite 2012-12-22 23:22:08 +00:00
parent 00068859b9
commit b24877b9ed
3 changed files with 9 additions and 9 deletions

View file

@ -10,12 +10,12 @@ module Fog
model Fog::Compute::Voxel::Image model Fog::Compute::Voxel::Image
def all def all
data = connection.images_list.body['images'] data = service.images_list.body['images']
load(data) load(data)
end end
def get(image_id) def get(image_id)
data = connection.images_list(image_id).body['images'] data = service.images_list(image_id).body['images']
if data.empty? if data.empty?
nil nil

View file

@ -22,13 +22,13 @@ module Fog
def destroy def destroy
requires :id requires :id
connection.voxcloud_delete(id) service.voxcloud_delete(id)
true true
end end
def image def image
requires :image_id requires :image_id
connection.images.get(image_id) service.images.get(image_id)
end end
def ready? def ready?
@ -45,19 +45,19 @@ module Fog
def reboot def reboot
requires :id requires :id
connection.devices_power(id, :reboot) service.devices_power(id, :reboot)
true true
end end
def state def state
@state ||= connection.voxcloud_status(id).body['devices'].first['status'] @state ||= service.voxcloud_status(id).body['devices'].first['status']
end end
def save def save
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
requires :name, :image_id, :processing_cores, :facility, :disk_size requires :name, :image_id, :processing_cores, :facility, :disk_size
data = connection.voxcloud_create({ data = service.voxcloud_create({
:disk_size => disk_size, :disk_size => disk_size,
:facility => facility, :facility => facility,
:hostname => name, :hostname => name,

View file

@ -9,12 +9,12 @@ module Fog
model Fog::Compute::Voxel::Server model Fog::Compute::Voxel::Server
def all def all
data = connection.devices_list.body['devices'].select {|device| device['type']['id'] == '3'} data = service.devices_list.body['devices'].select {|device| device['type']['id'] == '3'}
load(data) load(data)
end end
def get(device_id) def get(device_id)
if device_id && server = connection.devices_list(device_id).body['devices'] if device_id && server = service.devices_list(device_id).body['devices']
new(server.first) new(server.first)
end end
rescue Fog::Service::Error => error rescue Fog::Service::Error => error