All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.emc.vipr.client.core.BlockConsistencyGroups Maven / Gradle / Ivy

There is a newer version: 3.5.0.0
Show newest version
/*
 * Copyright (c) 2015 EMC Corporation
 * All Rights Reserved
 */
package com.emc.vipr.client.core;

import static com.emc.vipr.client.core.util.ResourceUtils.defaultList;

import java.net.URI;
import java.util.List;

import com.emc.storageos.model.BulkIdParam;
import com.emc.storageos.model.NamedRelatedResourceRep;
import com.emc.storageos.model.SnapshotList;
import com.emc.storageos.model.block.BlockConsistencyGroupBulkRep;
import com.emc.storageos.model.block.BlockConsistencyGroupCreate;
import com.emc.storageos.model.block.BlockConsistencyGroupRestRep;
import com.emc.storageos.model.block.BlockConsistencyGroupSnapshotCreate;
import com.emc.storageos.model.block.BlockConsistencyGroupUpdate;
import com.emc.storageos.model.block.BlockSnapshotSessionList;
import com.emc.storageos.model.block.BlockSnapshotSessionRestRep;
import com.emc.storageos.model.block.CopiesParam;
import com.emc.storageos.model.block.NamedVolumesList;
import com.emc.storageos.model.block.SnapshotSessionCreateParam;
import com.emc.storageos.model.block.VolumeFullCopyCreateParam;
import com.emc.vipr.client.Task;
import com.emc.vipr.client.Tasks;
import com.emc.vipr.client.ViPRCoreClient;
import com.emc.vipr.client.core.filters.ResourceFilter;
import com.emc.vipr.client.core.impl.PathConstants;
import com.emc.vipr.client.impl.RestClient;

