use of com.att.cdp.exceptions.ResourceNotFoundException in project AJSC by att.
the class OpenStackVolumeService method getVolume.
/**
* Returns information about the volume with the indicated id, if it exists.
*
* @param id
* The id of the volume that we want to find information about
* @return The volume if it exists
* @throws ZoneException
* - If the volume cannot be listed, or the volume does not exist
* @see com.att.cdp.zones.VolumeService#getVolume(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public Volume getVolume(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.VOLUME, id);
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
try {
com.woorea.openstack.nova.model.Volume volume = nova.getClient().volumes().show(id).execute();
if (volume == null) {
throw new ResourceNotFoundException(EELFResourceManager.format(OSMsg.PAL_OS_RESOURCE_NOT_FOUND, "Volume", id, context.getProvider().getName()));
}
return new OpenStackVolume(context, volume);
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
// for the compiler
return null;
}
use of com.att.cdp.exceptions.ResourceNotFoundException in project AJSC by att.
the class OpenStackVolumeService method getSnapshot.
/**
* Returns information about the snapshot with the indicated id, if it exists.
*
* @param id
* The id of the snapshot that we want to find information about
* @return The snapshot if it exists
* @throws ZoneException
* - If the snapshot cannot be listed, or the snapshot does not exist
* @see com.att.cdp.zones.VolumeService#getSnapshot(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public Snapshot getSnapshot(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SNAPSHOT, id);
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
try {
com.woorea.openstack.nova.model.Snapshot snapshot = nova.getClient().snapshots().show(id).execute();
if (snapshot == null) {
throw new ResourceNotFoundException(EELFResourceManager.format(OSMsg.PAL_OS_RESOURCE_NOT_FOUND, "Snapshot", id, context.getProvider().getName()));
}
return new OpenStackSnapshot(context, snapshot);
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
// for the compiler
return null;
}
use of com.att.cdp.exceptions.ResourceNotFoundException in project AJSC by att.
the class OpenStackComputeService method getTemplate.
/**
* Obtains the template specified by the provided id
*
* @see com.att.cdp.zones.ComputeService#getTemplate(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public Template getTemplate(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
RequestState.put(RequestState.TEMPLATE, id);
try {
return new OpenStackTemplate(context, nova.getClient().flavors().show(id).execute());
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
} catch (Exception e) {
throw new ResourceNotFoundException(e);
}
// for the compiler
return null;
}
use of com.att.cdp.exceptions.ResourceNotFoundException in project AJSC by att.
the class OpenStackVolumeService method getSnapshot.
/**
* Returns information about the snapshot with the indicated id, if it exists.
*
* @param id
* The id of the snapshot that we want to find information about
* @return The snapshot if it exists
* @throws ZoneException
* - If the snapshot cannot be listed, or the snapshot does not exist
* @see com.att.cdp.zones.VolumeService#getSnapshot(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public Snapshot getSnapshot(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SNAPSHOT, id);
RequestState.put(RequestState.SERVICE, "Volume");
RequestState.put(RequestState.SERVICE_URL, cinder.getEndpoint());
try {
com.woorea.openstack.cinder.model.Snapshot snapshot = cinder.getClient().snapshots().show(id).execute();
if (snapshot == null) {
throw new ResourceNotFoundException(EELFResourceManager.format(OSMsg.PAL_OS_RESOURCE_NOT_FOUND, "Snapshot", id, context.getProvider().getName()));
}
return new OpenStackSnapshot(context, snapshot);
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
// for the compiler
return null;
}
use of com.att.cdp.exceptions.ResourceNotFoundException in project AJSC by att.
the class OpenStackVolumeService method getVolume.
/**
* Returns information about the volume with the indicated id, if it exists.
*
* @param id
* The id of the volume that we want to find information about
* @return The volume if it exists
* @throws ZoneException
* - If the volume cannot be listed, or the volume does not exist
* @see com.att.cdp.zones.VolumeService#getVolume(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public Volume getVolume(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.VOLUME, id);
RequestState.put(RequestState.SERVICE, "Volume");
RequestState.put(RequestState.SERVICE_URL, cinder.getEndpoint());
try {
com.woorea.openstack.cinder.model.Volume volume = cinder.getClient().volumes().show(id).execute();
if (volume == null) {
throw new ResourceNotFoundException(EELFResourceManager.format(OSMsg.PAL_OS_RESOURCE_NOT_FOUND, "Volume", id, context.getProvider().getName()));
}
return new OpenStackVolume(context, volume);
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
// for the compiler
return null;
}
Aggregations