use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method createAccessControlList.
/**
* @see com.att.cdp.zones.ComputeService#createAccessControlList(com.att.cdp.zones.model.ACL)
*/
@SuppressWarnings("nls")
@Override
public ACL createAccessControlList(ACL model) throws ZoneException {
checkArg(model, "model");
checkArg(model.getName(), "name");
checkArg(model.getDescription(), "description");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
SecurityGroupForCreate create = new SecurityGroupForCreate();
create.setName(model.getName());
create.setDescription(model.getDescription());
try {
SecurityGroup group = nova.getClient().securityGroups().createSecurityGroup(create).execute();
return new OpenStackACL(context, group);
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
return null;
}
use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method getHypervisors.
/**
* @see com.att.cdp.zones.ComputeService#getHypervisors(java.lang.String)
*/
@Override
public List<Hypervisor> getHypervisors(String id) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
RequestState.put(RequestState.HYPERVISOR, id);
ArrayList<Hypervisor> list = new ArrayList<>();
try {
com.woorea.openstack.nova.model.Hypervisors hypervisors = nova.getClient().hypervisors().list(true).execute();
for (com.woorea.openstack.nova.model.Hypervisor h : hypervisors.getList()) {
if (id != null) {
if (h.getId().matches(id)) {
list.add(new OpenStackHypervisor(context, h));
}
} else {
list.add(new OpenStackHypervisor(context, h));
}
}
} 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 getServer.
/**
* Returns the indicated host using the specified identification token
*
* @param id
* The identification of the server
* @return The server
* @throws ZoneException
* - If the host cannot be found
* @see com.att.cdp.zones.ComputeService#getServer(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public Server getServer(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVER, id);
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
try {
com.woorea.openstack.nova.model.Server s = nova.getClient().servers().show(id).execute();
return new OpenStackServer(context, s);
} 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 getAccessControlLists.
/**
* @see com.att.cdp.zones.ComputeService#getAccessControlLists()
*/
@Override
public List<ACL> getAccessControlLists() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
ArrayList<ACL> list = new ArrayList<>();
try {
for (SecurityGroup group : nova.getClient().securityGroups().listSecurityGroups().execute()) {
list.add(new OpenStackACL(context, group));
}
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
return list;
}
use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method rebuildServer.
/**
* Rebuilds the server from a supplied snapshot
*
* @see com.att.cdp.zones.ComputeService#rebuildServer(com.att.cdp.zones.model.Server, java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public void rebuildServer(Server server, String snapshot) throws ZoneException {
checkArg(server, "server");
checkArg(snapshot, "snapshot");
connect();
trackRequest();
RequestState.put(RequestState.SERVER, server.getId());
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
Rebuild rebuild = new Rebuild();
rebuild.setImageRef(snapshot);
try {
nova.getClient().servers().rebuild(server.getId(), rebuild).execute();
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
}
Aggregations