return response;
}
@Override
public Site2SiteVpnConnectionResponse createSite2SiteVpnConnectionResponse(Site2SiteVpnConnection result) {
Site2SiteVpnConnectionResponse response = new Site2SiteVpnConnectionResponse();
response.setId(result.getId());
response.setVpnGatewayId(result.getVpnGatewayId());
Long vpnGatewayId = result.getVpnGatewayId();
if(vpnGatewayId != null) {
Site2SiteVpnGatewayVO vpnGateway = ApiDBUtils.findVpnGatewayById(vpnGatewayId);
long ipId = vpnGateway.getAddrId();
IPAddressVO ipObj = ApiDBUtils.findIpAddressById(ipId);
response.setIp(ipObj.getAddress().addr());
}
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.setIkeLifetime(customerGateway.getIkeLifetime());
response.setEspLifetime(customerGateway.getEspLifetime());
response.setDpd(customerGateway.getDpd());
}
populateAccount(response, result.getAccountId());
populateDomain(response, result.getDomainId());
response.setState(result.getState().toString());
response.setCreated(result.getCreated());
response.setRemoved(result.getRemoved());
response.setObjectName("vpnconnection");
return response;
}