Search in sources :

Example 86 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies 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 87 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies 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 88 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies 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 89 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies 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)

Example 90 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.

the class FileProvider method getExportedFilesystems.

// For mount operation
@Asset("fileExportedFilesystem")
@AssetDependencies("project")
public List<AssetOption> getExportedFilesystems(AssetOptionsContext ctx, URI project) {
    List<FileShareRestRep> filesystems = api(ctx).fileSystems().findByProject(project);
    List<FileShareRestRep> exportedFS = new ArrayList<FileShareRestRep>();
    for (FileShareRestRep fs : filesystems) {
        if (!api(ctx).fileSystems().getExports(fs.getId()).isEmpty()) {
            exportedFS.add(fs);
        }
    }
    return createFilesystemOptions(exportedFS, null);
}
Also used : ArrayList(java.util.ArrayList) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

Asset (com.emc.sa.asset.annotation.Asset)102 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)102 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)66 AssetOption (com.emc.vipr.model.catalog.AssetOption)63 URI (java.net.URI)43 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)35 ArrayList (java.util.ArrayList)22 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)17 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)13 HashSet (java.util.HashSet)12 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)11 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)10 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)10 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)8 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)7 SimpleValueRep (com.emc.storageos.model.customconfig.SimpleValueRep)7 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)7 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6