use of com.emc.storageos.model.block.tier.StorageTierList in project coprhd-controller by CoprHD.
the class StoragePoolService method getStorageTiers.
/**
* Get Storage tiers associated with given Pool
* Vmax pools, only one tier will be present always
* Vnx pools can have multiple tiers.
*
* @param id the URN of a ViPR storage pool.
*
* @brief List storage pool storage tiers
* @return A StorageTierList reference specifying the data for the
* storage tier with the passed id.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/storage-tiers")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageTierList getStorageTiers(@PathParam("id") URI id) {
ArgValidator.checkFieldUriType(id, StoragePool.class, "id");
StoragePool storagePool = queryRegisteredResource(id);
ArgValidator.checkEntity(storagePool, id, isIdEmbeddedInURL(id));
if (storagePool.getTiers() == null) {
throw APIException.badRequests.invalidParameterStoragePoolHasNoTiers(id);
}
StorageTierList storageTierList = new StorageTierList();
for (String tierUri : storagePool.getTiers()) {
StorageTier tier = _dbClient.queryObject(StorageTier.class, URI.create(tierUri));
if (null != tier) {
storageTierList.getStorageTiers().add(toNamedRelatedResource(tier, tier.getNativeGuid()));
}
}
return storageTierList;
}
use of com.emc.storageos.model.block.tier.StorageTierList in project coprhd-controller by CoprHD.
the class AutoTieringService method getStorageTiersForGivenPolicy.
/**
* Show the storage tiers associated with a specific auto tiering policy
* Only auto tiering policies belonging to VMAX systems have direct association to tiers.
*
* @param id the URN of a ViPR auto tier policy
*
* @prereq none
* @brief List storage tiers for auto tiering policy
* @return Policy Object
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
@Path("/{id}/storage-tiers")
public StorageTierList getStorageTiersForGivenPolicy(@PathParam("id") URI id) {
ArgValidator.checkFieldUriType(id, AutoTieringPolicy.class, "id");
AutoTieringPolicy policy = _dbClient.queryObject(AutoTieringPolicy.class, id);
ArgValidator.checkEntityNotNull(policy, id, isIdEmbeddedInURL(id));
StorageTierList storageTierList = new StorageTierList();
List<URI> tierUris = _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageTierFASTPolicyConstraint(policy.getId().toString()));
List<StorageTier> tiers = _dbClient.queryObject(StorageTier.class, tierUris);
for (StorageTier tier : tiers) {
storageTierList.getStorageTiers().add(toNamedRelatedResource(tier, tier.getNativeGuid()));
}
return storageTierList;
}
use of com.emc.storageos.model.block.tier.StorageTierList in project coprhd-controller by CoprHD.
the class StorageTierService method getStorageTiers.
/**
* List all storage tiers
*
* @prereq none
* @brief List all storage tiers.
* @return StorageTierList
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageTierList getStorageTiers() {
StorageTierList tierList = new StorageTierList();
List<URI> tierUris = _dbClient.queryByType(StorageTier.class, true);
List<StorageTier> tiers = _dbClient.queryObject(StorageTier.class, tierUris);
for (StorageTier tier : tiers) {
tierList.getStorageTiers().add(DbObjectMapper.toNamedRelatedResource(ResourceTypeEnum.STORAGE_TIER, tier.getId(), tier.getLabel()));
}
return tierList;
}
Aggregations