Search in sources :

Example 16 with TenantOrgRestRep

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

the class TenantUtils method getUserSubTenantOptions.

public static List<StringOption> getUserSubTenantOptions() {
    List<StringOption> options = Lists.newArrayList();
    if (Security.hasAnyRole(Security.SECURITY_ADMIN, Security.RESTRICTED_SECURITY_ADMIN, Security.HOME_TENANT_ADMIN)) {
        TenantOrgRestRep userTenant = getViprClient().tenants().get(uri(Security.getUserInfo().getTenant()));
        options.add(createTenantOption(userTenant));
    }
    for (TenantOrgRestRep tenant : getViprClient().tenants().getByIds(Security.getUserInfo().getSubTenants())) {
        options.add(createTenantOption(tenant));
    }
    return options;
}
Also used : TenantOrgRestRep(com.emc.storageos.model.tenant.TenantOrgRestRep)

Example 17 with TenantOrgRestRep

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

the class TenantUtils method getSubTenantOptions.

public static List<StringOption> getSubTenantOptions() {
    List<StringOption> options = Lists.newArrayList();
    TenantOrgRestRep userTenant = getViprClient().tenants().get(uri(Security.getUserInfo().getTenant()));
    options.add(createTenantOption(userTenant));
    for (TenantOrgRestRep tenant : getViprClient().tenants().getAllSubtenants(uri(Security.getUserInfo().getTenant()))) {
        options.add(createTenantOption(tenant));
    }
    Collections.sort(options);
    return options;
}
Also used : TenantOrgRestRep(com.emc.storageos.model.tenant.TenantOrgRestRep)

Example 18 with TenantOrgRestRep

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

the class OpenStackSynchronizationTaskTest method testCreateTenant.

@Test
public void testCreateTenant() {
    URI tenantId = URIUtil.createId(TenantOrg.class);
    TenantOrgRestRep tenant = new TenantOrgRestRep();
    tenant.setId(tenantId);
    when(_keystoneUtils.prepareTenantParam(any())).thenReturn(new TenantCreateParam());
    when(_internalTenantsService.createTenant(any())).thenReturn(tenant);
    URI result = _synchronizationTask.createTenant(keystoneTenant);
    verify(_internalTenantsService).createTenant(any());
    assertNotNull(result);
    assertEquals(tenantId, result);
}
Also used : TenantOrgRestRep(com.emc.storageos.model.tenant.TenantOrgRestRep) URI(java.net.URI) TenantCreateParam(com.emc.storageos.model.tenant.TenantCreateParam) Test(org.junit.Test)

Example 19 with TenantOrgRestRep

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

the class GeoTest method createSubTenant.

private void createSubTenant() {
    TenantResponse tenantResp = rSys.path("/tenant").get(TenantResponse.class);
    rootTenantId = tenantResp.getTenant();
    /*
         * CREATE subtenant
         */
    String subtenant_url = "/tenants/" + rootTenantId.toString() + "/subtenants";
    TenantCreateParam tenantParam = new TenantCreateParam();
    String subtenant1_label = "subtenant1";
    tenantParam.setLabel(subtenant1_label);
    tenantParam.setDescription("first subtenant");
    tenantParam.setUserMappings(new ArrayList<UserMappingParam>());
    UserMappingParam tenantMapping = new UserMappingParam();
    tenantMapping = new UserMappingParam();
    tenantMapping.setDomain("sanity.LOCAL");
    // Add an attribute scope to the mapping
    UserMappingAttributeParam tenantAttr = new UserMappingAttributeParam();
    Date now = new Date();
    tenantAttr.setKey("departMent" + now);
    tenantAttr.setValues(Collections.singletonList(SUBTENANT1_ATTR));
    tenantMapping.setAttributes(Collections.singletonList(tenantAttr));
    tenantParam.getUserMappings().add(tenantMapping);
    // Add the mappings
    TenantOrgRestRep subtenant1 = rSys.path(subtenant_url).post(TenantOrgRestRep.class, tenantParam);
    Assert.assertTrue(subtenant1.getName().equals(subtenant1_label));
    Assert.assertEquals(1, subtenant1.getUserMappings().size());
    subtenant1Id = subtenant1.getId();
}
Also used : UserMappingAttributeParam(com.emc.storageos.model.tenant.UserMappingAttributeParam) UserMappingParam(com.emc.storageos.model.tenant.UserMappingParam) TenantOrgRestRep(com.emc.storageos.model.tenant.TenantOrgRestRep) TenantResponse(com.emc.storageos.model.tenant.TenantResponse) TenantCreateParam(com.emc.storageos.model.tenant.TenantCreateParam)

