Search in sources :

Example 46 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class FileSystems method fileSystemSnapshotPolicies.

@FlashException(referrer = { "fileSystem" })
public static void fileSystemSnapshotPolicies(String fileSystemId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<FilePolicyRestRep> filePolicies = Lists.newArrayList();
    FileShareRestRep fs = client.fileSystems().get(uri(fileSystemId));
    if (fs != null) {
        // Get file system snapshot policies!!
        if (fs.getFilePolicies() != null && !fs.getFilePolicies().isEmpty()) {
            for (String uriPolicy : fs.getFilePolicies()) {
                FilePolicyRestRep policyRestRep = client.fileProtectionPolicies().get(uri(uriPolicy));
                if (policyRestRep != null) {
                    filePolicies.add(policyRestRep);
                }
            }
        }
    }
    render(filePolicies);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) FlashException(controllers.util.FlashException)

Example 47 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class FileSystems method save.

@FlashException(referrer = { "fileSystem" })
public static void save(Boolean edit, String id, String fsPath, String exportPath, String security, String anon, String subDir, @As(",") List<String> ro, @As(",") List<String> rw, @As(",") List<String> root, Boolean bypassDnsCheck) {
    ExportRule rule = new ExportRule();
    rule.setFsID(uri(id));
    rule.setMountPoint(fsPath);
    rule.setExportPath(exportPath);
    rule.setAnon(anon);
    rule.setSecFlavor(security);
    // Clean up endpoints list by removing all empty items
    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);
    FileShareExportUpdateParams params = new FileShareExportUpdateParams();
    params.setBypassDnsCheck(bypassDnsCheck);
    if (!edit) {
        params.setExportRulesToAdd(exportRules);
    } else {
        params.setExportRulesToModify(exportRules);
        subDir = FileUtils.findSubDirectory(fsPath, exportPath);
    }
    ViPRCoreClient client = BourneUtil.getViprClient();
    client.fileSystems().updateExport(uri(id), subDir, params);
    flash.put("info", MessagesUtils.get("resources.filesystem.export.update"));
    fileSystem(id);
}
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) FlashException(controllers.util.FlashException)

Example 48 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class FileSystems method mirrorOperationFileSystem.

@FlashException(referrer = { "fileSystem" })
public static void mirrorOperationFileSystem(String fileSystemId, String mirrorOperation) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileCopy copy = new FileCopy();
    copy.setType(LOCAL_MIRROR);
    FileReplicationParam param = new FileReplicationParam();
    List<FileCopy> listCopy = new ArrayList();
    listCopy.add(copy);
    param.setCopies(listCopy);
    URI fileSystemUri = URI.create(fileSystemId);
    if ("refresh".equalsIgnoreCase(mirrorOperation)) {
        client.fileSystems().refreshFileContinuousCopies(fileSystemUri, param);
    }
    if ("stop".equalsIgnoreCase(mirrorOperation)) {
        client.fileSystems().stopFileContinuousCopies(fileSystemUri, param);
    }
    if ("pause".equalsIgnoreCase(mirrorOperation)) {
        client.fileSystems().pauseFileContinuousCopies(fileSystemUri, param);
    }
    if ("resume".equalsIgnoreCase(mirrorOperation)) {
        client.fileSystems().resumeContinousCopies(fileSystemUri, param);
    }
    fileSystem(fileSystemId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileReplicationParam(com.emc.storageos.model.file.FileReplicationParam) ArrayList(java.util.ArrayList) FileCopy(com.emc.storageos.model.file.FileCopy) URI(java.net.URI) FlashException(controllers.util.FlashException)

Example 49 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class ObjectBuckets method deleteBucket.

@FlashException(referrer = { "bucket" })
public static void deleteBucket(String bucketId, String deleteType) {
    if (StringUtils.isNotBlank(bucketId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        boolean forceDelete = false;
        Task<BucketRestRep> task = client.objectBuckets().deactivate(uri(bucketId), new BucketDeleteParam(forceDelete, deleteType));
        flash.put("info", MessagesUtils.get("resources.bucket.deactivate"));
    }
    bucket(bucketId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BucketRestRep(com.emc.storageos.model.object.BucketRestRep) BucketDeleteParam(com.emc.storageos.model.object.BucketDeleteParam) FlashException(controllers.util.FlashException)

Example 50 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class Projects method delete.

@FlashException("list")
public static void delete(@As(",") String[] ids) {
    String tenantId = null;
    if (ids != null && ids.length > 0) {
        ProjectRestRep project = ProjectUtils.getProject(ids[0]);
        if (project != null) {
            tenantId = project.getTenant().toString();
        }
        for (String id : ids) {
            ProjectUtils.deactivate(uri(id));
        }
        flash.success(MessagesUtils.get("projects.deleted"));
    }
    list();
}
Also used : ProjectRestRep(com.emc.storageos.model.project.ProjectRestRep) FlashException(controllers.util.FlashException)

Aggregations

FlashException (controllers.util.FlashException)122 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)45 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)9 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)9 URI (java.net.URI)9 ExportUpdateParam (com.emc.storageos.model.block.export.ExportUpdateParam)8 Restrictions (controllers.deadbolt.Restrictions)8 ArrayList (java.util.ArrayList)7 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)5 CopiesParam (com.emc.storageos.model.block.CopiesParam)4 SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)4 ExportRule (com.emc.storageos.model.file.ExportRule)4 ExportRules (com.emc.storageos.model.file.ExportRules)4 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)4 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)4 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)4 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)2