Search in sources :

Example 1 with FilePolicyStorageResources

use of com.emc.storageos.model.file.policy.FilePolicyStorageResources in project coprhd-controller by CoprHD.

the class FilePolicyService method getFilePolicyStorageResources.

/**
 * @brief Get the list of policy storage resources of a file policy.
 *
 * @param id of the file policy.
 * @return List of policy storage resource information.
 */
@GET
@Path("/{id}/policy-storage-resources")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR, Role.TENANT_ADMIN })
public FilePolicyStorageResources getFilePolicyStorageResources(@PathParam("id") URI id) {
    _log.info("Request recieved to list storage resources for the policy {}", id);
    FilePolicy filepolicy = queryResource(id);
    ArgValidator.checkEntity(filepolicy, id, true);
    FilePolicyStorageResources resources = new FilePolicyStorageResources();
    List<FilePolicyStorageResourceRestRep> policyResources = new ArrayList<FilePolicyStorageResourceRestRep>();
    for (PolicyStorageResource storageRes : FileOrchestrationUtils.getFilePolicyStorageResources(_dbClient, filepolicy)) {
        policyResources.add(FilePolicyMapper.mapPolicyStorageResource(storageRes, filepolicy, _dbClient));
    }
    resources.setStorageResources(policyResources);
    return resources;
}
Also used : FilePolicy(com.emc.storageos.db.client.model.FilePolicy) MapFilePolicy(com.emc.storageos.api.mapper.functions.MapFilePolicy) ArrayList(java.util.ArrayList) FilePolicyStorageResourceRestRep(com.emc.storageos.model.file.policy.FilePolicyStorageResourceRestRep) PolicyStorageResource(com.emc.storageos.db.client.model.PolicyStorageResource) FilePolicyStorageResources(com.emc.storageos.model.file.policy.FilePolicyStorageResources) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

MapFilePolicy (com.emc.storageos.api.mapper.functions.MapFilePolicy)1 FilePolicy (com.emc.storageos.db.client.model.FilePolicy)1 PolicyStorageResource (com.emc.storageos.db.client.model.PolicyStorageResource)1 FilePolicyStorageResourceRestRep (com.emc.storageos.model.file.policy.FilePolicyStorageResourceRestRep)1 FilePolicyStorageResources (com.emc.storageos.model.file.policy.FilePolicyStorageResources)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 ArrayList (java.util.ArrayList)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1