Search in sources :

Example 31 with Asset

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

the class ComputeProvider method getComputeVirtualPoolForVirtualArray.

@Asset("computeVirtualPool")
@AssetDependencies({ "blockVirtualArray" })
public List<AssetOption> getComputeVirtualPoolForVirtualArray(AssetOptionsContext ctx, URI virtualArray) {
    debug("getting compute virtual pools");
    Collection<ComputeVirtualPoolRestRep> computeVirtualPools = api(ctx).computeVpools().getByVirtualArrayAndTenant(virtualArray, ctx.getTenant());
    List<AssetOption> options = Lists.newArrayList();
    for (ComputeVirtualPoolRestRep value : computeVirtualPools) {
        options.add(createComputeVirtualPoolOption(ctx, value));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ComputeVirtualPoolRestRep(com.emc.storageos.model.vpool.ComputeVirtualPoolRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 32 with Asset

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

the class FileProvider method getFileWithContinuousCopies.

@Asset("fileWithContinuousCopies")
@AssetDependencies("project")
public List<AssetOption> getFileWithContinuousCopies(AssetOptionsContext ctx, URI project) {
    final ViPRCoreClient client = api(ctx);
    List<FileShareRestRep> fileShares = client.fileSystems().findByProject(project, new SourceTargetFileSystemsFilter() {

        @Override
        public boolean acceptId(URI id) {
            return !client.fileSystems().getFileContinuousCopies(id).isEmpty();
        }
    });
    return createFilesystemOptions(fileShares);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) SourceTargetFileSystemsFilter(com.emc.vipr.client.core.filters.SourceTargetFileSystemsFilter) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 33 with Asset

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

the class FileProvider method getFileTargetVirtualPools.

@Asset("fileTargetVirtualPool")
@AssetDependencies({ "fileFilePolicy" })
public List<AssetOption> getFileTargetVirtualPools(AssetOptionsContext ctx, URI filePolicy) {
    List<AssetOption> options = Lists.newArrayList();
    ViPRCoreClient client = api(ctx);
    FilePolicyRestRep policyRest = client.fileProtectionPolicies().getFilePolicy(filePolicy);
    List<FileVirtualPoolRestRep> vpoolChanges = client.fileVpools().getByTenant(ctx.getTenant());
    for (FileVirtualPoolRestRep vpool : vpoolChanges) {
        if (vpool.getProtection() != null) {
            if ((policyRest.getType().equals("file_snapshot") && vpool.getProtection().getScheduleSnapshots()) || (policyRest.getType().equals("file_replication") && vpool.getProtection().getReplicationSupported())) {
                options.add(new AssetOption(vpool.getId(), vpool.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) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 34 with Asset

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

the class FileProvider method getFileSnapshotShares.

@Asset("fileSnapshotShares")
@AssetDependencies("fileSnapshot")
public List<AssetOption> getFileSnapshotShares(AssetOptionsContext ctx, URI fileSnapshot) {
    List<AssetOption> options = Lists.newArrayList();
    for (SmbShareResponse share : api(ctx).fileSnapshots().getShares(fileSnapshot)) {
        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 35 with Asset

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

the class FileProvider method getFilesystemsForAssociation.

@Asset("fileFilesystemAssociation")
@AssetDependencies("project")
public List<AssetOption> getFilesystemsForAssociation(AssetOptionsContext ctx, URI project) {
    ViPRCoreClient client = api(ctx);
    List<FileShareRestRep> fileSharesforAssociation = Lists.newArrayList();
    Map<URI, Boolean> uriToBool = Maps.newHashMap();
    List<FileShareRestRep> fileShares = client.fileSystems().findByProject(project);
    for (FileShareRestRep fileShare : fileShares) {
        URI vpoolId = fileShare.getVirtualPool().getId();
        if (!uriToBool.containsKey(vpoolId)) {
            FileVirtualPoolRestRep vpool = client.fileVpools().get(vpoolId);
            uriToBool.put(vpoolId, (vpool.getProtection() != null && vpool.getProtection().getAllowFilePolicyAtFSLevel() && (vpool.getProtection().getReplicationSupported() || vpool.getProtection().getScheduleSnapshots())));
        }
        if (uriToBool.get(vpoolId)) {
            fileSharesforAssociation.add(fileShare);
        }
    }
    return createFilesystemOptions(fileSharesforAssociation);
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

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