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