Chiradeep: The date generated in CloudMonkey is going to be consumed by server/src/com/cloud/api/ApiServer.java. Yes, I think I can make it configurable. I ran a simple test. You can compare the test code against server/src/com/cloud/api/ApiServer.java::verifyRequest(). The test code:
import java.io.*; import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.text.ParseException; public class MySimpleDateFormat { private static final DateFormat DateFormatToUse = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); public void checkTime(String expires) { Date expiresTS = null; try { expiresTS = DateFormatToUse.parse(expires); } catch (final ParseException pe) { System.out.println("Incorrect date format for Expires parameter" + pe.getMessage()); } final Date now = new Date(System.currentTimeMillis()); System.out.println("now: " + now.toString() + ", expires: " + expiresTS.toString()); } public static void main (String[] args) { if (args.length != 1) { System.out.println("Usage: MySimpleDateFormat <expires>"); System.exit(0); } MySimpleDateFormat msdf = new MySimpleDateFormat(); msdf.checkTime(args[0]); } } >From Python: >>> (datetime.datetime.utcnow() + datetime.timedelta(minutes=10)).isoformat() '2014-04-07T20:25:07.406023' Here are the JAVA test results: (1) USLT-205731:JAVA yichi.lu$ java MySimpleDateFormat 2014-04-07T20:25:07.406023 Incorrect date format for Expires parameterUnparseable date: "2014-04-07T20:25:07.406023" Exception in thread "main" java.lang.NullPointerException at MySimpleDateFormat.checkTime(MySimpleDateFormat.java:19) at MySimpleDateFormat.main(MySimpleDateFormat.java:28) (2) USLT-205731:JAVA yichi.lu$ java MySimpleDateFormat 2014-04-07T20:25:07 Incorrect date format for Expires parameterUnparseable date: "2014-04-07T20:25:07" Exception in thread "main" java.lang.NullPointerException at MySimpleDateFormat.checkTime(MySimpleDateFormat.java:19) at MySimpleDateFormat.main(MySimpleDateFormat.java:28) (3) USLT-205731:JAVA yichi.lu$ java MySimpleDateFormat 2014-04-07T20:25:07Z Incorrect date format for Expires parameterUnparseable date: "2014-04-07T20:25:07Z" Exception in thread "main" java.lang.NullPointerException at MySimpleDateFormat.checkTime(MySimpleDateFormat.java:19) at MySimpleDateFormat.main(MySimpleDateFormat.java:28) (4) USLT-205731:JAVA yichi.lu$ java MySimpleDateFormat 2014-04-07T20:25:07+0300 now: Mon Apr 07 15:17:04 CDT 2014, expires: Mon Apr 07 12:25:07 CDT 2014 (5) USLT-205731:JAVA yichi.lu$ java MySimpleDateFormat 2014-04-07T20:25:07-0530 now: Mon Apr 07 15:17:29 CDT 2014, expires: Mon Apr 07 20:55:07 CDT 2014 Yichi On Mon, Apr 7, 2014 at 11:51 AM, Chiradeep Vittal <chirade...@gmail.com>wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/19941/#review39692 > ----------------------------------------------------------- > > > > cloudmonkey/requester.py > <https://reviews.apache.org/r/19941/#comment72272> > > Seems overly complicated! This should work? > datetime.utcnow() + timedelta(minutes=expires) > > > > cloudmonkey/requester.py > <https://reviews.apache.org/r/19941/#comment72273> > > Can you make this configurable in the config? > > > - Chiradeep Vittal > > > On April 2, 2014, 4:39 p.m., Yichi Lu wrote: > > > > ----------------------------------------------------------- > > This is an automatically generated e-mail. To reply, visit: > > https://reviews.apache.org/r/19941/ > > ----------------------------------------------------------- > > > > (Updated April 2, 2014, 4:39 p.m.) > > > > > > Review request for cloudstack, Chiradeep Vittal and Rohit Yadav. > > > > > > Repository: cloudstack-git > > > > > > Description > > ------- > > > > When submitting cloudmonkey commands, include signature version (3) and > expiration date (10 minutes) to the commnds > > > > > > Diffs > > ----- > > > > cloudmonkey/requester.py b06e1fc > > server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java > 7a73b8a > > > > Diff: https://reviews.apache.org/r/19941/diff/ > > > > > > Testing > > ------- > > > > The request for area west of utc (0): > > request: [('signatureversion', '3'), ('apiKey', > '1h41nLKEg-3uO3TSWBQ_twEBfWGY2Uu0WrWkbvgWA_ogvKF-6By6GGTscPjyktVWHVAnmSD3BIXA9sNWMcfidQ'), > ('command', u'listUsers'), ('response', 'json'), ('expires', > '2014-04-01T17:30:26+0600')] > > seen by ApiServer.java: > > org.apache.cloudstack.api.command.admin.user.ListUsersCmd@5574c56e, > params: {expires=2014-04-01T17:30:26+0600, signatureversion=3, > httpmethod=GET, > apiKey=1h41nLKEg-3uO3TSWBQ_twEBfWGY2Uu0WrWkbvgWA_ogvKF-6By6GGTscPjyktVWHVAnmSD3BIXA9sNWMcfidQ, > signature=i6qW1tC3y1oIvXIHc29EUs2nSR8=} > > > > The one for area east of utc(0): > > request: [('signatureversion', '3'), ('apiKey', > '1h41nLKEg-3uO3TSWBQ_twEBfWGY2Uu0WrWkbvgWA_ogvKF-6By6GGTscPjyktVWHVAnmSD3BIXA9sNWMcfidQ'), > ('command', u'listUsers'), ('response', 'json'), ('expires', > '2014-04-01T21:16:45-0630')] > > org.apache.cloudstack.api.command.admin.user.ListUsersCmd@3484bd18, > params: {expires=2014-04-01T21:16:45-0630, signatureversion=3, > httpmethod=GET, > apiKey=1h41nLKEg-3uO3TSWBQ_twEBfWGY2Uu0WrWkbvgWA_ogvKF-6By6GGTscPjyktVWHVAnmSD3BIXA9sNWMcfidQ, > signature=9RDS6RWAz9vs4XHa6LRXxtd7MhQ=} > > > > > > Thanks, > > > > Yichi Lu > > > > > >