You can use the vRealize Automation REST API reservation service to create a vSphere reservation.

Before you begin

  • Log in to vRealize Automation as a fabric group administrator.

  • Verify that the host name and fully qualified domain name of the vRealize Automation instance are available.

  • If you are not using the API Explorer, verify that you have a valid HTTP bearer token that matches your login credentials. See REST API Authentication.

  • Display a list of the reservation types that are supported in the vRealize Automation server. See Display a List of Supported Reservation Types.

  • Obtain the permissible value field information required to create a new reservation. After you retrieve all permissible value field information, you have the input information required to create a reservation. See Get Resources Schema for a vSphere Reservation.

For the full list of tasks that you can perform before you create a reservation, see Create a Reservation.

Procedure

Create a vSphere reservation.
curl --insecure -H "Accept:application/json" 
-H "Authorization: Bearer $token" 
https://$host/reservation-service/api/reservations -d 
“
{
  "name": "TestCreateReservation",
  "reservationTypeId": "Infrastructure.Reservation.Virtual.vSphere",
  "tenantId": "qe",
  "subTenantId": "ef58f604-528d-4441-a219-4725bead629b",
  "enabled": true,
  "priority": 3,
  "reservationPolicyId": "b71c3a5f-087a-4d9e-9a56-fab785a3d128",
  "alertPolicy": {
    "enabled": true,
    "frequencyReminder": 20,
    "emailBgMgr": false,
    "recipients": ["test1@mycompany.com",
    "test2@mycompany.com"],
    "alerts": [{
      "alertPercentLevel": 10,
      "referenceResourceId": "storage",
      "id": "storage"
    },
    {
      "alertPercentLevel": 20,
      "referenceResourceId": "memory",
      "id": "memory"
    },
    {
      "alertPercentLevel": 30,
      "referenceResourceId": "cpu",
      "id": "cpu"
    },
    {
      "alertPercentLevel": 40,
      "referenceResourceId": "machine",
      "id": "machine"
    }]
  },
  "extensionData": {
    "entries": [{
      "key": "reservationNetworks",
      "value": {
        "type": "multiple",
        "elementTypeId": "COMPLEX",
        "items": [{
          "type": "complex",
          "componentTypeId": "com.mycompany.csp.iaas.blueprint.service",
          "componentId": null,
          "classId": "reservationNetwork",
          "typeFilter": null,
          "values": {
            "entries": [{
              "key": "reservationNetworkPath",
              "value": {
                "type": "entityRef",
                "componentId": null,
                "classId": "Network",
                "id": "44cb65d5-b321-43dd-a2ab-8ecf387bff8f",
                "label": "VM Network SQA"
              }
            }]
          }
        }]
      }
    },
    {
      "key": "custom-Properties-key0",
      "value": {
        "type": "string",
        "value": "custom-property-value0"
      }
    },
    {
      "key": "custom-Properties-key2",
      "value": {
        "type": "string",
        "value": "custom-property-value2"
      }
    },
    {
      "key": "reservationMemory",
      "value": {
        "type": "complex",
        "componentTypeId": "com.mycompany.csp.iaas.blueprint.service",
        "componentId": null,
        "classId": "reservationMemory",
        "typeFilter": null,
        "values": {
          "entries": [{
            "key": "hostMemoryTotalSizeMB",
            "value": {
              "type": "integer",
              "value": 57187
            }
          },
          {
            "key": "memoryReservedSizeMb",
            "value": {
              "type": "integer",
              "value": 15872
            }
          }]
        }
      }
    },
    {
      "key": "computeResource",
      "value": {
        "type": "entityRef",
        "componentId": null,
        "classId": "ComputeResource",
        "id": "cc254a84-95b8-434a-874d-bdfef8e8ad2c",
        "label": "NSX61-RC-ComputeClusterA"
      }
    },
    {
      "key": "machineQuota",
      "value": {
        "type": "integer",
        "value": 2
      }
    },
    {
      "key": "reservationStorages",
      "value": {
        "type": "multiple",
        "elementTypeId": "COMPLEX",
        "items": [{
          "type": "complex",
          "componentTypeId": "com.mycompany.csp.iaas.blueprint.service",
          "componentId": null,
          "classId": "reservationStorage",
          "typeFilter": null,
          "values": {
            "entries": [{
              "key": "storageTotalSizeGB",
              "value": {
                "type": "integer",
                "value": 394
              }
            },
            {
              "key": "storageReservedSizeGB",
              "value": {
                "type": "integer",
                "value": 32
              }
            },
            {
              "key": "storageEnabled",
              "value": {
                "type": "boolean",
                "value": true
              }
            },
            {
              "key": "reservationStoragePath",
              "value": {
                "type": "entityRef",
                "componentId": null,
                "classId": "StoragePath",
                "id": "f48a527b-30a6-4d54-8829-f549bc195b69",
                "label": "VNXe:qe-vnxe-nfs-1"
              }
            },
            {
              "key": "storageFreeSizeGB",
              "value": {
                "type": "integer",
                "value": 120
              }
            },
            {
              "key": "storagePriority",
              "value": {
                "type": "integer",
                "value": 1
              }
            }]
          }
        }]
      }
    },
    {
      "key": "resourcePool",
      "value": {
        "type": "entityRef",
        "componentId": null,
        "classId": "ResourcePools",
        "id": "4e51fabc-19e8-4e79-b413-d52309b3bb62",
        "label": "CoreDev"
      }
    }]
  }
}
”

The command output is a URL that includes the new reservation ID, for example https://$host/reservation-service/api/reservations/94d74105-831a-4598-8f42-efd590fea15c.