Search in sources :

Example 6 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class SystemHealth method getRecoveryStatus.

@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void getRecoveryStatus() {
    ViPRSystemClient client = BourneUtil.getSysClient();
    RecoveryStatus recoveryStatus = client.control().getRecoveryStatus();
    JsonElement jsonElement = new Gson().toJsonTree(recoveryStatus);
    JsonObject jsonObj = jsonElement.getAsJsonObject();
    if (recoveryStatus.getStartTime() != null) {
        DateTime startTime = new DateTime(recoveryStatus.getStartTime().getTime());
        jsonObj.addProperty("startTime", startTime.toString());
    }
    if (recoveryStatus.getEndTime() != null) {
        DateTime endTime = new DateTime(recoveryStatus.getEndTime().getTime());
        jsonObj.addProperty("endTime", endTime.toString());
    }
    renderJSON(jsonObj.toString());
}
Also used : ViPRSystemClient(com.emc.vipr.client.ViPRSystemClient) JsonElement(com.google.gson.JsonElement) Gson(com.google.gson.Gson) JsonObject(com.google.gson.JsonObject) RecoveryStatus(com.emc.vipr.model.sys.recovery.RecoveryStatus) DateTime(org.joda.time.DateTime) Restrictions(controllers.deadbolt.Restrictions)

Example 7 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class SystemHealth method nodeReboot.

@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void nodeReboot(@Required String nodeId) {
    NodeHealth nodeHealth = MonitorUtils.getNodeHealth(nodeId);
    String node = nodeId;
    try {
        node = MonitorUtils.getNodeHealth(nodeId).getNodeName();
    } catch (NullPointerException e) {
        Logger.warn("Could not determine node name.");
    }
    if (nodeHealth != null && nodeHealth.getStatus().equals("Good")) {
        new RebootNodeJob(getSysClient(), nodeId).in(3);
        flash.success(Messages.get("adminDashboard.nodeRebooting", node));
        Maintenance.maintenance(Common.reverseRoute(SystemHealth.class, "systemHealth"));
    } else {
        flash.error(Messages.get("systemHealth.message.reboot.unavailable", node));
        systemHealth();
    }
}
Also used : RebootNodeJob(jobs.RebootNodeJob) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth) Restrictions(controllers.deadbolt.Restrictions)

Example 8 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class DisasterRecovery method pause.

@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN"), @Restrict("SYSTEM_ADMIN"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void pause(@As(",") String[] ids) {
    List<String> uuids = Arrays.asList(ids);
    for (String uuid : uuids) {
        if (!DisasterRecoveryUtils.hasStandbySite(uuid)) {
            flash.error(MessagesUtils.get(UNKNOWN, uuid));
            list(true);
        }
    }
    SiteIdListParam param = new SiteIdListParam();
    param.getIds().addAll(uuids);
    try {
        DisasterRecoveryUtils.pauseStandby(param);
    } catch (ServiceErrorException ex) {
        flash.error(ex.getDetailedMessage());
        list(true);
    } catch (Exception ex) {
        flash.error(ex.getMessage());
        list(true);
    }
    flash.success(MessagesUtils.get(PAUSED_SUCCESS));
    list(true);
}
Also used : SiteIdListParam(com.emc.storageos.model.dr.SiteIdListParam) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) FlashException(controllers.util.FlashException) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 9 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class DisasterRecovery method create.

@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void create() {
    for (SiteRestRep site : DisasterRecoveryUtils.getSites()) {
        if (SiteState.STANDBY_PAUSED.toString().equals(site.getState())) {
            continue;
        }
        SiteDetailRestRep detail = DisasterRecoveryUtils.getSiteDetails(site.getUuid());
        if (!ClusterInfo.ClusterState.STABLE.toString().equals(detail.getClusterState())) {
            flash.error(MessagesUtils.get(ADD_WARNING, site.getName()));
            list();
        }
    }
    DisasterRecoveryForm site = new DisasterRecoveryForm();
    edit(site);
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) SiteDetailRestRep(com.emc.storageos.model.dr.SiteDetailRestRep) Restrictions(controllers.deadbolt.Restrictions)

Example 10 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class DisasterRecovery method delete.

@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void delete(@As(",") String[] ids) {
    List<String> uuids = Arrays.asList(ids);
    for (String uuid : uuids) {
        if (!DisasterRecoveryUtils.hasStandbySite(uuid)) {
            flash.error(MessagesUtils.get(UNKNOWN, uuid));
            list();
        }
    }
    SiteIdListParam param = new SiteIdListParam();
    param.getIds().addAll(uuids);
    DisasterRecoveryUtils.deleteStandby(param);
    flash.success(MessagesUtils.get(DELETED_SUCCESS));
    list();
}
Also used : SiteIdListParam(com.emc.storageos.model.dr.SiteIdListParam) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Aggregations

Restrictions (controllers.deadbolt.Restrictions)29 FlashException (controllers.util.FlashException)8 SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)7 BackupDataTable (models.datatable.BackupDataTable)4 RoleAssignmentEntry (com.emc.storageos.model.auth.RoleAssignmentEntry)2 SiteIdListParam (com.emc.storageos.model.dr.SiteIdListParam)2 VirtualDataCenterRestRep (com.emc.storageos.model.vdc.VirtualDataCenterRestRep)2 ViPRSystemClient (com.emc.vipr.client.ViPRSystemClient)2 BackupRestoreStatus (com.emc.vipr.model.sys.backup.BackupRestoreStatus)2 NodeHealth (com.emc.vipr.model.sys.healthmonitor.NodeHealth)2 RecoveryStatus (com.emc.vipr.model.sys.recovery.RecoveryStatus)2 Date (java.util.Date)2 RebootNodeJob (jobs.RebootNodeJob)2 TenantRoleAssignmentDataTable (models.datatable.TenantRoleAssignmentDataTable)2 DateTime (org.joda.time.DateTime)2 RoleAssignmentUtils.createRoleAssignmentEntry (util.RoleAssignmentUtils.createRoleAssignmentEntry)2 SiteActive (com.emc.storageos.model.dr.SiteActive)1 SiteAddParam (com.emc.storageos.model.dr.SiteAddParam)1 SiteDetailRestRep (com.emc.storageos.model.dr.SiteDetailRestRep)1 SiteUpdateParam (com.emc.storageos.model.dr.SiteUpdateParam)1