Updated Branches:
  refs/heads/api_refactoring 4e2b30d31 -> 575fab971

api: Annotate account and address 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/575fab97
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/575fab97
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/575fab97

Branch: refs/heads/api_refactoring
Commit: 575fab971103367c8c5c6935ce5c7d49e03e6aba
Parents: 4e2b30d
Author: Rohit Yadav <[email protected]>
Authored: Sat Dec 22 19:52:41 2012 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Sat Dec 22 19:52:41 2012 -0800

----------------------------------------------------------------------
 .../user/account/AddAccountToProjectCmd.java       |    6 +-
 .../user/account/DeleteAccountFromProjectCmd.java  |    6 +-
 .../api/command/user/account/ListAccountsCmd.java  |    5 +-
 .../user/account/ListProjectAccountsCmd.java       |    5 +-
 .../command/user/address/AssociateIPAddrCmd.java   |   22 +++++-----
 .../user/address/DisassociateIPAddrCmd.java        |   11 +++--
 .../user/address/ListPublicIpAddressesCmd.java     |   31 ++++++++-------
 7 files changed, 44 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/575fab97/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
index d010321..74f9143 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
@@ -16,12 +16,12 @@
 // under the License.
 package org.apache.cloudstack.api.command.user.account;
 
+import org.apache.cloudstack.api.response.ProjectResponse;
 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;
@@ -42,8 +42,8 @@ public class AddAccountToProjectCmd extends BaseAsyncCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, 
required=true, description="id of the project to add the account to")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType 
= ProjectResponse.class,
+            required=true, description="id of the project to add the account 
to")
     private Long projectId;
 
     @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, 
description="name of the account to be added to the project")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/575fab97/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
index 74e4385..61bd59c 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
@@ -17,12 +17,12 @@
 package org.apache.cloudstack.api.command.user.account;
 
 import org.apache.cloudstack.api.command.user.project.DeleteProjectCmd;
+import org.apache.cloudstack.api.response.ProjectResponse;
 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;
@@ -41,8 +41,8 @@ public class DeleteAccountFromProjectCmd extends BaseAsyncCmd 
{
     /////////////////////////////////////////////////////
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, 
required=true, description="id of the project to remove the account from")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType 
= ProjectResponse.class,
+            required=true, description="id of the project to remove the 
account from")
     private Long projectId;
 
     @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, 
required=true, description="name of the account to be removed from the project")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/575fab97/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java 
b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
index d4c08f7..6155bcd 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
@@ -23,7 +23,6 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseListDomainResourcesCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.response.AccountResponse;
@@ -43,8 +42,8 @@ public class ListAccountsCmd extends 
BaseListDomainResourcesCmd {
     @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.LONG, 
description="list accounts by account type. Valid account types are 1 (admin), 
2 (domain-admin), and 0 (user).")
     private Long accountType;
 
-    @IdentityMapper(entityTableName="account")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list 
account by account ID")
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = 
AccountResponse.class,
+            description="list account by account ID")
     private Long id;
 
     @Parameter(name=ApiConstants.IS_CLEANUP_REQUIRED, 
type=CommandType.BOOLEAN, description="list accounts by cleanuprequred 
attribute (values are true or false)")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/575fab97/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
index 1d56a60..f24ccf3 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
@@ -20,7 +20,6 @@ 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.ListResponse;
@@ -39,8 +38,8 @@ public class ListProjectAccountsCmd extends BaseListCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, 
required=true, description="id of the project")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType 
= ProjectResponse.class,
+            required=true, description="id of the project")
     private Long projectId;
 
     @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, 
description="list accounts of the project by account name")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/575fab97/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
index 594dff5..f4d4853 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
@@ -24,11 +24,15 @@ import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 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.IPAddressResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
 import com.cloud.async.AsyncJob;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenter.NetworkType;
@@ -58,28 +62,24 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
             description="the account to associate with this IP address")
     private String accountName;
 
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG,
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType 
= DomainResponse.class,
         description="the ID of the domain to associate with this IP address")
     private Long domainId;
 
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG,
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = 
ZoneResponse.class,
         description="the ID of the availability zone you want to acquire an 
public IP address from")
     private Long zoneId;
 
