Sha256: e8c7ea449edc0b14eec749f999f627fb20b5df1b3e431a614730e2b681509d64

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

module CloudstackClient

	module Volume

		##
    # Lists all volumes.

    def list_volumes(args = {})
      params = {
          'command' => 'listVolumes',
          'listall' => true,
      }

      if args[:zone]
        zone = get_zone(args[:zone])
        unless zone 
          puts "Error: Zone #{args[:zone]} not found"
          exit 1
        end
        params['zoneid'] = zone['id']  
      end

      if args[:account]
        if account = list_accounts(name: args[:account]).first
          params['domainid'] = account["domainid"]
          params['account'] = args[:account]
        end
      end

      params['projectid'] = args[:project_id] if args[:project_id]
      params['type'] = args[:type] if args[:type]
      params['keyword'] = args[:keyword] if args[:keyword]
      params['name'] = args[:name] if args[:name]
  
      json = send_request(params)
      json['volume'] || []
    end

	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloudstack_client-0.3.6 lib/cloudstack_client/commands/volume.rb