Updated Branches:
  refs/heads/api_refactoring 93532ea28 -> e9457cb40

api: Annotate Vlan admin apis, fix resource, storagepool, systemvm apis

Signed-off-by: Rohit Yadav <[email protected]>


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

Branch: refs/heads/api_refactoring
Commit: e9457cb40712d2bb4d015c3d1daa3973ca17aac8
Parents: f3f0962
Author: Rohit Yadav <[email protected]>
Authored: Sat Dec 22 17:31:16 2012 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Sat Dec 22 17:31:16 2012 -0800

----------------------------------------------------------------------
 .../api/command/admin/resource/ListAlertsCmd.java  |    1 -
 .../command/admin/storagepool/DeletePoolCmd.java   |    2 -
 .../command/admin/systemvm/StartSystemVMCmd.java   |    1 -
 .../command/admin/systemvm/UpgradeSystemVMCmd.java |    2 -
 .../command/admin/vlan/CreateVlanIpRangeCmd.java   |   31 ++++++++-----
 .../command/admin/vlan/DeleteVlanIpRangeCmd.java   |    6 +-
 .../command/admin/vlan/ListVlanIpRangesCmd.java    |   35 ++++++++------
 .../api/response/VlanIpRangeResponse.java          |    3 +
 8 files changed, 44 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e9457cb4/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 5dbb164..cbccc2f 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
@@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
 import com.cloud.alert.Alert;
 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.AlertResponse;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e9457cb4/api/src/org/apache/cloudstack/api/command/admin/storagepool/DeletePoolCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/storagepool/DeletePoolCmd.java
 
b/api/src/org/apache/cloudstack/api/command/admin/storagepool/DeletePoolCmd.java
index bc14ca3..84cfdd5 100644
--- 
a/api/src/org/apache/cloudstack/api/command/admin/storagepool/DeletePoolCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/admin/storagepool/DeletePoolCmd.java
@@ -21,7 +21,6 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
@@ -39,7 +38,6 @@ public class DeletePoolCmd extends BaseCmd {
     // ////////////// API parameters /////////////////////
     // ///////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="storage_pool")
     @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = 
StoragePoolResponse.class,
             required = true, description = "Storage pool id")
     private Long id;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e9457cb4/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
 
b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
index fccd4a7..94bd5dc 100644
--- 
a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
@@ -21,7 +21,6 @@ import org.apache.log4j.Logger;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e9457cb4/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
 
b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
index d530c14..77d812a 100644
--- 
a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
@@ -16,14 +16,12 @@
 // under the License.
 package org.apache.cloudstack.api.command.admin.systemvm;
 
-import com.cloud.offering.DiskOffering;
 import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
 import org.apache.cloudstack.api.response.DiskOfferingResponse;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e9457cb4/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
 
b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
index 2ae907b..d9b9557 100644
--- 
a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
@@ -20,11 +20,16 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
 import org.apache.cloudstack.api.response.VlanIpRangeResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
 import com.cloud.dc.Vlan;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
@@ -45,12 +50,12 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
     @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, 
description="account who will own the VLAN. If VLAN is Zone wide, this 
parameter should be ommited")
     private String accountName;
 
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, 
description="project who will own the VLAN. If VLAN is Zone wide, this 
parameter should be ommited")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType 
= ProjectResponse.class,
+            description="project who will own the VLAN. If VLAN is Zone wide, 
this parameter should be ommited")
     private Long projectId;
 
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, 
description="domain ID of the account owning a VLAN")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType 
= DomainResponse.class,
+            description="domain ID of the account owning a VLAN")
     private Long domainId;
 
     @Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, 
description="the ending IP address in the VLAN IP range")
@@ -65,8 +70,8 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
     @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, 
description="the netmask of the VLAN IP range")
     private String netmask;
 
-    @IdentityMapper(entityTableName="host_pod_ref")
-    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, 
description="optional parameter. Have to be specified for Direct Untagged vlan 
only.")
+    @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType = 
PodResponse.class,
+            description="optional parameter. Have to be specified for Direct 
Untagged vlan only.")
     private Long podId;
 
     @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, 
required=true, description="the beginning IP address in the VLAN IP range")
@@ -76,16 +81,16 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
             " will be defaulted to the vlan of the network or if vlan of the 
network is null - to Untagged")
     private String vlan;
 
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, 
description="the Zone ID of the VLAN IP range")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = 
ZoneResponse.class,
+            description="the Zone ID of the VLAN IP range")
     private Long zoneId;
 
