Class: Fog::Compute::Rackspace::Images

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/rackspace/models/compute/images.rb

Instance Method Summary collapse

Instance Method Details

#allObject



12
13
14
15
16
17
18
19
20
# File 'lib/fog/rackspace/models/compute/images.rb', line 12

def all
  data = service.list_images_detail.body['images']
  models = load(data)
  if server
    self.replace(self.select {|image| image.server_id == server.id})
  else
    models
  end
end

#get(image_id) ⇒ Object



22
23
24
25
26
27
# File 'lib/fog/rackspace/models/compute/images.rb', line 22

def get(image_id)
  data = service.get_image_details(image_id).body['image']
  new(data)
rescue Fog::Compute::Rackspace::NotFound
  nil
end