You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/23 01:33:16 UTC

git commit: api: Annotate resource apis

Updated Branches:
  refs/heads/api_refactoring 97514a069 -> 7e3c0ec00


api: Annotate resource apis

Signed-off-by: Rohit Yadav <bh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7e3c0ec0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7e3c0ec0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7e3c0ec0

Branch: refs/heads/api_refactoring
Commit: 7e3c0ec0028c42110197785d9bf2df6ba88b5dc1
Parents: 97514a0
Author: Rohit Yadav <bh...@apache.org>
Authored: Sat Dec 22 16:18:50 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Sat Dec 22 16:18:50 2012 -0800

----------------------------------------------------------------------
 .../api/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(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7e3c0ec0/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
----------------------------------------------------------------------
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 32dc3d9..5dbb164 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")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7e3c0ec0/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
----------------------------------------------------------------------
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 bd3634a..e6e4c7a 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")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7e3c0ec0/api/src/org/apache/cloudstack/api/response/AlertResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/AlertResponse.java b/api/src/org/apache/cloudstack/api/response/AlertResponse.java
index fdadd97..f81f07e 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")