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-nagios-0.3.1 lib/cloudstack-client/commands/zone.rb
cloudstack-nagios-0.3.0 lib/cloudstack-client/commands/zone.rb
cloudstack-nagios-0.2.0 lib/cloudstack-client/commands/zone.rb
cloudstack-nagios-0.1.3 lib/cloudstack-client/commands/zone.rb
cloudstack-nagios-0.1.1 lib/cloudstack-client/commands/zone.rb
cloudstack-nagios-0.1.0 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.11 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.10 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.9 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.8 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.7 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.6 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.5 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.4 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.3 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.2 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.3.1 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.2.2 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.2.1 lib/cloudstack-client/commands/zone.rb
cloudstack-cli-0.2.0 lib/cloudstack-client/commands/zone.rb