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