Search in sources :

Example 11 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.

the class BlockProvider method constructSnapshotOptions.

protected List<AssetOption> constructSnapshotOptions(ViPRCoreClient client, URI project, List<BlockSnapshotRestRep> snapshots) {
    List<AssetOption> options = Lists.newArrayList();
    Map<URI, VolumeRestRep> volumeNames = getProjectVolumeNames(client, project);
    for (BlockSnapshotRestRep snapshot : snapshots) {
        options.add(new AssetOption(snapshot.getId(), getBlockObjectLabel(client, snapshot, volumeNames)));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 12 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.

the class BlockProvider method getExportPortGroups.

@Asset("exportChangePortGroup")
@AssetDependencies({ "host", "exportPathStorageSystem", "exportPathVirtualArray", "exportCurrentPortGroup" })
public List<AssetOption> getExportPortGroups(AssetOptionsContext ctx, URI hostOrClusterId, URI storageSystemId, URI varrayId, URI exportCurrentPortGroupId) {
    final ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    SimpleValueRep value = client.customConfigs().getCustomConfigTypeValue(VMAX_PORT_GROUP_ENABLED, VMAX);
    if (value.getValue().equalsIgnoreCase("true")) {
        StoragePortGroupRestRepList portGroupsRestRep = client.varrays().getStoragePortGroups(varrayId, null, storageSystemId, null, null, true);
        // Get a handle of the actual port group list
        List<StoragePortGroupRestRep> portGroups = portGroupsRestRep.getStoragePortGroups();
        // Filter out the current port group as we do not want the user to see this an a valid option
        ResourceFilter<StoragePortGroupRestRep> filterExistingPG = new DefaultResourceFilter<StoragePortGroupRestRep>() {

            @Override
            public boolean accept(StoragePortGroupRestRep pg) {
                return !pg.getId().equals(exportCurrentPortGroupId);
            }
        };
        ResourceUtils.applyFilter(portGroups, filterExistingPG);
        return createPortGroupOptions(portGroups);
    }
    return options;
}
Also used : SimpleValueRep(com.emc.storageos.model.customconfig.SimpleValueRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) StoragePortGroupRestRepList(com.emc.storageos.model.portgroup.StoragePortGroupRestRepList) StoragePortGroupRestRep(com.emc.storageos.model.portgroup.StoragePortGroupRestRep) DefaultResourceFilter(com.emc.vipr.client.core.filters.DefaultResourceFilter) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 13 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.

the class BlockProvider method createVirtualPoolResourceOptions.

public static List<AssetOption> createVirtualPoolResourceOptions(Collection<? extends VirtualPoolCommonRestRep> virtualPools) {
    List<AssetOption> options = Lists.newArrayList();
    for (VirtualPoolCommonRestRep virtualPool : virtualPools) {
        options.add(createVirtualPoolResourceOption(virtualPool));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) VirtualPoolCommonRestRep(com.emc.storageos.model.vpool.VirtualPoolCommonRestRep)

Example 14 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.

the class BlockProvider method constructSnapshotSessionOptions.

protected List<AssetOption> constructSnapshotSessionOptions(ViPRCoreClient client, URI project, List<BlockSnapshotSessionRestRep> snapshotSessions) {
    List<AssetOption> options = Lists.newArrayList();
    Map<URI, VolumeRestRep> volumeNames = getProjectVolumeNames(client, project);
    for (BlockSnapshotSessionRestRep snapshotSession : snapshotSessions) {
        options.add(new AssetOption(snapshotSession.getId(), getBlockObjectLabel(client, snapshotSession, volumeNames)));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 15 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.

the class BlockProvider method constructSnapshotOptions.

protected List<AssetOption> constructSnapshotOptions(List<BlockSnapshotRestRep> snapshots) {
    List<AssetOption> options = Lists.newArrayList();
    for (BlockSnapshotRestRep snapshot : snapshots) {
        options.add(new AssetOption(snapshot.getId(), getMessage("block.snapshot.labelNoVolume", snapshot.getName(), snapshot.getWwn())));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep)

Aggregations

AssetOption (com.emc.vipr.model.catalog.AssetOption)107 Asset (com.emc.sa.asset.annotation.Asset)74 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)63 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)41 URI (java.net.URI)36 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)20 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)14 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)14 ArrayList (java.util.ArrayList)12 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)11 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)10 Map (java.util.Map)9 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)8 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)8 HashMap (java.util.HashMap)8 SimpleValueRep (com.emc.storageos.model.customconfig.SimpleValueRep)7 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)6 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6 ClusterRestRep (com.emc.storageos.model.host.cluster.ClusterRestRep)6 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)5