Search in sources :

Example 21 with RestResult

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

the class StorageCenterAPI method getMappingProfileMaps.

/**
 * Gets the individual maps created for a mapping profile.
 *
 * @param instanceId The mapping profile instance ID.
 * @return The mappings.
 * @throws StorageCenterAPIException
 */
public ScMapping[] getMappingProfileMaps(String instanceId) throws StorageCenterAPIException {
    RestResult rr = restClient.get(String.format("StorageCenter/ScMappingProfile/%s/MappingList", instanceId));
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScMapping[].class);
    }
    String message = String.format("Error getting volume maps: %s", rr.getErrorMsg());
    throw new StorageCenterAPIException(message);
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) ScMapping(com.emc.storageos.driver.dellsc.scapi.objects.ScMapping)

Example 22 with RestResult

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

the class StorageCenterAPI method getStorageTypes.

/**
 * Get all storage types from the system.
 *
 * @param ssn The Storage Center system serial number.
 * @return The storage types.
 */
public ScStorageType[] getStorageTypes(String ssn) {
    PayloadFilter filter = new PayloadFilter();
    if (ssn != null) {
        filter.append("scSerialNumber", ssn);
    }
    RestResult rr = restClient.post("StorageCenter/ScStorageType/GetList", filter.toJson());
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScStorageType[].class);
    }
    return new ScStorageType[0];
}
Also used : ScStorageType(com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)

Example 23 with RestResult

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

the class StorageCenterAPI method createClusterServer.

/**
 * Creates a new cluster server definition.
 *
 * @param ssn The Storage Center serial number.
 * @param clusterName The cluster name.
 * @param osId The OS instance ID.
 * @return The created server.
 * @throws StorageCenterAPIException
 */
public ScServer createClusterServer(String ssn, String clusterName, String osId) throws StorageCenterAPIException {
    Parameters params = new Parameters();
    params.add("Name", clusterName);
    params.add("StorageCenter", ssn);
    params.add("Notes", NOTES_STRING);
    params.add("OperatingSystem", osId);
    RestResult rr = restClient.post("StorageCenter/ScServerCluster", params.toJson());
    if (!checkResults(rr)) {
        String error = String.format("Error creating cluster server '%s': %s", clusterName, rr.getErrorMsg());
        throw new StorageCenterAPIException(error);
    }
    return gson.fromJson(rr.getResult(), ScServer.class);
}
Also used : Parameters(com.emc.storageos.driver.dellsc.scapi.rest.Parameters) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Example 24 with RestResult

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

the class StorageCenterAPI method getReplayProfileVolumes.

/**
 * Gets all volumes that are part of a replay profile.
 *
 * @param instanceId The replay profile instance ID.
 * @return The member volumes.
 * @throws StorageCenterAPIException
 */
public ScVolume[] getReplayProfileVolumes(String instanceId) throws StorageCenterAPIException {
    RestResult rr = restClient.get(String.format("StorageCenter/ScReplayProfile/%s/VolumeList", instanceId));
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScVolume[].class);
    }
    String message = "Unknown";
    if (rr.getErrorMsg().length() > 0) {
        message = rr.getErrorMsg();
    }
    message = String.format("Error getting replay profile member volumes: %s", message);
    throw new StorageCenterAPIException(message);
}
Also used : ScVolume(com.emc.storageos.driver.dellsc.scapi.objects.ScVolume) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Example 25 with RestResult

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

the class StorageCenterAPI method getScConfig.

/**
 * Gets SC configuration settings.
 *
 * @param ssn The system serial number.
 * @return The configuration settings.
 * @throws StorageCenterAPIException
 */
public ScConfiguration getScConfig(String ssn) throws StorageCenterAPIException {
    RestResult rr = restClient.get(String.format("StorageCenter/ScConfiguration/%s", ssn));
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScConfiguration.class);
    }
    String message = String.format("Error getting Storage Center configuration: %s", rr.getErrorMsg());
    throw new StorageCenterAPIException(message);
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

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