From 7e3c0ec0028c42110197785d9bf2df6ba88b5dc1 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Sat, 22 Dec 2012 16:18:50 -0800 Subject: [PATCH] api: Annotate resource apis Signed-off-by: Rohit Yadav --- .../command/admin/resource/ListAlertsCmd.java | 4 ++-- .../command/admin/resource/ListCapacityCmd.java | 16 +++++++++------- .../cloudstack/api/response/AlertResponse.java | 3 +++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java index 32dc3d96799..5dbb1649cb6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java @@ -42,8 +42,8 @@ public class ListAlertsCmd extends BaseListCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName="alert") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the alert") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AlertResponse.class, + description = "the ID of the alert") private Long id; @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "list by alert type") diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java index bd3634a8a9b..e6e4c7a5b9a 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java @@ -23,11 +23,13 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.CapacityResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.ClusterResponse; +import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.capacity.Capacity; import com.cloud.exception.InvalidParameterValueException; @@ -43,16 +45,16 @@ public class ListCapacityCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="data_center") - @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists capacity by the Zone ID") + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class, + description="lists capacity by the Zone ID") private Long zoneId; - @IdentityMapper(entityTableName="host_pod_ref") - @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="lists capacity by the Pod ID") + @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType = PodResponse.class, + description="lists capacity by the Pod ID") private Long podId; - @IdentityMapper(entityTableName="cluster") - @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, since="3.0.0", description="lists capacity by the Cluster ID") + @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType = ClusterResponse.class, + since="3.0.0", description="lists capacity by the Cluster ID") private Long clusterId; @Parameter(name=ApiConstants.FETCH_LATEST, type=CommandType.BOOLEAN, since="3.0.0", description="recalculate capacities and fetch the latest") diff --git a/api/src/org/apache/cloudstack/api/response/AlertResponse.java b/api/src/org/apache/cloudstack/api/response/AlertResponse.java index fdadd974de3..f81f07e7863 100644 --- a/api/src/org/apache/cloudstack/api/response/AlertResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AlertResponse.java @@ -18,11 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; +import com.cloud.alert.Alert; import org.apache.cloudstack.api.ApiConstants; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Entity; +@Entity(value=Alert.class) @SuppressWarnings("unused") public class AlertResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the id of the alert")