Search in sources :

Example 41 with RestResult

use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult 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 42 with RestResult

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

the class StorageCenterAPI method getControllerPort.

/**
 * Gets a controller port.
 *
 * @param instanceId The controller port ID.
 * @return The controller port.
 * @throws StorageCenterAPIException
 */
public ScControllerPort getControllerPort(String instanceId) throws StorageCenterAPIException {
    RestResult rr = restClient.get(String.format("/StorageCenter/ScControllerPort/%s", instanceId));
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScControllerPort.class);
    }
    String error = String.format("Error getting controller port %s: %s", instanceId, rr.getErrorMsg());
    throw new StorageCenterAPIException(error);
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Example 43 with RestResult

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

the class StorageCenterAPI method expireReplay.

/**
 * Expire a replay.
 *
 * @param instanceId The replay instance ID.
 * @throws StorageCenterAPIException
 */
public void expireReplay(String instanceId) throws StorageCenterAPIException {
    Parameters params = new Parameters();
    RestResult rr = restClient.post(String.format("StorageCenter/ScReplay/%s/Expire", instanceId), params.toJson());
    if (!checkResults(rr)) {
        String msg = String.format("Error expiring replay %s: %s", instanceId, rr.getErrorMsg());
        LOG.warn(msg);
        throw new StorageCenterAPIException(msg);
    }
}
Also used : Parameters(com.emc.storageos.driver.dellsc.scapi.rest.Parameters) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Example 44 with RestResult

use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult 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

RestResult (com.emc.storageos.driver.dellsc.scapi.rest.RestResult)44 Parameters (com.emc.storageos.driver.dellsc.scapi.rest.Parameters)16 PayloadFilter (com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)12 ScVolume (com.emc.storageos.driver.dellsc.scapi.objects.ScVolume)4 ScServerHba (com.emc.storageos.driver.dellsc.scapi.objects.ScServerHba)3 ScVolumeConfiguration (com.emc.storageos.driver.dellsc.scapi.objects.ScVolumeConfiguration)3 ArrayList (java.util.ArrayList)3 ScControllerPort (com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort)2 ScMapping (com.emc.storageos.driver.dellsc.scapi.objects.ScMapping)2 ScMappingProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScMappingProfile)2 ScObject (com.emc.storageos.driver.dellsc.scapi.objects.ScObject)2 ScReplay (com.emc.storageos.driver.dellsc.scapi.objects.ScReplay)2 ScServer (com.emc.storageos.driver.dellsc.scapi.objects.ScServer)2 ScStorageType (com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType)2 ScFaultDomain (com.emc.storageos.driver.dellsc.scapi.objects.ScFaultDomain)1 ScReplayConsistencyGroup (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayConsistencyGroup)1 ScReplayProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)1 ScServerOperatingSystem (com.emc.storageos.driver.dellsc.scapi.objects.ScServerOperatingSystem)1