use of com.emc.storageos.model.file.FilePolicyRestRep in project coprhd-controller by CoprHD.
the class FilePolicyApiTest method testGetFileSnapshotPolicy.
@Test
public void testGetFileSnapshotPolicy() {
FilePolicyRestRep fileSnapshotPolicyResp = rSys.path(getFilePolicyURI(createdFileSnapshotPolicyURI)).get(FilePolicyRestRep.class);
Assert.assertNotNull(fileSnapshotPolicyResp);
Assert.assertTrue(createdFileSnapshotPolicyURI.equals(fileSnapshotPolicyResp.getId()));
}
use of com.emc.storageos.model.file.FilePolicyRestRep in project coprhd-controller by CoprHD.
the class FileService method getFileSystemPolicy.
/**
* Get Policy for file system
*
* @param id
* the URN of a ViPR File system
* @brief Show file system
* @return File system Policy details
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/file-policies")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public FilePolicyList getFileSystemPolicy(@PathParam("id") URI id) {
FilePolicyList fpList = new FilePolicyList();
List<FilePolicyRestRep> fpRestList = new ArrayList<FilePolicyRestRep>();
ArgValidator.checkFieldUriType(id, FileShare.class, "id");
FileShare fs = queryResource(id);
StringSet fpolicies = fs.getFilePolicies();
for (String fpolicy : fpolicies) {
FilePolicyRestRep fpRest = new FilePolicyRestRep();
URI fpURI = URI.create(fpolicy);
if (fpURI != null) {
SchedulePolicy fp = _permissionsHelper.getObjectById(fpURI, SchedulePolicy.class);
if (fp != null) {
ArgValidator.checkEntityNotNull(fp, fpURI, isIdEmbeddedInURL(fpURI));
getFilePolicyRestRep(fpRest, fp, fs);
}
}
fpRestList.add(fpRest);
}
fpList.setFilePolicies(fpRestList);
return fpList;
}
Aggregations