Updated Branches: refs/heads/api_refactoring c7e1cb651 -> 6a032e029
api: annotate the vpc related Cmds Signed-off-by: Prasanna Santhanam <[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/6a032e02 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6a032e02 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6a032e02 Branch: refs/heads/api_refactoring Commit: 6a032e0295809105adedfadcc5c322e6c03730c4 Parents: c7e1cb6 Author: Prasanna Santhanam <[email protected]> Authored: Fri Dec 21 14:25:01 2012 -0800 Committer: Prasanna Santhanam <[email protected]> Committed: Fri Dec 21 14:25:48 2012 -0800 ---------------------------------------------------------------------- .../api/command/user/vpc/CreateStaticRouteCmd.java | 7 ++-- .../api/command/user/vpc/CreateVPCCmd.java | 24 +++++++------ .../command/user/vpc/ListPrivateGatewaysCmd.java | 10 +++--- .../api/command/user/vpc/ListStaticRoutesCmd.java | 15 ++++---- .../api/command/user/vpc/ListVPCOfferingsCmd.java | 5 +-- .../api/command/user/vpc/ListVPCsCmd.java | 26 ++++++++------- .../api/command/user/vpc/RestartVPCCmd.java | 5 +-- .../api/command/user/vpc/UpdateVPCCmd.java | 5 +-- .../api/response/StaticRouteResponse.java | 3 ++ .../api/response/VpcOfferingResponse.java | 3 ++ 10 files changed, 55 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java index a1d2c5d..9b674d9 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java @@ -16,12 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.user.vpc; +import org.apache.cloudstack.api.response.PrivateGatewayResponse; 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; @@ -41,9 +41,8 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd{ private static final String s_name = "createstaticrouteresponse"; public static final Logger s_logger = Logger.getLogger(CreateStaticRouteCmd.class.getName()); - @IdentityMapper(entityTableName="vpc_gateways") - @Parameter(name=ApiConstants.GATEWAY_ID, type=CommandType.LONG, required=true, - description="the gateway id we are creating static route for") + @Parameter(name=ApiConstants.GATEWAY_ID, type=CommandType.UUID, entityType=PrivateGatewayResponse.class, + required=true, description="the gateway id we are creating static route for") private Long gatewayId; @Parameter(name = ApiConstants.CIDR, required = true, type = CommandType.STRING, description = "static route cidr") http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java index 111f9fa..b5ad04e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java @@ -16,16 +16,19 @@ // under the License. package org.apache.cloudstack.api.command.user.vpc; +import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.cloudstack.api.response.VpcOfferingResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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.VpcResponse; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -47,17 +50,17 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{ "Must be used with the domainId parameter.") private String accountName; - @IdentityMapper(entityTableName="domain") - @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID associated with the VPC. " + + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, + description="the domain ID associated with the VPC. " + "If used with the account parameter returns the VPC associated with the account for the specified domain.") private Long domainId; - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="create VPC for the project") + @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType=ProjectResponse.class, + description="create VPC for the project") private Long projectId; - @IdentityMapper(entityTableName="data_center") - @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the availability zone") + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, + required=true, description="the ID of the availability zone") private Long zoneId; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the VPC") @@ -71,9 +74,8 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{ "guest networks' cidrs should be within this CIDR") private String cidr; - - @IdentityMapper(entityTableName="vpc_offerings") - @Parameter(name=ApiConstants.VPC_OFF_ID, type=CommandType.LONG, required=true, description="the ID of the VPC offering") + @Parameter(name=ApiConstants.VPC_OFF_ID, type=CommandType.UUID, entityType=VpcOfferingResponse.class, + required=true, description="the ID of the VPC offering") private Long vpcOffering; @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java index 3cde18c..12062c8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java @@ -19,11 +19,11 @@ package org.apache.cloudstack.api.command.user.vpc; import java.util.ArrayList; import java.util.List; +import org.apache.cloudstack.api.response.VpcResponse; 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.ListResponse; @@ -40,8 +40,8 @@ public class ListPrivateGatewaysCmd extends BaseListProjectAndAccountResourcesCm ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="vpc_gateways") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list private gateway by id") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=PrivateGatewayResponse.class, + description="list private gateway by id") private Long id; @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="list gateways by ip address") @@ -50,8 +50,8 @@ public class ListPrivateGatewaysCmd extends BaseListProjectAndAccountResourcesCm @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="list gateways by vlan") private String vlan; - @IdentityMapper(entityTableName="vpc") - @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="list gateways by vpc") + @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType=VpcResponse.class, + description="list gateways by vpc") private Long vpcId; @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list gateways by state") http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java index 173db0c..9efcc6d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java @@ -20,13 +20,14 @@ import java.util.ArrayList; import java.util.List; 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.ListResponse; +import org.apache.cloudstack.api.response.PrivateGatewayResponse; import org.apache.cloudstack.api.response.StaticRouteResponse; import com.cloud.network.vpc.StaticRoute; import com.cloud.utils.Pair; +import org.apache.cloudstack.api.response.VpcResponse; @Implementation(description="Lists all static routes", responseObject=StaticRouteResponse.class) public class ListStaticRoutesCmd extends BaseListTaggedResourcesCmd { @@ -35,16 +36,16 @@ public class ListStaticRoutesCmd extends BaseListTaggedResourcesCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="static_routes") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list static route by id") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=StaticRouteResponse.class, + description="list static route by id") private Long id; - @IdentityMapper(entityTableName="vpc") - @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="list static routes by vpc id") + @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType=VpcResponse.class, + description="list static routes by vpc id") private Long vpcId; - @IdentityMapper(entityTableName="vpc_gateways") - @Parameter(name=ApiConstants.GATEWAY_ID, type=CommandType.LONG, description="list static routes by gateway id") + @Parameter(name=ApiConstants.GATEWAY_ID, type=CommandType.UUID, entityType=PrivateGatewayResponse.class, + description="list static routes by gateway id") private Long gatewayId; public Long getId() { http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java index 04b2d9a..d10eac7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java @@ -23,7 +23,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; @@ -38,8 +37,8 @@ public class ListVPCOfferingsCmd extends BaseListCmd{ ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="vpc_offerings") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list VPC offerings by id") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VpcOfferingResponse.class, + description="list VPC offerings by id") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list VPC offerings by name") http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java index 9a244c3..e9a7e29 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java @@ -19,15 +19,17 @@ package org.apache.cloudstack.api.command.user.vpc; import java.util.ArrayList; import java.util.List; +import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.cloudstack.api.response.VpcOfferingResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ListResponse; 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.ListResponse; -import org.apache.cloudstack.api.response.VpcResponse; import com.cloud.network.vpc.Vpc; @@ -38,13 +40,13 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd{ ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// - ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="vpc") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list VPC by id") + //////////////////////////////////////////////////// + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VpcResponse.class, + description="list VPC by id") private Long id; - @IdentityMapper(entityTableName="data_center") - @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list by zone") + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, + description="list by zone") private Long zoneId; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list by name of the VPC") @@ -58,16 +60,16 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd{ "guest networks' cidrs should be within this CIDR") private String cidr; - @IdentityMapper(entityTableName="vpc_offerings") - @Parameter(name=ApiConstants.VPC_OFF_ID, type=CommandType.LONG, description="list by ID of the VPC offering") + @Parameter(name=ApiConstants.VPC_OFF_ID, type=CommandType.UUID, entityType=VpcOfferingResponse.class + , description="list by ID of the VPC offering") private Long VpcOffId; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list by account associated with the VPC. " + "Must be used with the domainId parameter.") private String accountName; - @IdentityMapper(entityTableName="domain") - @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="list by domain ID associated with the VPC. " + + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, + description="list by domain ID associated with the VPC. " + "If used with the account parameter returns the VPC associated with the account for the specified domain.") private Long domainId; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java index e954474..47065b4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.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; @@ -43,8 +42,8 @@ public class RestartVPCCmd extends BaseAsyncCmd{ //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="vpc") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the VPC") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VpcResponse.class, + description="the id of the VPC") private Long id; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java index a0c16e1..3299035 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.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; @@ -39,8 +38,8 @@ public class UpdateVPCCmd extends BaseAsyncCmd{ //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="vpc") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the VPC") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VpcResponse.class, + description="the id of the VPC") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the VPC") http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/response/StaticRouteResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/StaticRouteResponse.java b/api/src/org/apache/cloudstack/api/response/StaticRouteResponse.java index 54831fe..bfd2bb1 100644 --- a/api/src/org/apache/cloudstack/api/response/StaticRouteResponse.java +++ b/api/src/org/apache/cloudstack/api/response/StaticRouteResponse.java @@ -18,11 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; +import com.cloud.network.vpc.StaticRoute; 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=StaticRoute.class) @SuppressWarnings("unused") public class StaticRouteResponse extends BaseResponse implements ControlledEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the ID of static route") http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6a032e02/api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java index 9ea47f9..8395612 100644 --- a/api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java @@ -19,11 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; import java.util.List; +import com.cloud.network.vpc.VpcOffering; 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=VpcOffering.class) @SuppressWarnings("unused") public class VpcOfferingResponse extends BaseResponse { @SerializedName("id") @Param(description="the id of the vpc offering")
