cloudstack-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nik Martin <nik.mar...@nfinausa.com>
Subject Usage API Paging question
Date Fri, 11 Jan 2013 15:51:44 GMT
Could someone post some pseudocode on how to use paging when processing 
usage reports? I'm having a bit of trouble getting my head wrapped around 
this.

Here's pseudocode for what I have right now:
default.page.size: 2000

var page=1
usage = api.listusage{domain:xxx, page:page, pagesize: 2000, 
startdate:xx-xx-xxxx, enddate: xx-xx-xxxx};

while usage.length = 2000{
 	//there are more records
 	page+=1;
 	usage= usage + api.listusage{domain:xxx, page:page, pagesize: 
2000,
startdate:xx-xx-xxxx, enddate: xx-xx-xxxx};
}

Is this in line with what I should be doing?  As long as the number of 
records is 2000, it can be assumes that there are more records, so I 
should fetch until usage.length < 2000.


Regards,

Nik

Nik Martin
+1.251.243.0043 x1003
Relentless Reliability


Mime
View raw message