Search in sources :

Example 21 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class VolumesDataTable method fetch.

public static List<Volume> fetch(URI projectId) {
    if (projectId == null) {
        return Collections.EMPTY_LIST;
    }
    ViPRCoreClient client = getViprClient();
    List<VolumeRestRep> volumes = client.blockVolumes().findByProject(projectId);
    Map<URI, String> virtualArrays = ResourceUtils.mapNames(client.varrays().list());
    Map<URI, String> virtualPools = ResourceUtils.mapNames(client.blockVpools().list());
    List<Volume> results = Lists.newArrayList();
    for (VolumeRestRep volume : volumes) {
        results.add(new Volume(volume, virtualArrays, virtualPools));
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 22 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class BourneUtil method getViprClient.

public static ViPRCoreClient getViprClient() {
    String authToken = Security.getAuthToken();
    String key = String.format("ViPRCoreClient.%s", authToken);
    ViPRCoreClient client = getRequestArg(key);
    if (client == null) {
        Logger.debug("Creating new ViPRCoreClient");
        client = new ViPRCoreClient(getClientConfig()).withAuthToken(authToken);
        setRequestArg(key, client);
    } else {
        Logger.debug("Returning cached ViPRCoreClient");
    }
    return client;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient)

Example 23 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileUtils method getFSExportRules.

public static List<ExportRule> getFSExportRules(URI id) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<ExportRule> rules = Lists.newArrayList();
    if (URIUtil.isType(id, Snapshot.class)) {
        rules = client.fileSnapshots().getExport(id, true, "");
    } else if (URIUtil.isType(id, FileShare.class)) {
        rules = client.fileSystems().getExport(id, true, "");
    }
    return rules;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportRule(com.emc.storageos.model.file.ExportRule) FileShare(com.emc.storageos.db.client.model.FileShare)

Example 24 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class BlockVolumes method volumeMigrations.

public static void volumeMigrations(String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<NamedRelatedResourceRep> migrationsRep = client.blockVolumes().listMigrations(uri(volumeId));
    List<MigrationRestRep> migrations = client.blockMigrations().getByRefs(migrationsRep);
    render(migrations);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) MigrationRestRep(com.emc.storageos.model.block.MigrationRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 25 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class BlockVolumes method deleteContinuousCopy.

@FlashException(referrer = { "volume" })
public static void deleteContinuousCopy(String volumeId, String continuousCopyId) {
    if (StringUtils.isNotBlank(volumeId) && StringUtils.isNotBlank(continuousCopyId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        CopiesParam input = createCopiesParam(continuousCopyId);
        Tasks<VolumeRestRep> tasks = client.blockVolumes().deactivateContinuousCopies(uri(volumeId), input, VolumeDeleteTypeEnum.FULL);
        flash.put("info", MessagesUtils.get("resources.continuouscopy.deactivate"));
    }
    volume(volumeId, continuousCopyId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) CopiesParam(com.emc.storageos.model.block.CopiesParam) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) FlashException(controllers.util.FlashException)

Aggregations

ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)225 Asset (com.emc.sa.asset.annotation.Asset)72 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)66 URI (java.net.URI)66 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)49 FlashException (controllers.util.FlashException)48 AssetOption (com.emc.vipr.model.catalog.AssetOption)41 ArrayList (java.util.ArrayList)34 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)29 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)27 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)24 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)20 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)15 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)15 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)13 HashSet (java.util.HashSet)13 Task (com.emc.vipr.client.Task)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)10 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)8