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

  1. Create an enterprise object

    1. Reference: https://wiki.abiquo.com/api/latest/enterprise.html

    2. 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 }

       

    3. Optionally set the reseller or keyNode attributes for an enterprise hierarchy

  2. 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 }

       

  3. Keep the enterprise's edit link, to use when you switch to the enterprise

     

  4. Get a link to a datacenter or public cloud region for the enterprise to use

    1. Get the datacenter or public cloud region. References:

      1. https://wiki.abiquo.com/api/latest/DatacentersResource.html#list-datacenter-names-and-ids

      2. https://wiki.abiquo.com/api/latest/PublicCloudRegionsResource.html#list-public-cloud-regions

    2. Obtain the href version of the datacenter or publiccloudregion link from the datacenters-light or publiccloudregion object. Use a "rel" value of location

      1. datacenter link

         

      2. publiccloudregion link. 

         

  5. Create a limit object to allow the enterprise to use the datacenter or public cloud region

    1. Create a limit object, which represents an allowed location and allocation limits.

      1. Limits have links to also allow access to resources such as datastoretiers and backup policies, and set default roles.

    2. Reference: https://wiki.abiquo.com/api/latest/limit.html

    3. To allow unlimited resources in this location, set allocation limit values to 0

    4. 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

    5. Sample datacenterlimit object

       

  6. Create an enterprise limit to allow an enterprise to use a datacenter or public cloud region

    1. Reference: https://wiki.abiquo.com/api/latest/EnterpriseLimitsByDatacentersResource.html#create-a-datacenter-limit

    2. cURL

       

    3. Sample response. 

       

  7. Switch to the new enterprise

    1. Reference: How to switch enterprises via API

  8. Create user objects to create users

    1. Reference: https://wiki.abiquo.com/api/latest/user.html

    2. Get user role and scope links to add to user objects

    3. For roles, you can use the "has" parameter to filter the results with a text string

      1. IDs of roles and scopes that are useful for testing:

        • Global scope: 1

        • Cloud admin: 1

        • User: 2

        • Enterprise admin: 3

    4. For ABIQUO authentication, you will need to supply an initial passowrd

    5. References

      1. https://wiki.abiquo.com/api/latest/RolesResource.html#list-roles

      2. https://wiki.abiquo.com/api/latest/ScopesResource.html#list-scopes

    6. Example role and scope links

      1. Role link

         

      2. Scope link

         

    7. Example enterprise admin user

       

    8. Example cloud user

       

  9. Create a user

    1. Reference: https://wiki.abiquo.com/api/latest/UsersResource.html#create-a-user-in-an-enterprise

    2. cURL:

       

    3. Sample response. Success status code: 201

       

  10. 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