use of com.cloud.api.response.MockResponse in project cloudstack by apache.
the class ConfigureSimulatorCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
if (hostId != null && jsonResponse != null) {
jsonResponse = jsonResponse.replace("\"hostId\":0", "\"hostId\":" + hostId);
}
Long id = _simMgr.configureSimulator(zoneId, podId, clusterId, hostId, command, values, count, jsonResponse);
if (id == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure simulator");
}
MockConfigurationVO config = _simMgr.querySimulatorMock(id);
if (config == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to query simulator mock");
}
MockResponse response = new MockResponse();
response.setId(config.getId());
response.setZoneId(config.getDataCenterId());
response.setPodId(config.getPodId());
response.setClusterId(config.getClusterId());
response.setHostId(config.getHostId());
response.setName(config.getName());
response.setCount(config.getCount());
response.setResponseName("simulatormock");
this.setResponseObject(response);
}
use of com.cloud.api.response.MockResponse in project cloudstack by apache.
the class QuerySimulatorMockCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
MockConfigurationVO config = _simMgr.querySimulatorMock(id);
if (config == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to query mock");
}
MockResponse response = new MockResponse();
response.setId(config.getId());
response.setZoneId(config.getDataCenterId());
response.setPodId(config.getPodId());
response.setClusterId(config.getClusterId());
response.setHostId(config.getHostId());
response.setName(config.getName());
response.setCount(config.getCount());
response.setResponseName("simulatormock");
this.setResponseObject(response);
}
Aggregations