Sha256: 148429fb560e080fc2a564abfc6230c4317ce5e457439ec1c848812386ec9c85

Contents?: true

Size: 706 Bytes

Versions: 13

Compression:

Stored size: 706 Bytes

Contents

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

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/cloudstack/models/compute/zones.rb
fog-nirvanix-1.8.1 lib/fog/cloudstack/models/compute/zones.rb
fog-parser-fix-1.6.1 lib/fog/cloudstack/models/compute/zones.rb
fog-test-again-1.6.0 lib/fog/cloudstack/models/compute/zones.rb
fog-parser-fix-1.6.0 lib/fog/cloudstack/models/compute/zones.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/cloudstack/models/compute/zones.rb
fog-sgonyea-1.8.1 lib/fog/cloudstack/models/compute/zones.rb
fog-1.8.0 lib/fog/cloudstack/models/compute/zones.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/cloudstack/models/compute/zones.rb
fog-1.7.0 lib/fog/cloudstack/models/compute/zones.rb
fog-1.6.0 lib/fog/cloudstack/models/compute/zones.rb
fog-1.5.0 lib/fog/cloudstack/models/compute/zones.rb
fog-1.4.0 lib/fog/cloudstack/models/compute/zones.rb