Search in sources :

Example 1 with ListNamespacesResult

use of com.emc.ecs.management.entity.ListNamespacesResult 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 ListNamespacesResult

use of com.emc.ecs.management.entity.ListNamespacesResult 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)

Example 3 with ListNamespacesResult

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

the class ManagementClient method listNamespaces.

// ================================
// Public Methods
// ================================
/**
 * lists namespaces
 * @param namespaceRequest - namespace request
 * @return ListNamespacesResult
 */
public ListNamespacesResult listNamespaces(ListNamespaceRequest namespaceRequest) {
    String authToken = getAuthToken();
    WebResource mgmtResource = this.mgmtClient.resource(uri);
    // list namespaces
    WebResource listNamespacesResource = mgmtResource.path(REST_LIST_NAMESPACES);
    if (namespaceRequest.getNextMarker() != null) {
        listNamespacesResource = listNamespacesResource.queryParam(REST_MARKER_PARAMETER, namespaceRequest.getNextMarker());
    }
    ListNamespacesResult listNamespacetResponse = listNamespacesResource.header(X_SDS_AUTH_TOKEN, authToken).get(ListNamespacesResult.class);
    return listNamespacetResponse;
}
Also used : ListNamespacesResult(com.emc.ecs.management.entity.ListNamespacesResult) WebResource(com.sun.jersey.api.client.WebResource)

Aggregations

ListNamespacesResult (com.emc.ecs.management.entity.ListNamespacesResult)3 ListNamespaceRequest (com.emc.ecs.management.entity.ListNamespaceRequest)2 Namespace (com.emc.ecs.management.entity.Namespace)2 ArrayList (java.util.ArrayList)2 WebResource (com.sun.jersey.api.client.WebResource)1