use of com.emc.storageos.model.host.HostList in project coprhd-controller by CoprHD.
the class TenantsService method listHosts.
/**
* Lists the id and name for all the hosts that belong to the given tenant organization.
* <p>
* This method is deprecated. Use /compute/hosts instead
*
* @param id the URN of a ViPR tenant organization
* @prereq none
* @deprecated use {@link HostService#listHosts()}
* @brief List tenant hosts
* @return a list of hosts that belong to the tenant organization.
* @throws DatabaseException when a DB error occurs
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/hosts")
@Deprecated
public HostList listHosts(@PathParam("id") URI id) throws DatabaseException {
// this call validates the tenant id
getTenantById(id, false);
// check the user permissions for this tenant org
verifyAuthorizedInTenantOrg(id, getUserFromContext());
// get all host children
HostList list = new HostList();
list.setHosts(map(ResourceTypeEnum.HOST, listChildren(id, Host.class, "label", "tenant")));
return list;
}
use of com.emc.storageos.model.host.HostList in project coprhd-controller by CoprHD.
the class ClusterService method getClusterVblockHosts.
/**
* List the vblock hosts of a cluster.
*
* @param id the URN of a ViPR cluster
* @brief List vblock hosts for a cluster
* @return The list of vblock hosts in the cluster.
* @throws DatabaseException when a DB error occurs.
*/
@GET
@Path("/{id}/vblock-hosts")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public HostList getClusterVblockHosts(@PathParam("id") URI id) throws DatabaseException {
Cluster cluster = queryObject(Cluster.class, id, true);
// check the user permissions
verifyAuthorizedInTenantOrg(cluster.getTenant(), getUserFromContext());
HostList list = new HostList();
list.setHosts(map(ResourceTypeEnum.HOST, getVblockHostsFromCluster(id)));
return list;
}
use of com.emc.storageos.model.host.HostList in project coprhd-controller by CoprHD.
the class ClusterService method getClusterHosts.
/**
* List the hosts of a cluster.
*
* @param id the URN of a ViPR cluster
* @prereq none
* @brief List cluster hosts
* @return The list of hosts of the cluster.
* @throws DatabaseException when a DB error occurs.
*/
@GET
@Path("/{id}/hosts")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public HostList getClusterHosts(@PathParam("id") URI id) throws DatabaseException {
Cluster cluster = queryObject(Cluster.class, id, true);
// check the user permissions
verifyAuthorizedInTenantOrg(cluster.getTenant(), getUserFromContext());
HostList list = new HostList();
list.setHosts(map(ResourceTypeEnum.HOST, listChildren(id, Host.class, "label", "cluster")));
return list;
}
use of com.emc.storageos.model.host.HostList in project coprhd-controller by CoprHD.
the class ApiTestVcenter method getVcenterHosts.
private HostList getVcenterHosts(BalancedWebResource user, URI vCenterId, int expectedStatus) {
ClientResponse clientResponse = user.path(getVcenterHostsApi(vCenterId)).get(ClientResponse.class);
Assert.assertEquals(expectedStatus, clientResponse.getStatus());
if (expectedStatus != HttpStatus.SC_OK) {
return null;
}
HostList hostList = clientResponse.getEntity(HostList.class);
Assert.assertNotNull(hostList);
return hostList;
}
use of com.emc.storageos.model.host.HostList in project coprhd-controller by CoprHD.
the class VolumeGroupService method getHosts.
/**
* Get application hosts
*
* @param id Application Id
* @brief List hosts for an application
* @return HostList
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/hosts")
public HostList getHosts(@PathParam("id") URI id) {
ArgValidator.checkFieldUriType(id, VolumeGroup.class, "id");
VolumeGroup volumeGroup = _dbClient.queryObject(VolumeGroup.class, id);
HostList result = new HostList();
List<Host> hosts = getVolumeGroupHosts(_dbClient, volumeGroup);
for (Host host : hosts) {
result.getHosts().add(toNamedRelatedResource(host));
}
return result;
}
Aggregations