Skip to content

Commit fe29998

Browse files
svscorpyadvr
authored andcommitted
GetUsageRecordsCmd - NewInputFormat for START_DATE and END_DATE (with time; backward capabile)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 00b6a54 commit fe29998

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ public class GetUsageRecordsCmd extends BaseListCmd {
5555
@Parameter(name = ApiConstants.END_DATE,
5656
type = CommandType.DATE,
5757
required = true,
58-
description = "End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.")
58+
description = "End date range for usage record query (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\", e.g. startDate=2015-01-01 or startdate=2015-01-01 10:30:00).")
5959
private Date endDate;
6060

6161
@Parameter(name = ApiConstants.START_DATE,
6262
type = CommandType.DATE,
6363
required = true,
64-
description = "Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.")
64+
description = "Start date range for usage record query (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\", e.g. startDate=2015-01-01 or startdate=2015-01-01 11:00:00).")
6565
private Date startDate;
6666

6767
@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "List usage records for the specified account")

server/src/com/cloud/api/dispatch/ParamProcessWorker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import org.apache.cloudstack.api.ServerApiException;
5151
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
5252
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
53+
import org.apache.cloudstack.api.command.admin.usage.GetUsageRecordsCmd;
5354
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
5455
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
5556
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
@@ -254,9 +255,8 @@ private void setFieldValue(final Field field, final BaseCmd cmdObj, final Object
254255
case DATE:
255256
// This piece of code is for maintaining backward compatibility
256257
// and support both the date formats(Bug 9724)
257-
// Do the date messaging for ListEventsCmd only
258258
if (cmdObj instanceof ListEventsCmd || cmdObj instanceof DeleteEventsCmd || cmdObj instanceof ArchiveEventsCmd ||
259-
cmdObj instanceof ArchiveAlertsCmd || cmdObj instanceof DeleteAlertsCmd) {
259+
cmdObj instanceof ArchiveAlertsCmd || cmdObj instanceof DeleteAlertsCmd || cmdObj instanceof GetUsageRecordsCmd) {
260260
final boolean isObjInNewDateFormat = isObjInNewDateFormat(paramObj.toString());
261261
if (isObjInNewDateFormat) {
262262
final DateFormat newFormat = BaseCmd.NEW_INPUT_FORMAT;

0 commit comments

Comments
 (0)