use of com.cloud.api.response.RemoteAccessVpnResponse in project CloudStack-archive by CloudStack-extras.
the class CreateRemoteAccessVpnCmd method execute.
@Override
public void execute() {
try {
RemoteAccessVpn result = _ravService.startRemoteAccessVpn(publicIpId, getOpenFirewall());
if (result != null) {
RemoteAccessVpnResponse response = _responseGenerator.createRemoteAccessVpnResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
use of com.cloud.api.response.RemoteAccessVpnResponse in project CloudStack-archive by CloudStack-extras.
the class ListRemoteAccessVpnsCmd method execute.
@Override
public void execute() {
List<? extends RemoteAccessVpn> vpns = _ravService.searchForRemoteAccessVpns(this);
ListResponse<RemoteAccessVpnResponse> response = new ListResponse<RemoteAccessVpnResponse>();
List<RemoteAccessVpnResponse> vpnResponses = new ArrayList<RemoteAccessVpnResponse>();
if (vpns != null && !vpns.isEmpty()) {
for (RemoteAccessVpn vpn : vpns) {
vpnResponses.add(_responseGenerator.createRemoteAccessVpnResponse(vpn));
}
}
response.setResponses(vpnResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.RemoteAccessVpnResponse in project cosmic by MissionCriticalCloud.
the class ListRemoteAccessVpnsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Pair<List<? extends RemoteAccessVpn>, Integer> vpns = _ravService.searchForRemoteAccessVpns(this);
final ListResponse<RemoteAccessVpnResponse> response = new ListResponse<>();
final List<RemoteAccessVpnResponse> vpnResponses = new ArrayList<>();
if (vpns.first() != null && !vpns.first().isEmpty()) {
for (final RemoteAccessVpn vpn : vpns.first()) {
vpnResponses.add(_responseGenerator.createRemoteAccessVpnResponse(vpn));
}
}
response.setResponses(vpnResponses, vpns.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.api.response.RemoteAccessVpnResponse in project cosmic by MissionCriticalCloud.
the class UpdateRemoteAccessVpnCmd method execute.
@Override
public void execute() {
final RemoteAccessVpn result = _ravService.updateRemoteAccessVpn(id, this.getCustomId(), getDisplay());
final RemoteAccessVpnResponse response = _responseGenerator.createRemoteAccessVpnResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.RemoteAccessVpnResponse in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method createRemoteAccessVpnResponse.
@Override
public RemoteAccessVpnResponse createRemoteAccessVpnResponse(final RemoteAccessVpn vpn) {
final RemoteAccessVpnResponse vpnResponse = new RemoteAccessVpnResponse();
final IpAddress ip = ApiDBUtils.findIpAddressById(vpn.getServerAddressId());
if (ip != null) {
vpnResponse.setPublicIpId(ip.getUuid());
vpnResponse.setPublicIp(ip.getAddress().addr());
}
vpnResponse.setIpRange(vpn.getIpRange());
vpnResponse.setPresharedKey(vpn.getIpsecPresharedKey());
populateOwner(vpnResponse, vpn);
vpnResponse.setState(vpn.getState().toString());
vpnResponse.setId(vpn.getUuid());
vpnResponse.setForDisplay(vpn.isDisplay());
vpnResponse.setObjectName("remoteaccessvpn");
return vpnResponse;
}
Aggregations