Search in sources :

Example 1 with ScaleIOVolumeList

use of com.emc.storageos.scaleio.api.restapi.request.ScaleIOVolumeList in project coprhd-controller by CoprHD.

the class ScaleIORestClient method getVolumeNameMap.

/**
 * Get the volumes for the given volume Ids
 *
 * @param volumeIds The list of volume IDs
 * @return The map of the ScaleIO volume and volume ID
 * @throws Exception
 */
public Map<String, ScaleIOVolume> getVolumeNameMap(List<String> volumeIds) throws Exception {
    Map<String, ScaleIOVolume> result = new HashMap<String, ScaleIOVolume>();
    ScaleIOVolumeList parm = new ScaleIOVolumeList();
    parm.setIds(volumeIds);
    ClientResponse response = post(URI.create(ScaleIOConstants.GET_VOLUMES_BYIDS_URI), getJsonForEntity(parm));
    List<ScaleIOVolume> volumes = getResponseObjects(ScaleIOVolume.class, response);
    for (ScaleIOVolume volume : volumes) {
        result.put(volume.getName(), volume);
    }
    return result;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) HashMap(java.util.HashMap) ScaleIOVolumeList(com.emc.storageos.scaleio.api.restapi.request.ScaleIOVolumeList) ScaleIOVolume(com.emc.storageos.scaleio.api.restapi.response.ScaleIOVolume)

Example 2 with ScaleIOVolumeList

use of com.emc.storageos.scaleio.api.restapi.request.ScaleIOVolumeList in project coprhd-controller by CoprHD.

the class ScaleIORestClient method getVolumes.

/**
 * Get the volume names for the given volume Ids
 *
 * @param volumeIds The list of volume IDs
 * @return The map of the volume name and volume ID
 * @throws Exception
 */
public Map<String, String> getVolumes(List<String> volumeIds) throws Exception {
    Map<String, String> result = new HashMap<String, String>();
    ScaleIOVolumeList parm = new ScaleIOVolumeList();
    parm.setIds(volumeIds);
    ClientResponse response = post(URI.create(ScaleIOConstants.GET_VOLUMES_BYIDS_URI), getJsonForEntity(parm));
    List<ScaleIOVolume> volumes = getResponseObjects(ScaleIOVolume.class, response);
    for (ScaleIOVolume volume : volumes) {
        result.put(volume.getName(), volume.getId());
    }
    return result;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) HashMap(java.util.HashMap) ScaleIOVolumeList(com.emc.storageos.scaleio.api.restapi.request.ScaleIOVolumeList) ScaleIOVolume(com.emc.storageos.scaleio.api.restapi.response.ScaleIOVolume)

Aggregations

ScaleIOVolumeList (com.emc.storageos.scaleio.api.restapi.request.ScaleIOVolumeList)2 ScaleIOVolume (com.emc.storageos.scaleio.api.restapi.response.ScaleIOVolume)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)2 HashMap (java.util.HashMap)2