mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
GetUsageRecordsCmd - NewInputFormat for START_DATE and END_DATE (with time; backward capabile)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
00b6a54dcf
commit
fe29998938
@ -55,13 +55,13 @@ public class GetUsageRecordsCmd extends BaseListCmd {
|
|||||||
@Parameter(name = ApiConstants.END_DATE,
|
@Parameter(name = ApiConstants.END_DATE,
|
||||||
type = CommandType.DATE,
|
type = CommandType.DATE,
|
||||||
required = true,
|
required = true,
|
||||||
description = "End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.")
|
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).")
|
||||||
private Date endDate;
|
private Date endDate;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.START_DATE,
|
@Parameter(name = ApiConstants.START_DATE,
|
||||||
type = CommandType.DATE,
|
type = CommandType.DATE,
|
||||||
required = true,
|
required = true,
|
||||||
description = "Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.")
|
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).")
|
||||||
private Date startDate;
|
private Date startDate;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "List usage records for the specified account")
|
@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "List usage records for the specified account")
|
||||||
|
|||||||
@ -50,6 +50,7 @@ import org.apache.cloudstack.api.Parameter;
|
|||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
|
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
|
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.usage.GetUsageRecordsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
|
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
|
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
|
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
|
||||||
@ -254,9 +255,8 @@ public class ParamProcessWorker implements DispatchWorker {
|
|||||||
case DATE:
|
case DATE:
|
||||||
// This piece of code is for maintaining backward compatibility
|
// This piece of code is for maintaining backward compatibility
|
||||||
// and support both the date formats(Bug 9724)
|
// and support both the date formats(Bug 9724)
|
||||||
// Do the date messaging for ListEventsCmd only
|
|
||||||
if (cmdObj instanceof ListEventsCmd || cmdObj instanceof DeleteEventsCmd || cmdObj instanceof ArchiveEventsCmd ||
|
if (cmdObj instanceof ListEventsCmd || cmdObj instanceof DeleteEventsCmd || cmdObj instanceof ArchiveEventsCmd ||
|
||||||
cmdObj instanceof ArchiveAlertsCmd || cmdObj instanceof DeleteAlertsCmd) {
|
cmdObj instanceof ArchiveAlertsCmd || cmdObj instanceof DeleteAlertsCmd || cmdObj instanceof GetUsageRecordsCmd) {
|
||||||
final boolean isObjInNewDateFormat = isObjInNewDateFormat(paramObj.toString());
|
final boolean isObjInNewDateFormat = isObjInNewDateFormat(paramObj.toString());
|
||||||
if (isObjInNewDateFormat) {
|
if (isObjInNewDateFormat) {
|
||||||
final DateFormat newFormat = BaseCmd.NEW_INPUT_FORMAT;
|
final DateFormat newFormat = BaseCmd.NEW_INPUT_FORMAT;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user