1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/google/models/compute/flavors.rb

30 lines
613 B
Ruby
Raw Normal View History

2012-10-22 17:15:33 -07:00
require 'fog/core/collection'
2012-12-04 12:01:36 -08:00
require 'fog/google/models/compute/flavor'
2012-10-22 17:15:33 -07:00
module Fog
module Compute
2012-12-04 12:05:11 -08:00
class Google
2012-10-22 17:15:33 -07:00
class Flavors < Fog::Collection
2012-12-04 12:05:11 -08:00
model Fog::Compute::Google::Flavor
2012-10-22 17:15:33 -07:00
def all
zone = service.list_zones.body['items'].first
data = connection.list_machine_types(zone['name']).body["items"]
2012-10-22 17:15:33 -07:00
load(data)
end
def get(identity, zone_name = nil)
data = connection.get_machine_type(identity, zone_name).body
2012-10-22 17:15:33 -07:00
new(data)
rescue Excon::Errors::NotFound
nil
end
end
end
end
end