Search in sources :

Example 1 with Site2SiteCustomerGatewayResponse

use of org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse in project cloudstack by apache.

the class ApiResponseHelper method createSite2SiteCustomerGatewayResponse.

@Override
public Site2SiteCustomerGatewayResponse createSite2SiteCustomerGatewayResponse(Site2SiteCustomerGateway result) {
    Site2SiteCustomerGatewayResponse response = new Site2SiteCustomerGatewayResponse();
    response.setId(result.getUuid());
    response.setName(result.getName());
    response.setGatewayIp(result.getGatewayIp());
    response.setGuestCidrList(result.getGuestCidrList());
    response.setIpsecPsk(result.getIpsecPsk());
    response.setIkePolicy(result.getIkePolicy());
    response.setEspPolicy(result.getEspPolicy());
    response.setIkeLifetime(result.getIkeLifetime());
    response.setEspLifetime(result.getEspLifetime());
    response.setDpd(result.getDpd());
    response.setEncap(result.getEncap());
    response.setRemoved(result.getRemoved());
    response.setIkeVersion(result.getIkeVersion());
    response.setSplitConnections(result.getSplitConnections());
    response.setObjectName("vpncustomergateway");
    response.setHasAnnotation(annotationDao.hasAnnotations(result.getUuid(), AnnotationService.EntityType.VPN_CUSTOMER_GATEWAY.name(), _accountMgr.isRootAdmin(CallContext.current().getCallingAccount().getId())));
    populateAccount(response, result.getAccountId());
    populateDomain(response, result.getDomainId());
    return response;
}
Also used : Site2SiteCustomerGatewayResponse(org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse)

Example 2 with Site2SiteCustomerGatewayResponse

use of org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse in project cloudstack by apache.

the class UpdateVpnCustomerGatewayCmd method execute.

@Override
public void execute() {
    Site2SiteCustomerGateway result = _s2sVpnService.updateCustomerGateway(this);
    if (result != null) {
        Site2SiteCustomerGatewayResponse response = _responseGenerator.createSite2SiteCustomerGatewayResponse(result);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update customer VPN gateway");
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) Site2SiteCustomerGatewayResponse(org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse) Site2SiteCustomerGateway(com.cloud.network.Site2SiteCustomerGateway)

Example 3 with Site2SiteCustomerGatewayResponse

use of org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse 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");
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) Site2SiteCustomerGatewayResponse(org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse) Site2SiteCustomerGateway(com.cloud.network.Site2SiteCustomerGateway)

Example 4 with Site2SiteCustomerGatewayResponse

use of org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse in project cloudstack by apache.

the class ListVpnCustomerGatewaysCmd method execute.

@Override
public void execute() {
    Pair<List<? extends Site2SiteCustomerGateway>, Integer> gws = _s2sVpnService.searchForCustomerGateways(this);
    ListResponse<Site2SiteCustomerGatewayResponse> response = new ListResponse<Site2SiteCustomerGatewayResponse>();
    List<Site2SiteCustomerGatewayResponse> gwResponses = new ArrayList<Site2SiteCustomerGatewayResponse>();
    for (Site2SiteCustomerGateway gw : gws.first()) {
        if (gw == null) {
            continue;
        }
        Site2SiteCustomerGatewayResponse site2SiteCustomerGatewayRes = _responseGenerator.createSite2SiteCustomerGatewayResponse(gw);
        site2SiteCustomerGatewayRes.setObjectName("vpncustomergateway");
        gwResponses.add(site2SiteCustomerGatewayRes);
    }
    response.setResponses(gwResponses, gws.second());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) Site2SiteCustomerGatewayResponse(org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Site2SiteCustomerGateway(com.cloud.network.Site2SiteCustomerGateway)

Aggregations

Site2SiteCustomerGatewayResponse (org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse)4 Site2SiteCustomerGateway (com.cloud.network.Site2SiteCustomerGateway)3 ServerApiException (org.apache.cloudstack.api.ServerApiException)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1