use of com.att.cdp.openstack.model.OpenStackTemplate 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.openstack.model.OpenStackTemplate in project AJSC by att.
the class OpenStackComputeService method getTemplates.
/**
* This method returns a list of templates that are available.
* <p>
* A template represents a definition of a hardware environment that is used to create an image. This includes
* number of cpu's, amount of memory, etc.
* </p>
*
* @return A list of available templates
* @throws ZoneException
* If the templates cannot be listed
* @see com.att.cdp.zones.ComputeService#getTemplates()
*/
@Override
public List<Template> getTemplates() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
ArrayList<Template> list = new ArrayList<>();
try {
com.woorea.openstack.nova.model.Flavors flavors = nova.getClient().flavors().list(true).execute();
for (com.woorea.openstack.nova.model.Flavor f : flavors.getList()) {
Template template = new OpenStackTemplate(context, f);
list.add(template);
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.openstack.model.OpenStackTemplate 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.openstack.model.OpenStackTemplate in project AJSC by att.
the class OpenStackComputeService method getTemplates.
/**
* This method returns a list of templates that are available.
* <p>
* A template represents a definition of a hardware environment that is used
* to create an image. This includes number of cpu's, amount of memory, etc.
* </p>
*
* @return A list of available templates
* @throws ZoneException
* If the templates cannot be listed
* @see com.att.cdp.zones.ComputeService#getTemplates()
*/
@Override
public List<Template> getTemplates() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
ArrayList<Template> list = new ArrayList<>();
try {
com.woorea.openstack.nova.model.Flavors flavors = nova.getClient().flavors().list(true).execute();
for (com.woorea.openstack.nova.model.Flavor f : flavors.getList()) {
Template template = new OpenStackTemplate(context, f);
list.add(template);
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
Aggregations