Search in sources :

Example 21 with ProjectRestRep

use of com.emc.storageos.model.project.ProjectRestRep in project coprhd-controller by CoprHD.

the class ClusterAutoExportTest method createBlockVolumeForCluster.

public URI createBlockVolumeForCluster(String clusterName) {
    ClusterRestRep cluster = getCluster(clusterName);
    List<VirtualArrayRestRep> virtualArrays = client.varrays().findByConnectedCluster(cluster.getId());
    // User choice
    VirtualArrayRestRep selectedVirtualArray = chooseVirtualArray(virtualArrays);
    List<BlockVirtualPoolRestRep> virtualPools = client.blockVpools().getByVirtualArray(selectedVirtualArray.getId());
    // User choice
    BlockVirtualPoolRestRep selectedVirtualPool = chooseVirtualPool(virtualPools);
    List<ProjectRestRep> projects = client.projects().getByUserTenant();
    // User choice
    ProjectRestRep selectedProject = chooseProject(projects);
    URI volumeId = createVolume(selectedVirtualArray, selectedVirtualPool, selectedProject);
    return createExport(volumeId, cluster, selectedVirtualArray, selectedProject);
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) ProjectRestRep(com.emc.storageos.model.project.ProjectRestRep) URI(java.net.URI)

Example 22 with ProjectRestRep

use of com.emc.storageos.model.project.ProjectRestRep in project coprhd-controller by CoprHD.

the class TestBlockProviderFilter method main.

public static void main(String[] args) throws URISyntaxException {
    Logger.getRootLogger().setLevel(Level.OFF);
    ViPRCoreClient client = new ViPRCoreClient("host", true).withLogin("root", "password");
    try {
        for (ProjectRestRep project : client.projects().getByUserTenant()) {
            System.out.println("Project : " + project.getName());
            filter(client, project.getId());
            System.out.println();
        }
    } finally {
        client.auth().logout();
    }
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ProjectRestRep(com.emc.storageos.model.project.ProjectRestRep)

Example 23 with ProjectRestRep

use of com.emc.storageos.model.project.ProjectRestRep in project coprhd-controller by CoprHD.

the class StorageSystems method getProjectsForNas.

public static void getProjectsForNas() {
    List<URI> tenants = Lists.newArrayList();
    List<StringOption> allTenants = TenantUtils.getUserSubTenantOptions();
    Iterator<StringOption> tenantsIterator = allTenants.iterator();
    while (tenantsIterator.hasNext()) {
        StringOption tenant = tenantsIterator.next();
        if (tenant == null) {
            continue;
        }
        tenants.add(uri(tenant.id));
    }
    List<StringOption> projectTenantOptions = Lists.newArrayList();
    for (URI tenantId : tenants) {
        String tenantName = getViprClient().tenants().get(tenantId).getName();
        List<String> projectOptions = Lists.newArrayList();
        List<ProjectRestRep> projects = getViprClient().projects().getByTenant(tenantId);
        for (ProjectRestRep project : projects) {
            projectOptions.add(project.getId().toString() + "~~~" + project.getName());
        }
        projectTenantOptions.add(new StringOption(projectOptions.toString(), tenantName));
    }
    renderJSON(projectTenantOptions);
}
Also used : StringOption(util.StringOption) ProjectRestRep(com.emc.storageos.model.project.ProjectRestRep) URI(java.net.URI)

Example 24 with ProjectRestRep

use of com.emc.storageos.model.project.ProjectRestRep in project coprhd-controller by CoprHD.

the class DbObjectMapper method map.

public static ProjectRestRep map(Project from) {
    if (from == null) {
        return null;
    }
    ProjectRestRep to = new ProjectRestRep();
    mapDataObjectFields(from, to);
    if (from.getTenantOrg() != null) {
        to.setTenant(toRelatedResource(ResourceTypeEnum.TENANT, from.getTenantOrg().getURI()));
    }
    to.setOwner(from.getOwner());
    if (from.getAssignedVNasServers() != null && !from.getAssignedVNasServers().isEmpty()) {
        to.setAssignedVNasServers(from.getAssignedVNasServers());
    }
    if (from.getFilePolicies() != null && !from.getFilePolicies().isEmpty()) {
        to.setFileProtectionPolicies(from.getFilePolicies());
    }
    return to;
}
Also used : ProjectRestRep(com.emc.storageos.model.project.ProjectRestRep)

Aggregations

ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)24 URI (java.net.URI)13 ArrayList (java.util.ArrayList)7 ClientResponse (com.sun.jersey.api.client.ClientResponse)4 FlashException (controllers.util.FlashException)4 Test (org.junit.Test)4 Asset (com.emc.sa.asset.annotation.Asset)3 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)2 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)2 HostRestRep (com.emc.storageos.model.host.HostRestRep)2 ClusterRestRep (com.emc.storageos.model.host.cluster.ClusterRestRep)2 ProjectUpdateParam (com.emc.storageos.model.project.ProjectUpdateParam)2 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)2 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)2 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)2 AssetOption (com.emc.vipr.model.catalog.AssetOption)2 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)1