use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackVolumeService method getSnapshotsByVolume.
/**
* @see com.att.cdp.zones.VolumeService#getSnapshotsByVolume(java.lang.String)
*/
@Override
public List<Snapshot> getSnapshotsByVolume(String id) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.VOLUME, id);
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
ArrayList<Snapshot> list = new ArrayList<>();
try {
com.woorea.openstack.nova.model.Snapshots snapshots = nova.getClient().snapshots().list(true).execute();
for (com.woorea.openstack.nova.model.Snapshot snap : snapshots) {
if (id != null) {
if (snap.getVolumeId() != null && snap.getVolumeId().matches(id)) {
list.add(new OpenStackSnapshot(context, snap));
}
}
}
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
return list;
}
use of com.woorea.openstack.base.client.OpenStackBaseException 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.woorea.openstack.base.client.OpenStackBaseException 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.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method getServers.
/**
* Obtain a list of servers from the compute service.
*
* @return The list of servers that are defined.
* @throws ZoneException
* - If any of the following conditions are true:
* <ul>
* <li>the user has not successfully logged in to the provider</li>
* <li>the context has been closed and this service is requested</li>
* <li>the current user does not have the rights to perform this operation</li>
* <li>the user and/or credentials are not valid</li>
* </ul>
* @see com.att.cdp.zones.ComputeService#getServers()
*/
@Override
public List<Server> getServers() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
ArrayList<Server> list = new ArrayList<>();
try {
com.woorea.openstack.nova.model.Servers servers = nova.getClient().servers().list(true).execute();
for (com.woorea.openstack.nova.model.Server s : servers.getList()) {
list.add(new OpenStackServer(context, s));
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method getHypervisor.
/**
* @see com.att.cdp.zones.ComputeService#getHypervisor(java.lang.String)
*/
@Override
public Hypervisor getHypervisor(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.HYPERVISOR, id);
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
try {
com.woorea.openstack.nova.model.Hypervisor hypervisor = nova.getClient().hypervisors().show(id).execute();
return new OpenStackHypervisor(context, hypervisor);
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return null;
}
Aggregations