Search in sources :

Example 21 with Tasks

use of com.emc.vipr.client.Tasks in project coprhd-controller by CoprHD.

the class RestoreSnapshotForApplication method doExecute.

@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
    VolumeGroupSnapshotOperationParam input = new VolumeGroupSnapshotOperationParam();
    input.setSnapshots(snapshots);
    input.setPartial(true);
    TaskList taskList = getClient().application().restoreApplicationSnapshot(applicationId, input);
    return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
Also used : WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList) VolumeGroupSnapshotOperationParam(com.emc.storageos.model.application.VolumeGroupSnapshotOperationParam)

Example 22 with Tasks

use of com.emc.vipr.client.Tasks in project coprhd-controller by CoprHD.

the class RestoreSnapshotSessionForApplication method doExecute.

@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
    VolumeGroupSnapshotSessionRestoreParam input = new VolumeGroupSnapshotSessionRestoreParam();
    input.setSnapshotSessions(snapSessions);
    input.setPartial(true);
    TaskList taskList = getClient().application().restoreApplicationSnapshotSession(applicationId, input);
    return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
Also used : VolumeGroupSnapshotSessionRestoreParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionRestoreParam) WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList)

Example 23 with Tasks

use of com.emc.vipr.client.Tasks in project coprhd-controller by CoprHD.

the class UnlinkSnapshotSessionForApplication method doExecute.

@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
    VolumeGroupSnapshotSessionUnlinkTargetsParam input = new VolumeGroupSnapshotSessionUnlinkTargetsParam();
    input.setSnapshotSessions(snapshotSessions);
    input.setPartial(true);
    List<SnapshotSessionUnlinkTargetParam> linkedTargets = Lists.newArrayList();
    if (existingLinkedSnapshotIds != null) {
        for (String linkedSnapshot : existingLinkedSnapshotIds) {
            SnapshotSessionUnlinkTargetParam param = new SnapshotSessionUnlinkTargetParam();
            param.setId(uri(linkedSnapshot));
            if (deleteTarget != null) {
                param.setDeleteTarget(deleteTarget);
            }
            linkedTargets.add(param);
        }
    }
    input.setLinkedTargets(linkedTargets);
    TaskList taskList = getClient().application().unlinkApplicationSnapshotSession(applicationId, input);
    return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
Also used : WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) SnapshotSessionUnlinkTargetParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetParam) TaskList(com.emc.storageos.model.TaskList) VolumeGroupSnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionUnlinkTargetsParam)

Example 24 with Tasks

use of com.emc.vipr.client.Tasks in project coprhd-controller by CoprHD.

the class BlockSnapshotSessions method deactivate.

/**
 * Begins deactivating a given block snapshot session by ID.
 * <p>
 * API Call: <tt>POST /block/snapshot-sessions/{id}/deactivate</tt>
 *
 * @param id
 *            the ID of the snapshot session to deactivate.
 * @param type
 *            {@code FULL} or {@code VIPR_ONLY}
 *
 * @return a task for monitoring the progress of the operation.
 */
public Tasks<BlockSnapshotSessionRestRep> deactivate(URI id, VolumeDeleteTypeEnum type) {
    URI uri = client.uriBuilder(getDeactivateUrl()).queryParam("type", type).build(id);
    TaskList tasks = client.postURI(TaskList.class, uri);
    return new Tasks<>(client, tasks.getTaskList(), resourceClass);
}
Also used : Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList) URI(java.net.URI)

Example 25 with Tasks

use of com.emc.vipr.client.Tasks in project coprhd-controller by CoprHD.

the class BlockSnapshots method deactivate.

/**
 * Begins deactivating a given block snapshot by ID.
 * <p>
 * API Call: <tt>POST /block/snapshots/{id}/deactivate</tt>
 *
 * @param id
 *            the ID of the snapshot to deactivate.
 *
 * @param type
 *            {@code FULL} or {@code VIPR_ONLY}
 *
 * @return a task for monitoring the progress of the operation.
 */
public Tasks<BlockSnapshotRestRep> deactivate(URI id, VolumeDeleteTypeEnum type) {
    URI uri = client.uriBuilder(getDeactivateUrl()).queryParam("type", type).build(id);
    TaskList tasks = client.postURI(TaskList.class, uri);
    return new Tasks<>(client, tasks.getTaskList(), resourceClass);
}
Also used : Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList) URI(java.net.URI)

Aggregations

Tasks (com.emc.vipr.client.Tasks)29 TaskList (com.emc.storageos.model.TaskList)27 WaitForTasks (com.emc.sa.service.vipr.tasks.WaitForTasks)24 VolumeGroupUpdateParam (com.emc.storageos.model.application.VolumeGroupUpdateParam)8 URI (java.net.URI)8 VolumeGroupSnapshotOperationParam (com.emc.storageos.model.application.VolumeGroupSnapshotOperationParam)4 VolumeGroupVolumeList (com.emc.storageos.model.application.VolumeGroupUpdateParam.VolumeGroupVolumeList)4 VolumeGroupFullCopyDetachParam (com.emc.storageos.model.application.VolumeGroupFullCopyDetachParam)2 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 VolumeGroupFullCopyCreateParam (com.emc.storageos.model.application.VolumeGroupFullCopyCreateParam)1 VolumeGroupFullCopyRestoreParam (com.emc.storageos.model.application.VolumeGroupFullCopyRestoreParam)1 VolumeGroupFullCopyResynchronizeParam (com.emc.storageos.model.application.VolumeGroupFullCopyResynchronizeParam)1 VolumeGroupSnapshotCreateParam (com.emc.storageos.model.application.VolumeGroupSnapshotCreateParam)1 VolumeGroupSnapshotSessionCreateParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionCreateParam)1 VolumeGroupSnapshotSessionDeactivateParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionDeactivateParam)1 VolumeGroupSnapshotSessionLinkTargetsParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionLinkTargetsParam)1 VolumeGroupSnapshotSessionRelinkTargetsParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionRelinkTargetsParam)1 VolumeGroupSnapshotSessionRestoreParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionRestoreParam)1 VolumeGroupSnapshotSessionUnlinkTargetsParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionUnlinkTargetsParam)1