You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/08 04:29:51 UTC

[21/57] api: Refactor command and response classes to org.apache.cloudstack.api.*

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/CreateStaticRouteCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/CreateStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/CreateStaticRouteCmd.java
deleted file mode 100644
index bcd1bbb..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/CreateStaticRouteCmd.java
+++ /dev/null
@@ -1,149 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-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;
-import com.cloud.api.response.StaticRouteResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.NetworkRuleConflictException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.vpc.StaticRoute;
-import com.cloud.network.vpc.VpcGateway;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Creates a static route", responseObject=StaticRouteResponse.class)
-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")
-    private Long gatewayId;
-
-    @Parameter(name = ApiConstants.CIDR, required = true, type = CommandType.STRING, description = "static route cidr")
-    private String cidr;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-    public long getGatewayId() {
-        return gatewayId;
-    }
-
-    public String getCidr() {
-        return cidr;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public void create() throws ResourceAllocationException {
-        try {
-            StaticRoute result = _vpcService.createStaticRoute(getGatewayId(), getCidr());
-            setEntityId(result.getId());
-        } catch (NetworkRuleConflictException ex) {
-            s_logger.info("Network rule conflict: " + ex.getMessage());
-            s_logger.trace("Network rule conflict: ", ex);
-            throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
-        }
-    }
-
-    @Override
-    public String getEntityTable() {
-        return "static_routes";
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_STATIC_ROUTE_CREATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "creating static route";
-    }
-
-    @Override
-    public void execute() throws ResourceUnavailableException {
-        boolean success = false;
-        StaticRoute route = _entityMgr.findById(StaticRoute.class, getEntityId());
-        try {
-            UserContext.current().setEventDetails("Static route Id: " + getEntityId());
-            success = _vpcService.applyStaticRoutes(route.getVpcId());
-
-            // State is different after the route is applied, so get new object here
-            route = _entityMgr.findById(StaticRoute.class, getEntityId());
-            StaticRouteResponse routeResponse = new StaticRouteResponse();
-            if (route != null) {
-                routeResponse = _responseGenerator.createStaticRouteResponse(route);
-                setResponseObject(routeResponse);
-            }
-            routeResponse.setResponseName(getCommandName());
-        } finally {
-            if (!success || route == null) {
-                _vpcService.revokeStaticRoute(getEntityId());
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create static route");
-            }
-        }
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-         VpcGateway gateway =  _vpcService.getVpcGateway(gatewayId);
-         if (gateway == null) {
-             throw new InvalidParameterValueException("Invalid gateway id is specified");
-         }
-         return _vpcService.getVpc(gateway.getVpcId()).getAccountId();
-    }
-
-    @Override
-    public String getSyncObjType() {
-        return BaseAsyncCmd.vpcSyncObject;
-    }
-
-    @Override
-    public Long getSyncObjId() {
-        VpcGateway gateway =  _vpcService.getVpcGateway(gatewayId);
-        if (gateway == null) {
-            throw new InvalidParameterValueException("Invalid id is specified for the gateway");
-        }
-        return gateway.getVpcId();
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.StaticRoute;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/CreateVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/CreateVPCCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/CreateVPCCmd.java
deleted file mode 100644
index c56f715..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/CreateVPCCmd.java
+++ /dev/null
@@ -1,189 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-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 com.cloud.api.response.VpcResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Creates a VPC", responseObject=VpcResponse.class)
-public class CreateVPCCmd extends BaseAsyncCreateCmd{
-    public static final Logger s_logger = Logger.getLogger(CreateVPCCmd.class.getName());
-    private static final String s_name = "createvpcresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the 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="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")
-    private Long projectId;
-
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, 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")
-    private String vpcName;
-
-    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of " +
-            "the VPC")
-    private String displayText;
-
-    @Parameter(name=ApiConstants.CIDR, type=CommandType.STRING, required=true, description="the cidr of the VPC. All VPC " +
-            "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")
-    private Long vpcOffering;
-
-    @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING,
-            description="VPC network domain. All networks inside the VPC will belong to this domain")
-    private String networkDomain;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public Long getZoneId() {
-        return zoneId;
-    }
-
-    public String getVpcName() {
-        return vpcName;
-    }
-
-    public String getCidr() {
-        return cidr;
-    }
-
-    public String getDisplayText() {
-        return displayText;
-    }
-
-    public Long getVpcOffering() {
-        return vpcOffering;
-    }
-
-    public String getNetworkDomain() {
-        return networkDomain;
-    }
-
-    @Override
-    public void create() throws ResourceAllocationException {
-        Vpc vpc = _vpcService.createVpc(getZoneId(), getVpcOffering(), getEntityOwnerId(), getVpcName(), getDisplayText(),
-                getCidr(), getNetworkDomain());
-        if (vpc != null) {
-            this.setEntityId(vpc.getId());
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC");
-        }
-    }
-
-    @Override
-    public void execute() {
-        Vpc vpc = null;
-        try {
-             if (_vpcService.startVpc(this.getEntityId(), true)) {
-                 vpc = _vpcService.getVpc(getEntityId());
-             }
-        } catch (ResourceUnavailableException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
-        } catch (ConcurrentOperationException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
-        } catch (InsufficientCapacityException ex) {
-            s_logger.info(ex);
-            s_logger.trace(ex);
-            throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
-        }
-
-        if (vpc != null) {
-            VpcResponse response = _responseGenerator.createVpcResponse(vpc);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC");
-        }
-    }
-
-    @Override
-    public String getEntityTable() {
-        return "vpc";
-    }
-
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VPC_CREATE;
-    }
-
-
-    @Override
-    public String getEventDescription() {
-        return  "creating VPC. Id: " + getEntityId();
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
-        if (accountId == null) {
-            return UserContext.current().getCaller().getId();
-        }
-
-        return accountId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteStaticRouteCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteStaticRouteCmd.java
deleted file mode 100644
index 1235729..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteStaticRouteCmd.java
+++ /dev/null
@@ -1,124 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-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;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.vpc.StaticRoute;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Deletes a static route", responseObject=SuccessResponse.class)
-public class DeleteStaticRouteCmd extends BaseAsyncCmd{
-    public static final Logger s_logger = Logger.getLogger(DeleteStaticRouteCmd.class.getName());
-    private static final String s_name = "deletestaticrouteresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="static_routes")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the static route")
-    private Long id;
-
-    // unexposed parameter needed for events logging
-    @IdentityMapper(entityTableName="account")
-    @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, expose=false)
-    private Long ownerId;
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_STATIC_ROUTE_DELETE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  ("Deleting static route id=" + id);
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        if (ownerId == null) {
-            StaticRoute route = _entityMgr.findById(StaticRoute.class, id);
-            if (route == null) {
-                throw new InvalidParameterValueException("Unable to find static route by id=" + id);
-            } else {
-                ownerId = route.getAccountId();
-            }
-        }
-        return ownerId;
-    }
-
-    @Override
-    public void execute() throws ResourceUnavailableException {
-        UserContext.current().setEventDetails("Route Id: " + id);
-        boolean result = _vpcService.revokeStaticRoute(id);
-
-        if (result) {
-            SuccessResponse response = new SuccessResponse(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete static route");
-        }
-    }
-
-
-    @Override
-    public String getSyncObjType() {
-        return BaseAsyncCmd.vpcSyncObject;
-    }
-
-    @Override
-    public Long getSyncObjId() {
-        StaticRoute route =  _vpcService.getStaticRoute(id);
-        if (route == null) {
-            throw new InvalidParameterValueException("Invalid id is specified for the static route");
-        }
-        return route.getVpcId();
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.StaticRoute;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteVPCCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteVPCCmd.java
deleted file mode 100644
index 78dbfc1..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteVPCCmd.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-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;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.user.Account;
-
-
-@Implementation(description="Deletes a VPC", responseObject=SuccessResponse.class)
-public class DeleteVPCCmd extends BaseAsyncCmd{
-    public static final Logger s_logger = Logger.getLogger(DeleteVPCCmd.class.getName());
-    private static final String s_name = "deletevpcresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vpc")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the VPC")
-    private Long id;
-
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VPC_DELETE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Deleting VPC id=" + getId();
-    }
-
-    @Override
-    public void execute() {
-        try {
-            boolean result = _vpcService.deleteVpc(getId());
-            if (result) {
-                SuccessResponse response = new SuccessResponse(getCommandName());
-                this.setResponseObject(response);
-            } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC");
-            }
-        }catch (ResourceUnavailableException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
-        } catch (ConcurrentOperationException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
-        }
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Vpc vpc = _entityMgr.findById(Vpc.class, getId());
-        if (vpc != null) {
-            return vpc.getAccountId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/ListPrivateGatewaysCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/ListPrivateGatewaysCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/ListPrivateGatewaysCmd.java
deleted file mode 100644
index a76b07f..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/ListPrivateGatewaysCmd.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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 com.cloud.api.response.ListResponse;
-import com.cloud.api.response.PrivateGatewayResponse;
-import com.cloud.network.vpc.PrivateGateway;
-import com.cloud.utils.Pair;
-
-@Implementation(description="List private gateways", responseObject=PrivateGatewayResponse.class)
-public class ListPrivateGatewaysCmd extends BaseListProjectAndAccountResourcesCmd{
-    public static final Logger s_logger = Logger.getLogger(ListPrivateGatewaysCmd.class.getName());
-
-    private static final String s_name = "listprivategatewaysresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="vpc_gateways")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list private gateway by id")
-    private Long id;
-
-    @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="list gateways by ip address")
-    private String ipAddress;
-
-    @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")
-    private Long vpcId;
-
-    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list gateways by state")
-    private String state;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getVlan() {
-        return vlan;
-    }
-
-    public String getIpAddress() {
-        return ipAddress;
-    }
-
-    public Long getVpcId() {
-        return vpcId;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getState() {
-        return state;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public void execute() {
-        Pair<List<PrivateGateway>, Integer> gateways = _vpcService.listPrivateGateway(this);
-        ListResponse<PrivateGatewayResponse> response = new ListResponse<PrivateGatewayResponse>();
-        List<PrivateGatewayResponse> projectResponses = new ArrayList<PrivateGatewayResponse>();
-        for (PrivateGateway gateway : gateways.first()) {
-            PrivateGatewayResponse gatewayResponse = _responseGenerator.createPrivateGatewayResponse(gateway);
-            projectResponses.add(gatewayResponse);
-        }
-        response.setResponses(projectResponses, gateways.second());
-        response.setResponseName(getCommandName());
-
-        this.setResponseObject(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/ListStaticRoutesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/ListStaticRoutesCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/ListStaticRoutesCmd.java
deleted file mode 100644
index e5ae9f0..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/ListStaticRoutesCmd.java
+++ /dev/null
@@ -1,86 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-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 com.cloud.api.response.ListResponse;
-import com.cloud.api.response.StaticRouteResponse;
-import com.cloud.network.vpc.StaticRoute;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists all static routes", responseObject=StaticRouteResponse.class)
-public class ListStaticRoutesCmd extends BaseListTaggedResourcesCmd {
-    private static final String s_name = "liststaticroutesresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="static_routes")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, 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")
-    private Long vpcId;
-
-    @IdentityMapper(entityTableName="vpc_gateways")
-    @Parameter(name=ApiConstants.GATEWAY_ID, type=CommandType.LONG, description="list static routes by gateway id")
-    private Long gatewayId;
-
-    public Long getId() {
-        return id;
-    }
-
-    public Long getVpcId() {
-        return vpcId;
-    }
-
-    public Long getGatewayId() {
-        return gatewayId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public void execute(){
-        Pair<List<? extends StaticRoute>, Integer> result = _vpcService.listStaticRoutes(this);
-        ListResponse<StaticRouteResponse> response = new ListResponse<StaticRouteResponse>();
-        List<StaticRouteResponse> routeResponses = new ArrayList<StaticRouteResponse>();
-
-        for (StaticRoute route : result.first()) {
-            StaticRouteResponse ruleData = _responseGenerator.createStaticRouteResponse(route);
-            routeResponses.add(ruleData);
-        }
-        response.setResponses(routeResponses, result.second());
-        response.setResponseName(getCommandName());
-        this.setResponseObject(response);
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/ListVPCOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/ListVPCOfferingsCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/ListVPCOfferingsCmd.java
deleted file mode 100644
index 727b43c..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/ListVPCOfferingsCmd.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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 com.cloud.api.response.ListResponse;
-import com.cloud.api.response.VpcOfferingResponse;
-import com.cloud.network.vpc.VpcOffering;
-
-@Implementation(description="Lists VPC offerings", responseObject=VpcOfferingResponse.class)
-public class ListVPCOfferingsCmd extends BaseListCmd{
-    public static final Logger s_logger = Logger.getLogger(ListVPCOfferingsCmd.class.getName());
-    private static final String _name = "listvpcofferingsresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="vpc_offerings")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list VPC offerings by id")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list VPC offerings by name")
-    private String vpcOffName;
-
-    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="list VPC offerings by display text")
-    private String displayText;
-
-    @Parameter(name=ApiConstants.IS_DEFAULT, type=CommandType.BOOLEAN, description="true if need to list only default " +
-            "VPC offerings. Default value is false")
-    private Boolean isDefault;
-
-    @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING,
-            description="list VPC offerings supporting certain services")
-    private List<String> supportedServices;
-
-    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list VPC offerings by state")
-    private String state;
-
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-    public Long getId() {
-        return id;
-    }
-
-    public String getVpcOffName() {
-        return vpcOffName;
-    }
-
-    public String getDisplayText() {
-        return displayText;
-    }
-
-    public Boolean getIsDefault() {
-        return isDefault;
-    }
-
-    public List<String> getSupportedServices() {
-        return supportedServices;
-    }
-
-    public String getState() {
-        return state;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public void execute(){
-        List<? extends VpcOffering> offerings = _vpcService.listVpcOfferings(getId(), getVpcOffName(), getDisplayText(),
-                getSupportedServices(), isDefault, this.getKeyword(), getState(), this.getStartIndex(), this.getPageSizeVal());
-        ListResponse<VpcOfferingResponse> response = new ListResponse<VpcOfferingResponse>();
-        List<VpcOfferingResponse> offeringResponses = new ArrayList<VpcOfferingResponse>();
-        for (VpcOffering offering : offerings) {
-            VpcOfferingResponse offeringResponse = _responseGenerator.createVpcOfferingResponse(offering);
-            offeringResponses.add(offeringResponse);
-        }
-
-        response.setResponses(offeringResponses);
-        response.setResponseName(getCommandName());
-        this.setResponseObject(response);
-    }
-
-
-    @Override
-    public String getCommandName() {
-        return _name;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/ListVPCsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/ListVPCsCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/ListVPCsCmd.java
deleted file mode 100644
index 657dbd8..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/ListVPCsCmd.java
+++ /dev/null
@@ -1,159 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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 com.cloud.api.response.ListResponse;
-import com.cloud.api.response.VpcResponse;
-import com.cloud.network.vpc.Vpc;
-
-
-@Implementation(description="Lists VPCs", responseObject=VpcResponse.class)
-public class ListVPCsCmd extends BaseListTaggedResourcesCmd{
-    public static final Logger s_logger = Logger.getLogger(ListVPCsCmd.class.getName());
-    private static final String s_name = "listvpcsresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="vpc")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list VPC by id")
-    private Long id;
-
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list by zone")
-    private Long zoneId;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list by name of the VPC")
-    private String vpcName;
-
-    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="List by display text of " +
-            "the VPC")
-    private String displayText;
-
-    @Parameter(name=ApiConstants.CIDR, type=CommandType.STRING, description="list by cidr of the VPC. All VPC " +
-            "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")
-    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. " +
-            "If used with the account parameter returns the VPC associated with the account for the specified domain.")
-    private Long domainId;
-
-    @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING,
-            description="list VPC supporting certain services")
-    private List<String> supportedServices;
-
-    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list VPCs by state")
-    private String state;
-
-    @Parameter(name=ApiConstants.RESTART_REQUIRED, type=CommandType.BOOLEAN, description="list VPCs by restartRequired option")
-    private Boolean restartRequired;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public Long getZoneId() {
-        return zoneId;
-    }
-
-    public String getVpcName() {
-        return vpcName;
-    }
-
-    public String getCidr() {
-        return cidr;
-    }
-
-    public String getDisplayText() {
-        return displayText;
-    }
-
-    public Long getVpcOffId() {
-        return VpcOffId;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public List<String> getSupportedServices() {
-        return supportedServices;
-    }
-
-    public String getState() {
-        return state;
-    }
-
-    public Boolean getRestartRequired() {
-        return restartRequired;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public void execute() {
-        List<? extends Vpc> vpcs = _vpcService.listVpcs(getId(), getVpcName(), getDisplayText(),
-                getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(),
-                this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), getZoneId(), this.isRecursive(),
-                this.listAll(), getRestartRequired(), getTags(), getProjectId());
-        ListResponse<VpcResponse> response = new ListResponse<VpcResponse>();
-        List<VpcResponse> offeringResponses = new ArrayList<VpcResponse>();
-        for (Vpc vpc : vpcs) {
-            VpcResponse offeringResponse = _responseGenerator.createVpcResponse(vpc);
-            offeringResponses.add(offeringResponse);
-        }
-
-        response.setResponses(offeringResponses);
-        response.setResponseName(getCommandName());
-        this.setResponseObject(response);
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/RestartVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/RestartVPCCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/RestartVPCCmd.java
deleted file mode 100644
index 8421cde..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/RestartVPCCmd.java
+++ /dev/null
@@ -1,110 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-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;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.api.response.VpcResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.user.Account;
-
-@Implementation(description="Restarts a VPC", responseObject=VpcResponse.class)
-public class RestartVPCCmd extends BaseAsyncCmd{
-    public static final Logger s_logger = Logger.getLogger(RestartVPCCmd.class.getName());
-    private static final String _name = "restartvpcresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vpc")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the VPC")
-    private Long id;
-
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public String getCommandName() {
-        return _name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Vpc vpc = _entityMgr.findById(Vpc.class, getId());
-        if (vpc != null) {
-            return vpc.getAccountId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public void execute(){
-        try {
-            boolean result = _vpcService.restartVpc(getId());
-            if (result) {
-                SuccessResponse response = new SuccessResponse(getCommandName());
-                this.setResponseObject(response);
-            } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restart VPC");
-            }
-        } catch (ResourceUnavailableException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
-        } catch (ConcurrentOperationException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
-        } catch (InsufficientCapacityException ex) {
-            s_logger.info(ex);
-            s_logger.trace(ex);
-            throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
-        }
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VPC_RESTART;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "restarting VPC id=" + getId();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpc/command/UpdateVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpc/command/UpdateVPCCmd.java b/api/src/org/apache/cloudstack/api/user/vpc/command/UpdateVPCCmd.java
deleted file mode 100644
index 14b8ce7..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpc/command/UpdateVPCCmd.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpc.command;
-
-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;
-import com.cloud.api.response.VpcResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates a VPC", responseObject=VpcResponse.class)
-public class UpdateVPCCmd extends BaseAsyncCmd{
-    public static final Logger s_logger = Logger.getLogger(UpdateVPCCmd.class.getName());
-    private static final String _name = "updatevpcresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vpc")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the VPC")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the VPC")
-    private String vpcName;
-
-    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the VPC")
-    private String displayText;
-
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getVpcName() {
-        return vpcName;
-    }
-
-    public String getDisplayText() {
-        return displayText;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public String getCommandName() {
-        return _name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Vpc vpc = _entityMgr.findById(Vpc.class, getId());
-        if (vpc != null) {
-            return vpc.getAccountId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public void execute(){
-        Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText());
-        if (result != null) {
-            VpcResponse response = _responseGenerator.createVpcResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update VPC");
-        }
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VPC_UPDATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "updating VPC id=" + getId();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpn/command/CreateRemoteAccessVpnCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpn/command/CreateRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/user/vpn/command/CreateRemoteAccessVpnCmd.java
deleted file mode 100644
index 161c064..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpn/command/CreateRemoteAccessVpnCmd.java
+++ /dev/null
@@ -1,198 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpn.command;
-
-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;
-import com.cloud.api.response.RemoteAccessVpnResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.NetworkRuleConflictException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.IpAddress;
-import com.cloud.network.RemoteAccessVpn;
-
-@Implementation(description="Creates a l2tp/ipsec remote access vpn", responseObject=RemoteAccessVpnResponse.class)
-public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
-    public static final Logger s_logger = Logger.getLogger(CreateRemoteAccessVpnCmd.class.getName());
-
-    private static final String s_name = "createremoteaccessvpnresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="user_ip_address")
-    @Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.LONG, required=true, description="public ip address id of the vpn server")
-    private Long publicIpId;
-
-    @Parameter(name="iprange", type=CommandType.STRING, required=false, description="the range of ip addresses to allocate to vpn clients. The first ip in the range will be taken by the vpn server")
-    private String ipRange;
-
-    @Deprecated
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the VPN. Must be used with domainId.")
-    private String accountName;
-
-    @Deprecated
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the VPN. If the account parameter is used, domainId must also be used.")
-    private Long domainId;
-
-    @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default")
-    private Boolean openFirewall;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getEntityTable() {
-        return "user_ip_address";
-    }
-
-    public Long getPublicIpId() {
-        return publicIpId;
-    }
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public String getIpRange() {
-        return ipRange;
-    }
-
-    public void setIpRange(String ipRange) {
-        this.ipRange = ipRange;
-    }
-
-    public Boolean getOpenFirewall() {
-        if (openFirewall != null) {
-            return openFirewall;
-        } else {
-            return true;
-        }
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        IpAddress ip = _networkService.getIp(publicIpId);
-
-        if (ip == null) {
-            throw new InvalidParameterValueException("Unable to find ip address by id=" + publicIpId);
-        }
-
-        return ip.getAccountId();
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Create Remote Access VPN for account " + getEntityOwnerId() + " using public ip id=" + publicIpId;
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_REMOTE_ACCESS_VPN_CREATE;
-    }
-
-    public long getNetworkId() {
-        IpAddress ip = _entityMgr.findById(IpAddress.class, getPublicIpId());
-        Long ntwkId = null;
-
-        if (ip.getAssociatedWithNetworkId() != null) {
-            ntwkId = ip.getAssociatedWithNetworkId();
-        }
-
-        if (ntwkId == null) {
-            throw new InvalidParameterValueException("Unable to create remote access vpn for the ipAddress id=" + getPublicIpId() +
-                    " as ip is not associated with any network and no networkId is passed in");
-        }
-        return ntwkId;
-    }
-
-    @Override
-    public void create() {
-        try {
-            RemoteAccessVpn vpn = _ravService.createRemoteAccessVpn(publicIpId, ipRange, getOpenFirewall(), getNetworkId());
-            if (vpn != null) {
-                this.setEntityId(vpn.getServerAddressId());
-            } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
-            }
-        } catch (NetworkRuleConflictException e) {
-            s_logger.info("Network rule conflict: " + e.getMessage());
-            s_logger.trace("Network Rule Conflict: ", e);
-            throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
-        }
-    }
-
-    @Override
-    public void execute(){
-        try {
-            RemoteAccessVpn result = _ravService.startRemoteAccessVpn(publicIpId, getOpenFirewall());
-            if (result != null) {
-                RemoteAccessVpnResponse response = _responseGenerator.createRemoteAccessVpnResponse(result);
-                response.setResponseName(getCommandName());
-                this.setResponseObject(response);
-            } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
-            }
-        } catch (ResourceUnavailableException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
-        }
-    }
-
-
-    @Override
-    public String getSyncObjType() {
-        return BaseAsyncCmd.networkSyncObject;
-    }
-
-    @Override
-    public Long getSyncObjId() {
-        return getIp().getAssociatedWithNetworkId();
-    }
-
-    private IpAddress getIp() {
-        IpAddress ip = _networkService.getIp(publicIpId);
-        if (ip == null) {
-            throw new InvalidParameterValueException("Unable to find ip address by id " + publicIpId);
-        }
-        return ip;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnConnectionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnConnectionCmd.java
deleted file mode 100644
index b3d2824..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnConnectionCmd.java
+++ /dev/null
@@ -1,143 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpn.command;
-
-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;
-import com.cloud.api.response.Site2SiteVpnConnectionResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.NetworkRuleConflictException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Site2SiteVpnConnection;
-import com.cloud.network.Site2SiteVpnGateway;
-import com.cloud.network.vpc.Vpc;
-
-@Implementation(description="Create site to site vpn connection", responseObject=Site2SiteVpnConnectionResponse.class)
-public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
-    public static final Logger s_logger = Logger.getLogger(CreateVpnConnectionCmd.class.getName());
-
-    private static final String s_name = "createvpnconnectionresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="s2s_vpn_gateway")
-    @Parameter(name=ApiConstants.S2S_VPN_GATEWAY_ID, type=CommandType.LONG, required=true, description="id of the vpn gateway")
-    private Long vpnGatewayId;
-
-    @IdentityMapper(entityTableName="s2s_customer_gateway")
-    @Parameter(name=ApiConstants.S2S_CUSTOMER_GATEWAY_ID, type=CommandType.LONG, required=true, description="id of the customer gateway")
-    private Long customerGatewayId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getEntityTable() {
-        return "s2s_vpn_connection";
-    }
-
-    public Long getVpnGatewayId() {
-        return vpnGatewayId;
-    }
-
-    public Long getCustomerGatewayId() {
-        return customerGatewayId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Vpc vpc = _vpcService.getVpc(getVpnGateway().getVpcId());
-        return vpc.getAccountId();
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Create site-to-site VPN connection for account " + getEntityOwnerId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_S2S_VPN_CONNECTION_CREATE;
-    }
-
-    @Override
-    public void create() {
-        try {
-            Site2SiteVpnConnection conn = _s2sVpnService.createVpnConnection(this);
-            if (conn != null) {
-                this.setEntityId(conn.getId());
-            } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create site to site vpn connection");
-            }
-        } catch (NetworkRuleConflictException e) {
-            s_logger.info("Network rule conflict: " + e.getMessage());
-            s_logger.trace("Network Rule Conflict: ", e);
-            throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
-        }
-    }
-
-    @Override
-    public void execute(){
-        try {
-            Site2SiteVpnConnection result = _s2sVpnService.startVpnConnection(this.getEntityId());
-            if (result != null) {
-                Site2SiteVpnConnectionResponse response = _responseGenerator.createSite2SiteVpnConnectionResponse(result);
-                response.setResponseName(getCommandName());
-                this.setResponseObject(response);
-            } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create site to site vpn connection");
-            }
-        } catch (ResourceUnavailableException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
-        }
-    }
-
-
-    @Override
-    public String getSyncObjType() {
-        return BaseAsyncCmd.vpcSyncObject;
-    }
-
-    @Override
-    public Long getSyncObjId() {
-        return getVpnGateway().getVpcId();
-    }
-
-    private Site2SiteVpnGateway getVpnGateway() {
-        return _s2sVpnService.getVpnGateway(vpnGatewayId);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnCustomerGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnCustomerGatewayCmd.java
deleted file mode 100644
index 99cb62b..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnCustomerGatewayCmd.java
+++ /dev/null
@@ -1,169 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpn.command;
-
-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;
-import com.cloud.api.response.Site2SiteCustomerGatewayResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.network.Site2SiteCustomerGateway;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Creates site to site vpn customer gateway", responseObject=Site2SiteCustomerGatewayResponse.class)
-public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(CreateVpnCustomerGatewayCmd.class.getName());
-
-    private static final String s_name = "createcustomergatewayresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=false, description="name of this customer gateway")
-    private String name;
-
-    @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="public ip address id of the customer gateway")
-    private String gatewayIp;
-
-    @Parameter(name=ApiConstants.CIDR_LIST, type=CommandType.STRING, required=true, description="guest cidr list of the customer gateway")
-    private String guestCidrList;
-
-    @Parameter(name=ApiConstants.IPSEC_PSK, type=CommandType.STRING, required=true, description="IPsec Preshared-Key of the customer gateway")
-    private String ipsecPsk;
-
-    @Parameter(name=ApiConstants.IKE_POLICY, type=CommandType.STRING, required=true, description="IKE policy of the customer gateway")
-    private String ikePolicy;
-
-    @Parameter(name=ApiConstants.ESP_POLICY, type=CommandType.STRING, required=true, description="ESP policy of the customer gateway")
-    private String espPolicy;
-
-    @Parameter(name=ApiConstants.IKE_LIFETIME, type=CommandType.LONG, required=false, description="Lifetime of phase 1 VPN connection to the customer gateway, in seconds")
-    private Long ikeLifetime;
-
-    @Parameter(name=ApiConstants.ESP_LIFETIME, type=CommandType.LONG, required=false, description="Lifetime of phase 2 VPN connection to the customer gateway, in seconds")
-    private Long espLifetime;
-
-    @Parameter(name=ApiConstants.DPD, type=CommandType.BOOLEAN, required=false, description="If DPD is enabled for VPN connection")
-    private Boolean dpd;
-
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the gateway. 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 gateway. " +
-            "If used with the account parameter returns the gateway associated with the account for the specified domain.")
-    private Long domainId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getEntityTable() {
-        return "s2s_customer_gateway";
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getIpsecPsk() {
-        return ipsecPsk;
-    }
-
-    public String getGuestCidrList() {
-        return guestCidrList;
-    }
-
-    public String getGatewayIp() {
-        return gatewayIp;
-    }
-
-    public String getIkePolicy() {
-        return ikePolicy;
-    }
-
-    public String getEspPolicy() {
-        return espPolicy;
-    }
-
-    public Long getIkeLifetime() {
-        return ikeLifetime;
-    }
-
-    public Long getEspLifetime() {
-        return espLifetime;
-    }
-
-    public Boolean getDpd() {
-        return dpd;
-    }
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Long accountId = finalyzeAccountId(accountName, domainId, null, true);
-        if (accountId == null) {
-            accountId = UserContext.current().getCaller().getId();
-        }
-        return accountId;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Create site-to-site VPN customer gateway for account " + getEntityOwnerId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE;
-    }
-
-    @Override
-    public void execute(){
-        Site2SiteCustomerGateway result = _s2sVpnService.createCustomerGateway(this);
-        if (result != null) {
-            Site2SiteCustomerGatewayResponse response = _responseGenerator.createSite2SiteCustomerGatewayResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create customer VPN gateway");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnGatewayCmd.java
deleted file mode 100644
index 7a13c02..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpn/command/CreateVpnGatewayCmd.java
+++ /dev/null
@@ -1,106 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpn.command;
-
-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;
-import com.cloud.api.response.Site2SiteVpnGatewayResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.network.Site2SiteVpnGateway;
-import com.cloud.network.vpc.Vpc;
-
-@Implementation(description="Creates site to site vpn local gateway", responseObject=Site2SiteVpnGatewayResponse.class)
-public class CreateVpnGatewayCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(CreateVpnGatewayCmd.class.getName());
-
-    private static final String s_name = "createvpngatewayresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="vpc")
-    @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, required=true, description="public ip address id of the vpn gateway")
-    private Long vpcId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getEntityTable() {
-        return "s2s_vpn_gateway";
-    }
-
-    public Long getVpcId() {
-        return vpcId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Vpc vpc = _vpcService.getVpc(vpcId);
-        return vpc.getAccountId();
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Create site-to-site VPN gateway for account " + getEntityOwnerId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_S2S_VPN_GATEWAY_CREATE;
-    }
-
-    @Override
-    public void execute(){
-        Site2SiteVpnGateway result;
-        result = _s2sVpnService.createVpnGateway(this);
-        if (result != null) {
-            Site2SiteVpnGatewayResponse response = _responseGenerator.createSite2SiteVpnGatewayResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPN gateway");
-        }
-    }
-
-    @Override
-    public String getSyncObjType() {
-        return BaseAsyncCmd.vpcSyncObject;
-    }
-
-    @Override
-    public Long getSyncObjId() {
-        return getVpcId();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpn/command/DeleteRemoteAccessVpnCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpn/command/DeleteRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/user/vpn/command/DeleteRemoteAccessVpnCmd.java
deleted file mode 100644
index 03baf97..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpn/command/DeleteRemoteAccessVpnCmd.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpn.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.RemoteAccessVpn;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Destroys a l2tp/ipsec remote access vpn", responseObject=SuccessResponse.class)
-public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(DeleteRemoteAccessVpnCmd.class.getName());
-
-    private static final String s_name = "deleteremoteaccessvpnresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="user_ip_address")
-    @Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.LONG, required=true, description="public ip address id of the vpn server")
-    private Long publicIpId;
-
-    // unexposed parameter needed for events logging
-    @IdentityMapper(entityTableName="account")
-    @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, expose=false)
-    private Long ownerId;
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        if (ownerId == null) {
-            RemoteAccessVpn vpnEntity = _entityMgr.findById(RemoteAccessVpn.class, publicIpId);
-            if(vpnEntity != null)
-                return vpnEntity.getAccountId();
-
-            throw new InvalidParameterValueException("The specified public ip is not allocated to any account");
-        }
-        return ownerId;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Delete Remote Access VPN for account " + getEntityOwnerId() + " for  ip id=" + publicIpId;
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_REMOTE_ACCESS_VPN_DESTROY;
-    }
-
-    @Override
-    public void execute() throws ResourceUnavailableException {
-        _ravService.destroyRemoteAccessVpn(publicIpId, UserContext.current().getCaller());
-    }
-
-    @Override
-    public String getSyncObjType() {
-        return BaseAsyncCmd.networkSyncObject;
-    }
-
-    @Override
-    public Long getSyncObjId() {
-        return _ravService.getRemoteAccessVpn(publicIpId).getNetworkId();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e398b1e4/api/src/org/apache/cloudstack/api/user/vpn/command/DeleteVpnConnectionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vpn/command/DeleteVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/user/vpn/command/DeleteVpnConnectionCmd.java
deleted file mode 100644
index 19603bc..0000000
--- a/api/src/org/apache/cloudstack/api/user/vpn/command/DeleteVpnConnectionCmd.java
+++ /dev/null
@@ -1,103 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.vpn.command;
-
-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;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Site2SiteVpnConnection;
-import com.cloud.user.Account;
-
-@Implementation(description="Delete site to site vpn connection", responseObject=SuccessResponse.class)
-public class DeleteVpnConnectionCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(DeleteVpnConnectionCmd.class.getName());
-
-    private static final String s_name = "deletevpnconnectionresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="s2s_vpn_connection")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of vpn connection")
-    private Long id;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getEntityTable() {
-        return "s2s_vpn_connection";
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Site2SiteVpnConnection conn = _entityMgr.findById(Site2SiteVpnConnection.class, getId());
-        if (conn != null) {
-            return conn.getAccountId();
-        }
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Delete site-to-site VPN connection for account " + getEntityOwnerId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_S2S_VPN_CONNECTION_DELETE;
-    }
-
-    @Override
-    public void execute(){
-        try {
-            boolean result = _s2sVpnService.deleteVpnConnection(this);
-            if (result) {
-                SuccessResponse response = new SuccessResponse(getCommandName());
-                this.setResponseObject(response);
-            } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete site to site VPN connection");
-            }
-        } catch (ResourceUnavailableException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
-        }
-    }
-}