Updated Branches:
  refs/heads/api_refactoring 8559b4eab -> 06246ae27

api: Annotate nat 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/06246ae2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/06246ae2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/06246ae2

Branch: refs/heads/api_refactoring
Commit: 06246ae27cbef314eec638248cc9d317f5ff80e0
Parents: 8559b4e
Author: Rohit Yadav <[email protected]>
Authored: Sun Dec 23 03:08:09 2012 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Sun Dec 23 03:08:09 2012 -0800

----------------------------------------------------------------------
 .../user/nat/CreateIpForwardingRuleCmd.java        |    6 +++---
 .../user/nat/DeleteIpForwardingRuleCmd.java        |   12 ++++++------
 .../api/command/user/nat/DisableStaticNatCmd.java  |    6 +++---
 .../api/command/user/nat/EnableStaticNatCmd.java   |   15 ++++++++-------
 .../command/user/nat/ListIpForwardingRulesCmd.java |   15 ++++++++-------
 5 files changed, 28 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/06246ae2/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
index 4a962fb..e056953 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
@@ -18,13 +18,13 @@ package org.apache.cloudstack.api.command.user.nat;
 
 import java.util.List;
 
+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.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;
@@ -51,8 +51,8 @@ public class CreateIpForwardingRuleCmd extends 
BaseAsyncCreateCmd implements Sta
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="user_ip_address")
-    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, 
required=true, description="the public IP address id of the forwarding rule, 
already associated via associateIp")
+    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.UUID, 
entityType = IPAddressResponse.class,
+            required=true, description="the public IP address id of the 
forwarding rule, already associated via associateIp")
     private Long ipAddressId;
 
     @Parameter(name=ApiConstants.START_PORT, type=CommandType.INTEGER, 
required=true, description="the start port for the rule")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/06246ae2/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
index d8fa878..aa3fca2 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
@@ -16,12 +16,13 @@
 // under the License.
 package org.apache.cloudstack.api.command.user.nat;
 
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
 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,14 +43,13 @@ public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd 
{
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="firewall_rules")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, 
description="the id of the forwarding rule")
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = 
FirewallRuleResponse.class,
+            required=true, description="the id of the forwarding rule")
     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/06246ae2/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java 
b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
index e3c2ede..3b5dd02 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
@@ -17,12 +17,12 @@
 package org.apache.cloudstack.api.command.user.nat;
 
 import 
org.apache.cloudstack.api.command.user.firewall.DeletePortForwardingRuleCmd;
+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;
@@ -43,8 +43,8 @@ public class DisableStaticNatCmd extends BaseAsyncCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="user_ip_address")
-    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, 
required=true, description="the public IP address id for which static nat 
feature is being disableed")
+    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.UUID, 
entityType = IPAddressResponse.class,
+            required=true, description="the public IP address id for which 
static nat feature is being disableed")
     private Long ipAddressId;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/06246ae2/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java 
b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
index 5a77a0a..9e6e967 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
@@ -20,11 +20,13 @@ 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.SuccessResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.NetworkRuleConflictException;
 import com.cloud.exception.ResourceUnavailableException;
@@ -42,18 +44,17 @@ public class EnableStaticNatCmd extends BaseCmd{
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="user_ip_address")
-    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, 
required=true, description="the public IP " +
+    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.UUID, 
entityType = IPAddressResponse.class,
+            required=true, description="the public IP " +
             "address id for which static nat feature is being enabled")
     private Long ipAddressId;
 
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, 
required=true, description="the ID of " +
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, 
entityType = UserVmResponse.class,
+            required=true, description="the ID of " +
             "the virtual machine for enabling static nat feature")
     private Long virtualMachineId;
 
-    @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 of the vm the static nat will be enabled 
for." +
                 " Required when public Ip address is not associated with any 
Guest network yet (VPC case)")
     private Long networkId;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/06246ae2/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
index 1560111..255032d 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
@@ -23,12 +23,13 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
 import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
 import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.StaticNatRule;
 import com.cloud.utils.Pair;
@@ -43,16 +44,16 @@ public class ListIpForwardingRulesCmd extends 
BaseListProjectAndAccountResources
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="user_ip_address")
-    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, 
description="list the rule belonging to this public ip address")
+    @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.UUID, 
entityType = IPAddressResponse.class,
+            description="list the rule belonging to this public ip address")
     private Long publicIpAddressId;
 
-    @IdentityMapper(entityTableName="firewall_rules")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists 
rule with the specified ID.")
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = 
FirewallRuleResponse.class,
+            description="Lists rule with the specified ID.")
     private Long id;
 
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, 
description="Lists all rules applied to the specified Vm.")
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, 
entityType = UserVmResponse.class,
+            description="Lists all rules applied to the specified Vm.")
     private Long vmId;
 
     /////////////////////////////////////////////////////

Reply via email to