From 82020668a6812b5430f866d62ac016454179e5c2 Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Mon, 30 Jul 2012 10:52:57 -0700 Subject: [PATCH] S2S VPN: Remove obelete guest_ip from updateCustomerGateway --- .../commands/UpdateVpnCustomerGatewayCmd.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/api/src/com/cloud/api/commands/UpdateVpnCustomerGatewayCmd.java b/api/src/com/cloud/api/commands/UpdateVpnCustomerGatewayCmd.java index a3a9d8e249f..28f5a908429 100644 --- a/api/src/com/cloud/api/commands/UpdateVpnCustomerGatewayCmd.java +++ b/api/src/com/cloud/api/commands/UpdateVpnCustomerGatewayCmd.java @@ -25,6 +25,7 @@ import com.cloud.api.response.Site2SiteCustomerGatewayResponse; import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteCustomerGateway; import com.cloud.user.Account; +import com.cloud.user.UserContext; @Implementation(description="Update site to site vpn customer gateway", responseObject=Site2SiteCustomerGatewayResponse.class) public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { @@ -42,9 +43,6 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="public ip address id of the customer gateway") private String gatewayIp; - @Parameter(name=ApiConstants.GUEST_IP, type=CommandType.STRING, required=true, description="guest ip of the customer gateway") - private String guestIp; - @Parameter(name=ApiConstants.CIDR_LIST, type=CommandType.STRING, required=true, description="guest cidr of the customer gateway") private String guestCidrList; @@ -60,6 +58,14 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.LIFETIME, type=CommandType.LONG, required=false, description="Lifetime of vpn connection to the customer gateway, in seconds") private Long lifetime; + @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the gateway. Must be used with the domainId parameter.") + private String accountName; + + @IdentityMapper(entityTableName="domain") + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID associated with the gateway. " + + "If used with the account parameter returns the gateway associated with the account for the specified domain.") + private Long domainId; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -80,10 +86,6 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { return guestCidrList; } - public String getGuestIp() { - return guestIp; - } - public String getGatewayIp() { return gatewayIp; } @@ -112,7 +114,11 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { @Override public long getEntityOwnerId() { - return Account.ACCOUNT_ID_SYSTEM; + Long accountId = finalyzeAccountId(accountName, domainId, null, true); + if (accountId == null) { + accountId = UserContext.current().getCaller().getId(); + } + return accountId; } @Override