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
Carlos Sanchez 347dc96761 [google] Zone is a required parameter of machine_types request
Fixes ArgumentError: Missing required parameters: zone when calling get_machine_type
2013-09-26 21:49:37 +02:00

29 lines
613 B
Ruby

require 'fog/core/collection'
require 'fog/google/models/compute/flavor'
module Fog
module Compute
class Google
class Flavors < Fog::Collection
model Fog::Compute::Google::Flavor
def all
zone = service.list_zones.body['items'].first
data = connection.list_machine_types(zone['name']).body["items"]
load(data)
end
def get(identity, zone_name = nil)
data = connection.get_machine_type(identity, zone_name).body
new(data)
rescue Excon::Errors::NotFound
nil
end
end
end
end
end