Search in sources :

Example 41 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class FileSnapshots method deleteSnapshotExport.

@FlashException(referrer = { "snapshot" })
public static void deleteSnapshotExport(String snapshotId, String security, String exportPath) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportRule rule = new ExportRule();
    rule.setSecFlavor(security);
    List<ExportRule> list = Lists.newArrayList();
    list.add(rule);
    ExportRules exportRules = new ExportRules();
    exportRules.setExportRules(list);
    SnapshotExportUpdateParams params = new SnapshotExportUpdateParams();
    params.setExportRulesToDelete(exportRules);
    FileSnapshotRestRep snapshot = client.fileSnapshots().get(uri(snapshotId));
    String subDir = FileUtils.findSubDirectory(snapshot.getMountPath(), exportPath);
    client.fileSnapshots().updateExport(uri(snapshotId), subDir, params);
    flash.put("info", MessagesUtils.get("resources.filesnapshot.export.deactivate"));
    snapshot(snapshotId);
}
Also used : SnapshotExportUpdateParams(com.emc.storageos.model.file.SnapshotExportUpdateParams) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) ExportRules(com.emc.storageos.model.file.ExportRules) ExportRule(com.emc.storageos.model.file.ExportRule) FlashException(controllers.util.FlashException)

Example 42 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class FileSystems method unassignPolicyToFileSystem.

@FlashException(referrer = { "fileSystem" })
public static void unassignPolicyToFileSystem(String fileSystemId, String policyId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    try {
        client.fileSystems().dissociateFilePolicy(uri(fileSystemId), uri(policyId));
    } catch (Exception ex) {
        flash.error(MessagesUtils.get("schedulePolicy.unassign.error"), null);
    }
    fileSystem(fileSystemId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException) FlashException(controllers.util.FlashException) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) FlashException(controllers.util.FlashException)

Example 43 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class FileSystems method saveNfsAce.

@FlashException(referrer = { "fileSystem" })
public static void saveNfsAce(NfsACLForm nfsACL) {
    String name = params.get("name");
    String type = params.get("type");
    String domain = params.get("domain");
    String subDir = params.get("subDir");
    String fsMountPath = params.get("fsMountPath");
    String fileSystemId = params.get("fileSystemId");
    Set<String> permissions = nfsACL.permissions;
    String permissionType = nfsACL.permissionType;
    String strPer = "";
    nfsACL.validate("nfsACL");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    for (String permission : permissions) {
        strPer = strPer + permission.toLowerCase() + ",";
    }
    strPer = strPer.substring(0, strPer.length() - 1);
    List<NfsACE> aces = Lists.newArrayList();
    NfsACE nfsAce = new NfsACE();
    nfsAce.setType(type.toLowerCase());
    nfsAce.setUser(name);
    nfsAce.setPermissions(strPer);
    nfsAce.setPermissionType(permissionType);
    if (domain != null && !"".equals(domain) && !"null".equals(domain)) {
        nfsAce.setDomain(domain);
    }
    aces.add(nfsAce);
    FileNfsACLUpdateParams input = new FileNfsACLUpdateParams();
    input.setAcesToModify(aces);
    if (subDir != null && !"null".equals(subDir)) {
        input.setSubDir(subDir);
    }
    ViPRCoreClient client = BourneUtil.getViprClient();
    client.fileSystems().updateNfsACL(uri(fileSystemId), input);
    listNfsAcl(fileSystemId, fsMountPath, subDir);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) NfsACE(com.emc.storageos.model.file.NfsACE) FileNfsACLUpdateParams(com.emc.storageos.model.file.FileNfsACLUpdateParams) FlashException(controllers.util.FlashException)

Example 44 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class FileSystems method addSubDirectory.

/**
 * This method called when user adds sub directory.
 *
 * @param id
 *            id of the file system.
 * @param shareName
 *            shareName of the sub directory.
 * @param subDirectory
 *            name of the sub directory.
 * @param description
 *            Given description during creation of sub directory.
 */
@FlashException(referrer = { "fileSystem" })
public static void addSubDirectory(String id, String shareName, String subDirectroy, String description) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileSystemShareParam param = new FileSystemShareParam();
    param.setShareName(shareName);
    if (subDirectroy != null && !"".equals(subDirectroy)) {
        param.setSubDirectory(subDirectroy);
    }
    if (description != null && !"".equals(description)) {
        param.setDescription(description);
    }
    client.fileSystems().share(uri(id), param);
    flash.put("info", MessagesUtils.get("resources.filesystem.subdir.add"));
    fileSystem(id);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSystemShareParam(com.emc.storageos.model.file.FileSystemShareParam) FlashException(controllers.util.FlashException)

Example 45 with FlashException

use of controllers.util.FlashException 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)

Aggregations

FlashException (controllers.util.FlashException)122 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)45 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)9 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)9 URI (java.net.URI)9 ExportUpdateParam (com.emc.storageos.model.block.export.ExportUpdateParam)8 Restrictions (controllers.deadbolt.Restrictions)8 ArrayList (java.util.ArrayList)7 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)5 CopiesParam (com.emc.storageos.model.block.CopiesParam)4 SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)4 ExportRule (com.emc.storageos.model.file.ExportRule)4 ExportRules (com.emc.storageos.model.file.ExportRules)4 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)4 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)4 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)4 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)2