Div | ||
---|---|---|
| ||
API Deploy in Public Cloud Tutorial |
...
class | tocc |
---|
Table of Contents |
---|
This simple walkthrough shows how to deploy in a scenario in AWS where a virtual datacenter and a template exist for the public cloud region. The user role in this example is a plain user. The privileges needed are displayed for every query.
Privileges
...
required
VDC_ENUMERATE
VAPP_CUSTOMISE_SETTINGS
ENTERPRISE_ENUMERATE
VDC_MANAGE_VAPP
VAPP_DEPLOY_UNDEPLOY
AUTHENTICATED
Preparation
First we retrieve the virtual datacenter that will be used. From this we will need the links with rel enterprise and virtualappliances. We will create a new virtual appliance in the virtual datacenter. And we also need the hypervisorType of the virtual datacenter.
Then we will retrieve the enterprise, in order to access the repository and the and the virtual machine templates templates for the hypervisor of the virtual datacenter. To create the new virtual machine, we will take the virtual appliance and add the templates for the new virtual machinesmachines.
Get all
...
virtual datacenters
...
Tip |
---|
...
class | widecode tinycode |
---|
API Roles required
...
API Documentation For the Abiquo API documentation of this feature, see Abiquo API Resources and the page for this resource VirtualDatacenterResource. |
API roles required
GET all virtual datacenters
Code Block |
---|
* This action requires the privileges AUTHENTICATED, VDC_ENUMERATE
|
cURL:
Code Block |
---|
curl -X GET https://example.com/api/cloud/virtualdatacenters \
-H 'Accept:application/vnd.abiquo.virtualdatacenters+json;version=4.2' \
-u user:password --verbose |
Success status code: 200
Request payload:
--none--
Response payload:
The response to this query is a collection of virtual datacenters but in this case, there is only one virtual datacenter.
...
Code Block |
---|
{
"links": [
{
"rel": "first",
"href": "https://example.com:443/api/cloud/virtualdatacenters?limit=25&by=name&asc=true"
},
{
"rel": "last",
"href": "https://example.com:443/api/cloud/virtualdatacenters?startwith=0&limit=25&by=name&asc=true"
}
],
"collection": [
{
"id": 490,
"hypervisorType": "AMAZON",
"name": "vdc_m01j",
"network": {
"id": 572,
"name": "default_private_network",
"address": "192.168.0.0",
"mask": 24,
"gateway": "192.168.0.1",
"primaryDNS": "10.60.1.4",
"secondaryDNS": "8.8.8.8",
"sufixDNS": "",
"defaultNetwork": false,
"type": "INTERNAL",
"dhcpOptions": {
"links": [],
"collection": []
},
"ipv6": false,
"strict": false,
"providerId": "subnet-6a292931",
"restricted": false,
"internetGatewayRole": false,
"ipRanges": [
{
"firstIp": "192.168.0.5",
"lastIp": "192.168.0.253"
}
],
"excludedFromFirewall": false,
"links": [
{
"title": "vdc_m01j",
"rel": "virtualdatacenter",
"type": "application/vnd.abiquo.virtualdatacenter+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490"
},
{
"title": "default_private_network",
"rel": "edit",
"type": "application/vnd.abiquo.vlan+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572"
},
{
"title": "ips",
"rel": "ips",
"type": "application/vnd.abiquo.privateips+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572/ips"
},
{
"title": "eu-west-1c",
"rel": "availabilityzone",
"type": "application/vnd.abiquo.availabilityzone+json",
"href": "https://example.com:443/api/cloud/locations/2/availabilityzones/eu-west-1c"
},
{
"title": "load balancers",
"rel": "loadbalancers",
"type": "application/vnd.abiquo.loadbalancers+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572/loadbalancers"
},
{
"title": "configuration",
"rel": "configuration",
"type": "application/vnd.abiquo.networkconfiguration+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572/configuration"
},
{
"title": "192.168.0.0/24",
"rel": "network_configuration",
"type": "application/vnd.abiquo.networkconfiguration+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572/configuration/572"
}
]
},
"providerId": "vpc-04df7462",
"syncState": "NONE",
"links": [
{
"title": "vdc_m01j",
"rel": "edit",
"type": "application/vnd.abiquo.virtualdatacenter+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490"
},
{
"title": "private networks",
"rel": "privatenetworks",
"type": "application/vnd.abiquo.vlans+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks"
},
{
"title": "public networks",
"rel": "network",
"type": "application/vnd.abiquo.vlans+json",
"href": "https://example.com:443/api/admin/datacenters/2/network"
},
{
"title": "default_private_network",
"rel": "defaultvlan",
"type": "application/vnd.abiquo.vlan+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572"
},
{
"title": "AWS_enterprise_forBilling",
"rel": "enterprise",
"type": "application/vnd.abiquo.enterprise+json",
"href": "https://example.com:443/api/admin/enterprises/65"
},
{
"title": "virtual appliances",
"rel": "virtualappliances",
"type": "application/vnd.abiquo.virtualappliances+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances"
},
{
"title": "private ips",
"rel": "privateips",
"type": "application/vnd.abiquo.privateips+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/privateips"
},
{
"title": "external ips",
"rel": "externalips",
"type": "application/vnd.abiquo.externalips+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/externalips"
},
{
"title": "unmanaged ips",
"rel": "unmanagedips",
"type": "application/vnd.abiquo.unmanagedips+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/unmanagedips"
},
{
"title": "default vlan",
"rel": "defaultvlan",
"type": "application/vnd.abiquo.vlan+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/defaultvlan"
},
{
"title": "volumes",
"rel": "volumes",
"type": "application/vnd.abiquo.volumes+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/volumes"
},
{
"title": "disks",
"rel": "disks",
"type": "application/vnd.abiquo.harddisks+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/disks"
},
{
"title": "ips to purchase",
"rel": "topurchase",
"type": "application/vnd.abiquo.publicips+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/publicips/topurchase"
},
{
"title": "ips purchased",
"rel": "purchased",
"type": "application/vnd.abiquo.publicips+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/publicips/purchased"
},
{
"title": "stateful volumes",
"rel": "statefulcandidates",
"type": "application/vnd.abiquo.volumes+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/volumes/action/statefulcandidates"
},
{
"title": "tiers",
"rel": "tiers",
"type": "application/vnd.abiquo.tiers+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/tiers"
},
{
"title": "available templates",
"rel": "templates",
"type": "application/vnd.abiquo.virtualmachinetemplates+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/templates"
},
{
"title": "all virtual machines",
"rel": "virtualmachines",
"type": "application/vnd.abiquo.virtualmachines+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/virtualmachines"
},
{
"title": "eu-west-1",
"rel": "region",
"type": "application/vnd.abiquo.region+json",
"href": "https://example.com:443/api/config/hypervisortypes/AMAZON/regions/eu-west-1"
},
{
"title": "amazon-device",
"rel": "device",
"type": "application/vnd.abiquo.device+json",
"href": "https://example.com:443/api/cloud/locations/2/devices/1"
},
{
"title": "firewalls",
"rel": "firewalls",
"type": "application/vnd.abiquo.firewallpolicies+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/firewalls"
},
{
"title": "load balancers",
"rel": "loadbalancers",
"type": "application/vnd.abiquo.loadbalancers+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/loadbalancers"
},
{
"title": "000AmazonDC-IReland",
"rel": "location",
"type": "application/vnd.abiquo.publiccloudregion+json",
"href": "https://example.com:443/api/cloud/locations/2"
},
{
"title": "tasks",
"rel": "tasks",
"type": "application/vnd.abiquo.tasks+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/tasks"
},
{
"title": "location limit",
"rel": "limit",
"type": "application/vnd.abiquo.limit+json",
"href": "https://example.com:443/api/admin/enterprises/65/limits/199"
},
{
"title": "externalnetworks",
"rel": "externalnetworks",
"type": "application/vnd.abiquo.vlans+json",
"href": "https://example.com:443/api/admin/enterprises/65/limits/199/externalnetworks"
},
{
"title": "virtual appliances specs",
"rel": "vappspecs",
"type": "application/vnd.abiquo.virtualappliancespecs+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/vappspecs"
}
],
"diskSoftLimitInMb": 0,
"diskHardLimitInMb": 0,
"storageSoftInMb": 0,
"storageHardInMb": 0,
"vlansSoft": 0,
"vlansHard": 0,
"publicIpsSoft": 0,
"publicIpsHard": 0,
"ramSoft": 0,
"ramHard": 0,
"cpuSoft": 0,
"cpuHard": 0
}
],
"totalSize": 1
} |
A virtual datacenter contains virtual appliances. It is the root resource of all the virtual appliances that belong to that virtual datacenter. The Abiquo UI automatically creates a VApp when you create or synchronize a VDC, but if you use the API to create the VDC, you will need to create your own VApp from the virtualappliances link. The only data you need to supply is the name, and of course you can supply an optional icon.
Optionally create a
...
virtual appliance
...
Tip |
---|
...
class | widecode tinycode |
---|
API Roles required:
...
API Documentation For the Abiquo API documentation of this feature, see Abiquo API Resources and the page for this resource VirtualApplianceResource. |
API roles required:
CREATE a virtual appliance
Code Block |
---|
* This action requires the privilege VDC_MANAGE_VAPP
|
cURL:
Code Block |
---|
curl -X POST https://example.com/api/cloud/virtualdatacenters/490/virtualappliances \
-H 'Accept:application/vnd.abiquo.virtualappliance+json; version=4.2' \
-H 'Content-Type:application/vnd.abiquo.virtualappliance+json; version=4.2' \
-d @requestpayload.xml \
-u user:password --verbose |
Success status code: 201
Request payload:
Code Block |
---|
{
"name":"vapp_vdc_m01j_001",
"iconUrl":"https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png"
} |
Response payload:
...
Code Block |
---|
{
"id":836,
"error":0,
"highDisponibility":0,
"name":"vapp_vdc_m01j_001",
"publicApp":0,
"state":"NOT_DEPLOYED",
"iconUrl":"https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png",
"notAllocatedVirtualMachines":0,
"onVirtualMachines":0,
"offVirtualMachines":0,
"pausedVirtualMachines":0,
"allocatedVirtualMachines":0,
"configuredVirtualMachines":0,
"unknownVirtualMachines":0,
"lockedVirtualMachines":0,
"links":[
{
"title":"vapp_vdc_m01j_001",
"rel":"edit",
"type":"application/vnd.abiquo.virtualappliance+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836"
},
{
"title":"vdc_m01j",
"rel":"virtualdatacenter",
"type":"application/vnd.abiquo.virtualdatacenter+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490"
},
{
"title":"AWS_enterprise_forBilling",
"rel":"enterprise",
"type":"application/vnd.abiquo.enterprise+json",
"href":"https://example.com:443/api/admin/enterprises/65"
},
{
"title":"virtual machines",
"rel":"virtualmachines",
"type":"application/vnd.abiquo.virtualmachines+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines"
},
{
"title":"virtual appliances state",
"rel":"state",
"type":"application/vnd.abiquo.virtualappliancestate+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/state"
},
{
"title":"undeploy",
"rel":"undeploy",
"type":"application/vnd.abiquo.acceptedrequest+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/action/undeploy"
},
{
"title":"deploy",
"rel":"deploy",
"type":"application/vnd.abiquo.acceptedrequest+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/action/deploy"
},
{
"title":"price",
"rel":"price",
"type":"text/plain",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/action/price"
},
{
"title":"layers",
"rel":"layers",
"type":"application/vnd.abiquo.layers+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/layers"
},
{
"title":"alerts",
"rel":"alerts",
"type":"application/vnd.abiquo.alerts+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/alerts"
},
{
"title":"spec",
"rel":"spec",
"type":"application/vnd.abiquo.virtualappliancespec+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/action/spec"
},
{
"title":"tasks",
"rel":"tasks",
"type":"application/vnd.abiquo.tasks+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/tasks"
},
{
"title":"scalinggroups",
"rel":"scalinggroups",
"type":"application/vnd.abiquo.scalinggroups+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/scalinggroups"
},
{
"title":"metricsmetadata",
"rel":"metricsmetadata",
"type":"application/vnd.abiquo.metricsmetadata+json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/metrics"
},
{
"title":"collectd",
"rel":"collectd",
"type":"application/json",
"href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/metrics/collectd"
}
]
} |
Next we can determine which templates are available to deploy in our virtual datacenter.
Get
...
templates available to the
...
virtual datacenter
Get all the templates from the repository that are compatible with your virtual datacenter. In this example we only show one virtual machine template.
Divtip | |
---|---|
class | widecode tinycodeAPI Documentation For the Abiquo API documentation of this feature, see Abiquo API Resources and the page for this resource VirtualMachineTemplateResource. |
API Roles required:
...
GET all of the
...
virtual machine templates that are compatible with KVM
Code Block |
---|
* This action requires the privilege VDC_ENUMERATE,VDC_MANAGE,VDC_MANAGE_VAP
|
cURL:
Code Block |
---|
curl -X GET https://example.com/api/cloud/virtualdatacenters/490/action/templates
-H 'Accept:application/vnd.abiquo.virtualmachinetemplates+json;version=4.2' \
-u user:password --verbose |
Success status code: 200
Request payload:
--none--
Response payload:
...
Code Block |
---|
{
"links": [
{
"rel": "first",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/templates?limit=25&by=id&asc=true"
},
{
"rel": "last",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/templates?startwith=0&limit=25&by=id&asc=true"
}
],
"collection": [
{
"id": "1168",
"name": "amzn-ami-hvm-2015.03.0.x86_64-gp2",
"description": "Amazon Linux AMI 2015.03.0 x86_64 HVM GP2",
"osType": "OTHER_64",
"cpuRequired": 2,
"ramRequired": 60,
"shared": false,
"state": "DONE",
"creationDate": "2018-02-13T11:41:04.000+0000",
"creationUser": "137112412989",
"chefEnabled": true,
"iconUrl": "http://icons.abiquo.com/AWS-icon.png",
"loginUser": "ec2-user",
"variables": {},
"enableCpuHotAdd": false,
"enableRamHotAdd": false,
"enableDisksHotReconfigure": false,
"enableNicsHotReconfigure": false,
"enableRemoteAccessHotReconfigure": false,
"enableOnlyHPRecommended": false,
"generateGuestInitialPassword": false,
"links": [
{
"title": "AWS_enterprise_forBilling",
"rel": "enterprise",
"type": "application/vnd.abiquo.enterprise+json",
"href": "https://example.com:443/api/admin/enterprises/65"
},
{
"title": "Others",
"rel": "category",
"type": "application/vnd.abiquo.category+json",
"href": "https://example.com:443/api/config/categories/1"
},
{
"title": "amzn-ami-hvm-2015.03.0.x86_64-gp2",
"rel": "edit",
"type": "application/vnd.abiquo.virtualmachinetemplate+json",
"href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168"
},
{
"title": "tasks",
"rel": "tasks",
"type": "application/vnd.abiquo.tasks+json",
"href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168/tasks"
},
{
"title": "repository",
"rel": "datacenterrepository",
"type": "application/vnd.abiquo.datacenterrepository+json",
"href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2"
},
{
"title": "virtual machines",
"rel": "virtualmachines",
"type": "application/vnd.abiquo.virtualmachines+json",
"href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168/action/virtualmachines"
},
{
"title": "disks",
"rel": "disks",
"type": "application/vnd.abiquo.disks+json",
"href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168/disks"
},
{
"rel": "disk0",
"type": "application/vnd.abiquo.disk+json",
"href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168/disks/1371"
},
{
"title": "c3.large",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3084"
},
{
"title": "m3.large",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3106"
},
{
"title": "m4.2xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3111"
},
{
"title": "c3.xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3085"
},
{
"title": "hs1.8xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3075"
},
{
"title": "t2.small",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3079"
},
{
"title": "c4.large",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3089"
},
{
"title": "m4.xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3110"
},
{
"title": "c4.2xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3091"
},
{
"title": "r3.2xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3116"
},
{
"title": "r3.4xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3117"
},
{
"title": "g2.2xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3076"
},
{
"title": "r3.xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3115"
},
{
"title": "m4.10xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3113"
},
{
"title": "cc2.8xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3073"
},
{
"title": "t2.large",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3081"
},
{
"title": "i2.4xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3096"
},
{
"title": "m3.medium",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3105"
},
{
"title": "m3.2xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3108"
},
{
"title": "i2.2xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3095"
},
{
"title": "i2.8xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3097"
},
{
"title": "c4.xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3090"
},
{
"title": "m4.4xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3112"
},
{
"title": "r3.8xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3118"
},
{
"title": "i2.xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3094"
},
{
"title": "d2.8xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3128"
},
{
"title": "c4.8xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3093"
},
{
"title": "m4.large",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3109"
},
{
"title": "d2.2xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3126"
},
{
"title": "hi1.4xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3074"
},
{
"title": "c3.8xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3088"
},
{
"title": "m3.xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3107"
},
{
"title": "c3.2xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3086"
},
{
"title": "t2.medium",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3080"
},
{
"title": "cr1.8xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3129"
},
{
"title": "c3.4xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3087"
},
{
"title": "c4.4xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3092"
},
{
"title": "d2.4xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3127"
},
{
"title": "d2.xlarge",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3125"
},
{
"title": "r3.large",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3114"
},
{
"title": "t2.micro",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3078"
}
]
}
],
"totalSize": 1
} |
Create the
...
virtual machine
Now we will create the virtual machine. To do this, you will need:
the virtual machines link from the virtual appliance you created
Code Block |
---|
https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines |
the "edit" link to the compatible template (from the previous step). Note that the link here is in the template format. Change the rel entry from "edit" to "virtualmachinetemplate" to use it to create the virtual machine
Code Block |
---|
{ "title": "amzn-ami-hvm-2015.03.0.x86_64-gp2", "rel": "edit", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168" }, |
a "hardwareprofile" link for one of the hardware profiles allowed for the template
Code Block |
---|
{ "title": "t2.micro", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3078" }, |
...
So we will send a POST request with the VM object to the virtual machines link of the virtual appliance. Remember that until we deploy, the VM only exists in Abiquo – we haven't launched the VM in AWS yet.
...
Tip |
---|
...
API Documentation For the Abiquo API documentation of this feature, see Abiquo API Resources and the page for this resource VirtualMachineResource. |
cURL:
Code Block |
---|
curl -X POST https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines \
-H 'Accept:application/vnd.abiquo.virtualmachine+json; version=4.2' \
-H 'Content-Type:application/vnd.abiquo.virtualmachine+json; version=4.2' \
-d @requestpayload.xml \
-u user:password --verbose |
Success status code: 201
Request payload:
Code Block |
---|
{
"links": [
{
"href": "https://example.com:443/api/admin/enterprises/65",
"rel": "enterprise"
},
{
"href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168",
"rel": "virtualmachinetemplate"
},
{
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3078",
"rel": "hardwareprofile"
}
]
} |
Response payload:
...
Code Block |
---|
{
"id": 6376,
"uuid": "ee11c510-026b-4000-af9f-2c876cdeba46",
"name": "ABQ_ee11c510-026b-4000-af9f-2c876cdeba46",
"description": "Amazon Linux AMI 2015.03.0 x86_64 HVM GP2",
"cpu": 1,
"ram": 1024,
"vdrpEnabled": false,
"vdrpPort": 0,
"idState": 1,
"state": "NOT_ALLOCATED",
"idType": 0,
"type": "MANAGED",
"highDisponibility": 0,
"password": "hs7UuYwa",
"metadata": null,
"monitored": false,
"protected": false,
"variables": {},
"creationTimestamp": 1519921476000,
"backuppolicies": [],
"generateGuestInitialPassword": false,
"natrules": [],
"links": [
{
"title": "ABQ_ee11c510-026b-4000-af9f-2c876cdeba46",
"rel": "edit",
"type": "application/vnd.abiquo.virtualmachine+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376"
},
{
"title": "AWS_enterprise_forBilling",
"rel": "enterprise",
"type": "application/vnd.abiquo.enterprise+json",
"href": "https://example.com:443/api/admin/enterprises/65"
},
{
"title": "cloudadmin cloudadmin",
"rel": "user",
"type": "application/vnd.abiquo.user+json",
"href": "https://example.com:443/api/admin/enterprises/65/users/10"
},
{
"title": "vdc_m01j",
"rel": "virtualdatacenter",
"type": "application/vnd.abiquo.virtualdatacenter+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490"
},
{
"title": "vapp_vdc_m01j_001",
"rel": "virtualappliance",
"type": "application/vnd.abiquo.virtualappliance+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836"
},
{
"title": "metadata",
"rel": "metadata",
"type": "application/vnd.abiquo.metadata+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/metadata"
},
{
"title": "vlan network configurations",
"rel": "configurations",
"type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/network/configurations"
},
{
"title": "nics",
"rel": "nics",
"type": "application/vnd.abiquo.nics+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/network/nics"
},
{
"title": "disks",
"rel": "harddisks",
"type": "application/vnd.abiquo.harddisks+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/storage/disks"
},
{
"title": "NOT_ALLOCATED",
"rel": "state",
"type": "application/vnd.abiquo.virtualmachinestate+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/state"
},
{
"title": "virtual machine undeploy",
"rel": "undeploy",
"type": "application/vnd.abiquo.acceptedrequest+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/undeploy"
},
{
"title": "virtual machine deploy",
"rel": "deploy",
"type": "application/vnd.abiquo.acceptedrequest+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/deploy"
},
{
"title": "virtual machine reset",
"rel": "reset",
"type": "application/vnd.abiquo.acceptedrequest+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/reset"
},
{
"title": "virtual machine snapshot",
"rel": "instance",
"type": "application/vnd.abiquo.acceptedrequest+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/instance"
},
{
"title": "remote access",
"rel": "rdpaccess",
"type": "application/vnd.abiquo.virtualmachineconsole+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/config/rdpaccess"
},
{
"title": "tasks",
"rel": "tasks",
"type": "application/vnd.abiquo.tasks+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/tasks"
},
{
"title": "firewalls",
"rel": "firewalls",
"type": "application/vnd.abiquo.links+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/firewalls"
},
{
"title": "load balancers",
"rel": "loadbalancers",
"type": "application/vnd.abiquo.loadbalancers+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/loadbalancers"
},
{
"title": "request on demand backup",
"rel": "requestbackup",
"type": "application/vnd.abiquo.ondemandbackup+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/backup/action/request"
},
{
"title": "request a restore of a backup",
"rel": "requestrestore",
"type": "application/vnd.abiquo.restore+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/backup/action/restore"
},
{
"title": "default",
"rel": "firewall",
"type": "application/vnd.abiquo.firewallpolicy+json",
"href": "https://example.com:443/api/cloud/locations/2/devices/1/firewalls/182"
},
{
"title": "volumes",
"rel": "volumes",
"type": "application/vnd.abiquo.volumes+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/storage/volumes"
},
{
"title": "t2.micro",
"rel": "hardwareprofile",
"type": "application/vnd.abiquo.hardwareprofile+json",
"href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3078"
},
{
"diskControllerType": "IDE",
"length": "8192",
"title": "4ab5d232-4dc0-4618-b73e-fc0b56c40b85",
"rel": "disk0",
"type": "application/vnd.abiquo.harddisk+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/disks/5022"
},
{
"title": "protect",
"rel": "protect",
"type": "text/plain",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/protect"
},
{
"title": "unprotect",
"rel": "unprotect",
"type": "text/plain",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/unprotect"
},
{
"title": "metricsmetadata",
"rel": "metricsmetadata",
"type": "application/vnd.abiquo.metricsmetadata+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/metrics"
},
{
"title": "enablemonitoringlevel",
"rel": "enablemonitoringlevel",
"type": "application/vnd.abiquo.monitoringlevel+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/enablemonitoringlevel"
},
{
"title": "enablemonitoring",
"rel": "enablemonitoring",
"type": "",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/enablemonitoring"
},
{
"title": "collectd",
"rel": "collectd",
"type": "application/json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/metrics/collectd"
},
{
"title": "alarms",
"rel": "alarms",
"type": "application/vnd.abiquo.alarms+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/alarms"
},
{
"title": "actionplans",
"rel": "actionplans",
"type": "application/vnd.abiquo.virtualmachineactionplans+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/actionplans"
},
{
"title": "actionplansflat",
"rel": "actionplansflat",
"type": "application/vnd.abiquo.virtualmachineactionplansflat+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/actionplans"
},
{
"title": "clone",
"rel": "clone",
"type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/clone"
},
{
"title": "Amazon",
"rel": "hypervisortype",
"type": "application/vnd.abiquo.hypervisortype+json",
"href": "https://example.com:443/api/config/hypervisortypes/AMAZON"
},
{
"title": "amzn-ami-hvm-2015.03.0.x86_64-gp2",
"rel": "virtualmachinetemplate",
"type": "application/vnd.abiquo.virtualmachinetemplate+json",
"href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168"
},
{
"title": "Others",
"rel": "category",
"type": "application/vnd.abiquo.category+json",
"href": "https://example.com:443/api/config/categories/1"
}
]
}
|
Deploy
Then we can either deploy the virtual machine VM or the virtual appliance using the links in the corresponding entity. For example, in from the virtual machine above VM, the deploy link is:
Code Block |
---|
{ "title": "virtual machine deploy", "rel": "deploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/deploy" }, |
Deploy a
...
virtual machine
...
Tip |
---|
...
class | widecode tinycode |
---|
API Roles required:
...
API Documentation For the Abiquo API documentation of this feature, see Abiquo API Resources and the pages for this resource VirtualMachineResource and VirtualApplianceResource. |
DEPLOY a virtual machine
Code Block |
---|
* This action requires the privilege VAPP_DEPLOY_UNDEPLOY
|
cURL:
Code Block |
---|
curl -X POST https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/deploy \
-H 'Accept:application/vnd.abiquo.acceptedrequest+json;version=4.2' \
-u user:password --verbose |
Success status code: 202
Request payload:
--none--
Response payload:
Code Block |
---|
{
"message": "You can keep track of the progress in the link",
"links": [
{
"rel": "status",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/tasks/8ceb8256-6599-45f2-8989-e2d8e507c41a"
}
]
}
|
Undeploy a
...
virtual machine
And undeploy:
...
UNDEPLOY a virtual machine
Code Block | |
---|---|
UNDEPLOY a Virtual Machine |
The request payload should be the standard virtual machine task entity
Code Block | ||
---|---|---|
{
"forceVdcLimits": false,
"forceEnterpriseSoftLimits": false,
"forceUndeploy": false,
"links": []
} Code Block | | title |
The newly created
...
task
Code Block |
---|
{
"message": "You can keep track of the progress in the link",
"links": [
{
"rel": "status",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/tasks/cec70487-6d29-4fde-b6ef-e3488f5fe239"
}
]
} |
Check
...
progress
We can query the progress using:
...
class | widecode tinycode |
---|
...
title | The Task |
---|
The task
Code Block |
---|
* This action requires the privilege VAPP_CUSTOMISE_SETTINGS
curl -X GET https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/tasks/cec70487-6d29-4fde-b6ef-e3488f5fe239 \
-H 'Accept:application/vnd.abiquo.task+json; version=4.2' \
-u user:password --verbose |
Here the undeploy task finished successfully
...
Code Block |
---|
{
"taskId": "cec70487-6d29-4fde-b6ef-e3488f5fe239",
"userId": "10",
"type": "UNDEPLOY",
"ownerId": "6376",
"state": "FINISHED_SUCCESSFULLY",
"creationTimestamp": 1519922809,
"timestamp": 1519922843,
"jobs": {
"links": [],
"collection": [
{
"id": "cec70487-6d29-4fde-b6ef-e3488f5fe239.51224d77-a9d0-4384-aedb-f9efa795c742",
"parentTaskId": "cec70487-6d29-4fde-b6ef-e3488f5fe239",
"type": "DECONFIGURE",
"description": "Undeploy task's deconfigure on virtual machine with id 6376",
"state": "DONE",
"rollbackState": "UNKNOWN",
"creationTimestamp": 1519922809,
"timestamp": 1519922842,
"links": []
},
{
"id": "b5eaf47e-1a21-4d3b-8c98-a0514eb4334d",
"parentTaskId": "cec70487-6d29-4fde-b6ef-e3488f5fe239",
"type": "FREE_RESOURCES",
"description": "FRE-OK - Free resources OK",
"state": "DONE",
"rollbackState": "UNKNOWN",
"creationTimestamp": 1519922809,
"timestamp": 1519922843,
"links": []
}
]
},
"links": [
{
"rel": "self",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/tasks/cec70487-6d29-4fde-b6ef-e3488f5fe239"
},
{
"rel": "parent",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/tasks"
},
{
"rel": "result",
"type": "application/vnd.abiquo.virtualmachine+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376"
},
{
"title": "cloudadmin",
"rel": "user",
"type": "application/vnd.abiquo.user+json",
"href": "https://example.com:443/api/admin/enterprises/65/users/10"
},
{
"title": "ABQ_ee11c510-026b-4000-af9f-2c876cdeba46",
"rel": "virtualmachine",
"type": "application/vnd.abiquo.virtualmachine+json",
"href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376"
}
]
} |