Search in sources :

Example 11 with FlashException

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

the class VirtualDataCenters method listJson.

@FlashException(value = "list", keep = true)
public static void listJson() {
    List<VirtualDataCenterRestRep> viprVDCs = VirtualDataCenterUtils.listByIds(refIds(VirtualDataCenterUtils.list()));
    List<VirtualDataCentersDataTable.VirtualDataCenter> vdcs = Lists.newArrayList();
    for (VirtualDataCenterRestRep vdc : viprVDCs) {
        if (Security.isSystemAdminOrRestrictedSystemAdmin() || Security.isSecurityAdminOrRestrictedSecurityAdmin() || Security.isSystemMonitor()) {
            vdcs.add(new VirtualDataCentersDataTable.VirtualDataCenter(vdc));
        }
    }
    renderJSON(DataTablesSupport.createJSON(vdcs, params));
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) VirtualDataCenter(models.datatable.VirtualDataCentersDataTable.VirtualDataCenter) VirtualDataCentersDataTable(models.datatable.VirtualDataCentersDataTable) VirtualDataCenter(models.datatable.VirtualDataCentersDataTable.VirtualDataCenter) FlashException(controllers.util.FlashException)

Example 12 with FlashException

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

the class VirtualDataCenters method edit.

@FlashException(value = "list", keep = true)
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void edit(String id) {
    VirtualDataCenterRestRep viprVDC = VirtualDataCenterUtils.get(id);
    if (viprVDC != null) {
        VirtualDataCenterForm vdc = new VirtualDataCenterForm().from(viprVDC);
        addRenderArgs();
        render(vdc);
    } else {
        flash.error(MessagesUtils.get("vdcs.unknown", id));
        list();
    }
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 13 with FlashException

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

the class BlockConsistencyGroups method removeVolume.

@FlashException(referrer = { "consistencyGroupDetails" })
public static void removeVolume(String consistencyGroupId, String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<URI> uris = new ArrayList<URI>();
    uris.add(uri(volumeId));
    BlockConsistencyGroupUpdate blockConsistencyGroupUpdate = new BlockConsistencyGroupUpdate();
    BlockConsistencyGroupVolumeList volumeList = new BlockConsistencyGroupVolumeList();
    volumeList.setVolumes(uris);
    blockConsistencyGroupUpdate.setRemoveVolumesList(volumeList);
    Task<BlockConsistencyGroupRestRep> task = client.blockConsistencyGroups().update(uri(consistencyGroupId), blockConsistencyGroupUpdate);
    flash.put("info", MessagesUtils.get("resources.consistencygroup.volume.removed", task.getOpId()));
    consistencyGroupDetails(consistencyGroupId);
}
Also used : BlockConsistencyGroupVolumeList(com.emc.storageos.model.block.BlockConsistencyGroupUpdate.BlockConsistencyGroupVolumeList) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockConsistencyGroupRestRep(com.emc.storageos.model.block.BlockConsistencyGroupRestRep) ArrayList(java.util.ArrayList) BlockConsistencyGroupUpdate(com.emc.storageos.model.block.BlockConsistencyGroupUpdate) URI(java.net.URI) FlashException(controllers.util.FlashException)

Example 14 with FlashException

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

the class BlockExportGroups method addClusters.

@FlashException(referrer = { "exportGroup" })
public static void addClusters(String exportId, @As(",") String[] ids) {
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.setClusters(new ClustersUpdateParam());
    if (ids != null && ids.length > 0) {
        for (String clusterId : ids) {
            exportUpdateParam.getClusters().getAdd().add(uri(clusterId));
        }
    }
    Task<ExportGroupRestRep> task = getViprClient().blockExports().update(uri(exportId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.clusters.added", task.getOpId()));
    exportGroup(exportId);
}
Also used : ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ClustersUpdateParam(com.emc.storageos.model.block.export.ClustersUpdateParam) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) FlashException(controllers.util.FlashException)

Example 15 with FlashException

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

the class BlockExportGroups method removeCluster.

@FlashException(referrer = { "exportGroup" })
public static void removeCluster(String exportGroupId, String clusterId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.setClusters(new ClustersUpdateParam());
    exportUpdateParam.getClusters().getRemove().add(uri(clusterId));
    Task<ExportGroupRestRep> task = client.blockExports().update(uri(exportGroupId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.cluster.removed", task.getOpId()));
    exportGroup(exportGroupId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ClustersUpdateParam(com.emc.storageos.model.block.export.ClustersUpdateParam) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) 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