Search in sources :

Example 6 with VirtualDataCenterRestRep

use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.

the class VirtualDataCenters method reconnect.

private static void reconnect(List<URI> ids) {
    if (!ids.isEmpty()) {
        // UI only support single selection, ignore any additional IDs
        URI id = ids.get(0);
        Task<VirtualDataCenterRestRep> task = VirtualDataCenterUtils.reconnect(id);
        flash.put("inProgressTask", task.getTaskResource().getId());
    }
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) URI(java.net.URI)

Example 7 with VirtualDataCenterRestRep

use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.

the class VirtualDataCenters method disconnect.

private static void disconnect(List<URI> ids) {
    if (!ids.isEmpty()) {
        // UI only support single selection, ignore any additional IDs
        URI id = ids.get(0);
        Task<VirtualDataCenterRestRep> task = VirtualDataCenterUtils.disconnect(id);
        flash.put("inProgressTask", task.getTaskResource().getId());
    }
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) URI(java.net.URI)

Example 8 with VirtualDataCenterRestRep

use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep 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 9 with VirtualDataCenterRestRep

use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep 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 10 with VirtualDataCenterRestRep

use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.

the class VirtualDataCenterRestRepTest method testCanDisconnect.

@Test
public void testCanDisconnect() {
    VirtualDataCenterRestRep vdc = new VirtualDataCenterRestRep();
    vdc.setLocal(false);
    vdc.setConnectionStatus("CONNECTED");
    Assert.assertTrue("disconnect should work on a CONNECTED non-local vdc", vdc.canDisconnect());
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) Test(org.junit.Test)

Aggregations

VirtualDataCenterRestRep (com.emc.storageos.model.vdc.VirtualDataCenterRestRep)18 Test (org.junit.Test)6 URI (java.net.URI)4 FlashException (controllers.util.FlashException)3 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 VirtualDataCenterAddParam (com.emc.storageos.model.vdc.VirtualDataCenterAddParam)2 VirtualDataCenterList (com.emc.storageos.model.vdc.VirtualDataCenterList)2 Restrictions (controllers.deadbolt.Restrictions)2 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)1 RoleAssignmentChanges (com.emc.storageos.model.auth.RoleAssignmentChanges)1 RoleAssignmentEntry (com.emc.storageos.model.auth.RoleAssignmentEntry)1 VirtualDataCenterModifyParam (com.emc.storageos.model.vdc.VirtualDataCenterModifyParam)1 ViPRClientHelper (com.emc.storageos.usermanagement.util.ViPRClientHelper)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 VirtualDataCenters (com.emc.vipr.client.core.VirtualDataCenters)1 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)1 WebResource (com.sun.jersey.api.client.WebResource)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 GET (javax.ws.rs.GET)1