How to remove keynode enterprises via API

This page describes the basic process to remove the VDCs under keynode enterprises via API.

 

For a reseller, you can have customers with their own hierarchies of enterprises. A keynode enterprise is the top of a customer hierarchy and it could represent the customer's headquarters, for example. The scope of the keynode enterprise can be the parent of the (optional) scopes of the subsidiary enterprises, which can also have subsidiary enterprises in their child scopes. 



You will need the following resources:

  • A keynode and its subsidiary enterprises created in the platform 

Your user role should have an administrator profile to manage virtual datacenters and resources, and it must include the following privileges

  • ENTERPRISE_ENUMERATE

  • ENTERPRISE_ADMINISTER_ALL

  • USERS_MANAGE_ENTERPRISE

Your user must have the keynode enterprise and its hierarchy branch within their management scope.

The following page describes the enterprise keynode and reseller hierarchies in the Abiquo UI:

 

Summary diagram

The steps in this diagram link to the API reference guide resources and data entities sections.

 

.

Detailed steps

  1. Get the keynode enterprise by name

    1. Reference: https://wiki.abiquo.com/api/latest/EnterprisesResource.html#list-enterprises 

    2. The name search string should be escaped for HTML, so replace spaces in the customer name with %20. For example, to search for 4xCustomer 01 use 4xCustomer%2001

    3. Remember that you can use the -k option for an unsecured test environment  

    4. cURL request

      curl -X GET \ 'https://abiquo.example.com/api/admin/enterprises?has=4xCustomer%2001' \ -H 'Accept: application/vnd.abiquo.enterprises+json;version=5.1' \ -u user:password --verbose



    5. Sample response. Success status code: 200

      { "totalSize": 1, "links": [ { "rel": "first", "href": "https://abiquo.example.com:443/api/admin/enterprises?limit=25&has=4xCustomer 01&by=name&asc=true" }, { "rel": "last", "href": "https://abiquo.example.com:443/api/admin/enterprises?startwith=0&limit=25&has=4xCustomer 01&by=name&asc=true" } ], "collection": [ { "id": 272, "name": "4xCustomer 01", "isReservationRestricted": false, "idPricingTemplate": 46, "workflow": false, "twoFactorAuthenticationMandatory": false, "reseller": false, "keyNode": true, "diskSoftLimitInMb": 0, "diskHardLimitInMb": 0, "storageSoftInMb": 0, "storageHardInMb": 0, "vmsSoft": 0, "vmsHard": 0, "vlansSoft": 0, "vlansHard": 0, "publicIpsSoft": 0, "publicIpsHard": 0, "repositorySoftInMb": 0, "repositoryHardInMb": 0, "links": [ { "title": "4xCustomer 01", "rel": "edit", "type": "application/vnd.abiquo.enterprise+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272" }, { "title": "users", "rel": "users", "type": "application/vnd.abiquo.users+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/users" }, { "title": "properties", "rel": "properties", "type": "application/vnd.abiquo.enterpriseproperties+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/properties" }, { "title": "4xCustomerScope", "rel": "scope", "type": "application/vnd.abiquo.scope+json", "href": "https://abiquo.example.com:443/api/admin/scopes/104" }, { "title": "template definitions lists", "rel": "appslib/templateDefinitionLists", "type": "application/vnd.abiquo.templatedefinitionlists+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/appslib/templateDefinitionLists" }, { "title": "template defintion paths", "rel": "appslib/templateDefinitions", "type": "application/vnd.abiquo.templatedefinitions+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/appslib/templateDefinitions" }, { "title": "repositories", "rel": "datacenterrepositories", "type": "application/vnd.abiquo.datacenterrepositories+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/datacenterrepositories" }, { "title": "virtual machines", "rel": "virtualmachines", "type": "application/vnd.abiquo.virtualmachines+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/action/virtualmachines" }, { "title": "virtual appliances", "rel": "virtualappliances", "type": "application/vnd.abiquo.virtualappliances+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/action/virtualappliances" }, { "title": "ips", "rel": "ips", "type": "application/vnd.abiquo.privateips+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/action/ips" }, { "title": "virtual datacenters", "rel": "cloud/virtualdatacenters", "type": "application/vnd.abiquo.virtualdatacenters+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/action/virtualdatacenters" }, { "title": "res4x customer pricing model", "rel": "pricingtemplate", "type": "application/vnd.abiquo.pricingtemplate+json", "href": "https://abiquo.example.com:443/api/config/pricingtemplates/46" }, { "title": "reserved machines", "rel": "reservedmachines", "type": "application/vnd.abiquo.machines+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/reservedmachines" }, { "title": "limits", "rel": "limits", "type": "application/vnd.abiquo.limits+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/limits" }, { "title": "providerlimits", "rel": "providerlimits", "type": "application/vnd.abiquo.providerlimits+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/providerlimits" }, { "title": "volumes", "rel": "volumes", "type": "application/vnd.abiquo.volumes+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/action/volumes" }, { "title": "external networks", "rel": "externalnetworks", "type": "application/vnd.abiquo.vlans+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/action/externalnetworks" }, { "title": "pending tasks", "rel": "pendingtasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/action/pendingtasks" }, { "title": "credentials", "rel": "credentials", "type": "application/vnd.abiquo.publiccloudcredentialslist+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/credentials" }, { "title": "pricingcredentials", "rel": "pricingcredentials", "type": "application/vnd.abiquo.pricingcredentialslist+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/pricingcredentials" }, { "title": "virtual appliances specs", "rel": "vappspecs", "type": "application/vnd.abiquo.virtualappliancespecs+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/vappspecs" }, { "title": "bills", "rel": "bills", "type": "application/vnd.abiquo.bills+json", "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/272/bills" }, { "title": "billregisters", "rel": "billregisters", "type": "application/vnd.abiquo.bills+json", "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/272/billregisters" }, { "title": "estimation", "rel": "estimation", "type": "text/plain", "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/272/billregisters/action/estimate" }, { "title": "Bill providers", "rel": "billproviders", "type": "application/vnd.abiquo.billproviders+json", "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/272/bills/action/providers" }, { "title": "Budgets", "rel": "budgets", "type": "application/vnd.abiquo.budgets+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272/budgets" }, { "title": "4xResellerEnterprise", "rel": "reseller", "type": "application/vnd.abiquo.enterprise+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/268" } ], "ramSoft": 0, "ramHard": 0, "cpuSoft": 0, "cpuHard": 0 } ] }



    6. Find the required enterprise in the collection. The enterprise should have the keynode attribute set to true.

    7. Keep the enterprise edit link

      { "title": "4xCustomer 01", "rel": "edit", "type": "application/vnd.abiquo.enterprise+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/272" },



  2. Get the enterprises under the keynode enterprise

    1. Get the link with the rel value of edit for the keynode enterprise, and search for the enterprises under this keynode

    2. Reference: https://wiki.abiquo.com/api/latest/EnterprisesResource.html#list-enterprises-of-a-key-node

    3. cURL



    4. Sample response. Success status code: 200



    5. For each enterprise, you will need the credentials link

      and the "virtual datacenters" link



  3. List the public cloud credentials

    1. Perform a GET request to the credentials link to list the public cloud credentials

    2. Reference: https://wiki.abiquo.com/api/latest/PublicCloudCredentialsListResource.html#list-public-cloud-credentials-of-an-enterprise

    3. cURL request



    4. Sample response. Success status code: 200



    5. Keep the edit links for the public cloud credentials and the selected provider types

  4. Optionally, delete the public cloud credentials

    1. Send a DELETE request to the edit links of the credentials

    2. Reference: https://wiki.abiquo.com/api/latest/PublicCloudCredentialsListResource.html#delete-a-set-of-public-cloud-credentials

    3. cURL request



    4. Success status code: 204

    5. This step is optional because you can use the VDC logical delete parameter to delete VDCs in the platform only without removing credentials first

  5. Get the virtual datacenters of the enterprise using the URL from the enterprise's virtual datacenters link

    1. Reference: https://wiki.abiquo.com/api/latest/EnterprisesResource.html#list-virtual-datacenters-of-an-enterprise

    2. You can also use the hypervisortype parameter to search for the VMs from the provider, such as AMAZON or azurecompute-arm

    3. Here we will filter the results of the request with the hypervisorType attribute of the virtual datacenter

    4. cURL request



    5. Sample response. Success status code: 200



    6. Keep the edit link for each of these virtual datacenters.



  6. Delete the virtual datacenters

    1. Send a DELETE request to the edit link of each virtual datacenter and use the logicaldelete parameter set to true

    2. Reference: https://wiki.abiquo.com/api/latest/VirtualDatacentersResource.html#delete-a-virtual-datacenter

    3. cURL



    4. Deleting a VDC is an asynchronous task, so the request returns an asynchronous task media type and a status code of 200. Sample response



  7. Delete the enterprises

    1. After you have deleted the virtual datacenters, you can delete the enterprises

    2. Reference: https://wiki.abiquo.com/api/latest/EnterprisesResource.html#delete-an-enterprise

    3. cURL request to delete an enterprise



    4. Success status code: 204

Copyright © 2006-2024, Abiquo Holdings SL. All rights reserved