cloudstack-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kishan Kavala <Kishan.Kav...@citrix.com>
Subject RE: Usage API Paging question
Date Fri, 18 Jan 2013 11:58:22 GMT


> -----Original Message-----
> From: Nik Martin [mailto:nik.martin@nfinausa.com]
> Sent: Friday, 11 January 2013 9:22 PM
> To: cloudstack-users@incubator.apache.org
> Subject: Usage API Paging question
> 
> 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}; }


[KK]  This should instead be: 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.
> 
[KK] Yes, you need to fetch until length < 2000
> 
> Regards,
> 
> Nik
> 
> Nik Martin
> +1.251.243.0043 x1003
> Relentless Reliability


Mime
View raw message