Search in sources :

Example 21 with AssetOption

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

the class ClusterProvider method getEsxClusterOptions.

@Asset("esxCluster")
public List<AssetOption> getEsxClusterOptions(AssetOptionsContext ctx) {
    debug("getting esx clusters");
    Collection<ClusterRestRep> clusters = getClusters(ctx);
    List<AssetOption> options = Lists.newArrayList();
    for (ClusterRestRep value : clusters) {
        // If Cluster has an esx host - then add it to the list
        List<HostRestRep> hostList = api(ctx).hosts().getByCluster(value.getId());
        for (HostRestRep host : hostList) {
            if (host.getType().equalsIgnoreCase(Host.HostType.Esx.name())) {
                String dataCenterName = getDataCenterName(ctx, value);
                options.add(createClusterOption(ctx, value, dataCenterName));
                break;
            }
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) HostRestRep(com.emc.storageos.model.host.HostRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) Asset(com.emc.sa.asset.annotation.Asset)

Example 22 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption 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 23 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption 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 24 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption 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 25 with AssetOption

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

the class FileProvider method getNFSMountsForHost.

@Asset("mountedNFSExport")
@AssetDependencies("linuxFileHost")
public List<AssetOption> getNFSMountsForHost(AssetOptionsContext ctx, URI host) {
    List<AssetOption> options = Lists.newArrayList();
    List<MountInfo> hostMounts = api(ctx).fileSystems().getNfsMountsByHost(host);
    for (MountInfo mountInfo : hostMounts) {
        String mountString = mountInfo.getMountString();
        options.add(new AssetOption(mountString, getDisplayMount(ctx, mountInfo)));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) MountInfo(com.emc.storageos.model.file.MountInfo) 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