Search in sources :

Example 11 with FileSystemExportParam

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

Example 12 with FileSystemExportParam

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

the class CreateNfsExportAndDatastoreService method execute.

@Override
public void execute() throws Exception {
    URI fileSystemId = createNfsExportHelper.createNfsExport();
    List<Datastore> datastores = Lists.newArrayList();
    FileShareRestRep fileSystem = FileStorageUtils.getFileSystem(fileSystemId);
    FileSystemExportParam export = createNfsExportHelper.getNfsExport(fileSystemId);
    connectAndInitializeHost();
    if (cluster != null) {
        datastores.addAll(vmware.createNfsDatastore(cluster, fileSystem, export, datacenterId, datastoreName));
    } else {
        datastores.add(vmware.createNfsDatastore(host, fileSystem, export, datacenterId, datastoreName));
    }
    if (hostId != null) {
        ExecutionUtils.addAffectedResource(hostId.toString());
    }
    for (Datastore datastore : datastores) {
        vmware.setStorageIOControl(datastore, storageIOControl, true);
    }
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) Datastore(com.vmware.vim25.mo.Datastore) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI)

Example 13 with FileSystemExportParam

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

the class CreateFileSystemExport method doExecute.

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

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