Search in sources :

Example 86 with FlashException

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

the class BlockExportGroups method addInitiators.

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

Example 87 with FlashException

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

the class BlockExportGroups method removeHost.

@FlashException(referrer = { "exportGroup" })
public static void removeHost(String exportGroupId, String hostId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.setHosts(new HostsUpdateParam());
    exportUpdateParam.getHosts().getRemove().add(uri(hostId));
    Task<ExportGroupRestRep> task = client.blockExports().update(uri(exportGroupId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.host.removed", task.getOpId()));
    exportGroup(exportGroupId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) HostsUpdateParam(com.emc.storageos.model.block.export.HostsUpdateParam) FlashException(controllers.util.FlashException)

Example 88 with FlashException

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

the class BlockExportGroups method removeVolume.

@FlashException(referrer = { "exportGroup" })
public static void removeVolume(String exportGroupId, String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.removeVolume(uri(volumeId));
    Task<ExportGroupRestRep> task = client.blockExports().update(uri(exportGroupId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.volume.removed", task.getOpId()));
    exportGroup(exportGroupId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) FlashException(controllers.util.FlashException)

Example 89 with FlashException

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

the class BlockExportGroups method deleteExportGroup.

@FlashException(referrer = { "exportGroup" })
public static void deleteExportGroup(String exportGroupId) {
    if (StringUtils.isNotBlank(exportGroupId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        Task<ExportGroupRestRep> task = client.blockExports().deactivate(uri(exportGroupId));
        flash.put("info", MessagesUtils.get("resources.exportgroup.deactivate"));
    }
    exportGroup(exportGroupId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) FlashException(controllers.util.FlashException)

Example 90 with FlashException

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

the class BlockExportGroups method addHosts.

@FlashException(referrer = { "exportGroup" })
public static void addHosts(String exportId, @As(",") String[] ids) {
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.setHosts(new HostsUpdateParam());
    if (ids != null && ids.length > 0) {
        for (String hostId : ids) {
            exportUpdateParam.getHosts().getAdd().add(uri(hostId));
        }
    }
    Task<ExportGroupRestRep> task = getViprClient().blockExports().update(uri(exportId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.hosts.added", task.getOpId()));
    exportGroup(exportId);
}
Also used : ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) HostsUpdateParam(com.emc.storageos.model.block.export.HostsUpdateParam) 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