Search in sources :

Example 96 with FlashException

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

the class FileSnapshots method addSnapShotSubDir.

/**
 * 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 = { "snapshot" })
public static void addSnapShotSubDir(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.fileSnapshots().share(uri(id), param);
    flash.put("info", MessagesUtils.get("resources.filesystem.subdir.add"));
    snapshot(id);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSystemShareParam(com.emc.storageos.model.file.FileSystemShareParam) FlashException(controllers.util.FlashException)

Example 97 with FlashException

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

the class FileSnapshots method deleteFileSnapshot.

@FlashException(referrer = { "snapshot" })
public static void deleteFileSnapshot(String fileSnapshotId) {
    if (StringUtils.isNotBlank(fileSnapshotId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        Task<FileSnapshotRestRep> task = client.fileSnapshots().deactivate(uri(fileSnapshotId));
        flash.put("info", MessagesUtils.get("resources.filesnapshot.deactivate"));
    }
    snapshot(fileSnapshotId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) FlashException(controllers.util.FlashException)

Example 98 with FlashException

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

the class FileSystems method fileSystemQuotaDirectories.

@FlashException(referrer = { "fileSystem" })
public static void fileSystemQuotaDirectories(String fileSystemId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<QuotaDirectoryRestRep> quotas = client.quotaDirectories().getByFileSystem(uri(fileSystemId));
    render(quotas);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) QuotaDirectoryRestRep(com.emc.storageos.model.file.QuotaDirectoryRestRep) FlashException(controllers.util.FlashException)

Example 99 with FlashException

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

the class FileSystems method saveAce.

/**
 * This method called When user Modifies ACE.
 *
 * @param shareACL
 *            Form Data from modify screen.
 */
@FlashException(referrer = { "fileSystem" })
public static void saveAce(ShareACLForm shareACL) {
    String name = params.get("name");
    String type = params.get("type");
    String domain = params.get("domain");
    String shareName = params.get("shareName");
    String fileSystemId = params.get("fileSystemId");
    String permission = shareACL.permission;
    List<ShareACL> ace = new ArrayList<ShareACL>();
    ShareACL shareAcl = new ShareACL();
    ShareACLs aclsToModify = new ShareACLs();
    if ("GROUP".equalsIgnoreCase(type)) {
        shareAcl.setGroup(name);
    } else {
        shareAcl.setUser(name);
    }
    shareAcl.setPermission(permission);
    if (domain != null && !"".equals(domain)) {
        shareAcl.setDomain(domain);
    }
    ace.add(shareAcl);
    aclsToModify.setShareACLs(ace);
    FileCifsShareACLUpdateParams input = new FileCifsShareACLUpdateParams();
    input.setAclsToModify(aclsToModify);
    ViPRCoreClient client = BourneUtil.getViprClient();
    client.fileSystems().updateShareACL(uri(fileSystemId), shareName, input);
    listAcl(fileSystemId, shareName);
}
Also used : FileCifsShareACLUpdateParams(com.emc.storageos.model.file.FileCifsShareACLUpdateParams) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ShareACLs(com.emc.storageos.model.file.ShareACLs) ArrayList(java.util.ArrayList) ShareACL(com.emc.storageos.model.file.ShareACL) FlashException(controllers.util.FlashException)

Example 100 with FlashException

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

the class FileSystems method removeNfsAcl.

@FlashException(referrer = { "fileSystem" })
public static void removeNfsAcl(@As(",") String[] ids) {
    List<NfsACE> aces = Lists.newArrayList();
    String fileSystem = null;
    String subDir = null;
    String fsMountPath = null;
    if (ids != null && ids.length > 0) {
        for (String id : ids) {
            String type = NfsACLForm.extractTypeFromId(id);
            String name = NfsACLForm.extractNameFromId(id);
            String domain = NfsACLForm.extractDomainFromId(id);
            String permissions = NfsACLForm.extractPermissionsFromId(id);
            String permissionType = NfsACLForm.extractPermissionTypeFromId(id);
            fileSystem = NfsACLForm.extractFileSystemFromId(id);
            subDir = NfsACLForm.extractSubDirFromId(id);
            fsMountPath = NfsACLForm.extractMounPathFromId(id);
            NfsACE ace = new NfsACE();
            ace.setUser(name);
            ace.setType(type);
            ace.setPermissions(permissions.replaceAll("/", ","));
            ace.setPermissionType(permissionType);
            if (domain != null && !"".equals(domain) && !"null".equals(domain)) {
                ace.setDomain(domain);
            }
            aces.add(ace);
        }
        FileNfsACLUpdateParams input = new FileNfsACLUpdateParams();
        input.setAcesToDelete(aces);
        if (subDir != null && !"null".equals(subDir)) {
            input.setSubDir(subDir);
        }
        ViPRCoreClient client = BourneUtil.getViprClient();
        client.fileSystems().updateNfsACL(uri(fileSystem), input);
    }
    flash.success(MessagesUtils.get(DELETED));
    listNfsAcl(fileSystem, 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)

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