-    @IdentityMapper(entityTableName="networks")
-    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, 
description="the network id")
+    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType 
= NetworkResponse.class,
+            description="the network id")
     private Long networkID;
 
-    @IdentityMapper(entityTableName="physical_network")
-    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, 
description="the physical network id")
+    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, 
entityType = PhysicalNetworkResponse.class,
+            description="the physical network id")
     private Long physicalNetworkId;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e9457cb4/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
 
b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
index 5286152..3700dbd 100644
--- 
a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
@@ -16,11 +16,11 @@
 // under the License.
 package org.apache.cloudstack.api.command.admin.vlan;
 
+import org.apache.cloudstack.api.response.VlanIpRangeResponse;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
@@ -37,8 +37,8 @@ public class DeleteVlanIpRangeCmd extends BaseCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="vlan")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, 
description="the id of the VLAN IP range")
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = 
VlanIpRangeResponse.class,
+            required=true, description="the id of the VLAN IP range")
     private Long id;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e9457cb4/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java 
b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
index 6f7186a..1cb3ea2 100644
--- 
a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
@@ -23,10 +23,15 @@ 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.DomainResponse;
 import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.cloudstack.api.response.VlanIpRangeResponse;
 import com.cloud.dc.Vlan;
 import com.cloud.utils.Pair;
@@ -44,38 +49,38 @@ public class ListVlanIpRangesCmd extends BaseListCmd {
     @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, 
description="the account with which the VLAN IP range is associated. Must be 
used with the domainId parameter.")
     private String accountName;
 
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, 
description="project who will own the VLAN")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType 
= ProjectResponse.class,
+            description="project who will own the VLAN")
     private Long projectId;
 
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, 
description="the domain ID with which the VLAN IP range is associated.  If used 
with the account parameter, returns all VLAN IP ranges for that account in the 
specified domain.")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType 
= DomainResponse.class,
+            description="the domain ID with which the VLAN IP range is 
associated.  If used with the account parameter, returns all VLAN IP ranges for 
that account in the specified domain.")
     private Long domainId;
 
-    @IdentityMapper(entityTableName="vlan")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=false, 
description="the ID of the VLAN IP range")
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = 
VlanIpRangeResponse.class,
+            required=false, description="the ID of the VLAN IP range")
     private Long id;
 
-    @IdentityMapper(entityTableName="host_pod_ref")
-    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, 
description="the Pod ID of the VLAN IP range")
+    @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType = 
PodResponse.class,
+            description="the Pod ID of the VLAN IP range")
     private Long podId;
 
     @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, 
description="the ID or VID of the VLAN. Default is an \"untagged\" VLAN.")
     private String vlan;
 
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, 
description="the Zone ID of the VLAN IP range")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = 
ZoneResponse.class,
+            description="the Zone ID of the VLAN IP range")
     private Long zoneId;
 
-    @IdentityMapper(entityTableName="networks")
-    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, 
description="network id of the VLAN IP range")
+    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType 
= NetworkResponse.class,
+            description="network id of the VLAN IP range")
     private Long networkId;
 
     @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, 
type=CommandType.BOOLEAN, description="true if VLAN is of Virtual type, false 
if Direct")
     private Boolean forVirtualNetwork;
 
-    @IdentityMapper(entityTableName="physical_network")
-    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, 
description="physical network id of the VLAN IP range")
+    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, 
entityType = PhysicalNetworkResponse.class,
+            description="physical network id of the VLAN IP range")
     private Long physicalNetworkId;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e9457cb4/api/src/org/apache/cloudstack/api/response/VlanIpRangeResponse.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/response/VlanIpRangeResponse.java 
b/api/src/org/apache/cloudstack/api/response/VlanIpRangeResponse.java
index 5a3a236..1e8fcf4 100644
--- a/api/src/org/apache/cloudstack/api/response/VlanIpRangeResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/VlanIpRangeResponse.java
@@ -16,11 +16,14 @@
 // under the License.
 package org.apache.cloudstack.api.response;
 
+import com.cloud.dc.Vlan;
 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=Vlan.class)
 @SuppressWarnings("unused")
 public class VlanIpRangeResponse extends BaseResponse implements 
ControlledEntityResponse{
     @SerializedName(ApiConstants.ID) @Param(description="the ID of the VLAN IP 
range")

Reply via email to