Search in sources :

Example 1 with PayloadFilter

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

the class StorageCenterAPI method getServerDefinitions.

/**
 * Gets all server definitions on the array.
 *
 * @param ssn The Storage Center system serial number.
 * @return The server definitions.
 */
public ScServer[] getServerDefinitions(String ssn) {
    PayloadFilter filter = new PayloadFilter();
    filter.append("scSerialNumber", ssn);
    RestResult rr = restClient.post("StorageCenter/ScServer/GetList", filter.toJson());
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScServer[].class);
    }
    return new ScServer[0];
}
Also used : ScServer(com.emc.storageos.driver.dellsc.scapi.objects.ScServer) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)

Example 2 with PayloadFilter

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

the class StorageCenterAPI method findMappingProfiles.

/**
 * Finds mapping between a server and volume.
 *
 * @param serverId The server instance ID.
 * @param volumeId The volume instance ID.
 * @return The mapping profiles.
 * @throws StorageCenterAPIException
 */
public ScMappingProfile[] findMappingProfiles(String serverId, String volumeId) throws StorageCenterAPIException {
    PayloadFilter filter = new PayloadFilter();
    filter.append("server", serverId);
    filter.append("volume", volumeId);
    RestResult rr = restClient.post("StorageCenter/ScMappingProfile/GetList", filter.toJson());
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScMappingProfile[].class);
    }
    String message = String.format("Error getting mapping profiles from server %s and volume %s: %s", serverId, volumeId, rr.getErrorMsg());
    throw new StorageCenterAPIException(message);
}
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 3 with PayloadFilter

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

the class StorageCenterAPI method getServerOperatingSystems.

/**
 * Gets the OS types.
 *
 * @param ssn The Storage Center system serial number.
 * @param product The product to filter on or null.
 * @return The OS types.
 */
public ScServerOperatingSystem[] getServerOperatingSystems(String ssn, String product) {
    PayloadFilter filter = new PayloadFilter();
    filter.append("scSerialNumber", ssn);
    if (product != null && !product.isEmpty()) {
        filter.append("product", product, ValueFilterType.INCLUDESSTRING);
    }
    RestResult rr = restClient.post("StorageCenter/ScServerOperatingSystem/GetList", filter.toJson());
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScServerOperatingSystem[].class);
    }
    return new ScServerOperatingSystem[0];
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter) ScServerOperatingSystem(com.emc.storageos.driver.dellsc.scapi.objects.ScServerOperatingSystem)

Example 4 with PayloadFilter

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

the class StorageCenterAPI method findReplayView.

/**
 * Finds a view volume for a given replay.
 *
 * @param instanceId The replay instance ID.
 * @return The volume or null if not found.
 */
public ScVolume findReplayView(String instanceId) {
    PayloadFilter filter = new PayloadFilter();
    filter.append("notes", instanceId);
    RestResult rr = restClient.post("StorageCenter/ScVolumeConfiguration/GetList", filter.toJson());
    if (checkResults(rr)) {
        ScVolumeConfiguration[] config = gson.fromJson(rr.getResult(), ScVolumeConfiguration[].class);
        rr = restClient.get(String.format("StorageCenter/ScVolume/%s", config[0].volume.instanceId));
        if (checkResults(rr)) {
            return gson.fromJson(rr.getResult(), ScVolume.class);
        } else {
            LOG.warn(rr.getErrorMsg());
        }
    } else {
        LOG.warn(rr.getErrorMsg());
    }
    return null;
}
Also used : ScVolumeConfiguration(com.emc.storageos.driver.dellsc.scapi.objects.ScVolumeConfiguration) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)

Example 5 with PayloadFilter

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

the class StorageCenterAPI method getServerHbas.

/**
 * Gets all defined HBAs for a server definition.
 *
 * @param ssn The Storage Center serial number.
 * @param serverInstanceId The server definition.
 * @return The HBAs.
 */
public ScServerHba[] getServerHbas(String ssn, String serverInstanceId) {
    PayloadFilter filter = new PayloadFilter();
    filter.append("scSerialNumber", ssn);
    filter.append("Server", serverInstanceId);
    RestResult rr = restClient.post("StorageCenter/ScServerHba/GetList", filter.toJson());
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScServerHba[].class);
    }
    return new ScServerHba[0];
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter) ScServerHba(com.emc.storageos.driver.dellsc.scapi.objects.ScServerHba)

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