Search in sources :

Example 46 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSystems method listPolicySnapshot.

public static void listPolicySnapshot(String fileSystemId, String policyId, String policyName) {
    renderArgs.put("dataTable", new FilePolicySnapshotsDataTable());
    renderArgs.put("fileSystemId", uri(fileSystemId));
    renderArgs.put("policyId", uri(policyId));
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileShareRestRep restRep = client.fileSystems().get(uri(fileSystemId));
    renderArgs.put("filePolicyName", policyName);
    renderArgs.put("fileSystemName", restRep.getName());
    renderArgs.put("fileSystemAndpolicyId", fileSystemId + "~~~" + policyId);
    render();
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) FilePolicySnapshotsDataTable(models.datatable.FilePolicySnapshotsDataTable)

Example 47 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSystems method getScheculePolicies.

public static void getScheculePolicies() {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<NamedRelatedResourceRep> filePolicies = client.fileProtectionPolicies().listFilePolicies().getFilePolicies();
    List<StringOption> policyOptions = Lists.newArrayList();
    for (NamedRelatedResourceRep filePolicy : filePolicies) {
        FilePolicyRestRep policyRestRep = client.fileProtectionPolicies().get(filePolicy.getId());
        if (policyRestRep != null && "file_system".equalsIgnoreCase(policyRestRep.getAppliedAt())) {
            policyOptions.add(new StringOption(policyRestRep.getId().toString(), filePolicy.getName()));
        }
    }
    renderJSON(policyOptions);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) StringOption(util.StringOption) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 48 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSystems method addSubDirAndNfsAcl.

public static void addSubDirAndNfsAcl(String formAccessControlList, String fileSystem, String subDir) {
    if (formAccessControlList == null || "".equals(formAccessControlList)) {
        flash.error(MessagesUtils.get("resources.filesystem.share.acl.invalid.settings"), null);
        fileSystem(fileSystem);
    }
    FileNfsACLUpdateParams input = createNfsAclParams(formAccessControlList);
    if (subDir != null && !"null".equals(subDir) && !subDir.isEmpty()) {
        input.setSubDir(subDir);
    }
    ViPRCoreClient client = BourneUtil.getViprClient();
    try {
        client.fileSystems().updateNfsACL(uri(fileSystem), input);
    } catch (Exception e) {
        flash.error(e.getMessage(), null);
        fileSystem(fileSystem);
    }
    flash.success(MessagesUtils.get(ADDED));
    fileSystem(fileSystem);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileNfsACLUpdateParams(com.emc.storageos.model.file.FileNfsACLUpdateParams) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException) FlashException(controllers.util.FlashException) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException)

Example 49 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSystems method deleteFileSystemShare.

@FlashException(referrer = { "fileSystem" })
public static void deleteFileSystemShare(String fileSystemId, String shareName) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    Task<FileShareRestRep> task = client.fileSystems().removeShare(uri(fileSystemId), shareName);
    flash.put("info", MessagesUtils.get("resources.filesystem.share.deactivate"));
    fileSystem(fileSystemId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) FlashException(controllers.util.FlashException)

Example 50 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSystems method listAcl.

/**
 * This method called when Access Control List page is loaded.
 *
 * @param fileSystem
 *            File System id of the provided File System.
 * @param shareName
 *            Name of the file share.
 */
public static void listAcl(String fileSystem, String shareName) {
    renderArgs.put("dataTable", new ShareACLDataTable());
    renderArgs.put("fileSystem", uri(fileSystem));
    renderArgs.put("shareName", shareName);
    renderArgs.put("aclURL", "/file/filesystems/" + uri(fileSystem) + "/shares/" + shareName + "/acl");
    renderArgs.put("permissionOptions", StringOption.options(new String[] { "Read", "Change", "FullControl" }));
    renderArgs.put("fileSystemId", uri(fileSystem));
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileShareRestRep restRep = client.fileSystems().get(uri(fileSystem));
    renderArgs.put("fileSystemName", restRep.getName());
    ShareACLForm shareACL = new ShareACLForm();
    render(shareACL);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) ShareACLDataTable(models.datatable.ShareACLDataTable)

Aggregations

ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)225 Asset (com.emc.sa.asset.annotation.Asset)72 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)66 URI (java.net.URI)66 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)49 FlashException (controllers.util.FlashException)48 AssetOption (com.emc.vipr.model.catalog.AssetOption)41 ArrayList (java.util.ArrayList)34 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)29 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)27 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)24 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)20 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)15 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)15 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)13 HashSet (java.util.HashSet)13 Task (com.emc.vipr.client.Task)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)10 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)8