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-03 04:11:45 -04:00
|
|
|
class Servers
|
2009-11-15 23:05:59 -05:00
|
|
|
|
|
|
|
class Flavors < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Rackspace::Servers::Flavor
|
|
|
|
|
|
|
|
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-06-02 22:52:31 -04:00
|
|
|
rescue Fog::Rackspace::Servers::NotFound
|
2009-11-15 23:05:59 -05:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|