use of org.apache.cloudstack.api.response.GuestOSResponse in project cloudstack by apache.
the class ListGuestOsCmd method execute.
@Override
public void execute() {
Pair<List<? extends GuestOS>, Integer> result = _mgr.listGuestOSByCriteria(this);
ListResponse<GuestOSResponse> response = new ListResponse<GuestOSResponse>();
List<GuestOSResponse> osResponses = new ArrayList<GuestOSResponse>();
for (GuestOS guestOS : result.first()) {
GuestOSResponse guestOSResponse = _responseGenerator.createGuestOSResponse(guestOS);
osResponses.add(guestOSResponse);
}
response.setResponses(osResponses, result.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of org.apache.cloudstack.api.response.GuestOSResponse in project cloudstack by apache.
the class AddGuestOsCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("Guest OS Id: " + getEntityId());
GuestOS guestOs = _mgr.getAddedGuestOs(getEntityId());
if (guestOs != null) {
GuestOSResponse response = _responseGenerator.createGuestOSResponse(guestOs);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add new guest OS type");
}
}
use of org.apache.cloudstack.api.response.GuestOSResponse in project cloudstack by apache.
the class ApiResponseHelper method createGuestOSResponse.
@Override
public GuestOSResponse createGuestOSResponse(GuestOS guestOS) {
GuestOSResponse response = new GuestOSResponse();
response.setDescription(guestOS.getDisplayName());
response.setId(guestOS.getUuid());
response.setIsUserDefined(Boolean.valueOf(guestOS.getIsUserDefined()).toString());
GuestOSCategoryVO category = ApiDBUtils.findGuestOsCategoryById(guestOS.getCategoryId());
if (category != null) {
response.setOsCategoryId(category.getUuid());
}
response.setObjectName("ostype");
return response;
}
use of org.apache.cloudstack.api.response.GuestOSResponse in project cloudstack by apache.
the class UpdateGuestOsCmd method execute.
@Override
public void execute() {
GuestOS guestOs = _mgr.updateGuestOs(this);
if (guestOs != null) {
GuestOSResponse response = _responseGenerator.createGuestOSResponse(guestOs);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update guest OS type");
}
}
Aggregations