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/cloudstack/models/compute/zones.rb
2012-05-16 16:06:13 -07:00

33 lines
706 B
Ruby

require 'fog/core/collection'
require 'fog/cloudstack/models/compute/zone'
module Fog
module Compute
class Cloudstack
class Zones < Fog::Collection
model Fog::Compute::Cloudstack::Zone
def all(filters={})
options = {
'templatefilter' => 'self'
}.merge(filters)
data = connection.list_zones(options)["listzonesresponse"]["zone"] || []
load(data)
end
def get(zone_id)
if zone = connection.list_zones('id' => zone_id)["listzonesresponse"]["zone"].first
new(zone)
end
rescue Fog::Compute::Cloudstack::BadRequest
nil
end
end
end
end
end