Search in sources :

Example 1 with ListNamespaceRequest

use of com.emc.ecs.management.entity.ListNamespaceRequest in project ecs-dashboard by carone1.

the class NamespaceBO method getNamespaces.

/**
 * Gathers all namespaces present on a cluster
 *
 * @return List - List of namespace
 */
public List<Namespace> getNamespaces() {
    List<Namespace> namespaceList = new ArrayList<Namespace>();
    ListNamespaceRequest listNamespaceRequest = new ListNamespaceRequest();
    // first batch
    ListNamespacesResult namespacesResult = client.listNamespaces(listNamespaceRequest);
    namespaceList.addAll(namespacesResult.getNamespaces());
    // n subsequent batches
    while (namespacesResult.getNextMarker() != null) {
        listNamespaceRequest.setNextMarker(namespacesResult.getNextMarker());
        namespacesResult = client.listNamespaces(listNamespaceRequest);
        if (namespacesResult.getNamespaces() != null) {
            namespaceList.addAll(namespacesResult.getNamespaces());
        }
    }
    return namespaceList;
}
Also used : ListNamespacesResult(com.emc.ecs.management.entity.ListNamespacesResult) ArrayList(java.util.ArrayList) ListNamespaceRequest(com.emc.ecs.management.entity.ListNamespaceRequest) Namespace(com.emc.ecs.management.entity.Namespace)

Example 2 with ListNamespaceRequest

use of com.emc.ecs.management.entity.ListNamespaceRequest in project ecs-dashboard by carone1.

the class BillingBO method getNamespaces.

/**
 *  Gathers all namespaces present on a cluster
 * @return List - List of namespace
 */
public List<Namespace> getNamespaces() {
    // Start collecting billing data from ECS systems
    List<Namespace> namespaceList = new ArrayList<Namespace>();
    // collect namespace names
    ListNamespaceRequest listNamespaceRequest = new ListNamespaceRequest();
    // first batch
    ListNamespacesResult namespacesResult = client.listNamespaces(listNamespaceRequest);
    namespaceList.addAll(namespacesResult.getNamespaces());
    // n subsequent batches
    while (namespacesResult.getNextMarker() != null) {
        listNamespaceRequest.setNextMarker(namespacesResult.getNextMarker());
        namespacesResult = client.listNamespaces(listNamespaceRequest);
        if (namespacesResult.getNamespaces() != null) {
            namespaceList.addAll(namespacesResult.getNamespaces());
        }
    }
    return namespaceList;
}
Also used : ListNamespacesResult(com.emc.ecs.management.entity.ListNamespacesResult) ArrayList(java.util.ArrayList) ListNamespaceRequest(com.emc.ecs.management.entity.ListNamespaceRequest) Namespace(com.emc.ecs.management.entity.Namespace)

Aggregations

ListNamespaceRequest (com.emc.ecs.management.entity.ListNamespaceRequest)2 ListNamespacesResult (com.emc.ecs.management.entity.ListNamespacesResult)2 Namespace (com.emc.ecs.management.entity.Namespace)2 ArrayList (java.util.ArrayList)2