use of org.apache.cloudstack.api.response.GuestOsMappingResponse in project cloudstack by apache.
the class ApiResponseHelper method createGuestOSMappingResponse.
@Override
public GuestOsMappingResponse createGuestOSMappingResponse(GuestOSHypervisor guestOSHypervisor) {
GuestOsMappingResponse response = new GuestOsMappingResponse();
response.setId(guestOSHypervisor.getUuid());
response.setHypervisor(guestOSHypervisor.getHypervisorType());
response.setHypervisorVersion(guestOSHypervisor.getHypervisorVersion());
response.setOsNameForHypervisor((guestOSHypervisor.getGuestOsName()));
response.setIsUserDefined(Boolean.valueOf(guestOSHypervisor.getIsUserDefined()).toString());
GuestOS guestOs = ApiDBUtils.findGuestOSById(guestOSHypervisor.getGuestOsId());
if (guestOs != null) {
response.setOsStdName(guestOs.getDisplayName());
response.setOsTypeId(guestOs.getUuid());
}
response.setObjectName("guestosmapping");
return response;
}
use of org.apache.cloudstack.api.response.GuestOsMappingResponse in project cloudstack by apache.
the class UpdateGuestOsMappingCmd method execute.
@Override
public void execute() {
GuestOSHypervisor guestOsMapping = _mgr.updateGuestOsMapping(this);
if (guestOsMapping != null) {
GuestOsMappingResponse response = _responseGenerator.createGuestOSMappingResponse(guestOsMapping);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update guest OS mapping");
}
}
use of org.apache.cloudstack.api.response.GuestOsMappingResponse in project cloudstack by apache.
the class AddGuestOsMappingCmd method execute.
@Override
public void execute() {
GuestOSHypervisor guestOsMapping = _mgr.getAddedGuestOsMapping(getEntityId());
if (guestOsMapping != null) {
GuestOsMappingResponse response = _responseGenerator.createGuestOSMappingResponse(guestOsMapping);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add guest OS mapping");
}
}
use of org.apache.cloudstack.api.response.GuestOsMappingResponse in project cloudstack by apache.
the class ListGuestOsMappingCmd method execute.
@Override
public void execute() {
Pair<List<? extends GuestOSHypervisor>, Integer> result = _mgr.listGuestOSMappingByCriteria(this);
ListResponse<GuestOsMappingResponse> response = new ListResponse<GuestOsMappingResponse>();
List<GuestOsMappingResponse> osMappingResponses = new ArrayList<GuestOsMappingResponse>();
for (GuestOSHypervisor guestOSHypervisor : result.first()) {
GuestOsMappingResponse guestOsMappingResponse = _responseGenerator.createGuestOSMappingResponse(guestOSHypervisor);
osMappingResponses.add(guestOsMappingResponse);
}
response.setResponses(osMappingResponses, result.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
Aggregations