Search in sources :

Example 1 with VirtualNASList

use of com.emc.storageos.model.vnas.VirtualNASList in project coprhd-controller by CoprHD.

the class StorageSystemService method getVnasServers.

/**
 * Gets all virtual NAS for the registered storage system with the passed
 * id.
 *
 * @param id the URN of a ViPR storage system.
 *
 * @brief List storage system virtual nas servers
 * @return A reference to a StoragePooList specifying the id and self link
 *         for each storage pool.
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/vnasservers")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public VirtualNASList getVnasServers(@PathParam("id") URI id) {
    // Make sure storage system is registered.
    ArgValidator.checkFieldUriType(id, StorageSystem.class, "id");
    StorageSystem system = queryResource(id);
    ArgValidator.checkEntity(system, id, isIdEmbeddedInURL(id));
    VirtualNASList vNasList = new VirtualNASList();
    URIQueryResultList vNasURIs = new URIQueryResultList();
    _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceVirtualNasConstraint(id), vNasURIs);
    Iterator<URI> vNasIter = vNasURIs.iterator();
    while (vNasIter.hasNext()) {
        URI vNasURI = vNasIter.next();
        VirtualNAS vNas = _dbClient.queryObject(VirtualNAS.class, vNasURI);
        if (vNas != null && !vNas.getInactive()) {
            vNasList.getVNASServers().add(toNamedRelatedResource(vNas, vNas.getNativeGuid()));
        }
    }
    return vNasList;
}
Also used : VirtualNASList(com.emc.storageos.model.vnas.VirtualNASList) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 2 with VirtualNASList

use of com.emc.storageos.model.vnas.VirtualNASList in project coprhd-controller by CoprHD.

the class VirtualNasService method getVirtualNasServers.

/**
 * Gets the ids and self links for all virtual NAS.
 *
 * @brief List virtual NAS servers
 * @return A VirtualNASList reference specifying the ids and self links for
 *         the virtual NAS servers.
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public VirtualNASList getVirtualNasServers() {
    VirtualNASList vNasList = new VirtualNASList();
    List<URI> ids = _dbClient.queryByType(VirtualNAS.class, true);
    for (URI id : ids) {
        VirtualNAS vNas = _dbClient.queryObject(VirtualNAS.class, id);
        if ((vNas != null)) {
            vNasList.getVNASServers().add(toNamedRelatedResource(vNas, vNas.getNasName()));
        }
    }
    return vNasList;
}
Also used : VirtualNASList(com.emc.storageos.model.vnas.VirtualNASList) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) URI(java.net.URI) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

VirtualNAS (com.emc.storageos.db.client.model.VirtualNAS)2 VirtualNASList (com.emc.storageos.model.vnas.VirtualNASList)2 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)2 URI (java.net.URI)2 GET (javax.ws.rs.GET)2 Produces (javax.ws.rs.Produces)2 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 Path (javax.ws.rs.Path)1