Search in sources :

Example 1 with Reference

use of com.emc.vipr.model.catalog.Reference in project coprhd-controller by CoprHD.

the class ApprovalsApi method approvals.

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

Example 2 with Reference

use of com.emc.vipr.model.catalog.Reference in project coprhd-controller by CoprHD.

the class ApprovalsApi method pending.

public static void pending() {
    List<Reference> approvals = Lists.newArrayList();
    List<ApprovalRestRep> pendingApprovals = getCatalogClient().approvals().search().byStatus(ApprovalRestRep.PENDING).run();
    for (ApprovalRestRep request : pendingApprovals) {
        approvals.add(newApprovalReference(request.getId().toString()));
    }
    renderApi(approvals);
}
Also used : ApiMapperUtils.newApprovalReference(util.api.ApiMapperUtils.newApprovalReference) Reference(com.emc.vipr.model.catalog.Reference) ApprovalRestRep(com.emc.vipr.model.catalog.ApprovalRestRep)

Example 3 with Reference

use of com.emc.vipr.model.catalog.Reference in project coprhd-controller by CoprHD.

the class AssetOptionsApi method dependencies.

public static void dependencies(String asset, String service) {
    // The 'service' may be the baseService or a service ID
    ServiceDescriptorRestRep descriptor;
    if (StringUtils.isEmpty(service)) {
        error(Messages.get("AssetOptionsApi.serviceParameterIsRequired"));
    }
    if (service.startsWith("urn:")) {
        CatalogServiceRestRep catalogService = CatalogServiceUtils.getCatalogService(uri(service));
        descriptor = catalogService.getServiceDescriptor();
    } else {
        descriptor = ServiceDescriptorUtils.getDescriptor(service);
    }
    Set<String> allAssetTypes = ServiceDescriptorUtils.getAllAssetTypes(descriptor);
    List<String> dependencies = calculateAssetDependencies(cleanAssetType(asset), allAssetTypes);
    List<Reference> references = Lists.newArrayList();
    for (String dependency : dependencies) {
        references.add(newAssetOptionsReference(dependency));
    }
    renderApi(references);
}
Also used : ServiceDescriptorRestRep(com.emc.vipr.model.catalog.ServiceDescriptorRestRep) Reference(com.emc.vipr.model.catalog.Reference) ApiMapperUtils.newAssetOptionsReference(util.api.ApiMapperUtils.newAssetOptionsReference) CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep)

Example 4 with Reference

use of com.emc.vipr.model.catalog.Reference in project coprhd-controller by CoprHD.

the class OrdersApi method allOrders.

@Restrict("TENANT_ADMIN")
public static void allOrders(String startTime, String endTime) {
    List<? extends RelatedResourceRep> elements = queryOrders(startTime, endTime);
    List<Reference> orders = Lists.newArrayList();
    for (RelatedResourceRep element : elements) {
        orders.add(newOrderReference(element.getId().toString()));
    }
    renderApi(orders);
}
Also used : NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) Reference(com.emc.vipr.model.catalog.Reference) ApiMapperUtils.newOrderReference(util.api.ApiMapperUtils.newOrderReference) Restrict(controllers.deadbolt.Restrict)

Example 5 with Reference

use of com.emc.vipr.model.catalog.Reference 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)

Aggregations

Reference (com.emc.vipr.model.catalog.Reference)5 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)3 ApiMapperUtils.newApprovalReference (util.api.ApiMapperUtils.newApprovalReference)2 ApiMapperUtils.newOrderReference (util.api.ApiMapperUtils.newOrderReference)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 ViPRCatalogClient2 (com.emc.vipr.client.ViPRCatalogClient2)1 ApprovalRestRep (com.emc.vipr.model.catalog.ApprovalRestRep)1 CatalogServiceRestRep (com.emc.vipr.model.catalog.CatalogServiceRestRep)1 ServiceDescriptorRestRep (com.emc.vipr.model.catalog.ServiceDescriptorRestRep)1 Restrict (controllers.deadbolt.Restrict)1 ApiMapperUtils.newAssetOptionsReference (util.api.ApiMapperUtils.newAssetOptionsReference)1