use of com.cloud.api.response.Site2SiteVpnGatewayResponse in project cosmic by MissionCriticalCloud.
the class CreateVpnGatewayCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("VPN gateway Id: " + getEntityId());
final Site2SiteVpnGateway result = _s2sVpnService.getVpnGateway(getEntityId());
if (result != null) {
final Site2SiteVpnGatewayResponse response = _responseGenerator.createSite2SiteVpnGatewayResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPN gateway");
}
}
use of com.cloud.api.response.Site2SiteVpnGatewayResponse in project cosmic by MissionCriticalCloud.
the class UpdateVpnGatewayCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Site2SiteVpnGateway result = _s2sVpnService.updateVpnGateway(id, this.getCustomId(), getDisplay());
if (result != null) {
final Site2SiteVpnGatewayResponse response = _responseGenerator.createSite2SiteVpnGatewayResponse(result);
response.setResponseName(getCommandName());
}
}
use of com.cloud.api.response.Site2SiteVpnGatewayResponse in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method createSite2SiteVpnGatewayResponse.
@Override
public Site2SiteVpnGatewayResponse createSite2SiteVpnGatewayResponse(final Site2SiteVpnGateway result) {
final Site2SiteVpnGatewayResponse response = new Site2SiteVpnGatewayResponse();
response.setId(result.getUuid());
response.setIp(ApiDBUtils.findIpAddressById(result.getAddrId()).getAddress().toString());
final 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 com.cloud.api.response.Site2SiteVpnGatewayResponse in project cosmic by MissionCriticalCloud.
the class ListVpnGatewaysCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Pair<List<? extends Site2SiteVpnGateway>, Integer> gws = _s2sVpnService.searchForVpnGateways(this);
final ListResponse<Site2SiteVpnGatewayResponse> response = new ListResponse<>();
final List<Site2SiteVpnGatewayResponse> gwResponses = new ArrayList<>();
for (final Site2SiteVpnGateway gw : gws.first()) {
if (gw == null) {
continue;
}
final Site2SiteVpnGatewayResponse site2SiteVpnGatewayRes = _responseGenerator.createSite2SiteVpnGatewayResponse(gw);
site2SiteVpnGatewayRes.setObjectName("vpngateway");
gwResponses.add(site2SiteVpnGatewayRes);
}
response.setResponses(gwResponses, gws.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
Aggregations