use of com.emc.vipr.client.exceptions.ViPRHttpException in project coprhd-controller by CoprHD.
the class ObjectBuckets method bucket.
public static void bucket(String bucketId) {
ViPRCoreClient client = BourneUtil.getViprClient();
BucketRestRep bucket = null;
if (isBucketId(bucketId)) {
try {
bucket = client.objectBuckets().get(uri(bucketId));
} catch (ViPRHttpException e) {
if (e.getHttpCode() == 404) {
flash.error(MessagesUtils.get(UNKNOWN, bucketId));
buckets(null);
}
throw e;
}
}
if (bucket == null) {
notFound(Messages.get("resources.bucket.notfound"));
}
if (bucket.getVirtualArray() != null) {
// NOSONAR
// ("Suppressing Sonar violation of Possible null pointer dereference of volume. When volume is null, the previous if condition handles with throw")
renderArgs.put("virtualArray", VirtualArrayUtils.getVirtualArrayRef(bucket.getVirtualArray()));
}
if (bucket.getVirtualPool() != null) {
renderArgs.put("virtualPool", VirtualPoolUtils.getObjectVirtualPoolRef(bucket.getVirtualPool()));
}
Tasks<BucketRestRep> tasksResponse = client.objectBuckets().getTasks(bucket.getId());
List<Task<BucketRestRep>> tasks = tasksResponse.getTasks();
renderArgs.put("tasks", tasks);
render(bucket);
}
use of com.emc.vipr.client.exceptions.ViPRHttpException in project coprhd-controller by CoprHD.
the class FileSnapshots method snapshot.
public static void snapshot(String snapshotId) {
ViPRCoreClient client = BourneUtil.getViprClient();
FileSnapshotRestRep snapshot = null;
try {
snapshot = client.fileSnapshots().get(uri(snapshotId));
} catch (ViPRHttpException e) {
if (e.getHttpCode() == 404 || e.getHttpCode() == 400) {
flash.error(MessagesUtils.get(UNKNOWN, snapshotId));
snapshots(null);
}
throw e;
}
if (snapshot != null) {
if (snapshot.getParent() != null) {
FileShareRestRep fileSystem = client.fileSystems().get(snapshot.getParent());
renderArgs.put("fileSystem", fileSystem);
}
Tasks<FileSnapshotRestRep> tasksResponse = client.fileSnapshots().getTasks(snapshot.getId());
List<Task<FileSnapshotRestRep>> tasks = tasksResponse.getTasks();
renderArgs.put("tasks", tasks);
} else {
flash.error(MessagesUtils.get(UNKNOWN, snapshotId));
snapshots(null);
}
render(snapshot);
}
use of com.emc.vipr.client.exceptions.ViPRHttpException in project coprhd-controller by CoprHD.
the class BlockVolumes method volume.
public static void volume(String volumeId, String continuousCopyId) {
ViPRCoreClient client = BourneUtil.getViprClient();
VolumeRestRep volume = null;
if (isVolumeId(volumeId)) {
if (isContinuousCopyId(continuousCopyId)) {
volume = client.blockVolumes().getContinuousCopy(uri(volumeId), uri(continuousCopyId));
renderArgs.put("isContinuousCopy", Boolean.TRUE);
renderArgs.put("isBlockContinuousCopy", isBlockContinuousCopyId(continuousCopyId));
renderArgs.put("isVplexContinuousCopy", isVplexContinuousCopyId(continuousCopyId));
} else {
try {
volume = client.blockVolumes().get(uri(volumeId));
} catch (ViPRHttpException e) {
if (e.getHttpCode() == 404) {
flash.error(MessagesUtils.get(UNKNOWN, volumeId));
volumes(null);
}
throw e;
}
}
}
if (volume == null) {
notFound(Messages.get("resources.volume.notfound"));
}
if (volume.getVirtualArray() != null) {
// NOSONAR
// ("Suppressing Sonar violation of Possible null pointer dereference of volume. When volume is null, the previous if condition handles with throw")
renderArgs.put("virtualArray", VirtualArrayUtils.getVirtualArrayRef(volume.getVirtualArray()));
}
if (volume.getVirtualPool() != null) {
renderArgs.put("virtualPool", VirtualPoolUtils.getBlockVirtualPoolRef(volume.getVirtualPool()));
}
if (volume.getConsistencyGroup() != null) {
renderArgs.put("consistencyGroup", BlockConsistencyGroupUtils.getBlockConsistencyGroupRef(volume.getConsistencyGroup()));
}
if (volume.getStorageController() != null) {
renderArgs.put("storageSystem", StorageSystemUtils.getStorageSystemRef(volume.getStorageController()));
}
if (volume.getCompressionRatio() != null) {
renderArgs.put("compressionRatio", volume.getCompressionRatio());
}
if (volume.getAccessState() == null || volume.getAccessState().isEmpty()) {
renderArgs.put("isAccessStateEmpty", "true");
}
Tasks<VolumeRestRep> tasksResponse = client.blockVolumes().getTasks(volume.getId());
List<Task<VolumeRestRep>> tasks = tasksResponse.getTasks();
renderArgs.put("tasks", tasks);
render(volume);
}
Aggregations