mirror of https://github.com/apache/cloudstack.git
cloudstack 3.0 API - listVpnConnections API - add gatewayIp, guestCidrList,ipsecPsk, ikePolicy, espPolicy, lifetime property (get it from customerGateway object).
This commit is contained in:
parent
196885e378
commit
830901d7cc
|
|
@ -31,12 +31,30 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.S2S_VPN_GATEWAY_ID) @Param(description="the vpn gateway ID")
|
||||
private IdentityProxy vpnGatewayId= new IdentityProxy("s2s_vpn_gateway");
|
||||
|
||||
@SerializedName(ApiConstants.PUBLIC_IP) @Param(description="the public IP address")
|
||||
@SerializedName(ApiConstants.PUBLIC_IP) @Param(description="the public IP address") //from VpnGateway
|
||||
private String ip;
|
||||
|
||||
@SerializedName(ApiConstants.S2S_CUSTOMER_GATEWAY_ID) @Param(description="the customer gateway ID")
|
||||
private IdentityProxy customerGatewayId = new IdentityProxy("s2s_customer_gateway");
|
||||
|
||||
@SerializedName(ApiConstants.GATEWAY) @Param(description="public ip address id of the customer gateway") //from CustomerGateway
|
||||
private String gatewayIp;
|
||||
|
||||
@SerializedName(ApiConstants.CIDR_LIST) @Param(description="guest cidr list of the customer gateway") //from CustomerGateway
|
||||
private String guestCidrList;
|
||||
|
||||
@SerializedName(ApiConstants.IPSEC_PSK) @Param(description="IPsec Preshared-Key of the customer gateway") //from CustomerGateway
|
||||
private String ipsecPsk;
|
||||
|
||||
@SerializedName(ApiConstants.IKE_POLICY) @Param(description="IKE policy of the customer gateway") //from CustomerGateway
|
||||
private String ikePolicy;
|
||||
|
||||
@SerializedName(ApiConstants.ESP_POLICY) @Param(description="ESP policy of the customer gateway") //from CustomerGateway
|
||||
private String espPolicy;
|
||||
|
||||
@SerializedName(ApiConstants.LIFETIME) @Param(description="Lifetime of vpn connection to the customer gateway, in seconds") //from CustomerGateway
|
||||
private Long lifetime;
|
||||
|
||||
@SerializedName(ApiConstants.CREATED) @Param(description="the date and time the host was created")
|
||||
private Date created;
|
||||
|
||||
|
|
@ -58,7 +76,31 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse {
|
|||
public void setCustomerGatewayId(Long customerGatewayId) {
|
||||
this.customerGatewayId.setValue(customerGatewayId);
|
||||
}
|
||||
|
||||
|
||||
public void setGatewayIp(String gatewayIp) {
|
||||
this.gatewayIp = gatewayIp;
|
||||
}
|
||||
|
||||
public void setGuestCidrList(String guestCidrList) {
|
||||
this.guestCidrList = guestCidrList;
|
||||
}
|
||||
|
||||
public void setIpsecPsk(String ipsecPsk) {
|
||||
this.ipsecPsk = ipsecPsk;
|
||||
}
|
||||
|
||||
public void setIkePolicy(String ikePolicy) {
|
||||
this.ikePolicy = ikePolicy;
|
||||
}
|
||||
|
||||
public void setEspPolicy(String espPolicy) {
|
||||
this.espPolicy = espPolicy;
|
||||
}
|
||||
|
||||
public void setLifetime(Long lifetime) {
|
||||
this.lifetime = lifetime;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ import com.cloud.network.NetworkProfile;
|
|||
import com.cloud.network.NetworkRuleConfigVO;
|
||||
import com.cloud.network.NetworkVO;
|
||||
import com.cloud.network.Site2SiteVpnGatewayVO;
|
||||
import com.cloud.network.Site2SiteCustomerGatewayVO;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.dao.FirewallRulesCidrsDao;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
|
|
@ -71,6 +72,7 @@ import com.cloud.network.dao.NetworkDao;
|
|||
import com.cloud.network.dao.NetworkDomainDao;
|
||||
import com.cloud.network.dao.NetworkRuleConfigDao;
|
||||
import com.cloud.network.dao.Site2SiteVpnGatewayDao;
|
||||
import com.cloud.network.dao.Site2SiteCustomerGatewayDao;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.network.security.SecurityGroupManager;
|
||||
import com.cloud.network.security.SecurityGroupVO;
|
||||
|
|
@ -186,6 +188,7 @@ public class ApiDBUtils {
|
|||
private static VlanDao _vlanDao;
|
||||
private static VolumeDao _volumeDao;
|
||||
private static Site2SiteVpnGatewayDao _site2SiteVpnGatewayDao;
|
||||
private static Site2SiteCustomerGatewayDao _site2SiteCustomerGatewayDao;
|
||||
private static VolumeHostDao _volumeHostDao;
|
||||
private static DataCenterDao _zoneDao;
|
||||
private static NetworkOfferingDao _networkOfferingDao;
|
||||
|
|
@ -242,6 +245,7 @@ public class ApiDBUtils {
|
|||
_vlanDao = locator.getDao(VlanDao.class);
|
||||
_volumeDao = locator.getDao(VolumeDao.class);
|
||||
_site2SiteVpnGatewayDao = locator.getDao(Site2SiteVpnGatewayDao.class);
|
||||
_site2SiteCustomerGatewayDao = locator.getDao(Site2SiteCustomerGatewayDao.class);
|
||||
_volumeHostDao = locator.getDao(VolumeHostDao.class);
|
||||
_zoneDao = locator.getDao(DataCenterDao.class);
|
||||
_securityGroupDao = locator.getDao(SecurityGroupDao.class);
|
||||
|
|
@ -563,6 +567,10 @@ public class ApiDBUtils {
|
|||
return _site2SiteVpnGatewayDao.findById(vpnGatewayId);
|
||||
}
|
||||
|
||||
public static Site2SiteCustomerGatewayVO findCustomerGatewayById(Long customerGatewayId) {
|
||||
return _site2SiteCustomerGatewayDao.findById(customerGatewayId);
|
||||
}
|
||||
|
||||
public static List<UserVO> listUsersByAccount(long accountId) {
|
||||
return _userDao.listByAccount(accountId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ import com.cloud.network.PhysicalNetworkServiceProvider;
|
|||
import com.cloud.network.PhysicalNetworkTrafficType;
|
||||
import com.cloud.network.RemoteAccessVpn;
|
||||
import com.cloud.network.Site2SiteCustomerGateway;
|
||||
import com.cloud.network.Site2SiteCustomerGatewayVO;
|
||||
import com.cloud.network.Site2SiteVpnConnection;
|
||||
import com.cloud.network.Site2SiteVpnGateway;
|
||||
import com.cloud.network.Site2SiteVpnGatewayVO;
|
||||
|
|
@ -3795,14 +3796,25 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
response.setVpnGatewayId(result.getVpnGatewayId());
|
||||
Long vpnGatewayId = result.getVpnGatewayId();
|
||||
if(vpnGatewayId != null) {
|
||||
Site2SiteVpnGatewayVO vpnGateway = ApiDBUtils.findVpnGatewayById(vpnGatewayId);//???
|
||||
Site2SiteVpnGatewayVO vpnGateway = ApiDBUtils.findVpnGatewayById(vpnGatewayId);
|
||||
|
||||
long ipId = vpnGateway.getAddrId();
|
||||
IPAddressVO ipObj = ApiDBUtils.findIpAddressById(ipId);
|
||||
response.setIp(ipObj.getAddress().addr());
|
||||
}
|
||||
|
||||
response.setCustomerGatewayId(result.getCustomerGatewayId());
|
||||
response.setCustomerGatewayId(result.getCustomerGatewayId());
|
||||
Long customerGatewayId = result.getCustomerGatewayId();
|
||||
if(customerGatewayId != null) {
|
||||
Site2SiteCustomerGatewayVO customerGateway = ApiDBUtils.findCustomerGatewayById(customerGatewayId);
|
||||
response.setGatewayIp(customerGateway.getGatewayIp());
|
||||
response.setGuestCidrList(customerGateway.getGuestCidrList());
|
||||
response.setIpsecPsk(customerGateway.getIpsecPsk());
|
||||
response.setIkePolicy(customerGateway.getIkePolicy());
|
||||
response.setEspPolicy(customerGateway.getEspPolicy());
|
||||
response.setLifetime(customerGateway.getLifetime());
|
||||
}
|
||||
|
||||
response.setCreated(result.getCreated());
|
||||
response.setRemoved(result.getRemoved());
|
||||
response.setObjectName("vpnconnection");
|
||||
|
|
|
|||
Loading…
Reference in New Issue