Search in sources :

Example 81 with AssetOption

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

the class ConsistencyGroupProvider method getConsistencyGroupFilters.

@Asset("consistencyGroupFilter")
public List<AssetOption> getConsistencyGroupFilters(AssetOptionsContext ctx) {
    List<ProjectRestRep> projects = api(ctx).projects().getByTenant(ctx.getTenant());
    List<BlockConsistencyGroupRestRep> cgs = Lists.newArrayList();
    for (ProjectRestRep project : projects) {
        cgs.addAll(api(ctx).blockConsistencyGroups().findByProject(project));
    }
    List<AssetOption> options = createBaseResourceOptions(cgs);
    options.add(0, new AssetOption("None", "None"));
    return options;
}
Also used : BlockConsistencyGroupRestRep(com.emc.storageos.model.block.BlockConsistencyGroupRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) ProjectRestRep(com.emc.storageos.model.project.ProjectRestRep) Asset(com.emc.sa.asset.annotation.Asset)

Example 82 with AssetOption

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

the class FileProvider method getNFSFileExports.

@Asset("fileExports")
@AssetDependencies("fileNFSFilesystem")
public List<AssetOption> getNFSFileExports(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 83 with AssetOption

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

the class FileProvider method getNFSFileShares.

@Asset("fileShares")
@AssetDependencies("fileNFSFilesystem")
public List<AssetOption> getNFSFileShares(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 84 with AssetOption

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

the class FileProvider method getFilesystemsWithPolicies.

@Asset("fileFilesystemWithPolicies")
@AssetDependencies("project")
public List<AssetOption> getFilesystemsWithPolicies(AssetOptionsContext ctx, URI project) {
    List<AssetOption> options = Lists.newArrayList();
    List<FilePolicyRestRep> fileSystemPolicies = getAllFileSystemLevelPolicies(ctx);
    List<FileShareRestRep> fileSystems = api(ctx).fileSystems().findByProject(project);
    for (FilePolicyRestRep policyRestRep : fileSystemPolicies) {
        if (policyRestRep.getAssignedResources() != null && !policyRestRep.getAssignedResources().isEmpty()) {
            for (FileShareRestRep fileSystem : fileSystems) {
                for (NamedRelatedResourceRep resource : policyRestRep.getAssignedResources()) {
                    if (resource.getId().equals(fileSystem.getId())) {
                        options.add(new AssetOption(fileSystem.getId(), fileSystem.getName()));
                        break;
                    }
                }
            }
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 85 with AssetOption

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

the class FileProvider method getFileContinuousCopies.

@Asset("fileContinuousCopies")
@AssetDependencies("fileWithContinuousCopies")
public List<AssetOption> getFileContinuousCopies(AssetOptionsContext ctx, URI fileId) {
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<NamedRelatedResourceRep> mirrors = client.fileSystems().getFileContinuousCopies(fileId);
    for (NamedRelatedResourceRep mirror : mirrors) {
        FileShareRestRep fileShare = client.fileSystems().get(mirror.getId());
        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) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) 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