Example 20 with TenantOrgRestRep

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

the class SystemHealth method download.

/**
 * Download logs capability really creates the old support package.
 */
public static void download(String nodeId, String[] service, Integer severity, String searchMessage, String startTime, String endTime, String orderTypes) {
    SupportPackageCreator creator = new SupportPackageCreator(request, BourneUtil.getSysClient(), Models.currentTenant(), BourneUtil.getCatalogClient());
    if (StringUtils.isNotEmpty(nodeId)) {
        creator.setNodeIds(Lists.newArrayList(nodeId));
    }
    if (service != null && service.length > 0) {
        List<String> logNames = getLogNames(service);
        creator.setLogNames(logNames);
    }
    if (StringUtils.isNotEmpty(searchMessage)) {
        creator.setMsgRegex("(?i).*" + searchMessage + ".*");
    }
    if (StringUtils.isNotEmpty(startTime)) {
        creator.setStartTimeWithRestriction(startTime);
    }
    if (StringUtils.isNotEmpty(endTime)) {
        creator.setEndTime(endTime);
    }
    if (severity != null && severity > 0) {
        creator.setLogSeverity(severity);
    }
    if (DisasterRecoveryUtils.isActiveSite()) {
        if (StringUtils.equalsIgnoreCase(orderTypes, OrderTypes.ALL.name())) {
            creator.setOrderTypes(OrderTypes.ALL);
        } else if (StringUtils.equals(orderTypes, OrderTypes.ERROR.name())) {
            creator.setOrderTypes(OrderTypes.ERROR);
        }
    }
    if (Security.isSystemAdmin()) {
        List<URI> tenantIds = Lists.newArrayList();
        for (TenantOrgRestRep tenant : TenantUtils.getAllTenants()) {
            tenantIds.add(tenant.getId());
        }
        creator.setTenantIds(tenantIds);
    }
    renderSupportPackage(creator);
}
Also used : SupportPackageCreator(util.support.SupportPackageCreator) TenantOrgRestRep(com.emc.storageos.model.tenant.TenantOrgRestRep) URI(java.net.URI)

Aggregations

TenantOrgRestRep (com.emc.storageos.model.tenant.TenantOrgRestRep)22 TenantCreateParam (com.emc.storageos.model.tenant.TenantCreateParam)5 URI (java.net.URI)5 ProjectParam (com.emc.storageos.model.project.ProjectParam)4 UserMappingAttributeParam (com.emc.storageos.model.tenant.UserMappingAttributeParam)3 UserMappingParam (com.emc.storageos.model.tenant.UserMappingParam)3 ProjectElement (com.emc.storageos.model.project.ProjectElement)2 TenantResponse (com.emc.storageos.model.tenant.TenantResponse)2 UserInfo (com.emc.storageos.model.user.UserInfo)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)2 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)2 WebResource (com.sun.jersey.api.client.WebResource)2 ArrayList (java.util.ArrayList)2 JAXBContext (javax.xml.bind.JAXBContext)2 ACLEntry (com.emc.storageos.model.auth.ACLEntry)1 AuthnUpdateParam (com.emc.storageos.model.auth.AuthnUpdateParam)1 RoleAssignmentChanges (com.emc.storageos.model.auth.RoleAssignmentChanges)1 RoleAssignmentEntry (com.emc.storageos.model.auth.RoleAssignmentEntry)1 RoleAssignments (com.emc.storageos.model.auth.RoleAssignments)1 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)1