Search in sources :

Example 1 with FileSystemExportParam

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

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

the class FileStorageUtils method getExport.

public static FileSystemExportParam getExport(URI fileSystemId, String protocol, String security, String permissions, String rootUser) {
    List<FileSystemExportParam> exports = execute(new GetNfsExportsForFileSystem(fileSystemId));
    for (FileSystemExportParam export : exports) {
        boolean protocolMatch = StringUtils.equals(export.getProtocol(), protocol);
        boolean securityMatch = StringUtils.equals(export.getSecurityType(), security);
        boolean permissionMatch = StringUtils.equals(export.getPermissions(), permissions);
        boolean rootUserMatch = StringUtils.equals(export.getRootUserMapping(), rootUser);
        if (protocolMatch && securityMatch && permissionMatch && rootUserMatch) {
            return export;
        }
    }
    return null;
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) GetNfsExportsForFileSystem(com.emc.sa.service.vipr.file.tasks.GetNfsExportsForFileSystem)

Example 3 with FileSystemExportParam

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

the class CreateFileSnapshotExport method doExecute.

@Override
protected Task<FileSnapshotRestRep> doExecute() throws Exception {
    FileSystemExportParam export = new FileSystemExportParam();
    export.setProtocol(protocol);
    export.setSecurityType(security);
    export.setPermissions(permissions);
    export.setRootUserMapping(user);
    export.getEndpoints().addAll(hosts);
    if (StringUtils.isNotBlank(comment)) {
        export.setComments(comment);
    }
    if (StringUtils.isNotBlank(subDirectory)) {
        export.setSubDirectory(subDirectory);
    }
    return getClient().fileSnapshots().export(fileSnapshotId, export);
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam)

Example 4 with FileSystemExportParam

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

the class FileSystems method fileSystemExports.

public static void fileSystemExports(String fileSystemId) {
    URI id = uri(fileSystemId);
    List<ExportRule> exports = FileUtils.getFSExportRules(id);
    List<FileSystemExportParam> exportsParam = FileUtils.getExports(id);
    renderArgs.put("permissionTypeOptions", Lists.newArrayList(FileShareExport.Permissions.values()));
    render(exports, exportsParam);
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) ExportRule(com.emc.storageos.model.file.ExportRule) URI(java.net.URI)

Example 5 with FileSystemExportParam

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

the class FileProvider method getNFSFileExports.

@Asset("fileExports")
@AssetDependencies("fileNFSFilesystem")
public List<AssetOption> getNFSFileExports(AssetOptionsContext ctx, URI fileFilesystem) {
    List<AssetOption> options = Lists.newArrayList();
    for (FileSystemExportParam export : listFileExports(ctx, fileFilesystem)) {
        options.add(new AssetOption(export.getMountPoint(), export.getMountPoint()));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) AssetOption(com.emc.vipr.model.catalog.AssetOption) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

FileSystemExportParam (com.emc.storageos.model.file.FileSystemExportParam)13 Asset (com.emc.sa.asset.annotation.Asset)4 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)4 AssetOption (com.emc.vipr.model.catalog.AssetOption)4 URI (java.net.URI)4 FSExportMap (com.emc.storageos.db.client.model.FSExportMap)2 FileExport (com.emc.storageos.db.client.model.FileExport)2 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)2 FileSystemDeleteParam (com.emc.storageos.model.file.FileSystemDeleteParam)2 FileSystemExportList (com.emc.storageos.model.file.FileSystemExportList)2 FileSystemParam (com.emc.storageos.model.file.FileSystemParam)2 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)2 WebResource (com.sun.jersey.api.client.WebResource)2 ArrayList (java.util.ArrayList)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 Test (org.junit.Test)2 GetNfsExportsForFileSystem (com.emc.sa.service.vipr.file.tasks.GetNfsExportsForFileSystem)1