Updated Branches: refs/heads/api_refactoring 4b75132aa -> 32ca9e2aa
api: Annotate ListRoutersCmd, fix @Entity for Network,User,VPC Response 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/32ca9e2a Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/32ca9e2a Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/32ca9e2a Branch: refs/heads/api_refactoring Commit: 32ca9e2aa4e2265a483911ef91208d0be84f3269 Parents: a9df2cb Author: Rohit Yadav <[email protected]> Authored: Tue Dec 18 17:42:11 2012 -0800 Committer: Rohit Yadav <[email protected]> Committed: Tue Dec 18 17:44:18 2012 -0800 ---------------------------------------------------------------------- .../api/command/admin/router/ListRoutersCmd.java | 33 ++++++++------- .../cloudstack/api/response/NetworkResponse.java | 3 +- .../cloudstack/api/response/UserVmResponse.java | 4 +- .../cloudstack/api/response/VpcResponse.java | 3 + 4 files changed, 26 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/32ca9e2a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java index 1995384..334c85c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java @@ -20,13 +20,16 @@ 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.DomainRouterResponse; +import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.async.AsyncJob; @@ -40,34 +43,34 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="host") - @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID of the router") + @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class, + description="the host ID of the router") private Long hostId; - @IdentityMapper(entityTableName="vm_instance") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the disk router") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class, + description="the ID of the disk router") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the router") private String routerName; - @IdentityMapper(entityTableName="host_pod_ref") - @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the router") + @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class, + description="the Pod ID of the router") private Long podId; @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the router") private String state; - @IdentityMapper(entityTableName="data_center") - @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the router") + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, + description="the Zone ID of the router") private Long zoneId; - @IdentityMapper(entityTableName="networks") - @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="list by network id") + @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class, + description="list by network id") private Long networkId; - @IdentityMapper(entityTableName="vpc") - @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="List networks by VPC") + @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType=VpcResponse.class, + description="List networks by VPC") private Long vpcId; @Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC routers") http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/32ca9e2a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java index fe71371..f5110c7 100644 --- a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response; import java.util.List; +import com.cloud.network.Network; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.Entity; @@ -26,7 +27,7 @@ import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") -@Entity(value = ProjectAccount.class) +@Entity(value = {Network.class, ProjectAccount.class}) public class NetworkResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the id of the network") http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/32ca9e2a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java index bea841f..767ee0f 100644 --- a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java +++ b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java @@ -20,6 +20,8 @@ import java.util.Date; import java.util.HashSet; import java.util.Set; +import com.cloud.network.router.VirtualRouter; +import com.cloud.uservm.UserVm; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.Entity; @@ -28,7 +30,7 @@ import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") -@Entity(value = VirtualMachine.class) +@Entity(value={VirtualMachine.class, UserVm.class, VirtualRouter.class}) public class UserVmResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the virtual machine") private String id; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/32ca9e2a/api/src/org/apache/cloudstack/api/response/VpcResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/VpcResponse.java b/api/src/org/apache/cloudstack/api/response/VpcResponse.java index d23337f..d0666f4 100644 --- a/api/src/org/apache/cloudstack/api/response/VpcResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VpcResponse.java @@ -19,12 +19,15 @@ package org.apache.cloudstack.api.response; import java.util.Date; import java.util.List; +import com.cloud.network.vpc.Vpc; import org.apache.cloudstack.api.ApiConstants; import com.cloud.serializer.Param; import com.cloud.utils.IdentityProxy; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Entity; +@Entity(value=Vpc.class) @SuppressWarnings("unused") public class VpcResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName("id") @Param(description="the id of the VPC")
