use of com.cloud.network.Site2SiteCustomerGateway in project cloudstack by apache.
the class CreateVpnCustomerGatewayCmd method execute.
@Override
public void execute() {
Site2SiteCustomerGateway result = _s2sVpnService.createCustomerGateway(this);
if (result != null) {
Site2SiteCustomerGatewayResponse response = _responseGenerator.createSite2SiteCustomerGatewayResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create customer VPN gateway");
}
}
use of com.cloud.network.Site2SiteCustomerGateway in project cloudstack by apache.
the class ApiResponseHelper method createSite2SiteVpnConnectionResponse.
@Override
public Site2SiteVpnConnectionResponse createSite2SiteVpnConnectionResponse(Site2SiteVpnConnection result) {
Site2SiteVpnConnectionResponse response = new Site2SiteVpnConnectionResponse();
response.setId(result.getUuid());
response.setPassive(result.isPassive());
Long vpnGatewayId = result.getVpnGatewayId();
if (vpnGatewayId != null) {
Site2SiteVpnGateway vpnGateway = ApiDBUtils.findVpnGatewayById(vpnGatewayId);
if (vpnGateway != null) {
response.setVpnGatewayId(vpnGateway.getUuid());
long ipId = vpnGateway.getAddrId();
IPAddressVO ipObj = ApiDBUtils.findIpAddressById(ipId);
response.setIp(ipObj.getAddress().addr());
}
}
Long customerGatewayId = result.getCustomerGatewayId();
if (customerGatewayId != null) {
Site2SiteCustomerGateway customerGateway = ApiDBUtils.findCustomerGatewayById(customerGatewayId);
if (customerGateway != null) {
response.setCustomerGatewayId(customerGateway.getUuid());
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());
response.setEncap(customerGateway.getEncap());
}
}
populateAccount(response, result.getAccountId());
populateDomain(response, result.getDomainId());
response.setState(result.getState().toString());
response.setCreated(result.getCreated());
response.setRemoved(result.getRemoved());
response.setForDisplay(result.isDisplay());
response.setObjectName("vpnconnection");
return response;
}
Aggregations