Search in sources :

Example 1 with StorageProviderList

use of com.emc.storageos.model.smis.StorageProviderList in project coprhd-controller by CoprHD.

the class StorageProviderService method getStorageProviderList.

/**
 * @brief List Storage providers
 *        This function allows user to fetch list of all Storage Providers information.
 *
 * @return List of Storage Providers.
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageProviderList getStorageProviderList() {
    List<URI> ids = _dbClient.queryByType(StorageProvider.class, true);
    List<StorageProvider> mgmtProviders = _dbClient.queryObject(StorageProvider.class, ids);
    if (mgmtProviders == null) {
        throw APIException.badRequests.unableToFindStorageProvidersForIds(ids);
    }
    StorageProviderList providerList = new StorageProviderList();
    for (StorageProvider provider : mgmtProviders) {
        providerList.getStorageProviders().add(toNamedRelatedResource(provider));
    }
    return providerList;
}
Also used : StorageProviderList(com.emc.storageos.model.smis.StorageProviderList) MapStorageProvider(com.emc.storageos.api.mapper.functions.MapStorageProvider) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

MapStorageProvider (com.emc.storageos.api.mapper.functions.MapStorageProvider)1 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)1 StorageProviderList (com.emc.storageos.model.smis.StorageProviderList)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 URI (java.net.URI)1 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1