use of com.att.cdp.zones.model.Template 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.zones.model.Template in project AJSC by att.
the class TestTemplates method listTemplates.
/**
* Verifies that we can list the existing templates on a provider. This test requires that the provider actually has
* templates installed.
*
* @throws ZoneException
*/
@Test
@Ignore
public void listTemplates() throws ZoneException {
Context context = connect();
ComputeService service = context.getComputeService();
List<Template> templates = service.getTemplates();
assertNotNull(templates);
assertFalse(templates.isEmpty());
for (Template template : templates) {
System.out.println(template.toString());
}
}
use of com.att.cdp.zones.model.Template 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.zones.model.Template in project AJSC by att.
the class TestComputeService method testComputeService.
/**
* @throws ZoneException
* If something goes horribly wrong
*/
@Ignore
@Test
public void testComputeService() throws ZoneException {
Context context = connect();
ComputeService computeService = context.getComputeService();
List<Server> servers = computeService.getServers();
for (Server server : servers) {
computeService.getServers(server.getName());
computeService.getServer(server.getId());
computeService.getAttachments(server);
computeService.getAttachments(server.getId());
computeService.getConsoleOutput(server);
}
List<Template> templates = computeService.getTemplates();
for (Template template : templates) {
computeService.getTemplate(template.getId());
}
List<ACL> accessControlLists = computeService.getAccessControlLists();
for (ACL acl : accessControlLists) {
computeService.getAccessControlList(acl.getId());
}
}
Aggregations