use of com.att.cdp.openstack.model.OpenStackImage in project AJSC by att.
the class OpenStackImageService method listImages.
/**
* This method is used to list all of the images that are available within the context.
*
* @return The list of images or an empty list if there are none available.
* @throws ZoneException
* If the service fails.
* @see com.att.cdp.zones.ImageService#listImages()
*/
@Override
public List<Image> listImages() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
ArrayList<Image> list = new ArrayList<>();
try {
for (com.woorea.openstack.nova.model.Image osImage : nova.getClient().images().list(true).execute()) {
list.add(new OpenStackImage(context, osImage));
}
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
return list;
}
use of com.att.cdp.openstack.model.OpenStackImage in project AJSC by att.
the class OpenStackImageService method getImage.
/**
* @see com.att.cdp.zones.ImageService#getImage(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public Image getImage(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.IMAGE, id);
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
try {
return new OpenStackImage(context, nova.getClient().images().show(id).execute());
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
// just for the compiler
return null;
}
use of com.att.cdp.openstack.model.OpenStackImage in project AJSC by att.
the class OpenStackImageService method listImages.
/**
* This method is used to list all of the images where the name of the image matches the supplied pattern.
*
* @param pattern
* The pattern (regular expression) that is compared to the image name to select it for the returned
* list.
* @return The list of images that match the specified name pattern
* @throws ZoneException
* If anything fails
* @see com.att.cdp.zones.ImageService#listImages(java.lang.String)
*/
@Override
public List<Image> listImages(String pattern) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.IMAGE, pattern);
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
ArrayList<Image> list = new ArrayList<>();
try {
for (com.woorea.openstack.nova.model.Image osImage : nova.getClient().images().list(true).execute()) {
if (pattern != null) {
if (osImage.getName().matches(pattern)) {
list.add(new OpenStackImage(context, osImage));
}
} else {
list.add(new OpenStackImage(context, osImage));
}
}
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
return list;
}
Aggregations