use of com.emc.storageos.model.varray.VArrayAttributeList in project coprhd-controller by CoprHD.
the class VirtualArrayService method getAvailableAttributes.
/**
* Finds the available attributes & its values in a varray. Ex: In a
* varray, if a system supports raid_levels such as RAID1, RAID2 then
* this API call provides the supported information.
*
* @brief List available attributes for all VirtualArrays
* @return List available attributes for all VirtualArrays
*/
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/available-attributes")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public VArrayAttributeList getAvailableAttributes(BulkIdParam param) {
_log.info("Finding the available attributes for all varray: {}");
VArrayAttributeList vArrayAttributes = new VArrayAttributeList();
ObjectLocalCache cache = new ObjectLocalCache(_dbClient);
Map<URI, List<StoragePool>> allPools = getVirtualArrayPools(param.getIds(), cache);
for (Map.Entry<URI, List<StoragePool>> varrEntry : allPools.entrySet()) {
Map<String, Set<String>> availableAttrs = _matcherFramework.getAvailableAttributes(varrEntry.getKey(), varrEntry.getValue(), cache, AttributeMatcher.VPOOL_MATCHERS);
AttributeList list = new AttributeList();
list.setVArrayId(varrEntry.getKey());
for (Map.Entry<String, Set<String>> entry : availableAttrs.entrySet()) {
list.getAttributes().add(new VirtualPoolAvailableAttributesResourceRep(entry.getKey(), entry.getValue()));
}
if (!list.getAttributes().isEmpty()) {
vArrayAttributes.getAttributes().add(list);
}
}
cache.clearCache();
return vArrayAttributes;
}
use of com.emc.storageos.model.varray.VArrayAttributeList in project coprhd-controller by CoprHD.
the class VirtualArrays method getAvailableAttributes.
/**
* Gets the available attributes for the given virtual arrays.
* <p>
* API Call: <tt>GET /vdc/varrays/available-attributes</tt>
*
* @param virtualArrayIds
* the IDs of the virtual arrays.
* @return the list of available attributes.
*/
public Map<URI, List<VirtualPoolAvailableAttributesResourceRep>> getAvailableAttributes(Collection<URI> virtualArrayIds) {
BulkIdParam input = new BulkIdParam((List<URI>) virtualArrayIds);
VArrayAttributeList response = client.post(VArrayAttributeList.class, input, PathConstants.AVAILABLE_ATTRIBUTES_FOR_ALL_VARRAY);
Map<URI, List<VirtualPoolAvailableAttributesResourceRep>> availableAttributes = new HashMap<URI, List<VirtualPoolAvailableAttributesResourceRep>>();
for (AttributeList attributes : response.getAttributes()) {
availableAttributes.put(attributes.getVArrayId(), attributes.getAttributes());
}
return availableAttributes;
}
Aggregations