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);
}
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();
}
}
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);
}
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;
}
Aggregations