Search in sources :

Example 31 with ViPRCoreClient

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

the class BlockVolumes method volumeSnapshotSessions.

public static void volumeSnapshotSessions(String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    VolumeRestRep volume = client.blockVolumes().get(uri(volumeId));
    List<BlockSnapshotSessionRestRep> snapshotSessions = Lists.newArrayList();
    if (volume.getConsistencyGroup() != null) {
        URI consistencygroup = volume.getConsistencyGroup().getId();
        List<NamedRelatedResourceRep> cgSessions = client.blockConsistencyGroups().getSnapshotSessions(consistencygroup);
        snapshotSessions = client.blockSnapshotSessions().getByRefs(cgSessions);
    } else {
        List<NamedRelatedResourceRep> refs = client.blockSnapshotSessions().listByVolume(uri(volumeId));
        snapshotSessions = client.blockSnapshotSessions().getByRefs(refs);
    }
    render(snapshotSessions, volumeId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 32 with ViPRCoreClient

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

the class BlockVolumes method volumeDetails.

public static void volumeDetails(String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    String consistencygroup = "";
    VolumeRestRep volume = client.blockVolumes().get(uri(volumeId));
    if (volume == null) {
        error(MessagesUtils.get(UNKNOWN, volumeId));
    }
    if (volume.getConsistencyGroup() != null) {
        consistencygroup = client.blockConsistencyGroups().get(volume.getConsistencyGroup().getId()).getName();
    }
    render(consistencygroup);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep)

Example 33 with ViPRCoreClient

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

the class BlockVolumes method volumeContinuousCopies.

public static void volumeContinuousCopies(String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<BlockMirrorRestRep> continuousCopies = client.blockVolumes().getContinuousCopies(uri(volumeId));
    render(continuousCopies);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockMirrorRestRep(com.emc.storageos.model.block.BlockMirrorRestRep)

Example 34 with ViPRCoreClient

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

the class FileSnapshots method deleteSnapshotShare.

@FlashException(referrer = { "snapshot" })
public static void deleteSnapshotShare(String snapshotId, String shareName) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    Task<FileSnapshotRestRep> task = client.fileSnapshots().removeShare(uri(snapshotId), shareName);
    flash.put("info", MessagesUtils.get("resources.filesnapshot.share.deactivate"));
    snapshot(snapshotId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep) FlashException(controllers.util.FlashException)

Example 35 with ViPRCoreClient

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

the class FileSnapshots method removeSnapShotAcl.

/**
 * This method called When user selects ACLs and hit delete button.
 *
 * @param aclURL
 *            URL of the snapshot share.
 * @param ids
 *            ids of the selected ACL
 */
@FlashException(referrer = { "snapshot" })
public static void removeSnapShotAcl(String aclUrl, @As(",") String[] ids) {
    ShareACLs aclsToDelete = new ShareACLs();
    List<ShareACL> shareAcls = new ArrayList<ShareACL>();
    String snapshotId = null;
    String shareName = null;
    if (ids != null && ids.length > 0) {
        for (String id : ids) {
            String type = SnapshotShareACLForm.extractTypeFromId(id);
            String name = SnapshotShareACLForm.extractNameFromId(id);
            String domain = SnapshotShareACLForm.extractDomainFromId(id);
            snapshotId = SnapshotShareACLForm.extractSnapshotFromId(id);
            shareName = SnapshotShareACLForm.extractShareNameFromId(id);
            ShareACL ace = new ShareACL();
            if (SnapshotShareACLForm.GROUP.equalsIgnoreCase(type)) {
                ace.setGroup(name);
            } else {
                ace.setUser(name);
            }
            if (domain != null && !"".equals(domain) && !"null".equals(domain)) {
                ace.setDomain(domain);
            }
            shareAcls.add(ace);
        }
        aclsToDelete.setShareACLs(shareAcls);
        SnapshotCifsShareACLUpdateParams input = new SnapshotCifsShareACLUpdateParams();
        input.setAclsToDelete(aclsToDelete);
        ViPRCoreClient client = BourneUtil.getViprClient();
        client.fileSnapshots().updateShareACL(uri(snapshotId), shareName, input);
    }
    flash.success(MessagesUtils.get("resources.filesystem.share.acl.deleted"));
    listSnapshotAcl(snapshotId, shareName);
}
Also used : SnapshotCifsShareACLUpdateParams(com.emc.storageos.model.file.SnapshotCifsShareACLUpdateParams) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ShareACLs(com.emc.storageos.model.file.ShareACLs) ArrayList(java.util.ArrayList) ShareACL(com.emc.storageos.model.file.ShareACL) FlashException(controllers.util.FlashException)

Aggregations

ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)225 Asset (com.emc.sa.asset.annotation.Asset)72 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)66 URI (java.net.URI)66 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)49 FlashException (controllers.util.FlashException)48 AssetOption (com.emc.vipr.model.catalog.AssetOption)41 ArrayList (java.util.ArrayList)34 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)29 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)27 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)24 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)20 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)15 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)15 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)13 HashSet (java.util.HashSet)13 Task (com.emc.vipr.client.Task)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)10 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)8