Search in sources :

Example 36 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSnapshots method save.

@FlashException(referrer = { "snapshot" })
public static void save(Boolean edit, String id, String fsPath, String exportPath, String security, String anon, @As(",") List<String> ro, @As(",") List<String> rw, @As(",") List<String> root) {
    ExportRule rule = new ExportRule();
    rule.setAnon(anon);
    rule.setSecFlavor(security);
    // Clean up endpoints list by removing all empty items if any
    List<String> empty = Arrays.asList("");
    rw.removeAll(empty);
    ro.removeAll(empty);
    root.removeAll(empty);
    if (!ro.isEmpty()) {
        rule.setReadOnlyHosts(FileUtils.buildEndpointList(ro));
    }
    if (!rw.isEmpty()) {
        rule.setReadWriteHosts(FileUtils.buildEndpointList(rw));
    }
    if (!root.isEmpty()) {
        rule.setRootHosts(FileUtils.buildEndpointList(root));
    }
    List<ExportRule> addRules = Lists.newArrayList();
    addRules.add(rule);
    ExportRules exportRules = new ExportRules();
    exportRules.setExportRules(addRules);
    SnapshotExportUpdateParams params = new SnapshotExportUpdateParams();
    if (!edit) {
        params.setExportRulesToAdd(exportRules);
    } else {
        params.setExportRulesToModify(exportRules);
    }
    ViPRCoreClient client = BourneUtil.getViprClient();
    client.fileSnapshots().updateExport(uri(id), null, params);
    flash.put("info", MessagesUtils.get("resources.filesystem.export.update"));
    snapshot(id);
}
Also used : SnapshotExportUpdateParams(com.emc.storageos.model.file.SnapshotExportUpdateParams) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportRules(com.emc.storageos.model.file.ExportRules) ExportRule(com.emc.storageos.model.file.ExportRule) FlashException(controllers.util.FlashException)

Example 37 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSnapshots method snapshotShares.

public static void snapshotShares(String snapshotId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<SmbShareResponse> shares = client.fileSnapshots().getShares(uri(snapshotId));
    render(shares);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) SmbShareResponse(com.emc.storageos.model.file.SmbShareResponse)

Example 38 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSnapshots method deleteSnapshotExport.

@FlashException(referrer = { "snapshot" })
public static void deleteSnapshotExport(String snapshotId, 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);
    SnapshotExportUpdateParams params = new SnapshotExportUpdateParams();
    params.setExportRulesToDelete(exportRules);
    FileSnapshotRestRep snapshot = client.fileSnapshots().get(uri(snapshotId));
    String subDir = FileUtils.findSubDirectory(snapshot.getMountPath(), exportPath);
    client.fileSnapshots().updateExport(uri(snapshotId), subDir, params);
    flash.put("info", MessagesUtils.get("resources.filesnapshot.export.deactivate"));
    snapshot(snapshotId);
}
Also used : SnapshotExportUpdateParams(com.emc.storageos.model.file.SnapshotExportUpdateParams) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) ExportRules(com.emc.storageos.model.file.ExportRules) ExportRule(com.emc.storageos.model.file.ExportRule) FlashException(controllers.util.FlashException)

Example 39 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSystems method unassignPolicyToFileSystem.

@FlashException(referrer = { "fileSystem" })
public static void unassignPolicyToFileSystem(String fileSystemId, String policyId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    try {
        client.fileSystems().dissociateFilePolicy(uri(fileSystemId), uri(policyId));
    } catch (Exception ex) {
        flash.error(MessagesUtils.get("schedulePolicy.unassign.error"), null);
    }
    fileSystem(fileSystemId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException) FlashException(controllers.util.FlashException) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) FlashException(controllers.util.FlashException)

Example 40 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSystems method saveNfsAce.

@FlashException(referrer = { "fileSystem" })
public static void saveNfsAce(NfsACLForm nfsACL) {
    String name = params.get("name");
    String type = params.get("type");
    String domain = params.get("domain");
    String subDir = params.get("subDir");
    String fsMountPath = params.get("fsMountPath");
    String fileSystemId = params.get("fileSystemId");
    Set<String> permissions = nfsACL.permissions;
    String permissionType = nfsACL.permissionType;
    String strPer = "";
    nfsACL.validate("nfsACL");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    for (String permission : permissions) {
        strPer = strPer + permission.toLowerCase() + ",";
    }
    strPer = strPer.substring(0, strPer.length() - 1);
    List<NfsACE> aces = Lists.newArrayList();
    NfsACE nfsAce = new NfsACE();
    nfsAce.setType(type.toLowerCase());
    nfsAce.setUser(name);
    nfsAce.setPermissions(strPer);
    nfsAce.setPermissionType(permissionType);
    if (domain != null && !"".equals(domain) && !"null".equals(domain)) {
        nfsAce.setDomain(domain);
    }
    aces.add(nfsAce);
    FileNfsACLUpdateParams input = new FileNfsACLUpdateParams();
    input.setAcesToModify(aces);
    if (subDir != null && !"null".equals(subDir)) {
        input.setSubDir(subDir);
    }
    ViPRCoreClient client = BourneUtil.getViprClient();
    client.fileSystems().updateNfsACL(uri(fileSystemId), input);
    listNfsAcl(fileSystemId, fsMountPath, subDir);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) NfsACE(com.emc.storageos.model.file.NfsACE) FileNfsACLUpdateParams(com.emc.storageos.model.file.FileNfsACLUpdateParams) FlashException(controllers.util.FlashException)

Aggregations

ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)225 Asset (com.emc.sa.asset.annotation.Asset)72 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)66 URI (java.net.URI)66 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)49 FlashException (controllers.util.FlashException)48 AssetOption (com.emc.vipr.model.catalog.AssetOption)41 ArrayList (java.util.ArrayList)34 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)29 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)27 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)24 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)20 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)15 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)15 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)13 HashSet (java.util.HashSet)13 Task (com.emc.vipr.client.Task)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)10 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)8