...
Code Block |
---|
{ "title":"privateip", "rel":"nic1", "type":"application/vnd.abiquo.privateip+json", "href":"https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips/11" }, |
...
From the link to the NIC in the previous step, get only the networks IPs link
Code Block https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips
Use a GET request to obtain the first 3 IP addresses in this network, and add the query parameter
limit
with a value of3
Code Block curl --verbose 'https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips?limit=3' \ -H 'Accept: application/vnd.abiquo.privateips+json; version=6.1' \ -u user:password -k | jq .
To retrieve IPs that are available for use only, use the query parameter
free
with a value oftrue
The response has 3 IP addresses: the gateway and the IP addresses we created specifically for this exercise.
Code Block √ ~ % curl --verbose -k 'https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips?limit=3' \ -H 'Accept: application/vnd.abiquo.privateips+json; version=6.1' \ -u user:password | jq . > GET /api/cloud/virtualdatacenters/12/privatenetworks/9/ips?limit=3 HTTP/1.1 > Host: mjsabiquoabiquo.lab.abiquoexample.com > Authorization: Basic XXXXXX > User-Agent: curl/7.88.1 > Accept: application/vnd.abiquo.privateips+json; version=6.1 > < HTTP/1.1 200 200 < Date: Wed, 07 Jun 2023 13:54:46 GMT < Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips < Set-Cookie: ABQSESSIONID=5848743475559326145; Max-Age=1800; Expires=Wed, 07-Jun-2023 14:24:46 GMT; Path=/; Secure; HttpOnly; SameSite=strict < X-Abiquo-TracerContext: c2b1df27-14c5-4e28-917d-f793d7dc3a71 < X-Abiquo-Token: XXXXXX < Cache-Control: no-cache, no-store, max-age=0, must-revalidate < Pragma: no-cache < Expires: 0 < Strict-Transport-Security: max-age=31536000 ; includeSubDomains < X-XSS-Protection: 1; mode=block < X-Frame-Options: DENY < X-Content-Type-Options: nosniff < Content-Type: application/vnd.abiquo.privateips+json; version=6.1 < Transfer-Encoding: chunked < { "totalSize": 4, "links": [ { "rel": "first", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips?limit=3&by=ip&asc=true" }, { "rel": "next", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips?startwith=3&limit=3&by=ip&asc=true" }, { "rel": "last", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips?startwith=1&limit=3&by=ip&asc=true" } ], "collection": [ { "id": 8, "ip": "192.168.0.1", "mac": "00:50:56:2F:D8:F3", "name": "0050562FD8F3_captured", "networkName": "default_private_network", "ipv6": false, "quarantine": false, "available": true, "links": [ { "title": "default_private_network", "rel": "privatenetwork", "type": "application/vnd.abiquo.vlan+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9" }, { "title": "privateip", "rel": "self", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips/8" }, { "title": "vdcbcdc", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12" } ] }, { "id": 11, "ip": "192.168.0.2", "mac": "00:50:56:1A:2E:18", "name": "0050561A2E18_captured", "networkName": "default_private_network", "ipv6": false, "usedBy": "1979e77f-32b1-430d-9b92-9f6347dbd416", "quarantine": false, "available": true, "links": [ { "title": "default_private_network", "rel": "privatenetwork", "type": "application/vnd.abiquo.vlan+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9" }, { "title": "privateip", "rel": "self", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips/11" }, { "title": "vdcbcdc", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12" }, { "title": "vapbcdc", "rel": "virtualappliance", "type": "application/vnd.abiquo.virtualappliance+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/virtualappliances/4" }, { "title": "vmapihowto", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/virtualappliances/4/virtualmachines/304" } ] }, { "id": 12, "ip": "192.168.0.3", "mac": "00:50:56:18:63:13", "name": "005056186313_host", "networkName": "default_private_network", "ipv6": false, "quarantine": false, "available": true, "links": [ { "title": "default_private_network", "rel": "privatenetwork", "type": "application/vnd.abiquo.vlan+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9" }, { "title": "privateip", "rel": "self", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips/12" }, { "title": "vdcbcdc", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12" } ] } ] }
...
Code Block |
---|
{ "title": "privateip", "rel": "self", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips/12" }, |
...
Code Block |
---|
{ "title": "privateip", "rel": "nic1", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips/12" }, |
...
Code Block |
---|
√ ~ % curl --verbose 'https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualmachines?vmname=2' \ -H 'Accept: application/vnd.abiquo.virtualmachines+json; version=6.1' \ -u user:password -k | jq . |
...
Code Block |
---|
{ "id": 305, "uuid": "eb613c22-ffa1-4498-827a-ccaf37385c2e", "fqdn": "box.localdomain", "description": "A virtual machine", "coresPerSocket": 1, "idState": 1, "idType": 0, "type": "MANAGED", "highDisponibility": 0, "monitored": false, "monitoringLevel": "DEFAULT", "protected": false, "variables": {}, "backuppolicies": [], "lastSynchronize": 1686046081000, "generateGuestInitialPassword": false, "natrules": [], "vdrpEnabled": true, "vdrpPort": 0, "password": "6t51rgZ9", "deallocated": false, "name": "vmapihowto2", "ram": 48, "cpu": 1, "state": "NOT_ALLOCATED", "creationTimestamp": 1686042455000, "birthTimestamp": 1686045726000, "links": [ { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/admin/enterprises/1" }, { "title": "vmapihowto2", "rel": "edit", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/virtualappliances/4/virtualmachines/305" }, ... { "title": "VMware vCenter Cluster", "rel": "hypervisortype", "type": "application/vnd.abiquo.hypervisortype+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/config/hypervisortypes/VCENTER_CLUSTER" }, { "title": "yVM", "rel": "virtualmachinetemplate", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/admin/enterprises/1/datacenterrepositories/2/virtualmachinetemplates/145" }, { "title": "Others", "rel": "category", "type": "application/vnd.abiquo.category+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/config/categories/1" }, { "title": "privateip", "rel": "nic1", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/privatenetworks/9/ips/12" } ], "usageStatistics": [] } |
...
Code Block |
---|
curl --verbose -X PUT 'https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/virtualappliances/4/virtualmachines/305' \ -H 'Content-Type: application/vnd.abiquo.virtualmachine+json; version=6.1' \ -H 'Accept: application/vnd.abiquo.acceptedrequest+json; version=6.1' \ -u user:password \ -d @vmapihowto2.json -k |
...
Code Block |
---|
√ api_tutorials % curl --verbose -X PUT 'https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/virtualappliances/4/virtualmachines/305' \ -H 'Content-Type: application/vnd.abiquo.virtualmachine+json; version=6.1' \ -H 'Accept: application/vnd.abiquo.acceptedrequest+json; version=6.1' \ -u user:password \ -d @vmapihowto2.json -k > PUT /api/cloud/virtualdatacenters/12/virtualappliances/4/virtualmachines/305 HTTP/1.1 > Host: mjsabiquoabiquo.lab.abiquoexample.com > Authorization: Basic XXXXXXX > User-Agent: curl/7.88.1 > Content-Type: application/vnd.abiquo.virtualmachine+json; version=6.1 > Accept: application/vnd.abiquo.acceptedrequest+json; version=6.1 > Content-Length: 12498 > < HTTP/1.1 204 204 < Date: Wed, 07 Jun 2023 15:06:58 GMT < Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips < Set-Cookie: ABQSESSIONID=7288756894413749700; Max-Age=1800; Expires=Wed, 07-Jun-2023 15:36:58 GMT; Path=/; Secure; HttpOnly; SameSite=strict < X-Abiquo-TracerContext: e54d1e2f-6b6a-4338-ba9e-4c770f4e9813 < X-Abiquo-Token: XXXXXX < Cache-Control: no-cache, no-store, max-age=0, must-revalidate < Pragma: no-cache < Expires: 0 < Strict-Transport-Security: max-age=31536000 ; includeSubDomains < X-XSS-Protection: 1; mode=block < X-Frame-Options: DENY < X-Content-Type-Options: nosniff < |
...
Code Block |
---|
curl -X DELETE https://mjsabiquoabiquo.lab.abiquoexample.com:443/api/cloud/virtualdatacenters/12/virtualappliances/4/virtualmachines/305 \ -H 'Accept: text/json,application/json;' \ -u user:password -k |
...