Search in sources :

Example 16 with ViPRCoreClient

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

the class BlockSnapshotSessionsDataTable method fetch.

public static List<BlockSnapshotSession> fetch(URI projectId) {
    if (projectId == null) {
        return Collections.emptyList();
    }
    ViPRCoreClient client = getViprClient();
    List<BlockSnapshotSessionRestRep> blockSnapshots = client.blockSnapshotSessions().findByProject(projectId);
    Map<URI, VolumeRestRep> parentVolumes = getParentVolumes(blockSnapshots);
    List<BlockSnapshotSession> results = Lists.newArrayList();
    for (BlockSnapshotSessionRestRep blockSnapshot : blockSnapshots) {
        BlockSnapshotSession snap = new BlockSnapshotSession(blockSnapshot);
        // Get the parent volume of the snapshot
        VolumeRestRep volume = parentVolumes.get(ResourceUtils.id(blockSnapshot.getParent()));
        snap.volume = ResourceUtils.name(volume);
        results.add(snap);
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 17 with ViPRCoreClient

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

the class BlockSnapshotsDataTable method fetch.

public static List<BlockSnapshot> fetch(URI projectId) {
    if (projectId == null) {
        return Collections.emptyList();
    }
    ViPRCoreClient client = getViprClient();
    List<BlockSnapshotRestRep> blockSnapshots = client.blockSnapshots().findByProject(projectId);
    Map<URI, VolumeRestRep> parentVolumes = getParentVolumes(blockSnapshots);
    List<BlockSnapshot> results = Lists.newArrayList();
    for (BlockSnapshotRestRep blockSnapshot : blockSnapshots) {
        BlockSnapshot snap = new BlockSnapshot(blockSnapshot);
        // Get the parent volume of the snapshot
        VolumeRestRep volume = parentVolumes.get(ResourceUtils.id(blockSnapshot.getParent()));
        snap.volume = ResourceUtils.name(volume);
        results.add(snap);
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 18 with ViPRCoreClient

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

the class BlockVolumesDataTable method fetch.

public static List<Volume> fetch(URI projectId, URI applicationId) {
    if (projectId == null && applicationId == null) {
        return Collections.EMPTY_LIST;
    }
    ViPRCoreClient client = getViprClient();
    List<VolumeRestRep> volumes = Lists.newArrayList();
    List<Volume> results = Lists.newArrayList();
    Map<URI, String> virtualArrays = ResourceUtils.mapNames(client.varrays().list());
    Map<URI, String> virtualPools = ResourceUtils.mapNames(client.blockVpools().list());
    if (projectId != null) {
        volumes = client.blockVolumes().findByProject(projectId);
        for (VolumeRestRep volume : volumes) {
            results.add(new Volume(volume, virtualArrays, virtualPools));
        }
    } else if (applicationId != null) {
        List<VolumeRestRep> result = Lists.newArrayList();
        List<NamedRelatedResourceRep> groups = AppSupportUtil.getVolumesByApplication(applicationId.toString());
        List<NamedRelatedResourceRep> clones = AppSupportUtil.getFullCopiesByApplication(applicationId.toString());
        for (NamedRelatedResourceRep volume : groups) {
            result.add(BourneUtil.getViprClient().blockVolumes().get((volume.getId())));
        }
        for (NamedRelatedResourceRep clone : clones) {
            result.add(BourneUtil.getViprClient().blockVolumes().get((clone.getId())));
        }
        for (VolumeRestRep volumeApplication : result) {
            results.add(new Volume(volumeApplication, virtualArrays, virtualPools));
        }
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) List(java.util.List) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 19 with ViPRCoreClient

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

the class ConsistencyGroupsDataTable method fetch.

public static List<ConsistencyGroup> fetch(URI projectId) {
    if (projectId == null) {
        return Collections.EMPTY_LIST;
    }
    ViPRCoreClient client = getViprClient();
    List<BlockConsistencyGroupRestRep> blockConsistencyGroups = client.blockConsistencyGroups().findByProject(projectId);
    List<ConsistencyGroup> results = Lists.newArrayList();
    for (BlockConsistencyGroupRestRep blockConsistencyGroup : blockConsistencyGroups) {
        results.add(new ConsistencyGroup(blockConsistencyGroup));
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockConsistencyGroupRestRep(com.emc.storageos.model.block.BlockConsistencyGroupRestRep)

Example 20 with ViPRCoreClient

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

the class FileSnapshotsDataTable method fetch.

public static List<FileSnapshot> fetch(URI projectId) {
    if (projectId == null) {
        return Collections.EMPTY_LIST;
    }
    ViPRCoreClient client = getViprClient();
    List<FileSnapshotRestRep> fileSnapshots = client.fileSnapshots().findByProject(projectId);
    List<FileSnapshot> results = Lists.newArrayList();
    for (FileSnapshotRestRep fileSnapshot : fileSnapshots) {
        results.add(new FileSnapshot(fileSnapshot));
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileSnapshotRestRep(com.emc.storageos.model.file.FileSnapshotRestRep)

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