Search in sources :

Example 1 with CatalogUpgrade

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

the class CatalogCategories method upgradeAvailable.

/**
 * Determines if an upgrade is available to the service catalog
 * <p>
 * API Call: <tt>GET /catalog/upgrade</tt>
 *
 * @param tenantId
 *            the ID of the tenant
 */
public boolean upgradeAvailable(URI tenantId) {
    UriBuilder uriBuilder = client.uriBuilder(PathConstants.CATALOG_UPGRADE_URI);
    if (tenantId != null) {
        uriBuilder = uriBuilder.queryParam(SearchConstants.TENANT_ID_PARAM, tenantId);
    }
    CatalogUpgrade response = client.getURI(CatalogUpgrade.class, uriBuilder.build());
    return response != null && response.getUpgradeAvailable();
}
Also used : CatalogUpgrade(com.emc.vipr.model.catalog.CatalogUpgrade) UriBuilder(javax.ws.rs.core.UriBuilder)

Example 2 with CatalogUpgrade

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

the class CatalogCategoryService method upgradeAvailable.

/**
 * Check to see if an update to the service catalog is available
 *
 * @prereq none
 * @brief Check for Service Catalog Update
 * @return True if Update Available
 */
@GET
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.TENANT_ADMIN })
@Path("/upgrade")
public CatalogUpgrade upgradeAvailable(@DefaultValue("") @QueryParam(SearchConstants.TENANT_ID_PARAM) String tenantId) {
    StorageOSUser user = getUserFromContext();
    if (StringUtils.isBlank(tenantId)) {
        tenantId = user.getTenantId();
    }
    verifyAuthorizedInTenantOrg(uri(tenantId), user);
    CatalogUpgrade catalogUpgrade = new CatalogUpgrade();
    catalogUpgrade.setUpgradeAvailable(catalogCategoryManager.isCatalogUpdateAvailable(uri(tenantId)));
    return catalogUpgrade;
}
Also used : StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) CatalogUpgrade(com.emc.vipr.model.catalog.CatalogUpgrade) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

CatalogUpgrade (com.emc.vipr.model.catalog.CatalogUpgrade)2 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 UriBuilder (javax.ws.rs.core.UriBuilder)1