-    @IdentityMapper(entityTableName="networks")
-    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG,
+    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType 
= NetworkResponse.class,
         description="The network this ip address should be associated to.")
     private Long networkId;
 
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG,
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType 
= ProjectResponse.class,
         description="Deploy vm for the project")
     private Long projectId;
 
-    @IdentityMapper(entityTableName="vpc")
-    @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, 
description="the VPC you want the ip address to " +
+    @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType = 
VpcResponse.class,
+            description="the VPC you want the ip address to " +
             "be associated with")
     private Long vpcId;
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/575fab97/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
index bcdf09d..c3d9d39 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
@@ -16,12 +16,13 @@
 // under the License.
 package org.apache.cloudstack.api.command.user.address;
 
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
 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;
@@ -44,14 +45,14 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="user_ip_address")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, 
description="the id of the public ip address" +
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID,entityType = 
IPAddressResponse.class,
+            required=true, description="the id of the public ip address" +
             " to disassociate")
     private Long id;
 
     // unexposed parameter needed for events logging
-    @IdentityMapper(entityTableName="account")
-    @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, 
expose=false)
+    @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType 
= AccountResponse.class,
+            expose=false)
     private Long ownerId;
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/575fab97/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
index fdd19ef..5951b5f 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
@@ -23,16 +23,19 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.response.IPAddressResponse;
 import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.VlanIpRangeResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
 import com.cloud.async.AsyncJob;
 import com.cloud.network.IpAddress;
 import com.cloud.utils.Pair;
 
-
 @Implementation(description="Lists all public ip addresses", 
responseObject=IPAddressResponse.class)
 public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd {
     public static final Logger s_logger = 
Logger.getLogger(ListPublicIpAddressesCmd.class.getName());
@@ -49,30 +52,30 @@ public class ListPublicIpAddressesCmd extends 
BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, 
type=CommandType.BOOLEAN, description="the virtual network for the IP address")
     private Boolean forVirtualNetwork;
 
-    @IdentityMapper(entityTableName="user_ip_address")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="lists 
ip address by id")
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = 
IPAddressResponse.class,
+            description="lists ip address by id")
     private Long id;
 
     @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, 
description="lists the specified IP address")
     private String ipAddress;
 
-    @IdentityMapper(entityTableName="vlan")
-    @Parameter(name=ApiConstants.VLAN_ID, type=CommandType.LONG, 
description="lists all public IP addresses by VLAN ID")
+    @Parameter(name=ApiConstants.VLAN_ID, type=CommandType.UUID, entityType = 
VlanIpRangeResponse.class,
+            description="lists all public IP addresses by VLAN ID")
     private Long vlanId;
 
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, 
description="lists all public IP addresses by Zone ID")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = 
ZoneResponse.class,
+            description="lists all public IP addresses by Zone ID")
     private Long zoneId;
 
     @Parameter(name=ApiConstants.FOR_LOAD_BALANCING, type=CommandType.BOOLEAN, 
description="list only ips used for load balancing")
     private Boolean forLoadBalancing;
 
-    @IdentityMapper(entityTableName="physical_network")
-    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, 
description="lists all public IP addresses by physical network id")
+    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, 
entityType = PhysicalNetworkResponse.class,
+            description="lists all public IP addresses by physical network id")
     private Long physicalNetworkId;
 
-    @IdentityMapper(entityTableName="networks")
-    @Parameter(name=ApiConstants.ASSOCIATED_NETWORK_ID, type=CommandType.LONG, 
description="lists all public IP addresses associated to the network specified")
+    @Parameter(name=ApiConstants.ASSOCIATED_NETWORK_ID, type=CommandType.UUID, 
entityType = NetworkResponse.class,
+            description="lists all public IP addresses associated to the 
network specified")
     private Long associatedNetworkId;
 
     @Parameter(name=ApiConstants.IS_SOURCE_NAT, type=CommandType.BOOLEAN, 
description="list only source nat ip addresses")
@@ -81,8 +84,8 @@ public class ListPublicIpAddressesCmd extends 
BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.IS_STATIC_NAT, type=CommandType.BOOLEAN, 
description="list only static nat ip addresses")
     private Boolean isStaticNat;
 
-    @IdentityMapper(entityTableName="vpc")
-    @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, 
description="List ips belonging to the VPC")
+    @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType = 
VpcResponse.class,
+            description="List ips belonging to the VPC")
     private Long vpcId;
 
     /////////////////////////////////////////////////////

Reply via email to