Search in sources :

Example 91 with AssetOption

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

the class FileProvider method getFilePolicies.

@Asset("fileFilePolicy")
@AssetDependencies({ "project", "fileFilesystemAssociation" })
public List<AssetOption> getFilePolicies(AssetOptionsContext ctx, URI project, URI fsId) {
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    for (FilePolicyRestRep policyRestRep : getAllFileSystemLevelPolicies(ctx)) {
        options.add(new AssetOption(policyRestRep.getId(), policyRestRep.getName()));
    }
    if (options != null && !options.isEmpty()) {
        AssetOptionsUtils.sortOptionsByLabel(options);
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 92 with AssetOption

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

the class FileProvider method getFileFilesystemSourceArrayForAssociation.

@Asset("fileFilesystemSourceArray")
@AssetDependencies("fileFilesystemAssociation")
public List<AssetOption> getFileFilesystemSourceArrayForAssociation(AssetOptionsContext ctx, URI fsId) {
    ViPRCoreClient client = api(ctx);
    VirtualArrayRestRep vArray = null;
    List<AssetOption> options = Lists.newArrayList();
    FileShareRestRep fsObj = client.fileSystems().get(fsId);
    if (fsObj != null) {
        vArray = client.varrays().get(fsObj.getVirtualArray().getId());
        options.add(createBaseResourceOption(vArray));
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 93 with AssetOption

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

the class FileProvider method createFilesystemOptions.

/**
 * Create filesystem options from the list of filesystems, filtering using the given predicate
 *
 * @return The list of AssetOptions
 */
protected List<AssetOption> createFilesystemOptions(Collection<FileShareRestRep> filesystems, Predicate predicate) {
    CollectionUtils.filter(filesystems, predicate);
    List<AssetOption> options = Lists.newArrayList();
    for (FileShareRestRep fs : filesystems) {
        options.add(new AssetOption(fs.getId(), getLabel(fs)));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep)

Example 94 with AssetOption

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

the class FileProvider method getExportedSubdirectory.

@Asset("subDirectory")
@AssetDependencies("fileExportedFilesystem")
public List<AssetOption> getExportedSubdirectory(AssetOptionsContext ctx, URI fileExportedFilesystem) {
    List<AssetOption> options = Lists.newArrayList();
    List<ExportRule> exports = api(ctx).fileSystems().getExport(fileExportedFilesystem, true, null);
    for (ExportRule export : exports) {
        AssetOption tempOption;
        if (StringUtils.isEmpty(getSubDir(ctx, export))) {
            tempOption = new AssetOption("!No subdirectory", "No subdirectory");
        } else {
            tempOption = new AssetOption(getSubDir(ctx, export), getSubDir(ctx, export));
        }
        if (!options.contains(tempOption)) {
            options.add(tempOption);
        }
    }
    AssetOptionsUtils.sortOptionsByKey(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) ExportRule(com.emc.storageos.model.file.ExportRule) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 95 with AssetOption

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

the class FileProvider method getFileExports.

@Asset("fileExports")
@AssetDependencies("fileFilesystem")
public List<AssetOption> getFileExports(AssetOptionsContext ctx, URI fileFilesystem) {
    List<AssetOption> options = Lists.newArrayList();
    for (FileSystemExportParam export : listFileExports(ctx, fileFilesystem)) {
        options.add(new AssetOption(export.getMountPoint(), export.getMountPoint()));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) AssetOption(com.emc.vipr.model.catalog.AssetOption) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

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