Search in sources :

Example 11 with PayloadFilter

use of com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter in project coprhd-controller by CoprHD.

the class StorageCenterAPI method getServerVolumeMapping.

/**
 * Gets existing mapping profiles between a server and volume.
 *
 * @param volInstanceId The volume instance ID.
 * @param serverInstanceId The server instance ID.
 * @return The mapping profiles between the two.
 */
public ScMappingProfile[] getServerVolumeMapping(String volInstanceId, String serverInstanceId) {
    PayloadFilter filter = new PayloadFilter();
    filter.append("volume", volInstanceId);
    filter.append("server", serverInstanceId);
    RestResult rr = restClient.post("StorageCenter/ScMappingProfile/GetList", filter.toJson());
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScMappingProfile[].class);
    }
    return new ScMappingProfile[0];
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter) ScMappingProfile(com.emc.storageos.driver.dellsc.scapi.objects.ScMappingProfile)

Example 12 with PayloadFilter

use of com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter in project coprhd-controller by CoprHD.

the class StorageCenterAPI method getTargetPorts.

/**
 * Gets all controller target ports.
 *
 * @param ssn The Storage Center serial number.
 * @param type The type of port to get or Null for all types.
 * @return The controller ports.
 */
public ScControllerPort[] getTargetPorts(String ssn, String type) {
    PayloadFilter filter = new PayloadFilter();
    filter.append("scSerialNumber", ssn);
    if (type != null && type.length() > 0) {
        filter.append("transportType", type);
    }
    RestResult rr = restClient.post("StorageCenter/ScControllerPort/GetList", filter.toJson());
    if (checkResults(rr)) {
        List<ScControllerPort> ports = new ArrayList<>();
        ScControllerPort[] scPorts = gson.fromJson(rr.getResult(), ScControllerPort[].class);
        for (ScControllerPort port : scPorts) {
            if (port.purpose.startsWith("FrontEnd") && !"FrontEndReserved".equals(port.purpose)) {
                ports.add(port);
            }
        }
        return ports.toArray(new ScControllerPort[0]);
    }
    return new ScControllerPort[0];
}
Also used : ScControllerPort(com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter) ArrayList(java.util.ArrayList)

Aggregations

PayloadFilter (com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)12 RestResult (com.emc.storageos.driver.dellsc.scapi.rest.RestResult)12 ScMappingProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScMappingProfile)2 ScServerHba (com.emc.storageos.driver.dellsc.scapi.objects.ScServerHba)2 ScControllerPort (com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort)1 ScReplay (com.emc.storageos.driver.dellsc.scapi.objects.ScReplay)1 ScReplayProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)1 ScServer (com.emc.storageos.driver.dellsc.scapi.objects.ScServer)1 ScServerOperatingSystem (com.emc.storageos.driver.dellsc.scapi.objects.ScServerOperatingSystem)1 ScStorageType (com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType)1 ScVolume (com.emc.storageos.driver.dellsc.scapi.objects.ScVolume)1 ScVolumeConfiguration (com.emc.storageos.driver.dellsc.scapi.objects.ScVolumeConfiguration)1 ArrayList (java.util.ArrayList)1