2010-03-19 21:29:42 -04:00
|
|
|
require 'fog/collection'
|
|
|
|
require 'fog/rackspace/models/servers/flavor'
|
|
|
|
|
2009-11-15 23:05:59 -05:00
|
|
|
module Fog
|
|
|
|
module Rackspace
|
2010-09-08 16:50:23 -04:00
|
|
|
class Compute
|
2009-11-15 23:05:59 -05:00
|
|
|
|
|
|
|
class Flavors < Fog::Collection
|
|
|
|
|
2010-09-08 16:50:23 -04:00
|
|
|
model Fog::Rackspace::Compute::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)
|
2010-09-08 16:50:23 -04:00
|
|
|
rescue Fog::Rackspace::Compute::NotFound
|
2009-11-15 23:05:59 -05:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|