2010-10-04 17:02:08 -04:00
|
|
|
require 'fog/core/collection'
|
2011-01-14 13:41:12 -05:00
|
|
|
require 'fog/compute/models/rackspace/flavor'
|
2010-03-19 21:29:42 -04:00
|
|
|
|
2009-11-15 23:05:59 -05:00
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class Rackspace
|
2009-11-15 23:05:59 -05:00
|
|
|
|
|
|
|
class Flavors < Fog::Collection
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
model Fog::Compute::Rackspace::Flavor
|
2009-11-15 23:05:59 -05:00
|
|
|
|
|
|
|
def all
|
2010-03-06 23:02:10 -05:00
|
|
|
data = connection.list_flavors_detail.body['flavors']
|
|
|
|
load(data)
|
2009-11-15 23:05:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(flavor_id)
|
2010-03-19 21:29:42 -04:00
|
|
|
data = connection.get_flavor_details(flavor_id).body['flavor']
|
|
|
|
new(data)
|
2011-06-16 19:28:54 -04:00
|
|
|
rescue Fog::Compute::Rackspace::NotFound
|
2009-11-15 23:05:59 -05:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|