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];
}
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);
}
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);
}
}
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];
}
Aggregations