use of com.emc.storageos.model.tenant.TenantOrgRestRep in project coprhd-controller by CoprHD.
the class AbstractRequestWrapperFilter method createTenantNProject.
private void createTenantNProject(KeystoneTenant tenant) {
_internalTenantServiceClient.setServer(_keystoneUtils.getVIP());
// Create Tenant via internal API call.
TenantOrgRestRep tenantResp = _internalTenantServiceClient.createTenant(_keystoneUtils.prepareTenantParam(tenant));
// Create Project via internal API call.
ProjectParam projectParam = new ProjectParam(tenant.getName() + CinderConstants.PROJECT_NAME_SUFFIX);
ProjectElement projectResp = _internalTenantServiceClient.createProject(tenantResp.getId(), projectParam);
_keystoneUtils.tagProjectWithOpenstackId(projectResp.getId(), tenant.getId(), tenantResp.getId().toString());
// Creates OSTenant representation of Openstack Tenant
OSTenant osTenant = _keystoneUtils.mapToOsTenant(tenant);
osTenant.setId(URIUtil.createId(OSTenant.class));
_dbClient.createObject(osTenant);
}
use of com.emc.storageos.model.tenant.TenantOrgRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getVolumeTagCommand.
/**
* Returns the viprcli command for adding a tag to a block volume
*
* @param blockObjectId the id of the block object
* @param tagName the tag name
* @param tagValue the tag value
* @return viprcli command
*/
public static String getVolumeTagCommand(URI blockObjectId, String tagName, String tagValue) {
BlockObjectRestRep blockObject = getBlockResource(blockObjectId);
URI projectId = getProjectId(blockObject);
ProjectRestRep project = getProject(projectId);
TenantOrgRestRep tenant = getTenant(project.getTenant().getId());
return ExecutionUtils.getMessage("viprcli.volume.tag", blockObject.getName(), tenant.getName(), project.getName(), tagName, tagValue);
}
use of com.emc.storageos.model.tenant.TenantOrgRestRep in project coprhd-controller by CoprHD.
the class InternalTenantServiceClient method createTenant.
public TenantOrgRestRep createTenant(TenantCreateParam param) {
WebResource rRoot = createRequest(INTERNAL_CREATE_TENANT);
TenantOrgRestRep resp = null;
try {
resp = addSignature(rRoot).post(TenantOrgRestRep.class, param);
} catch (Exception e) {
_log.error("Could not create tenant. Err:{}", e.getStackTrace());
}
return resp;
}
use of com.emc.storageos.model.tenant.TenantOrgRestRep in project coprhd-controller by CoprHD.
the class InternalTenantServiceClient method setTenantNamespace.
/**
* Set namespace mapping info for tenant or subtenant
*
* @param tenantId the URN of a ViPR Tenant/Subtenant
* @param namespace name of the target namespace the tenant will be mapped to
* @return the updated Tenant/Subtenant instance
*/
public TenantOrgRestRep setTenantNamespace(URI tenantId, String namespace) {
String setNamespacePath = String.format(INTERNAL_TENANT_SET_NAMESPACE, tenantId.toString(), namespace);
WebResource rRoot = createRequest(setNamespacePath);
TenantOrgRestRep resp = null;
try {
resp = addSignature(rRoot).put(TenantOrgRestRep.class);
} catch (UniformInterfaceException e) {
_log.warn("could not attach namespace to tenant {}. Err:{}", tenantId, e);
}
return resp;
}
use of com.emc.storageos.model.tenant.TenantOrgRestRep in project coprhd-controller by CoprHD.
the class TenantUtils method getAllTenants.
public static List<TenantOrgRestRep> getAllTenants() {
List<TenantOrgRestRep> tenants = Lists.newArrayList();
TenantOrgRestRep rootTenant = findRootTenant();
tenants.add(rootTenant);
tenants.addAll(getSubTenants(id(rootTenant)));
return tenants;
}
Aggregations