Search in sources :

Example 16 with FileSnapshotRestRep

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

the class FileStorageUtils method deactivateSnapshotExport.

public static void deactivateSnapshotExport(URI fileSnapshotId, String protocol, String type, String permissions, String rootUser) {
    Task<FileSnapshotRestRep> task = execute(new DeactivateFileSnapshotExport(fileSnapshotId, protocol, type, permissions, rootUser));
    addAffectedResource(task);
}
Also used : FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) DeactivateFileSnapshotExport(com.emc.sa.service.vipr.file.tasks.DeactivateFileSnapshotExport)

Example 17 with FileSnapshotRestRep

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

the class FileSnapshots method listSnapshotAcl.

/**
 * This method called when Access Control List page is loaded.
 *
 * @param snapShotId
 *            SnapShot id of the provided SnapShot.
 * @param shareName
 *            Name of the file share.
 */
public static void listSnapshotAcl(String snapshotId, String shareName) {
    renderArgs.put("dataTable", new ShareACLDataTable());
    renderArgs.put("snapshotId", uri(snapshotId));
    renderArgs.put("shareName", shareName);
    renderArgs.put("aclURL", "/file/snapshots/" + uri(snapshotId) + "/shares/" + shareName + "/acl");
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileSnapshotRestRep restRep = client.fileSnapshots().get(uri(snapshotId));
    renderArgs.put("snapshotName", restRep.getName());
    SnapshotShareACLForm shareACL = new SnapshotShareACLForm();
    render(shareACL);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) ShareACLDataTable(models.datatable.ShareACLDataTable)

Example 18 with FileSnapshotRestRep

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

the class FileSnapshots method delete.

private static void delete(List<URI> ids) {
    if (ids != null) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        List<Task<FileSnapshotRestRep>> tasks = Lists.newArrayList();
        for (URI id : ids) {
            Task<FileSnapshotRestRep> task = client.fileSnapshots().deactivate(id);
            tasks.add(task);
        }
        if (!tasks.isEmpty()) {
            flash.put("info", MessagesUtils.get("resources.filesnapshots.deactivate", tasks.size()));
        }
    }
    snapshots(null);
}
Also used : Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) URI(java.net.URI)

Example 19 with FileSnapshotRestRep

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

the class FileSnapshots method snapshot.

public static void snapshot(String snapshotId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileSnapshotRestRep snapshot = null;
    try {
        snapshot = client.fileSnapshots().get(uri(snapshotId));
    } catch (ViPRHttpException e) {
        if (e.getHttpCode() == 404 || e.getHttpCode() == 400) {
            flash.error(MessagesUtils.get(UNKNOWN, snapshotId));
            snapshots(null);
        }
        throw e;
    }
    if (snapshot != null) {
        if (snapshot.getParent() != null) {
            FileShareRestRep fileSystem = client.fileSystems().get(snapshot.getParent());
            renderArgs.put("fileSystem", fileSystem);
        }
        Tasks<FileSnapshotRestRep> tasksResponse = client.fileSnapshots().getTasks(snapshot.getId());
        List<Task<FileSnapshotRestRep>> tasks = tasksResponse.getTasks();
        renderArgs.put("tasks", tasks);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, snapshotId));
        snapshots(null);
    }
    render(snapshot);
}
Also used : Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException)

Example 20 with FileSnapshotRestRep

use of com.emc.storageos.model.file.FileSnapshotRestRep 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)

Aggregations

FileSnapshotRestRep (com.emc.storageos.model.file.FileSnapshotRestRep)21 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)8 DeactivateFileSnapshotExportRule (com.emc.sa.service.vipr.file.tasks.DeactivateFileSnapshotExportRule)3 Task (com.emc.vipr.client.Task)3 FlashException (controllers.util.FlashException)3 CreateFileSnapshot (com.emc.sa.service.vipr.file.tasks.CreateFileSnapshot)2 ExportRule (com.emc.storageos.model.file.ExportRule)2 ExportRules (com.emc.storageos.model.file.ExportRules)2 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)2 SnapshotExportUpdateParams (com.emc.storageos.model.file.SnapshotExportUpdateParams)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 CreateFileSnapshotExport (com.emc.sa.service.vipr.file.tasks.CreateFileSnapshotExport)1 CreateFileSnapshotShare (com.emc.sa.service.vipr.file.tasks.CreateFileSnapshotShare)1 DeactivateFileSnapshot (com.emc.sa.service.vipr.file.tasks.DeactivateFileSnapshot)1 DeactivateFileSnapshotExport (com.emc.sa.service.vipr.file.tasks.DeactivateFileSnapshotExport)1 DeactivateFileSnapshotShare (com.emc.sa.service.vipr.file.tasks.DeactivateFileSnapshotShare)1 DeactivateFileSystemExportRule (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystemExportRule)1 FindFileSnapshotExportRules (com.emc.sa.service.vipr.file.tasks.FindFileSnapshotExportRules)1 FindFileSystemExportRules (com.emc.sa.service.vipr.file.tasks.FindFileSystemExportRules)1