Search in sources :

Example 1 with VcenterList

use of com.emc.storageos.model.host.vcenter.VcenterList in project coprhd-controller by CoprHD.

the class TenantsService method listVcenters.

/**
 * Lists the id and name for all the vCenters that belong to the given tenant organization.
 *
 * @param id the URN of a ViPR tenant organization
 * @prereq none
 * @brief List tenant vCenters
 * @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}/vcenters")
public VcenterList listVcenters(@PathParam("id") URI id) throws DatabaseException {
    // this call is for validating the tenant Id
    getTenantById(id, false);
    // check the user permissions for this tenant org
    verifyAuthorizedInTenantOrg(id, getUserFromContext());
    // get all children vcenters
    VcenterList list = new VcenterList();
    list.setVcenters(map(ResourceTypeEnum.VCENTER, listChildrenWithAcls(id, Vcenter.class, "label")));
    return list;
}
Also used : VcenterList(com.emc.storageos.model.host.vcenter.VcenterList) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

VcenterList (com.emc.storageos.model.host.vcenter.VcenterList)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1