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/go_grid/models/compute/images.rb

34 lines
658 B
Ruby
Raw Normal View History

2010-10-11 02:16:40 -04:00
require 'fog/core/collection'
require 'fog/go_grid/models/compute/image'
2010-10-11 02:16:40 -04:00
module Fog
module Compute
class GoGrid
2010-10-11 02:16:40 -04:00
class Images < Fog::Collection
model Fog::Compute::GoGrid::Image
2010-10-11 02:16:40 -04:00
attribute :server
def all
data = service.grid_image_list.body['list']
2010-10-11 02:16:40 -04:00
load(data)
if server
self.replace(self.select {|image| image.server_id == server.id})
end
2010-10-11 02:16:40 -04:00
end
def get(image_id)
response = service.grid_image_get.body['list'][image_id]
new(data)
rescue Fog::Compute::GoGrid::NotFound
2010-10-11 02:16:40 -04:00
nil
end
end
end
end
end