From 4e2b30d31dc944800ec37db6113b5b9b98d38941 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Sat, 22 Dec 2012 19:09:18 -0800 Subject: [PATCH] api: Annotate vpc admin apis Signed-off-by: Rohit Yadav --- .../command/admin/vpc/CreatePrivateGatewayCmd.java | 11 ++++++----- .../command/admin/vpc/DeletePrivateGatewayCmd.java | 6 +++--- .../api/command/admin/vpc/DeleteVPCOfferingCmd.java | 8 +++----- .../api/command/admin/vpc/UpdateVPCOfferingCmd.java | 5 ++--- .../api/response/PrivateGatewayResponse.java | 3 +++ 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java index 800a54c0d35..3126e6de105 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.command.admin.vpc; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; +import org.apache.cloudstack.api.response.VpcResponse; 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; @@ -48,8 +49,8 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="physical_network") - @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the Physical Network ID the network belongs to") + @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class, + description="the Physical Network ID the network belongs to") private Long physicalNetworkId; @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="the gateway of the Private gateway") @@ -64,8 +65,8 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, required=true, description="the Vlan for the private gateway") private String vlan; - @IdentityMapper(entityTableName="vpc") - @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, required=true, description="the VPC network belongs to") + @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType = VpcResponse.class, + required=true, description="the VPC network belongs to") private Long vpcId; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java index 01576e85ce4..53b6ba1572d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java @@ -16,12 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.admin.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.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,8 +44,8 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="vpc_gateways") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the private gateway") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = PrivateGatewayResponse.class, + required=true, description="the ID of the private gateway") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java index 6d81f2e80ae..71f4148f6d8 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java @@ -16,12 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.admin.vpc; +import org.apache.cloudstack.api.response.VpcOfferingResponse; 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; @@ -38,11 +38,10 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd{ //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="vpc_offerings") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the VPC offering") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = VpcOfferingResponse.class, + required=true, description="the ID of the VPC offering") private Long id; - ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -51,7 +50,6 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd{ return id; } - ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java index 0fa03cab189..c2fcbc81d06 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.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 UpdateVPCOfferingCmd extends BaseAsyncCmd{ //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="vpc_offerings") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the VPC offering") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = VpcOfferingResponse.class, + description="the id of the VPC offering") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the VPC offering") diff --git a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java index 143a61aa618..0bbc66a24d2 100644 --- a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java +++ b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java @@ -15,11 +15,14 @@ // specific language governing permissions and limitations // under the License. package org.apache.cloudstack.api.response; +import com.cloud.network.vpc.VpcGateway; 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=VpcGateway.class) @SuppressWarnings("unused") public class PrivateGatewayResponse extends BaseResponse implements ControlledEntityResponse{