How to create a tenant via API
Introduction
This page describes how to create a basic tenant (enterprise) and some users.
You will need the following resources.
- Datacenter or public cloud region
Your user role must include the following privileges.
- ENTERPRISE_ADMINISTER_ALL
- MANAGE_ENTERPRISES
- MANAGE_USERS
APPLIB_ALLOW_MODIFY
After you create a tenant, you can continue and add templates. See How to add a VM template in a datacenter via API
The following pages describe the enterprise UI and Apps library functionality.
And to add templates
Summary diagram
The steps in this diagram link to the API reference guide resources and data entities sections.
Detailed steps
- Create an enterprise object
- Reference: https://wiki.abiquo.com/api/latest/enterprise.html
If you use the following example, change the name and enterprise allocation limits as required
Sample enterpriseentity.json fileOptionally set the reseller or keyNode attributes for an enterprise hierarchy
- Create the enterprise
Reference: https://wiki.abiquo.com/api/latest/EnterprisesResource.html#create-an-enterprise
cURL
curl -X POST https://abiquoapi.com/api/admin/enterprises \ -H 'Accept:application/vnd.abiquo.enterprise+json; version=4.7' \ -H 'Content-Type:application/vnd.abiquo.enterprise+json; version=4.7' \ -d @enterpriseentity.json \ -u user:password --verbose
Sample response. Success status code: 200
This request returns the enterprise
Keep the enterprise's edit link, to use when you switch to the enterprise
{ "title": "enterprise_444", "rel": "edit", "type": "application/vnd.abiquo.enterprise+json", "href": "https://example.com:443/api/admin/enterprises/292" },
- Get a link to a datacenter or public cloud region for the enterprise to use
- Get the datacenter or public cloud region. References:
Obtain the href version of the datacenter or publiccloudregion link from the datacenters-light or publiccloudregion object. Use a "rel" value of location
datacenter link
{ "title": "Abiquo-DC", "rel": "datacenter", "type": "application/vnd.abiquo.datacenter+json", "href": "https://example.com:443/api/admin/datacenters/1" }
publiccloudregion link.
{ "title": "000AmazonDC-IReland", "rel": "edit", "type": "application/vnd.abiquo.publiccloudregion+json", "href": "https://example.com:443/api/admin/publiccloudregions/2" }
- Create a limit object to allow the enterprise to use the datacenter or public cloud region
- Create a limit object, which represents an allowed location and allocation limits.
- Limits have links to also allow access to resources such as datastoretiers and backup policies, and set default roles.
- Reference: https://wiki.abiquo.com/api/latest/limit.html
To allow unlimited resources in this location, set allocation limit values to 0
- After you allow an enterprise to access a region, you can also set a provider limit. See https://wiki.abiquo.com/api/latest/EnterpriseLimitsByProviderResource.html
Sample datacenterlimit object
{ "enabledHardwareProfiles" : false, "vmsSoft" : 0, "vmsHard" : 0, "vlansSoft" : 0, "vlansHard" : 0, "publicIpsSoft" : 0, "publicIpsHard" : 0, "links" : [ { "rel" : "location", "href" : "http://example.com/api/admin/datacenters/1" } ], "ramSoft" : 0, "ramHard" : 0, "cpuSoft" : 0, "cpuHard" : 0 }
- Create a limit object, which represents an allowed location and allocation limits.
Create an enterprise limit to allow an enterprise to use a datacenter or public cloud region
cURL
curl -X POST http://example.com/api/admin/enterprises/292/limits \ -H "Accept : application/vnd.abiquo.limit+json;version=4.7" \ -H "Content-Type : application/vnd.abiquo.limit+json;version=4.7" \ -u user:password \ -d @datacenterlimit.json \
Sample response.
- Switch to the new enterprise
- Reference: How to switch enterprises via API
- Create user objects to create users
- Reference: https://wiki.abiquo.com/api/latest/user.html
- Get user role and scope links to add to user objects
- For roles, you can use the "has" parameter to filter the results with a text string
Useful role and scope IDs for testing
Role or scope ID Global scope 1 Cloud admin 1 User 2 Enterprise admin 3
- For ABIQUO authentication, you will need to supply an initial passowrd
- References
- Example role and scope links
Role link
{ "title": "ENTERPRISE_ADMIN_for_training", "rel": "edit", "type": "application/vnd.abiquo.role+json", "href": "https://example.com:443/api/admin/roles/47" },
Scope link
{ "title": "Reseller Scope", "rel": "edit", "type": "application/vnd.abiquo.scope+json", "href": "https://example.com:443/api/admin/scopes/101" },
Example enterprise admin user
Example cloud user
- Create a user
- Reference: https://wiki.abiquo.com/api/latest/UsersResource.html#create-a-user-in-an-enterprise
cURL:
curl -X POST https://example.com/api/admin/enterprises/292/users \ -H "Accept : application/vnd.abiquo.user+json; version=4.7" \ -H "Content-Type : application/vnd.abiquo.user+json; version=4.7" \ -u user:password \ -d @userentity.json
Sample response. Success status code: 201
- Add templates to the enterprise's Apps library. See How to add a VM template in a datacenter via API
Copyright © 2006-2022, Abiquo Holdings SL. All rights reserved