You can use the REST API reservation service to create a vCloud reservation.

Input

Use the supported input parameters to control the command output.

Parameter

Description

URL

https://$host/reservation-service/api/reservations

Method

Post

$host

Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server.

$token

Specifies a valid HTTP bearer token with necessary credentials.

HTTP body

The HTTP body describes the reservation to create and calls the REST API used to create the reservation.

Compose the HTTP body using one of the following methods:

  • Copy the HTTP body from the JSON output from this example and edit the applicable field values to compose the HTTP body input for the command line.

  • Update the formatted reservation information to specify the new information:

    • remove the appropriate ID field from the HTTP response

    • edit the field values to compose the HTTP body input for the command line

    For information, see Syntax for Verifying a Reservation and Getting Reservation Details.

Output

The output URL contains the new reservation ID.

Property

Description

status

When the reservation is successfully created, the HTTP response status is 201 created.

Header.Location

The HTTP response contains a Location attribute that is formatted as https://$host /reservation-service/api/reservations/$reservationId.

$reservationId

Specifies the new reservation ID.

curl Command

The following sample command creates a vCloud reservation. The HTTP body is included as part of the command line input.

curl --insecure -H "Accept:application/json" 
-H "Authorization: Bearer $token" 
https://$host/reservation-service/api/reservations -d “
{
  "id": "bf922450-d495-460d-9dbf-1c09b0692db2",
  "name": "TestvAppReservation",
  "reservationTypeId": "Infrastructure.Reservation.Cloud.vCloud",
  "tenantId": "qe",
  "subTenantId": "a5d056be-3aa2-4fdd-ba1e-a3805f26f0e0",
  "enabled": true,
  "priority": 1,
  "reservationPolicyId": null,
  "alertPolicy": {
    "enabled": false,
    "frequencyReminder": 0,
    "emailBgMgr": true,
    "recipients": [
      
    ],
    "alerts": [
      {
        "alertPercentLevel": 80,
        "referenceResourceId": "storage",
        "id": "storage"
      },
      {
        "alertPercentLevel": 80,
        "referenceResourceId": "memory",
        "id": "memory"
      },
      {
        "alertPercentLevel": 80,
        "referenceResourceId": "cpu",
        "id": "cpu"
      },
      {
        "alertPercentLevel": 80,
        "referenceResourceId": "machine",
        "id": "machine"
      }
    ]
  },
  "extensionData": {
    "entries": [
      {
        "key": "computeResource",
        "value": {
          "type": "entityRef",
          "componentId": null,
          "classId": "ComputeResource",
          "id": "c527a0f5-b1ae-4b61-8145-ad9d5c434dc7",
          "label": "Engineering Allocation VDC"
        }
      },
      {
        "key": "machineQuota",
        "value": {
          "type": "integer",
          "value": 0
        }
      },
      {
        "key": "allocationModel",
        "value": {
          "type": "integer",
          "value": 0
        }
      },
      {
        "key": "reservationNetworks",
        "value": {
          "type": "multiple",
          "elementTypeId": "COMPLEX",
          "items": [
            {
              "type": "complex",
              "componentTypeId": "com.mycompany.csp.iaas.blueprint.service",
              "componentId": null,
              "classId": "Infrastructure.Reservation.Network",
              "typeFilter": null,
              "values": {
                "entries": [
                  {
                    "key": "networkPath",
                    "value": {
                      "type": "entityRef",
                      "componentId": null,
                      "classId": "Network",
                      "id": "42c5063c-5422-448f-aac7-22ebe941ac8e",
                      "label": "VM Network SQA"
                    }
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "key": "reservationStorages",
        "value": {
          "type": "multiple",
          "elementTypeId": "COMPLEX",
          "items": [
            {
              "type": "complex",
              "componentTypeId": "com.mycompany.csp.iaas.blueprint.service",
              "componentId": null,
              "classId": "Infrastructure.Reservation.Storage",
              "typeFilter": null,
              "values": {
                "entries": [
                  {
                    "key": "computeResourceStorageTotalSizeGB",
                    "value": {
                      "type": "integer",
                      "value": 1000
                    }
                  },
                  {
                    "key": "storagePath",
                    "value": {
                      "type": "entityRef",
                      "componentId": null,
                      "classId": "Storage",
                      "id": "e655aa78-e5fb-4722-9e8a-0cd4139248cf",
                      "label": "High Performance Storage"
                    }
                  },
                  {
                    "key": "storageReservationPriority",
                    "value": {
                      "type": "integer",
                      "value": 1
                    }
                  },
                  {
                    "key": "storageReservedSizeGB",
                    "value": {
                      "type": "integer",
                      "value": 100
                    }
                  },
                  {
                    "key": "storageEnabled",
                    "value": {
                      "type": "boolean",
                      "value": true
                    }
                  },
                  {
                    "key": "computeResourceStorageFreeSizeGB",
                    "value": {
                      "type": "integer",
                      "value": 691
                    }
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "key": "reservationMemory",
        "value": {
          "type": "complex",
          "componentTypeId": "com.mycompany.csp.iaas.blueprint.service",
          "componentId": null,
          "classId": "Infrastructure.Reservation.Memory",
          "typeFilter": null,
          "values": {
            "entries": [
              {
                "key": "computeResourceMemoryTotalSizeMB",
                "value": {
                  "type": "integer",
                  "value": 13312
                }
              },
              {
                "key": "memoryReservedSizeMb",
                "value": {
                  "type": "integer",
                  "value": 4096
                }
              }
            ]
          }
        }
      }
    ]
  }
} 
“

JSON Output

The output response displays the location URL, including the new vCloud reservation ID.

Location: https://$host/reservation-service/api/reservations/3289b039-2a11-4ab4-a0bc-b583e4c6d085

Copy the output response into an XML editor for use in a future procedure, such as updating or deleting the reservation.