Search in sources :

Example 21 with ViPRCatalogClient2

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

the class OrderUtils method getScheduledOrders.

public static List<OrderRestRep> getScheduledOrders(URI tenantId) {
    ViPRCatalogClient2 catalog = getCatalogClient();
    List<OrderRestRep> scheduledOrders = catalog.orders().search().byStatus(OrderStatus.SCHEDULED.name(), tenantId).run();
    return scheduledOrders;
}
Also used : OrderRestRep(com.emc.vipr.model.catalog.OrderRestRep) ViPRCatalogClient2(com.emc.vipr.client.ViPRCatalogClient2)

Example 22 with ViPRCatalogClient2

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

the class OrderUtils method getOrder.

public static OrderRestRep getOrder(URI id) {
    ViPRCatalogClient2 catalog = getCatalogClient();
    OrderRestRep order = null;
    try {
        order = catalog.orders().get(id);
    } catch (ViPRHttpException e) {
        if (e.getHttpCode() == 404) {
            order = null;
        } else {
            throw e;
        }
    }
    return order;
}
Also used : OrderRestRep(com.emc.vipr.model.catalog.OrderRestRep) ViPRCatalogClient2(com.emc.vipr.client.ViPRCatalogClient2) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException)

Example 23 with ViPRCatalogClient2

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

the class OrderUtils method getErrorOrders.

public static List<OrderRestRep> getErrorOrders(URI tenantId) {
    ViPRCatalogClient2 catalog = getCatalogClient();
    List<OrderRestRep> scheduledOrders = catalog.orders().search().byStatus(OrderStatus.ERROR.name(), tenantId).run();
    return scheduledOrders;
}
Also used : OrderRestRep(com.emc.vipr.model.catalog.OrderRestRep) ViPRCatalogClient2(com.emc.vipr.client.ViPRCatalogClient2)

Example 24 with ViPRCatalogClient2

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

the class OrdersApi method orders.

public static void orders() {
    ViPRCatalogClient2 catalog = getCatalogClient();
    List<Reference> orders = Lists.newArrayList();
    for (NamedRelatedResourceRep element : catalog.orders().listByUserTenant()) {
        orders.add(newOrderReference(element.getId().toString()));
    }
    renderApi(orders);
}
Also used : Reference(com.emc.vipr.model.catalog.Reference) ApiMapperUtils.newOrderReference(util.api.ApiMapperUtils.newOrderReference) ViPRCatalogClient2(com.emc.vipr.client.ViPRCatalogClient2) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 25 with ViPRCatalogClient2

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

the class BourneUtil method getCatalogClient.

public static ViPRCatalogClient2 getCatalogClient() {
    String authToken = Security.getAuthToken();
    String key = String.format("ViPRCatalogClient.%s", authToken);
    ViPRCatalogClient2 client = getRequestArg(key);
    if (client == null) {
        Logger.debug("Creating new ViPRCatalogClient");
        client = new ViPRCatalogClient2(getClientConfig()).withAuthToken(authToken);
        setRequestArg(key, client);
    } else {
        Logger.debug("Returning cached ViPRCatalogClient");
    }
    return client;
}
Also used : ViPRCatalogClient2(com.emc.vipr.client.ViPRCatalogClient2)

Aggregations

ViPRCatalogClient2 (com.emc.vipr.client.ViPRCatalogClient2)32 OrderRestRep (com.emc.vipr.model.catalog.OrderRestRep)7 ApprovalRestRep (com.emc.vipr.model.catalog.ApprovalRestRep)4 CatalogServiceRestRep (com.emc.vipr.model.catalog.CatalogServiceRestRep)4 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)2 URI (java.net.URI)2 Date (java.util.Date)2 OrderTextCreator (com.emc.storageos.db.client.util.OrderTextCreator)1 AssetDependencyRequest (com.emc.vipr.model.catalog.AssetDependencyRequest)1 AssetOptionsRequest (com.emc.vipr.model.catalog.AssetOptionsRequest)1 ExecutionLogRestRep (com.emc.vipr.model.catalog.ExecutionLogRestRep)1 ExecutionStateRestRep (com.emc.vipr.model.catalog.ExecutionStateRestRep)1 ExecutionWindowRestRep (com.emc.vipr.model.catalog.ExecutionWindowRestRep)1 OrderLogRestRep (com.emc.vipr.model.catalog.OrderLogRestRep)1 Reference (com.emc.vipr.model.catalog.Reference)1 ScheduledEventRestRep (com.emc.vipr.model.catalog.ScheduledEventRestRep)1 ApprovalRequestInfo (models.datatable.ApprovalsDataTable.ApprovalRequestInfo)1 DateTime (org.joda.time.DateTime)1 Util (play.mvc.Util)1