Search in sources :

Example 1 with StorageTierList

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;
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) StorageTier(com.emc.storageos.db.client.model.StorageTier) StorageTierList(com.emc.storageos.model.block.tier.StorageTierList) 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 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;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) StorageTier(com.emc.storageos.db.client.model.StorageTier) StorageTierList(com.emc.storageos.model.block.tier.StorageTierList) URI(java.net.URI) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 3 with 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;
}
Also used : MapStorageTier(com.emc.storageos.api.mapper.functions.MapStorageTier) StorageTier(com.emc.storageos.db.client.model.StorageTier) StorageTierList(com.emc.storageos.model.block.tier.StorageTierList) URI(java.net.URI) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

StorageTier (com.emc.storageos.db.client.model.StorageTier)3 StorageTierList (com.emc.storageos.model.block.tier.StorageTierList)3 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)3 URI (java.net.URI)2 MapStorageTier (com.emc.storageos.api.mapper.functions.MapStorageTier)1 AutoTieringPolicy (com.emc.storageos.db.client.model.AutoTieringPolicy)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1