Sha256: 0f0bccc7656cfde8e311991903f0ec1f88e6642bf3e2e2507536200feab17afa

Contents?: true

Size: 949 Bytes

Versions: 60

Compression:

Stored size: 949 Bytes

Contents

module CloudstackClient

	module Zone

	  ##
    # Finds the zone with the specified name.

    def get_zone(name)
      params = {
          'command' => 'listZones',
          'available' => 'true'
      }
      json = send_request(params)

      networks = json['zone']
      return nil unless networks

      networks.each { |z|
        if z['name'] == name then
          return z
        end
      }

      nil
    end

    ##
    # Finds the default zone for your account.

    def get_default_zone
      params = {
          'command' => 'listZones',
          'available' => 'true'
      }
      json = send_request(params)

      zones = json['zone']
      return nil unless zones

      zones.first
    end

    ##
    # Lists all available zones.

    def list_zones
      params = {
          'command' => 'listZones',
          'available' => 'true'
      }
      json = send_request(params)
      json['zone'] || []
    end

	end

end

Version data entries

60 entries across 60 versions & 3 rubygems

Version Path
cloudstack_client-0.9.7 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.9.6 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.9.5 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.9.3 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.9.2 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.9.1 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.9.0 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.8.0 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.7.1 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.7.0 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.6.4 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.6.3 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.6.2 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.6.0 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.6.1 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.5.0 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.4.4 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.4.3 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.4.2 lib/cloudstack_client/commands/zone.rb
cloudstack_client-0.4.1 lib/cloudstack_client/commands/zone.rb