use of com.emc.storageos.model.compute.ComputeImageList in project coprhd-controller by CoprHD.
the class ComputeImageService method getComputeImages.
/**
* Returns a list of all compute images.
*
* @brief Show compute images
* @return List of all compute images.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public ComputeImageList getComputeImages(@QueryParam("imageType") String imageType) {
log.info("getComputeImages, imageType: {}", imageType);
// validate query param
if (imageType != null) {
ArgValidator.checkFieldValueFromEnum(imageType, "imageType", ComputeImage.ImageType.class);
}
List<URI> ids = _dbClient.queryByType(ComputeImage.class, true);
ComputeImageList list = new ComputeImageList();
Iterator<ComputeImage> iter = _dbClient.queryIterativeObjects(ComputeImage.class, ids);
while (iter.hasNext()) {
ComputeImage img = iter.next();
if (imageType == null || imageType.equals(img.getImageType())) {
list.getComputeImages().add(DbObjectMapper.toNamedRelatedResource(img));
}
}
return list;
}
use of com.emc.storageos.model.compute.ComputeImageList in project coprhd-controller by CoprHD.
the class ComputeImages method listByImageType.
/**
* Filter to show only ESX/i compute images.
*
* @param imageType
* the type of the image (e.g. esx, linux)
* @return List of ESX/i compute images.
*/
public List<NamedRelatedResourceRep> listByImageType(String imageType) {
URI getUri = client.uriBuilder(baseUrl).queryParam("imageType", imageType).build();
ComputeImageList response = client.getURI(ComputeImageList.class, getUri);
return ResourceUtils.defaultList(response.getComputeImages());
}
Aggregations