Search in sources :

Example 26 with AssetOption

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

the class FileProvider method getUnprotectedFileSystems.

@Asset("unprotectedFilesystem")
@AssetDependencies({ "project" })
public List<AssetOption> getUnprotectedFileSystems(AssetOptionsContext ctx, URI project) {
    debug("getting unprotected file system (project=%s)", project);
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<FileShareRestRep> fileSystems = client.fileSystems().findByProject(project);
    for (FileShareRestRep fileShare : fileSystems) {
        if (fileShare.getProtection() != null && fileShare.getProtection().getPersonality() == null) {
            options.add(new AssetOption(fileShare.getId(), fileShare.getName()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 27 with AssetOption

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

the class FileProvider method getFileShares.

@Asset("fileShares")
@AssetDependencies("fileFilesystem")
public List<AssetOption> getFileShares(AssetOptionsContext ctx, URI fileFilesystem) {
    List<AssetOption> options = Lists.newArrayList();
    for (SmbShareResponse share : listFileShares(ctx, fileFilesystem)) {
        String label = String.format("%s [%s]", share.getShareName(), share.getMountPoint());
        options.add(new AssetOption(share.getShareName(), label));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) SmbShareResponse(com.emc.storageos.model.file.SmbShareResponse) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 28 with AssetOption

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

the class FileProvider method getProtectedFileSystems.

@Asset("protectedRemoteFileSystem")
@AssetDependencies({ "project" })
public List<AssetOption> getProtectedFileSystems(AssetOptionsContext ctx, URI project) {
    debug("getting protected remote file system (project=%s)", project);
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<FileShareRestRep> fileSystems = client.fileSystems().findByProject(project);
    for (FileShareRestRep fileShare : fileSystems) {
        if (fileShare.getProtection() != null && StringUtils.equals(FileShare.PersonalityTypes.SOURCE.toString(), fileShare.getProtection().getPersonality())) {
            options.add(new AssetOption(fileShare.getId(), fileShare.getName()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 29 with AssetOption

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

the class FileProvider method getFileSourceVirtualPool.

@Asset("fileSourceVirtualPool")
@AssetDependencies({ "unprotectedFilesystem" })
public List<AssetOption> getFileSourceVirtualPool(AssetOptionsContext ctx, URI fileSystems) {
    List<AssetOption> options = Lists.newArrayList();
    ViPRCoreClient client = api(ctx);
    URI sourceVpoolId = client.fileSystems().get(fileSystems).getVirtualPool().getId();
    FileVirtualPoolRestRep sourceVpool = client.fileVpools().get(sourceVpoolId);
    options.add(new AssetOption(sourceVpool.getId(), sourceVpool.getName()));
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 30 with AssetOption

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

the class ObjectProvider method createBucketOptions.

protected static List<AssetOption> createBucketOptions(ViPRCoreClient client, URI project, URI hostId, Collection<? extends DataObjectRestRep> bucketObjects) {
    Map<URI, BucketRestRep> bucketNames = getProjectBucketNames(client, project);
    List<AssetOption> options = Lists.newArrayList();
    for (DataObjectRestRep bucketObject : bucketObjects) {
        options.add(createBucketOption(client, hostId, bucketObject, bucketNames));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) DataObjectRestRep(com.emc.storageos.model.DataObjectRestRep) BucketRestRep(com.emc.storageos.model.object.BucketRestRep) URI(java.net.URI)

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