Search in sources :

Example 61 with FileShareRestRep

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

the class FileSystems method getVarrayVpool.

public static void getVarrayVpool(String resourceId) {
    HashMap<String, String> response = new HashMap<String, String>();
    URI fileShareId = uri(resourceId);
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileShareRestRep fileShare = client.fileSystems().get(fileShareId);
    URI vArray = fileShare.getVirtualArray().getId();
    URI vPool = fileShare.getVirtualPool().getId();
    response.put("vArray", client.varrays().get(vArray).getName());
    response.put("vPool", client.fileVpools().get(vPool).getName());
    renderJSON(response);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) HashMap(java.util.HashMap) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI)

Example 62 with FileShareRestRep

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

the class FileSystems method editAce.

/**
 * This method called When user clicks ACE hyper-link to modify.
 *
 * @param id
 *            Access control entry.
 */
public static void editAce(@Required String id) {
    String type = ShareACLForm.extractTypeFromId(id);
    String name = ShareACLForm.extractNameFromId(id);
    String domain = ShareACLForm.extractDomainFromId(id);
    String fileSystem = ShareACLForm.extractFileSystemFromId(id);
    String shareName = ShareACLForm.extractShareNameFromId(id);
    String permission = ShareACLForm.extractPermissionFromId(id);
    if ("null".equals(domain)) {
        domain = "";
    }
    ShareACLForm shareACL = new ShareACLForm();
    shareACL.type = type;
    shareACL.name = name;
    shareACL.domain = domain;
    shareACL.permission = permission;
    renderArgs.put("permissionOptions", StringOption.options(new String[] { "Read", "Change", "FullControl" }));
    renderArgs.put("fileSystemId", uri(fileSystem));
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileShareRestRep restRep = client.fileSystems().get(uri(fileSystem));
    renderArgs.put("fileSystemName", restRep.getName());
    renderArgs.put("shareName", shareName);
    renderArgs.put("TYPE", type.toUpperCase());
    render(shareACL);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep)

Example 63 with FileShareRestRep

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

the class FileSystems method deleteFileSystem.

@FlashException(referrer = { "fileSystem" })
public static void deleteFileSystem(String fileSystemId, String deleteType) {
    if (StringUtils.isNotBlank(fileSystemId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        boolean forceDelete = false;
        Task<FileShareRestRep> task = client.fileSystems().deactivate(uri(fileSystemId), new FileSystemDeleteParam(forceDelete, deleteType));
        flash.put("info", MessagesUtils.get("resources.filesystem.deactivate"));
    }
    fileSystem(fileSystemId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) FileSystemDeleteParam(com.emc.storageos.model.file.FileSystemDeleteParam) FlashException(controllers.util.FlashException)

Example 64 with FileShareRestRep

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

the class FileSystems method editNfsAce.

public static void editNfsAce(@Required String id) {
    String type = NfsACLForm.extractTypeFromId(id);
    String name = NfsACLForm.extractNameFromId(id);
    String domain = NfsACLForm.extractDomainFromId(id);
    String fileSystem = NfsACLForm.extractFileSystemFromId(id);
    String subDir = NfsACLForm.extractSubDirFromId(id);
    String permissions = NfsACLForm.extractPermissionsFromId(id);
    String permissionType = NfsACLForm.extractPermissionTypeFromId(id);
    String fsMountPath = NfsACLForm.extractMounPathFromId(id);
    if ("null".equals(domain)) {
        domain = "";
    }
    NfsACLForm nfsACL = new NfsACLForm();
    nfsACL.type = type.toUpperCase();
    nfsACL.name = name;
    nfsACL.domain = domain;
    String[] strPerm = permissions.replaceAll("/", ",").split(",");
    nfsACL.permissions = new HashSet<String>(Arrays.asList(strPerm));
    nfsACL.permissionType = permissionType;
    renderArgs.put("permissionOptions", StringOption.options(new String[] { "read", "write", "execute", "fullControl" }));
    renderArgs.put("permissionTypeOptions", StringOption.options(new String[] { "allow", "deny" }));
    renderArgs.put("fileSystemId", uri(fileSystem));
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileShareRestRep restRep = client.fileSystems().get(uri(fileSystem));
    renderArgs.put("fileSystemName", restRep.getName());
    renderArgs.put("subDir", subDir);
    renderArgs.put("fsMountPath", fsMountPath);
    renderArgs.put("TYPE", type.toUpperCase());
    render(nfsACL);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep)

Example 65 with FileShareRestRep

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

the class FileSystems method deleteFileSystemExport.

@FlashException(referrer = { "fileSystem" })
public static void deleteFileSystemExport(String fileSystemId, String security, String exportPath) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportRule rule = new ExportRule();
    rule.setSecFlavor(security);
    List<ExportRule> list = Lists.newArrayList();
    list.add(rule);
    ExportRules exportRules = new ExportRules();
    exportRules.setExportRules(list);
    FileShareExportUpdateParams params = new FileShareExportUpdateParams();
    params.setExportRulesToDelete(exportRules);
    FileShareRestRep fileSystem = client.fileSystems().get(uri(fileSystemId));
    String subDir = FileUtils.findSubDirectory(fileSystem.getMountPath(), exportPath);
    client.fileSystems().updateExport(uri(fileSystemId), subDir, params);
    flash.put("info", MessagesUtils.get("resources.filesystem.export.deactivate"));
    fileSystem(fileSystemId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportRules(com.emc.storageos.model.file.ExportRules) FileShareExportUpdateParams(com.emc.storageos.model.file.FileShareExportUpdateParams) ExportRule(com.emc.storageos.model.file.ExportRule) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) FlashException(controllers.util.FlashException)

Aggregations

FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)66 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)27 URI (java.net.URI)15 Asset (com.emc.sa.asset.annotation.Asset)13 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)13 AssetOption (com.emc.vipr.model.catalog.AssetOption)10 ArrayList (java.util.ArrayList)7 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)6 FileProtectionRestRep (com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep)5 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)5 Task (com.emc.vipr.client.Task)4 FlashException (controllers.util.FlashException)4 CreateFileSystem (com.emc.sa.service.vipr.file.tasks.CreateFileSystem)3 DeactivateFileSystem (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystem)3 DeactivateFileSystemExportRule (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystemExportRule)3 FileSystemDeleteParam (com.emc.storageos.model.file.FileSystemDeleteParam)3 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)3 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)3 MachineTagsCollection (com.emc.sa.machinetags.MachineTagsCollection)2 DeactivateFileSystemShare (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystemShare)2