Search in sources :

Example 1 with FileSystemExportList

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

the class FileSnapshotService method getFileSystemSnapshotExportList.

/**
 * @Deprecated use {id}/export instead
 *             Get file share snapshots exports
 * @param id
 *            the URN of a ViPR Snapshot
 * @brief List file snapshot exports.This method is deprecated.
 *        <p>
 *        Use /file/snapshots/{id}/export instead.
 * @return List of file share snapshot exports
 */
@Deprecated
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/exports")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public FileSystemExportList getFileSystemSnapshotExportList(@PathParam("id") URI id) {
    ArgValidator.checkFieldUriType(id, Snapshot.class, "id");
    Snapshot snapshot = queryResource(id);
    FileSystemExportList fileExportListResponse = new FileSystemExportList();
    if (snapshot.getInactive()) {
        return fileExportListResponse;
    }
    // Get export map from snapshot
    FSExportMap exportMap = snapshot.getFsExports();
    Collection<FileExport> fileExports = new ArrayList<FileExport>();
    if (exportMap != null) {
        fileExports = exportMap.values();
    }
    // Process each export from the map and its data to exports in response list.
    for (FileExport fileExport : fileExports) {
        FileSystemExportParam fileExportParam = new FileSystemExportParam();
        fileExportParam.setEndpoints(fileExport.getClients());
        fileExportParam.setSecurityType(fileExport.getSecurityType());
        fileExportParam.setPermissions(fileExport.getPermissions());
        fileExportParam.setRootUserMapping(fileExport.getRootUserMapping());
        fileExportParam.setProtocol(fileExport.getProtocol());
        fileExportParam.setMountPoint(fileExport.getMountPoint());
        fileExportListResponse.getExportList().add(fileExportParam);
    }
    return fileExportListResponse;
}
Also used : MapFileSnapshot(com.emc.storageos.api.mapper.functions.MapFileSnapshot) Snapshot(com.emc.storageos.db.client.model.Snapshot) FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) FileSystemExportList(com.emc.storageos.model.file.FileSystemExportList) FileExport(com.emc.storageos.db.client.model.FileExport) ArrayList(java.util.ArrayList) FSExportMap(com.emc.storageos.db.client.model.FSExportMap) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 2 with FileSystemExportList

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

the class InternalFileServiceClient method getFileSystemExportList.

/**
 * Get list of exports for this file system
 *
 * @param fsId file share ID
 * @return
 */
public FileSystemExportList getFileSystemExportList(URI fsId) {
    WebResource rRoot = createRequest(INTERNAL_FILE_ROOT + fsId + EXPORTS);
    FileSystemExportList resp = addSignature(rRoot).get(FileSystemExportList.class);
    return resp;
}
Also used : FileSystemExportList(com.emc.storageos.model.file.FileSystemExportList) WebResource(com.sun.jersey.api.client.WebResource)

Example 3 with FileSystemExportList

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

the class FileService method getFileSystemExportList.

/**
 * @Deprecated use @Path("/{id}/export") instead.
 *             Get list of file system exports
 * @param id
 *            the URN of a ViPR File system
 * @brief List file system exports.
 *        <p>
 *        Use /file/filesystems/{id}/export instead
 * @return File system exports list.
 */
@Deprecated
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/exports")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public FileSystemExportList getFileSystemExportList(@PathParam("id") URI id) {
    ArgValidator.checkFieldUriType(id, FileShare.class, "id");
    FileShare fileShare = queryResource(id);
    FileSystemExportList fileExportListResponse = new FileSystemExportList();
    if (fileShare.getInactive()) {
        return fileExportListResponse;
    }
    // Get export map from fileSystem
    FSExportMap exportMap = fileShare.getFsExports();
    Collection<FileExport> fileExports = new ArrayList<FileExport>();
    if (exportMap != null) {
        fileExports = exportMap.values();
    }
    // Process each export from the map and its data to exports in response list.
    for (FileExport fileExport : fileExports) {
        FileSystemExportParam fileExportParam = new FileSystemExportParam();
        fileExportParam.setEndpoints(fileExport.getClients());
        fileExportParam.setSecurityType(fileExport.getSecurityType());
        fileExportParam.setPermissions(fileExport.getPermissions());
        fileExportParam.setRootUserMapping(fileExport.getRootUserMapping());
        fileExportParam.setProtocol(fileExport.getProtocol());
        fileExportParam.setMountPoint(fileExport.getMountPoint());
        fileExportParam.setSubDirectory(fileExport.getSubDirectory());
        fileExportListResponse.getExportList().add(fileExportParam);
    }
    return fileExportListResponse;
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) FileSystemExportList(com.emc.storageos.model.file.FileSystemExportList) FileExport(com.emc.storageos.db.client.model.FileExport) ArrayList(java.util.ArrayList) FSExportMap(com.emc.storageos.db.client.model.FSExportMap) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) MapFileShare(com.emc.storageos.api.mapper.functions.MapFileShare) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

FileSystemExportList (com.emc.storageos.model.file.FileSystemExportList)3 FSExportMap (com.emc.storageos.db.client.model.FSExportMap)2 FileExport (com.emc.storageos.db.client.model.FileExport)2 FileSystemExportParam (com.emc.storageos.model.file.FileSystemExportParam)2 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)2 ArrayList (java.util.ArrayList)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 MapFileShare (com.emc.storageos.api.mapper.functions.MapFileShare)1 MapFileSnapshot (com.emc.storageos.api.mapper.functions.MapFileSnapshot)1 FileShare (com.emc.storageos.db.client.model.FileShare)1 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)1 Snapshot (com.emc.storageos.db.client.model.Snapshot)1 WebResource (com.sun.jersey.api.client.WebResource)1