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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations