2011-09-26 02:41:54 -04:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/openstack/models/compute/flavor'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class OpenStack
|
|
|
|
|
|
|
|
class Flavors < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Compute::OpenStack::Flavor
|
|
|
|
|
2013-06-18 11:58:07 -04:00
|
|
|
def all(options = {})
|
|
|
|
data = service.list_flavors_detail(options).body['flavors']
|
2011-09-26 02:41:54 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(flavor_id)
|
2012-12-22 18:24:36 -05:00
|
|
|
data = service.get_flavor_details(flavor_id).body['flavor']
|
2011-09-26 02:41:54 -04:00
|
|
|
new(data)
|
|
|
|
rescue Fog::Compute::OpenStack::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|