use of com.cloud.network.Site2SiteVpnConnection in project cosmic by MissionCriticalCloud.
the class ListVpnConnectionsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Pair<List<? extends Site2SiteVpnConnection>, Integer> conns = _s2sVpnService.searchForVpnConnections(this);
final ListResponse<Site2SiteVpnConnectionResponse> response = new ListResponse<>();
final List<Site2SiteVpnConnectionResponse> connResponses = new ArrayList<>();
for (final Site2SiteVpnConnection conn : conns.first()) {
if (conn == null) {
continue;
}
final Site2SiteVpnConnectionResponse site2SiteVpnConnectonRes = _responseGenerator.createSite2SiteVpnConnectionResponse(conn);
site2SiteVpnConnectonRes.setObjectName("vpnconnection");
connResponses.add(site2SiteVpnConnectonRes);
}
response.setResponses(connResponses, conns.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.network.Site2SiteVpnConnection in project cosmic by MissionCriticalCloud.
the class ResetVpnConnectionCmd method execute.
@Override
public void execute() {
try {
final Site2SiteVpnConnection result = _s2sVpnService.resetVpnConnection(this);
if (result != null) {
final Site2SiteVpnConnectionResponse response = _responseGenerator.createSite2SiteVpnConnectionResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset site to site VPN connection");
}
} catch (final ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
use of com.cloud.network.Site2SiteVpnConnection in project cosmic by MissionCriticalCloud.
the class CreateVpnConnectionCmd method execute.
@Override
public void execute() {
try {
final Site2SiteVpnConnection result = _s2sVpnService.startVpnConnection(getEntityId());
if (result != null) {
final Site2SiteVpnConnectionResponse response = _responseGenerator.createSite2SiteVpnConnectionResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection");
}
} catch (final ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
use of com.cloud.network.Site2SiteVpnConnection in project cloudstack by apache.
the class CreateVpnConnectionCmd method execute.
@Override
public void execute() {
try {
Site2SiteVpnConnection result = _s2sVpnService.startVpnConnection(getEntityId());
if (result != null) {
Site2SiteVpnConnectionResponse response = _responseGenerator.createSite2SiteVpnConnectionResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
use of com.cloud.network.Site2SiteVpnConnection in project cloudstack by apache.
the class ListVpnConnectionsCmd method execute.
@Override
public void execute() {
Pair<List<? extends Site2SiteVpnConnection>, Integer> conns = _s2sVpnService.searchForVpnConnections(this);
ListResponse<Site2SiteVpnConnectionResponse> response = new ListResponse<Site2SiteVpnConnectionResponse>();
List<Site2SiteVpnConnectionResponse> connResponses = new ArrayList<Site2SiteVpnConnectionResponse>();
for (Site2SiteVpnConnection conn : conns.first()) {
if (conn == null) {
continue;
}
Site2SiteVpnConnectionResponse site2SiteVpnConnectonRes = _responseGenerator.createSite2SiteVpnConnectionResponse(conn);
site2SiteVpnConnectonRes.setObjectName("vpnconnection");
connResponses.add(site2SiteVpnConnectonRes);
}
response.setResponses(connResponses, conns.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
Aggregations