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
Get the keynode enterprise by name
Reference: https://wiki.abiquo.com/api/latest/EnterprisesResource.html#list-enterprises
The name search string should be escaped for HTML, so replace spaces in the customer name with
%20
. For example, to search for4xCustomer 01
use4xCustomer%2001
.Remember that you can use the
-k
option for an unsecured test environmentcURL 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
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 } ] }
Find the required enterprise in the collection. The enterprise should have the
keynode
attribute set totrue
.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" },
Get the enterprises under the keynode enterprise
Get the link with the
rel
value ofedit
for the keynode enterprise, and search for the enterprises under this keynodeReference: https://wiki.abiquo.com/api/latest/EnterprisesResource.html#list-enterprises-of-a-key-node
cURL
Sample response. Success status code:
200
For each enterprise, you will need the credentials link
and the "virtual datacenters" link
List the public cloud credentials
Perform a
GET
request to the credentials link to list the public cloud credentialscURL request
Sample response. Success status code:
200
Keep the edit links for the public cloud credentials and the selected provider types
Optionally, delete the public cloud credentials
Send a
DELETE
request to the edit links of the credentialscURL request
Success status code:
204
This step is optional because you can use the VDC logical delete parameter to delete VDCs in the platform only without removing credentials first
Get the virtual datacenters of the enterprise using the URL from the enterprise's virtual datacenters link
You can also use the
hypervisortype
parameter to search for the VMs from the provider, such asAMAZON
orazurecompute-arm
.Here we will filter the results of the request with the
hypervisorType
attribute of the virtual datacentercURL request
Sample response. Success status code:
200
Keep the edit link for each of these virtual datacenters.
Delete the virtual datacenters
Send a
DELETE
request to the edit link of each virtual datacenter and use thelogicaldelete
parameter set totrue
Reference: https://wiki.abiquo.com/api/latest/VirtualDatacentersResource.html#delete-a-virtual-datacenter
cURL
Deleting a VDC is an asynchronous task, so the request returns an asynchronous task media type and a status code of
200
. Sample response
Delete the enterprises
After you have deleted the virtual datacenters, you can delete the enterprises
Reference: https://wiki.abiquo.com/api/latest/EnterprisesResource.html#delete-an-enterprise
cURL request to delete an enterprise
Success status code:
204
Copyright © 2006-2024, Abiquo Holdings SL. All rights reserved