use of com.emc.storageos.model.varray.AttributeList 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.AttributeList 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.
*
* @param id the URN of a ViPR VirtualArray.
* @brief List available attributes for VirtualArray
* @return List available attributes for VirtualArray
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/available-attributes")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public AttributeList getAvailableAttributes(@PathParam("id") URI id) {
// Get and validate the varray with the passed id.
ArgValidator.checkFieldUriType(id, VirtualArray.class, "id");
VirtualArray varray = _dbClient.queryObject(VirtualArray.class, id);
ArgValidator.checkEntityNotNull(varray, id, isIdEmbeddedInURL(id));
_log.info("Finding the available attributes for varray: {}", id);
AttributeList list = new AttributeList();
list.setVArrayId(id);
ObjectLocalCache cache = new ObjectLocalCache(_dbClient);
List<StoragePool> pools = getVirtualArrayPools(Arrays.asList(id), cache).get(id);
Map<String, Set<String>> availableAttrs = _matcherFramework.getAvailableAttributes(id, pools, cache, AttributeMatcher.VPOOL_MATCHERS);
cache.clearCache();
for (Map.Entry<String, Set<String>> entry : availableAttrs.entrySet()) {
list.getAttributes().add(new VirtualPoolAvailableAttributesResourceRep(entry.getKey(), entry.getValue()));
}
return list;
}
use of com.emc.storageos.model.varray.AttributeList 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