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/04 11:02:57 UTC

[40/55] [abbrv] git commit: api_refactor: refactor vpc apis

api_refactor: refactor vpc apis

- Fix refactored apis in commands*.in
- Fix comments etc.
- Expand tabs, remove trailing whitespace

Signed-off-by: Rohit Yadav <bh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/ac1ea761
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/ac1ea761
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/ac1ea761

Branch: refs/heads/api_refactoring
Commit: ac1ea7616abbb89b1f1b8525572ed470037cca28
Parents: 6fc3bc3
Author: Rohit Yadav <bh...@apache.org>
Authored: Mon Dec 3 21:44:40 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Mon Dec 3 21:44:40 2012 -0800

----------------------------------------------------------------------
 .../cloud/api/commands/CreateStaticRouteCmd.java   |  149 ------------
 api/src/com/cloud/api/commands/CreateVPCCmd.java   |  189 ---------------
 .../cloud/api/commands/DeleteStaticRouteCmd.java   |  124 ----------
 api/src/com/cloud/api/commands/DeleteVPCCmd.java   |  107 --------
 .../cloud/api/commands/ListPrivateGatewaysCmd.java |  107 --------
 .../cloud/api/commands/ListStaticRoutesCmd.java    |   86 -------
 .../cloud/api/commands/ListVPCOfferingsCmd.java    |  116 ---------
 api/src/com/cloud/api/commands/ListVPCsCmd.java    |  159 ------------
 api/src/com/cloud/api/commands/RestartVPCCmd.java  |  110 ---------
 api/src/com/cloud/api/commands/UpdateVPCCmd.java   |  109 ---------
 api/src/com/cloud/network/vpc/VpcService.java      |    4 +-
 .../api/user/vpc/command/CreateStaticRouteCmd.java |  149 ++++++++++++
 .../api/user/vpc/command/CreateVPCCmd.java         |  189 +++++++++++++++
 .../api/user/vpc/command/DeleteStaticRouteCmd.java |  124 ++++++++++
 .../api/user/vpc/command/DeleteVPCCmd.java         |  107 ++++++++
 .../user/vpc/command/ListPrivateGatewaysCmd.java   |  107 ++++++++
 .../api/user/vpc/command/ListStaticRoutesCmd.java  |   86 +++++++
 .../api/user/vpc/command/ListVPCOfferingsCmd.java  |  116 +++++++++
 .../api/user/vpc/command/ListVPCsCmd.java          |  159 ++++++++++++
 .../api/user/vpc/command/RestartVPCCmd.java        |  110 +++++++++
 .../api/user/vpc/command/UpdateVPCCmd.java         |  109 +++++++++
 client/tomcatconf/commands.properties.in           |   20 +-
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |    8 +-
 server/test/com/cloud/vpc/MockVpcManagerImpl.java  |    4 +-
 24 files changed, 1274 insertions(+), 1274 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac1ea761/api/src/com/cloud/api/commands/CreateStaticRouteCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/CreateStaticRouteCmd.java b/api/src/com/cloud/api/commands/CreateStaticRouteCmd.java
deleted file mode 100644
index 446116c..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/api/commands/CreateVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/CreateVPCCmd.java b/api/src/com/cloud/api/commands/CreateVPCCmd.java
deleted file mode 100644
index b07a714..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/api/commands/DeleteStaticRouteCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteStaticRouteCmd.java b/api/src/com/cloud/api/commands/DeleteStaticRouteCmd.java
deleted file mode 100644
index e2f2c52..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/api/commands/DeleteVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteVPCCmd.java b/api/src/com/cloud/api/commands/DeleteVPCCmd.java
deleted file mode 100644
index d12c9fa..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/api/commands/ListPrivateGatewaysCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListPrivateGatewaysCmd.java b/api/src/com/cloud/api/commands/ListPrivateGatewaysCmd.java
deleted file mode 100644
index b6a02f3..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/api/commands/ListStaticRoutesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListStaticRoutesCmd.java b/api/src/com/cloud/api/commands/ListStaticRoutesCmd.java
deleted file mode 100644
index e397c6c..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/api/commands/ListVPCOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVPCOfferingsCmd.java b/api/src/com/cloud/api/commands/ListVPCOfferingsCmd.java
deleted file mode 100644
index ecca2dd..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/api/commands/ListVPCsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVPCsCmd.java b/api/src/com/cloud/api/commands/ListVPCsCmd.java
deleted file mode 100644
index fec3eea..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/api/commands/RestartVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RestartVPCCmd.java b/api/src/com/cloud/api/commands/RestartVPCCmd.java
deleted file mode 100644
index dc7d897..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/api/commands/UpdateVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateVPCCmd.java b/api/src/com/cloud/api/commands/UpdateVPCCmd.java
deleted file mode 100644
index abe66fe..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/ac1ea761/api/src/com/cloud/network/vpc/VpcService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java
index c13e37f..3d6c2b7 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -20,8 +20,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import com.cloud.api.commands.ListPrivateGatewaysCmd;
-import com.cloud.api.commands.ListStaticRoutesCmd;
+import org.apache.cloudstack.api.user.vpc.command.ListPrivateGatewaysCmd;
+import org.apache.cloudstack.api.user.vpc.command.ListStaticRoutesCmd;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientCapacityException;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac1ea761/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
new file mode 100644
index 0000000..bcd1bbb
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/vpc/command/CreateStaticRouteCmd.java
@@ -0,0 +1,149 @@
+// 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/ac1ea761/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
new file mode 100644
index 0000000..c56f715
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/vpc/command/CreateVPCCmd.java
@@ -0,0 +1,189 @@
+// 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/ac1ea761/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
new file mode 100644
index 0000000..1235729
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteStaticRouteCmd.java
@@ -0,0 +1,124 @@
+// 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/ac1ea761/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
new file mode 100644
index 0000000..78dbfc1
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/vpc/command/DeleteVPCCmd.java
@@ -0,0 +1,107 @@
+// 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/ac1ea761/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
new file mode 100644
index 0000000..a76b07f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/vpc/command/ListPrivateGatewaysCmd.java
@@ -0,0 +1,107 @@
+// 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/ac1ea761/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
new file mode 100644
index 0000000..e5ae9f0
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/vpc/command/ListStaticRoutesCmd.java
@@ -0,0 +1,86 @@
+// 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);
+    }
+
+
+}