use of com.cloud.api.response.GuestOsMappingResponse in project cosmic by MissionCriticalCloud.
the class AddGuestOsMappingCmd method execute.
@Override
public void execute() {
final GuestOSHypervisor guestOsMapping = _mgr.getAddedGuestOsMapping(getEntityId());
if (guestOsMapping != null) {
final 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 com.cloud.api.response.GuestOsMappingResponse in project cosmic by MissionCriticalCloud.
the class ListGuestOsMappingCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Pair<List<? extends GuestOSHypervisor>, Integer> result = _mgr.listGuestOSMappingByCriteria(this);
final ListResponse<GuestOsMappingResponse> response = new ListResponse<>();
final List<GuestOsMappingResponse> osMappingResponses = new ArrayList<>();
for (final GuestOSHypervisor guestOSHypervisor : result.first()) {
final GuestOsMappingResponse guestOsMappingResponse = _responseGenerator.createGuestOSMappingResponse(guestOSHypervisor);
osMappingResponses.add(guestOsMappingResponse);
}
response.setResponses(osMappingResponses, result.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.api.response.GuestOsMappingResponse in project cosmic by MissionCriticalCloud.
the class UpdateGuestOsMappingCmd method execute.
@Override
public void execute() {
final GuestOSHypervisor guestOsMapping = _mgr.updateGuestOsMapping(this);
if (guestOsMapping != null) {
final 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 com.cloud.api.response.GuestOsMappingResponse in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method createGuestOSMappingResponse.
@Override
public GuestOsMappingResponse createGuestOSMappingResponse(final GuestOSHypervisor guestOSHypervisor) {
final 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());
final GuestOS guestOs = ApiDBUtils.findGuestOSById(guestOSHypervisor.getGuestOsId());
if (guestOs != null) {
response.setOsStdName(guestOs.getDisplayName());
response.setOsTypeId(guestOs.getUuid());
}
response.setObjectName("guestosmapping");
return response;
}
Aggregations