Search in sources :

Example 1 with FileSnapshotRestRep

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

the class FileSnapshotService method getSnapshots.

/**
 * Get all Snapshots matching the path
 *
 * @QueryParam mountpath
 * @brief Show snapshots
 * @return Snapshot details
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.OWN, ACL.ALL })
public List<FileSnapshotRestRep> getSnapshots(@QueryParam("mountpath") String mountPath) {
    List<FileSnapshotRestRep> snapRepList = new ArrayList<FileSnapshotRestRep>();
    List<URI> ids = _dbClient.queryByType(Snapshot.class, true);
    Iterator<Snapshot> iter = _dbClient.queryIterativeObjects(Snapshot.class, ids);
    _log.info("getSnapshots call ... with mountpath {}", mountPath);
    while (iter.hasNext()) {
        Snapshot snap = iter.next();
        if (snap != null) {
            if (mountPath != null) {
                if (snap.getMountPath().equalsIgnoreCase(mountPath)) {
                    snapRepList.add(map(snap));
                } else {
                    _log.info("Skip this Snapshot Mount Path doesnt match {} {}", snap.getMountPath(), mountPath);
                }
            } else {
                _log.info("Mountpath query param is null");
                snapRepList.add(map(snap));
            }
        }
    }
    return snapRepList;
}
Also used : MapFileSnapshot(com.emc.storageos.api.mapper.functions.MapFileSnapshot) Snapshot(com.emc.storageos.db.client.model.Snapshot) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) ArrayList(java.util.ArrayList) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 2 with FileSnapshotRestRep

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

the class FileStorageUtils method createFileSnapshot.

public static URI createFileSnapshot(URI fileSystemId, String name) {
    Task<FileSnapshotRestRep> task = execute(new CreateFileSnapshot(fileSystemId, name));
    addAffectedResource(task);
    return task.getResourceId();
}
Also used : FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) CreateFileSnapshot(com.emc.sa.service.vipr.file.tasks.CreateFileSnapshot)

Example 3 with FileSnapshotRestRep

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

the class FileStorageUtils method createFileSnapshotExport.

public static String createFileSnapshotExport(URI fileSnapshotId, String comment, String security, String permissions, String rootUser, List<String> exportHosts, String subDirectory) {
    Task<FileSnapshotRestRep> task = execute(new CreateFileSnapshotExport(fileSnapshotId, comment, NFS_PROTOCOL, security, permissions, rootUser, exportHosts, subDirectory));
    addAffectedResource(task);
    String exportId = task.getResourceId().toString();
    addRollback(new DeactivateFileSnapshotExportRule(fileSnapshotId, true, null));
    logInfo("file.storage.export.task", exportId, task.getOpId());
    return exportId;
}
Also used : FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) DeactivateFileSnapshotExportRule(com.emc.sa.service.vipr.file.tasks.DeactivateFileSnapshotExportRule) CreateFileSnapshotExport(com.emc.sa.service.vipr.file.tasks.CreateFileSnapshotExport)

Example 4 with FileSnapshotRestRep

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

the class FileStorageUtils method deactivateSnapshotShare.

public static void deactivateSnapshotShare(URI fileSnapshotId, String shareName) {
    Task<FileSnapshotRestRep> task = execute(new DeactivateFileSnapshotShare(fileSnapshotId, shareName));
    addAffectedResource(task);
}
Also used : FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) DeactivateFileSnapshotShare(com.emc.sa.service.vipr.file.tasks.DeactivateFileSnapshotShare)

Example 5 with FileSnapshotRestRep

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

the class FileStorageUtils method setFileSnapshotShareACL.

public static void setFileSnapshotShareACL(URI snapshotId, String shareName, FileSystemACLs[] acls) {
    Task<FileSnapshotRestRep> task = execute(new SetFileSnapshotShareACL(snapshotId, shareName, acls));
    addAffectedResource(task);
    logInfo("file.storage.share.snapshot.acl", snapshotId, shareName, task.getOpId());
}
Also used : SetFileSnapshotShareACL(com.emc.sa.service.vipr.file.tasks.SetFileSnapshotShareACL) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep)

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