use of com.cloud.dc.DedicatedResources in project cloudstack by apache.
the class ListDedicatedZonesCmd method execute.
@Override
public void execute() {
Pair<List<? extends DedicatedResourceVO>, Integer> result = _dedicatedservice.listDedicatedZones(this);
ListResponse<DedicateZoneResponse> response = new ListResponse<DedicateZoneResponse>();
List<DedicateZoneResponse> Responses = new ArrayList<DedicateZoneResponse>();
if (result != null) {
for (DedicatedResources resource : result.first()) {
DedicateZoneResponse zoneResponse = _dedicatedservice.createDedicateZoneResponse(resource);
Responses.add(zoneResponse);
}
response.setResponses(Responses, result.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to list dedicated zones");
}
}
use of com.cloud.dc.DedicatedResources in project cloudstack by apache.
the class DedicateHostCmd method execute.
@Override
public void execute() {
List<? extends DedicatedResources> result = dedicatedService.dedicateHost(getHostId(), getDomainId(), getAccountName());
ListResponse<DedicateHostResponse> response = new ListResponse<DedicateHostResponse>();
List<DedicateHostResponse> hostResponseList = new ArrayList<DedicateHostResponse>();
if (result != null) {
for (DedicatedResources resource : result) {
DedicateHostResponse hostResponse = dedicatedService.createDedicateHostResponse(resource);
hostResponseList.add(hostResponse);
}
response.setResponses(hostResponseList);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate host");
}
}
use of com.cloud.dc.DedicatedResources in project cloudstack by apache.
the class DedicatePodCmd method execute.
@Override
public void execute() {
List<? extends DedicatedResources> result = dedicatedService.dedicatePod(getPodId(), getDomainId(), getAccountName());
ListResponse<DedicatePodResponse> response = new ListResponse<DedicatePodResponse>();
List<DedicatePodResponse> podResponseList = new ArrayList<DedicatePodResponse>();
if (result != null) {
for (DedicatedResources resource : result) {
DedicatePodResponse podresponse = dedicatedService.createDedicatePodResponse(resource);
podResponseList.add(podresponse);
}
response.setResponses(podResponseList);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate pod");
}
}
Aggregations