use of org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse in project cloudstack by apache.
the class ListVpnGatewaysCmd method execute.
@Override
public void execute() {
Pair<List<? extends Site2SiteVpnGateway>, Integer> gws = _s2sVpnService.searchForVpnGateways(this);
ListResponse<Site2SiteVpnGatewayResponse> response = new ListResponse<Site2SiteVpnGatewayResponse>();
List<Site2SiteVpnGatewayResponse> gwResponses = new ArrayList<Site2SiteVpnGatewayResponse>();
for (Site2SiteVpnGateway gw : gws.first()) {
if (gw == null) {
continue;
}
Site2SiteVpnGatewayResponse site2SiteVpnGatewayRes = _responseGenerator.createSite2SiteVpnGatewayResponse(gw);
site2SiteVpnGatewayRes.setObjectName("vpngateway");
gwResponses.add(site2SiteVpnGatewayRes);
}
response.setResponses(gwResponses, gws.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse in project cloudstack by apache.
the class UpdateVpnGatewayCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
Site2SiteVpnGateway result = _s2sVpnService.updateVpnGateway(id, this.getCustomId(), getDisplay());
if (result != null) {
Site2SiteVpnGatewayResponse response = _responseGenerator.createSite2SiteVpnGatewayResponse(result);
response.setResponseName(getCommandName());
}
}
use of org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse in project cloudstack by apache.
the class ApiResponseHelper method createSite2SiteVpnGatewayResponse.
@Override
public Site2SiteVpnGatewayResponse createSite2SiteVpnGatewayResponse(Site2SiteVpnGateway result) {
Site2SiteVpnGatewayResponse response = new Site2SiteVpnGatewayResponse();
response.setId(result.getUuid());
response.setIp(ApiDBUtils.findIpAddressById(result.getAddrId()).getAddress().toString());
Vpc vpc = ApiDBUtils.findVpcById(result.getVpcId());
if (vpc != null) {
response.setVpcId(vpc.getUuid());
}
response.setRemoved(result.getRemoved());
response.setForDisplay(result.isDisplay());
response.setObjectName("vpngateway");
populateAccount(response, result.getAccountId());
populateDomain(response, result.getDomainId());
return response;
}
use of org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse in project cloudstack by apache.
the class CreateVpnGatewayCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("VPN gateway Id: " + getEntityId());
Site2SiteVpnGateway result = _s2sVpnService.getVpnGateway(getEntityId());
if (result != null) {
Site2SiteVpnGatewayResponse response = _responseGenerator.createSite2SiteVpnGatewayResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPN gateway");
}
}
Aggregations