Search in sources :

Example 61 with ViPRCoreClient

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

the class ObjectBuckets method listBucketACL.

public static void listBucketACL(String id) {
    renderArgs.put("dataTable", new BucketACLDataTable());
    renderArgs.put("bucketId", uri(id));
    ViPRCoreClient client = BourneUtil.getViprClient();
    BucketRestRep bucket = client.objectBuckets().get(uri(id));
    renderArgs.put("bucketName", bucket.getName());
    BucketACLForm bucketACL = new BucketACLForm();
    render(bucketACL);
}
Also used : BucketACLDataTable(models.datatable.BucketACLDataTable) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BucketRestRep(com.emc.storageos.model.object.BucketRestRep)

Example 62 with ViPRCoreClient

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

the class ObjectBuckets method listBucketACLJson.

public static void listBucketACLJson(String id) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<BucketACE> bucketAcl = client.objectBuckets().getBucketACL(uri(id));
    List<BucketACLDataTable.AclInfo> acl = Lists.newArrayList();
    for (BucketACE ace : bucketAcl) {
        String userOrGroupOrCustomgroup = ace.getUser();
        String type = USER;
        if (ace.getGroup() != null && !ace.getGroup().isEmpty()) {
            type = GROUP;
            userOrGroupOrCustomgroup = ace.getGroup();
        } else if (ace.getCustomGroup() != null && !ace.getCustomGroup().isEmpty()) {
            type = CUSTOMGROUP;
            userOrGroupOrCustomgroup = ace.getCustomGroup();
        }
        acl.add(new BucketACLDataTable.AclInfo(userOrGroupOrCustomgroup, type, ace.getPermissions(), id, ace.getDomain()));
    }
    renderJSON(DataTablesSupport.createJSON(acl, params));
}
Also used : BucketACLDataTable(models.datatable.BucketACLDataTable) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BucketACE(com.emc.storageos.model.object.BucketACE)

Example 63 with ViPRCoreClient

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

the class Events method getCountSummary.

public static void getCountSummary(URI tenantId) {
    ViPRCoreClient client = getViprClient();
    EventStatsRestRep stats = client.events().getStatsByTenant(tenantId);
    renderJSON(stats);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) EventStatsRestRep(com.emc.storageos.model.event.EventStatsRestRep)

Example 64 with ViPRCoreClient

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

the class Tasks method taskPoll.

private static List<TaskResourceRep> taskPoll(Long lastUpdated, Boolean systemTasks, int maxTasks) {
    List<TaskResourceRep> taskResourceReps = Lists.newArrayList();
    ViPRCoreClient client = getViprClient();
    URI tenant = null;
    if (systemTasks) {
        tenant = SYSTEM_TENANT;
    } else {
        tenant = uri(Models.currentAdminTenant());
    }
    for (TaskResourceRep item : client.tasks().findCreatedSince(tenant, lastUpdated, maxTasks)) {
        taskResourceReps.add(item);
    }
    return taskResourceReps;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) URI(java.net.URI)

Example 65 with ViPRCoreClient

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

the class Tasks method listAllJson.

public static void listAllJson(Long lastUpdated, Boolean systemTasks) {
    if (systemTasks == null) {
        systemTasks = Boolean.FALSE;
    }
    if (systemTasks && Security.isSystemAdminOrRestrictedSystemAdmin() == false) {
        forbidden();
    }
    Integer maxTasks = params.get("maxTasks", Integer.class);
    if (maxTasks == null) {
        maxTasks = 100;
    }
    if (maxTasks == 0) {
        maxTasks = -1;
    }
    ViPRCoreClient client = getViprClient();
    List<TaskResourceRep> taskResourceReps = null;
    if (lastUpdated == null) {
        if (systemTasks) {
            taskResourceReps = client.tasks().getByRefs(client.tasks().listByTenant(SYSTEM_TENANT, maxTasks));
        } else {
            taskResourceReps = client.tasks().getByRefs(client.tasks().listByTenant(uri(Models.currentAdminTenant()), maxTasks));
        }
    } else {
        taskResourceReps = taskPoll(lastUpdated, systemTasks, maxTasks);
    }
    Collections.sort(taskResourceReps, orderedTaskComparitor);
    List<TasksDataTable.Task> tasks = Lists.newArrayList();
    if (taskResourceReps != null) {
        for (TaskResourceRep taskResourceRep : taskResourceReps) {
            TasksDataTable.Task task = new TasksDataTable.Task(taskResourceRep);
            if (Objects.equals(task.state, "pending") || Objects.equals(task.state, "queued")) {
                task.progress = Math.max(task.progress, MINIMUM_TASK_PROGRESS);
            }
            tasks.add(task);
        }
    }
    renderJSON(DataTablesSupport.createJSON(tasks, params));
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) TasksDataTable(models.datatable.TasksDataTable) TaskResourceRep(com.emc.storageos.model.TaskResourceRep)

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