api: Annotate ListRoutersCmd, fix @Entity for Network,User,VPC Response

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2012-12-18 17:42:11 -08:00
parent a9df2cb0f5
commit 32ca9e2aa4
4 changed files with 26 additions and 17 deletions

View File

@ -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")

View File

@ -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")

View File

@ -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;

View File

@ -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")