Search in sources :

Example 21 with Task

use of com.emc.vipr.client.Task 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);
}
Also used : Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BucketRestRep(com.emc.storageos.model.object.BucketRestRep) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException)

Aggregations

Task (com.emc.vipr.client.Task)21 URI (java.net.URI)13 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)11 ArrayList (java.util.ArrayList)6 ExecutionException (com.emc.sa.engine.ExecutionException)5 DeactivateHost (com.emc.sa.service.vipr.compute.tasks.DeactivateHost)5 DiscoverHost (com.emc.sa.service.vipr.compute.tasks.DiscoverHost)5 GetHost (com.emc.sa.service.vipr.tasks.GetHost)5 Host (com.emc.storageos.db.client.model.Host)5 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)4 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)4 TimeoutException (com.emc.vipr.client.exceptions.TimeoutException)4 ViPRException (com.emc.vipr.client.exceptions.ViPRException)4 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)4 HashMap (java.util.HashMap)4 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)3 FileSnapshotRestRep (com.emc.storageos.model.file.FileSnapshotRestRep)3 HostRestRep (com.emc.storageos.model.host.HostRestRep)3 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)2 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)2