You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ya...@apache.org on 2014/06/12 03:37:01 UTC
git commit: updated refs/heads/4.4-forward to 4c168bf
Repository: cloudstack
Updated Branches:
refs/heads/4.4-forward 95b7330d5 -> 4c168bf9d
Make CreateVpnGatewayCmd implements BaseAsyncCreateCmd
Instead of BaseAsyncCmd.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4c168bf9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4c168bf9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4c168bf9
Branch: refs/heads/4.4-forward
Commit: 4c168bf9dbb6b7f3bc9b39fa6f270a4487496a16
Parents: 95b7330
Author: Sheng Yang <sh...@citrix.com>
Authored: Wed Jun 11 18:34:50 2014 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Wed Jun 11 18:35:47 2014 -0700
----------------------------------------------------------------------
.../command/user/vpn/CreateVpnGatewayCmd.java | 30 ++++++++++++++------
1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c168bf9/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
index fb933ba..3043edc 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
@@ -16,25 +16,26 @@
// under the License.
package org.apache.cloudstack.api.command.user.vpn;
-import org.apache.log4j.Logger;
-
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.network.Site2SiteVpnGateway;
+import com.cloud.network.vpc.Vpc;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
import org.apache.cloudstack.api.response.VpcResponse;
-
-import com.cloud.event.EventTypes;
-import com.cloud.network.Site2SiteVpnGateway;
-import com.cloud.network.vpc.Vpc;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
@APICommand(name = "createVpnGateway", description = "Creates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class, entityType = {Site2SiteVpnGateway.class},
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
-public class CreateVpnGatewayCmd extends BaseAsyncCmd {
+public class CreateVpnGatewayCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateVpnGatewayCmd.class.getName());
private static final String s_name = "createvpngatewayresponse";
@@ -101,8 +102,8 @@ public class CreateVpnGatewayCmd extends BaseAsyncCmd {
@Override
public void execute() {
- Site2SiteVpnGateway result;
- result = _s2sVpnService.createVpnGateway(this);
+ CallContext.current().setEventDetails("VPN gateway Id: " + getEntityId());
+ Site2SiteVpnGateway result = _s2sVpnService.getVpnGateway(getEntityId());
if (result != null) {
Site2SiteVpnGatewayResponse response = _responseGenerator.createSite2SiteVpnGatewayResponse(result);
response.setResponseName(getCommandName());
@@ -121,4 +122,15 @@ public class CreateVpnGatewayCmd extends BaseAsyncCmd {
public Long getSyncObjId() {
return getVpcId();
}
+
+ @Override
+ public void create() throws ResourceAllocationException {
+ Site2SiteVpnGateway result = _s2sVpnService.createVpnGateway(this);
+ if (result != null) {
+ setEntityId(result.getId());
+ setEntityUuid(result.getUuid());
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPN gateway");
+ }
+ }
}