/**
 * Block Consistency Group resources.
 * 

* Base URL: /block/consistency-groups * * @see BlockConsistencyGroupRestRep */ public class BlockConsistencyGroups extends ProjectResources implements TaskResources { public BlockConsistencyGroups(ViPRCoreClient parent, RestClient client) { super(parent, client, BlockConsistencyGroupRestRep.class, PathConstants.BLOCK_CONSISTENCY_GROUP_URL); } @Override public BlockConsistencyGroups withInactive(boolean inactive) { return (BlockConsistencyGroups) super.withInactive(inactive); } @Override public BlockConsistencyGroups withInternal(boolean internal) { return (BlockConsistencyGroups) super.withInternal(internal); } @Override protected List getBulkResources(BulkIdParam input) { BlockConsistencyGroupBulkRep response = client.post(BlockConsistencyGroupBulkRep.class, input, getBulkUrl()); return defaultList(response.getConsistencyGroups()); } @Override public Tasks getTasks(URI id) { return doGetTasks(id); } @Override public Task getTask(URI id, URI taskId) { return doGetTask(id, taskId); } /** * Begins creating a full copy of the given block volume. *

* API Call: POST /block/consistency-groups/{id}/protection/full-copies * * @param consistencyGroupId * the ID of the consistency group. * @param input * the create configuration. * @return tasks for monitoring the progress of the operation(s). */ public Tasks createFullCopy(URI consistencyGroupId, VolumeFullCopyCreateParam input) { final String url = getIdUrl() + "/protection/full-copies"; return postTasks(input, url, consistencyGroupId); } /** * List full copies for a consistency group *

* API Call: GET /block/consistency-groups/{id}/protection/full-copies * * @param consistencyGroupId * the ID of the consistency group * @return The list of full copies for the consistency group */ public List getFullCopies(URI consistencyGroupId) { final String url = getIdUrl() + "/protection/full-copies"; NamedVolumesList response = client.get(NamedVolumesList.class, url, consistencyGroupId); return defaultList(response.getVolumes()); } /** * Activate consistency group full copy *

* API Call: POST /block/consistency-groups/{id}/protection/full-copies/{fcid}/activate * * @param consistencyGroupId * the ID of the consistency group. * @param fullCopyId * the Id of the full copy * @return An asychronous operation realized as a Tasks object */ public Tasks activateFullCopy(URI consistencyGroupId, URI fullCopyId) { final String url = getIdUrl() + "/protection/full-copies/{fcid}/activate"; return postTasks(url, consistencyGroupId, fullCopyId); } /** * Detach consistency group full copy *

* API Call: POST /block/consistency-groups/{id}/protection/full-copies/{fcid}/detach * * @param consistencyGroupId * the ID of the consistency group. * @param fullCopyId * the Id of the full copy * @return An asychronous operation realized as a Tasks object */ public Tasks detachFullCopy(URI consistencyGroupId, URI fullCopyId) { final String url = getIdUrl() + "/protection/full-copies/{fcid}/detach"; return postTasks(url, consistencyGroupId, fullCopyId); } /** * Restore consistency group full copy *

* API Call: POST /block/consistency-groups/{id}/protection/full-copies/{fcid}/restore * * @param consistencyGroupId * the ID of the consistency group. * @param fullCopyId * the Id of the full copy * @return An asychronous operation realized as a Tasks object */ public Tasks restoreFullCopy(URI consistencyGroupId, URI fullCopyId) { final String url = getIdUrl() + "/protection/full-copies/{fcid}/restore"; return postTasks(url, consistencyGroupId, fullCopyId); } /** * Resynchronize consistency group full copy *

* API Call: POST /block/consistency-groups/{id}/protection/full-copies/{fcid}/resynchronize * * @param consistencyGroupId * the ID of the consistency group. * @param fullCopyId * the Id of the full copy * @return An asychronous operation realized as a Tasks object */ public Tasks resynchronizeFullCopy(URI consistencyGroupId, URI fullCopyId) { final String url = getIdUrl() + "/protection/full-copies/{fcid}/resynchronize"; return postTasks(url, consistencyGroupId, fullCopyId); } /** * Deactivate consistency group full copy *

* API Call: POST /block/consistency-groups/{id}/protection/full-copies/{fcid}/deactivate * * @param consistencyGroupId * the ID of the consistency group. * @param fullCopyId * the Id of the full copy * @return An asychronous operation realized as a Tasks object */ public Tasks deactivateFullCopy(URI consistencyGroupId, URI fullCopyId) { final String url = getIdUrl() + "/protection/full-copies/{fcid}/deactivate"; return postTasks(url, consistencyGroupId, fullCopyId); } /** * List snapshots in the consistency group *

* API Call: GET /block/consistency-groups/{id}/protection/snapshots * * @param consistencyGroupId * the ID of the consistency group * @return The list of snapshots in the consistency group */ public List getSnapshots(URI consistencyGroupId) { final String url = getIdUrl() + "/protection/snapshots"; SnapshotList response = client.get(SnapshotList.class, url, consistencyGroupId); return response.getSnapList(); } /** * Create consistency group snapshot *

* API Call: POST /block/consistency-groups/{id}/protection/snapshots * * @param consistencyGroupId * the ID of the consistency group * @param input * the create snapshot specification * @return An asychronous operation realized as a Tasks object */ public Tasks createSnapshot(URI consistencyGroupId, BlockConsistencyGroupSnapshotCreate input) { final String url = getIdUrl() + "/protection/snapshots"; return postTasks(input, url, consistencyGroupId); } /** * Activate consistency group snapshot *

* API Call: POST /block/consistency-groups/{id}/protection/snapshots/{sid}/activate * * @param consistencyGroupId * the ID of the consistency group * @param snapshotId * the ID of the snapshot * @return An asychronous operation realized as a Task object */ public Task activateSnapshot(URI consistencyGroupId, URI snapshotId) { final String url = getIdUrl() + "/protection/snapshots/{fcid}/activate"; return postTask(url, consistencyGroupId, snapshotId); } /** * Deactivate consistency group snapshot *

* API Call: POST /block/consistency-groups/{id}/protection/snapshots/{sid}/deactivate * * @param consistencyGroupId * the ID of the consistency group * @param snapshotId * the ID of the snapshot * @return An asychronous operation realized as a Tasks object */ public Tasks deactivateSnapshot(URI consistencyGroupId, URI snapshotId) { final String url = getIdUrl() + "/protection/snapshots/{fcid}/deactivate"; return postTasks(url, consistencyGroupId, snapshotId); } /** * Restore consistency group snapshot *

* API Call: POST /block/consistency-groups/{id}/protection/snapshots/{sid}/restore * * @param consistencyGroupId * the ID of the consistency group * @param snapshotId * the ID of the snapshot * @return An asychronous operation realized as a Task object */ public Task restoreSnapshot(URI consistencyGroupId, URI snapshotId) { final String url = getIdUrl() + "/protection/snapshots/{fcid}/restore"; return postTask(url, consistencyGroupId, snapshotId); } /** * Resynchronize consistency group snapshot *

* API Call: POST /block/consistency-groups/{id}/protection/snapshot/{fcid}/resynchronize * * @param consistencyGroupId * the ID of the consistency group. * @param snapshotId * the Id of the snapshot * @return An asychronous operation realized as a Tasks object */ public Task resynchronizeSnapshot(URI consistencyGroupId, URI snapshotId) { final String url = getIdUrl() + "/protection/snapshots/{fcid}/resynchronize"; return postTask(url, consistencyGroupId, snapshotId); } /** * Begins initiating failover for a given consistency group. *

* API Call: POST /block/consistency-groups/{id}/protection/continuous-copies/failover * * @param consistencyGroupId * the ID of the consistency group. * @param input * the input configuration. * @return a task for monitoring the progress of the operation. */ public Tasks failover(URI consistencyGroupId, CopiesParam input) { final String url = getIdUrl() + "/protection/continuous-copies/failover"; return postTasks(input, url, consistencyGroupId); } /** * Begins initiating failover cancel for a given consistency group. *

* API Call: POST /block/consistency-groups/{id}/protection/continuous-copies/failover-cancel * * @param consistencyGroupId * the ID of the consistency group. * @param input * the input configuration. * @return a task for monitoring the progress of the operation. */ public Tasks failoverCancel(URI consistencyGroupId, CopiesParam input) { final String url = getIdUrl() + "/protection/continuous-copies/failover-cancel"; return postTasks(input, url, consistencyGroupId); } /** * Begins initiating swap for a given consistency group. *

* API Call: POST /block/consistency-groups/{id}/protection/continuous-copies/swap * * @param consistencyGroupId * the ID of the consistency group. * @param input * the input configuration. * @return a task for monitoring the progress of the operation. */ public Tasks swap(URI consistencyGroupId, CopiesParam input) { final String url = getIdUrl() + "/protection/continuous-copies/swap"; return postTasks(input, url, consistencyGroupId); } /** * Creates a block consistency group. *

* API Call: POST /block/consistency-groups * * @param input * the create configuration. * @return the created block consistency group. */ public BlockConsistencyGroupRestRep create(BlockConsistencyGroupCreate input) { return client.post(BlockConsistencyGroupRestRep.class, input, baseUrl); } /** * Begins updating a block consistency group. *

* API Call: PUT /block/consistency-groups/{id} * * @param id * the ID of the block consistency group to update. * @param input * the update configuration. * @return a task for monitoring the progress of the update operation. */ public Task update(URI id, BlockConsistencyGroupUpdate input) { return putTask(input, getIdUrl(), id); } /** * Begins deactivating a block consistency group. *

* API Call: POST /block/consistency-groups/{id}/deactivate * * @param id * the ID of the block consistency group to deactivate. * @return a task for monitoring the progres of the deactivate operation. * * @see #doDeactivateWithTask(URI) */ public Task deactivate(URI id) { return doDeactivateWithTask(id); } /** * List snapshot sessions in the consistency group *

* API Call: GET /block/consistency-groups/{id}/protection/snapshot-sessions * * @param consistencyGroupId * the ID of the consistency group * @return The list of snapshot sessions in the consistency group */ public List getSnapshotSessions(URI consistencyGroupId) { final String url = getIdUrl() + "/protection/snapshot-sessions"; BlockSnapshotSessionList response = client.get(BlockSnapshotSessionList.class, url, consistencyGroupId); return response.getSnapSessionRelatedResourceList(); } /** * Create consistency group snapshot session *

* API Call: POST /block/consistency-groups/{id}/protection/snapshot-sessions * * @param consistencyGroupId * the ID of the consistency group * @param input * the create snapshot session specification * @return An asychronous operation realized as a Tasks object */ public Tasks createSnapshotSession(URI consistencyGroupId, SnapshotSessionCreateParam input) { final String url = getIdUrl() + "/protection/snapshot-sessions"; return postTasks(input, url, consistencyGroupId); } /** * Deactivate consistency group snapshot session *

* API Call: POST /block/consistency-groups/{id}/protection/snapshot-sessions/{sid}/deactivate * * @param consistencyGroupId * the ID of the consistency group * @param snapshotSessionId * the ID of the snapshot session * @return An asychronous operation realized as a Tasks object */ public Tasks deactivateSnapshotSession(URI consistencyGroupId, URI snapshotSessionId) { final String url = getIdUrl() + "/protection/snapshot-sessions/{fcid}/deactivate"; return postTasks(url, consistencyGroupId, snapshotSessionId); } /** * Restore consistency group snapshot session *

* API Call: POST /block/consistency-groups/{id}/protection/snapshot-sessions/{sid}/restore * * @param consistencyGroupId * the ID of the consistency group * @param snapshotSessionId * the ID of the snapshot session * @return An asychronous operation realized as a Task object */ public Task restoreSnapshotSession(URI consistencyGroupId, URI snapshotSessionId) { final String url = getIdUrl() + "/protection/snapshot-sessions/{fcid}/restore"; return postTask(url, consistencyGroupId, snapshotSessionId); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy