use of com.att.cdp.openstack.model.OpenStackServer 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.att.cdp.openstack.model.OpenStackServer in project AJSC by att.
the class OpenStackComputeService method getServers.
/**
* Returns the list of servers that match the name pattern supplied.
*
* @param name
* A regular expression that can be used to filter server names. A string that is suitable to use in the
* Java <code>String.matches()</code> method.
* @return The server
* @throws ZoneException
* If the host cannot be found
* @see java.lang.String#matches(String)
* @see com.att.cdp.zones.ComputeService#getServers(java.lang.String)
*/
@Override
public List<Server> getServers(String name) throws ZoneException {
// checkArg(name, "name");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
RequestState.put(RequestState.SERVER, name);
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()) {
if (name != null) {
if (s.getName().matches(name)) {
list.add(new OpenStackServer(context, s));
}
} else {
list.add(new OpenStackServer(context, s));
}
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.openstack.model.OpenStackServer 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.att.cdp.openstack.model.OpenStackServer in project AJSC by att.
the class OpenStackComputeService method getServers.
/**
* Returns the list of servers that match the name pattern supplied.
*
* @param name
* A regular expression that can be used to filter server names.
* A string that is suitable to use in the Java
* <code>String.matches()</code> method.
* @return The server
* @throws ZoneException
* If the host cannot be found
* @see java.lang.String#matches(String)
* @see com.att.cdp.zones.ComputeService#getServers(java.lang.String)
*/
@Override
public List<Server> getServers(String name) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
RequestState.put(RequestState.SERVER, name);
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()) {
if (name != null) {
if (s.getName().matches(name)) {
list.add(new OpenStackServer(context, s));
}
} else {
list.add(new OpenStackServer(context, s));
}
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.openstack.model.OpenStackServer 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;
}
Aggregations