use of org.apache.cloudstack.region.PortableIpRange in project cloudstack by apache.
the class CreatePortableIpRangeCmd method create.
@Override
public void create() throws ResourceAllocationException {
try {
PortableIpRange portableIpRange = _configService.createPortableIpRange(this);
if (portableIpRange != null) {
this.setEntityId(portableIpRange.getId());
this.setEntityUuid(portableIpRange.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create portable public IP range");
}
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
use of org.apache.cloudstack.region.PortableIpRange in project cloudstack by apache.
the class CreatePortableIpRangeCmd method execute.
@Override
public void execute() {
PortableIpRange portableIpRange = _entityMgr.findById(PortableIpRange.class, getEntityId());
if (portableIpRange != null) {
PortableIpRangeResponse response = _responseGenerator.createPortableIPRangeResponse(portableIpRange);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}
use of org.apache.cloudstack.region.PortableIpRange in project cloudstack by apache.
the class ListPortableIpRangesCmd method execute.
@Override
public void execute() {
ListResponse<PortableIpRangeResponse> response = new ListResponse<PortableIpRangeResponse>();
List<PortableIpRangeResponse> responses = new ArrayList<PortableIpRangeResponse>();
List<? extends PortableIpRange> portableIpRanges = _configService.listPortableIpRanges(this);
if (portableIpRanges != null && !portableIpRanges.isEmpty()) {
for (PortableIpRange range : portableIpRanges) {
PortableIpRangeResponse rangeResponse = _responseGenerator.createPortableIPRangeResponse(range);
List<? extends PortableIp> portableIps = _configService.listPortableIps(range.getId());
if (portableIps != null && !portableIps.isEmpty()) {
List<PortableIpResponse> portableIpResponses = new ArrayList<PortableIpResponse>();
for (PortableIp portableIP : portableIps) {
PortableIpResponse portableIpresponse = _responseGenerator.createPortableIPResponse(portableIP);
portableIpResponses.add(portableIpresponse);
}
rangeResponse.setPortableIpResponses(portableIpResponses);
}
responses.add(rangeResponse);
}
response.setResponses(responses, portableIpRanges.size());
}
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations