use of com.emc.storageos.model.portgroup.StoragePortGroupList in project coprhd-controller by CoprHD.
the class StorageSystemService method getAllStoragePortGroups.
/**
* Get all storage port groups for the storage system with the passed id.
*
* @param id
* the URN of a ViPR storage system.
*
* @brief List storage system storage port groups
* @return A reference to a StoragePortGroupList specifying the id and self link
* for each port group.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/storage-port-groups")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StoragePortGroupList getAllStoragePortGroups(@PathParam("id") URI id) {
ArgValidator.checkFieldUriType(id, StorageSystem.class, "id");
StorageSystem system = queryResource(id);
ArgValidator.checkEntity(system, id, isIdEmbeddedInURL(id));
URIQueryResultList portGroupURIs = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDevicePortGroupConstraint(id), portGroupURIs);
StoragePortGroupList portList = new StoragePortGroupList();
Iterator<URI> portGroupIter = portGroupURIs.iterator();
while (portGroupIter.hasNext()) {
URI pgURI = portGroupIter.next();
StoragePortGroup portGroup = _dbClient.queryObject(StoragePortGroup.class, pgURI);
if (portGroup != null && !portGroup.getInactive() && !portGroup.checkInternalFlags(Flag.INTERNAL_OBJECT)) {
portList.getPortGroups().add(toNamedRelatedResource(portGroup, portGroup.getNativeGuid()));
}
}
return portList;
}
use of com.emc.storageos.model.portgroup.StoragePortGroupList in project coprhd-controller by CoprHD.
the class StorageSystems method getStoragePortGroups.
/**
* Gets the list of storage port group from a storage system
*
* @param storageSystemId
* the ID of the storage system.
* @param exportId
* the ID of the export group
* @return the list of storage port groups.
*/
public List<NamedRelatedResourceRep> getStoragePortGroups(URI storageSystemId, URI exportId) {
UriBuilder builder = client.uriBuilder(baseUrl + "/{id}/storage-port-groups");
if (exportId != null && !exportId.equals("")) {
builder = builder.queryParam("export_group", exportId);
}
StoragePortGroupList portGroups = client.getURI(StoragePortGroupList.class, builder.build(storageSystemId));
return defaultList(portGroups.getPortGroups());
}
Aggregations