Sha256: d108018f0102e53d77ba3b9649fc34c1ccb9560edc6d1b0936306d297b5f2671

Contents?: true

Size: 1.46 KB

Versions: 6

Compression:

Stored size: 1.46 KB

Contents

module CloudstackClient

	module Iso

		##
    # Lists all isos that match the specified filter.
    #
    # Allowable filter values are:
    #
    # * featured - isos that are featured and are public
    # * self - isos that have been registered/created by the owner
    # * self-executable - isos that have been registered/created by the owner that can be used to deploy a new VM
    # * executable - all isos that can be used to deploy a new VM
    # * community - isos that are public

    def list_isos(args = {})
      filter = args[:filter] || 'featured'
      params = {
          'command' => 'listIsos',
          'templateFilter' => filter
      }
      params['projectid'] = args[:project_id] if args[:project_id]
      params['zoneid'] = args[:zone_id] if args[:zone_id]
      
      json = send_request(params)
      json['iso'] || []
    end

    ##
    # Finds the template with the specified name.

    def get_iso(name)

      # TODO: use name parameter
      # listIsos in CloudStack 2.2 doesn't seem to work
      # when the name parameter is specified. When this is fixed,
      # the name parameter should be added to the request.
      params = {
          'command' => 'listIsos',
          'templateFilter' => 'executable'
      }
      json = send_request(params)

      isos = json['iso']
      if !isos then
        return nil
      end

      isos.each { |t|
        if t['name'] == name then
          return t
        end
      }

      nil
    end

	end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cloudstack-cli-0.3.3 lib/cloudstack-client/commands/iso.rb
cloudstack-cli-0.3.2 lib/cloudstack-client/commands/iso.rb
cloudstack-cli-0.3.1 lib/cloudstack-client/commands/iso.rb
cloudstack-cli-0.2.2 lib/cloudstack-client/commands/iso.rb
cloudstack-cli-0.2.1 lib/cloudstack-client/commands/iso.rb
cloudstack-cli-0.2.0 lib/cloudstack-client/commands/iso.rb