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 file{ "name" : "enterprise_444", "isReservationRestricted" : false, "workflow" : false, "twoFactorAuthenticationMandatory" : false, "reseller" : false, "keyNode" : false, "diskSoftLimitInMb" : 1024, "diskHardLimitInMb" : 4096, "vmsSoft" : 0, "vmsHard" : 0, "vlansSoft" : 0, "vlansHard" : 0, "publicIpsSoft" : 0, "publicIpsHard" : 0, "ramSoft" : 1, "ramHard" : 2, "cpuSoft" : 1, "cpuHard" : 2 }
Optionally 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{ "id": 292, "name": "enterprise_444", "isReservationRestricted": false, "workflow": false, "twoFactorAuthenticationMandatory": false, "reseller": false, "keyNode": false, "diskSoftLimitInMb": 1024, "diskHardLimitInMb": 4096, "storageSoftInMb": 0, "storageHardInMb": 0, "vmsSoft": 0, "vmsHard": 0, "vlansSoft": 0, "vlansHard": 0, "publicIpsSoft": 0, "publicIpsHard": 0, "repositorySoftInMb": 0, "repositoryHardInMb": 0, "links": [ { "title": "enterprise_444", "rel": "edit", "type": "application/vnd.abiquo.enterprise+json", "href": "https://example.com:443/api/admin/enterprises/292" }, { "title": "users", "rel": "users", "type": "application/vnd.abiquo.users+json", "href": "https://example.com:443/api/admin/enterprises/292/users" }, { "title": "properties", "rel": "properties", "type": "application/vnd.abiquo.enterpriseproperties+json", "href": "https://example.com:443/api/admin/enterprises/292/properties" }, { "title": "Global scope", "rel": "scope", "type": "application/vnd.abiquo.scope+json", "href": "https://example.com:443/api/admin/scopes/1" }, { "title": "template definitions lists", "rel": "appslib/templateDefinitionLists", "type": "application/vnd.abiquo.templatedefinitionlists+json", "href": "https://example.com:443/api/admin/enterprises/292/appslib/templateDefinitionLists" }, { "title": "template defintion paths", "rel": "appslib/templateDefinitions", "type": "application/vnd.abiquo.templatedefinitions+json", "href": "https://example.com:443/api/admin/enterprises/292/appslib/templateDefinitions" }, { "title": "repositories", "rel": "datacenterrepositories", "type": "application/vnd.abiquo.datacenterrepositories+json", "href": "https://example.com:443/api/admin/enterprises/292/datacenterrepositories" }, { "title": "virtual machines", "rel": "virtualmachines", "type": "application/vnd.abiquo.virtualmachines+json", "href": "https://example.com:443/api/admin/enterprises/292/action/virtualmachines" }, { "title": "virtual appliances", "rel": "virtualappliances", "type": "application/vnd.abiquo.virtualappliances+json", "href": "https://example.com:443/api/admin/enterprises/292/action/virtualappliances" }, { "title": "ips", "rel": "ips", "type": "application/vnd.abiquo.privateips+json", "href": "https://example.com:443/api/admin/enterprises/292/action/ips" }, { "title": "virtual datacenters", "rel": "cloud/virtualdatacenters", "type": "application/vnd.abiquo.virtualdatacenters+json", "href": "https://example.com:443/api/admin/enterprises/292/action/virtualdatacenters" }, { "title": "reserved machines", "rel": "reservedmachines", "type": "application/vnd.abiquo.machines+json", "href": "https://example.com:443/api/admin/enterprises/292/reservedmachines" }, { "title": "limits", "rel": "limits", "type": "application/vnd.abiquo.limits+json", "href": "https://example.com:443/api/admin/enterprises/292/limits" }, { "title": "providerlimits", "rel": "providerlimits", "type": "application/vnd.abiquo.providerlimits+json", "href": "https://example.com:443/api/admin/enterprises/292/providerlimits" }, { "title": "volumes", "rel": "volumes", "type": "application/vnd.abiquo.volumes+json", "href": "https://example.com:443/api/admin/enterprises/292/action/volumes" }, { "title": "external networks", "rel": "externalnetworks", "type": "application/vnd.abiquo.vlans+json", "href": "https://example.com:443/api/admin/enterprises/292/action/externalnetworks" }, { "title": "pending tasks", "rel": "pendingtasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://example.com:443/api/admin/enterprises/292/action/pendingtasks" }, { "title": "credentials", "rel": "credentials", "type": "application/vnd.abiquo.publiccloudcredentialslist+json", "href": "https://example.com:443/api/admin/enterprises/292/credentials" }, { "title": "pricingcredentials", "rel": "pricingcredentials", "type": "application/vnd.abiquo.pricingcredentialslist+json", "href": "https://example.com:443/api/admin/enterprises/292/pricingcredentials" }, { "title": "virtual appliances specs", "rel": "vappspecs", "type": "application/vnd.abiquo.virtualappliancespecs+json", "href": "https://example.com:443/api/admin/enterprises/292/vappspecs" }, { "title": "bills", "rel": "bills", "type": "application/vnd.abiquo.bills+json", "href": "https://example.com:443/api/statistics/enterpriseresources/292/bills" }, { "title": "billregisters", "rel": "billregisters", "type": "application/vnd.abiquo.bills+json", "href": "https://example.com:443/api/statistics/enterpriseresources/292/billregisters" }, { "title": "estimation", "rel": "estimation", "type": "text/plain", "href": "https://example.com:443/api/statistics/enterpriseresources/292/billregisters/action/estimate" }, { "title": "Bill providers", "rel": "billproviders", "type": "application/vnd.abiquo.billproviders+json", "href": "https://example.com:443/api/statistics/enterpriseresources/292/bills/action/providers" }, { "title": "Budgets", "rel": "budgets", "type": "application/vnd.abiquo.budgets+json", "href": "https://example.com:443/api/admin/enterprises/292/budgets" }, { "title": "Reseller enterprise", "rel": "reseller", "type": "application/vnd.abiquo.enterprise+json", "href": "https://example.com:443/api/admin/enterprises/267" } ], "ramSoft": 1, "ramHard": 2, "cpuSoft": 1, "cpuHard": 2 }
Keep the enterprise's edit link, to use when you switch to the enterprise
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
publiccloudregion link.
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.
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
Create an enterprise limit to allow an enterprise to use a datacenter or public cloud region
cURL
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
IDs of roles and scopes that are useful for testing:
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
Scope link
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:
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-2024, Abiquo Holdings SL. All rights reserved