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

Before you begin

About this task

You can use the following procedure to create a vSphere, vCloud Air, or Amazon reservation.

Procedure

  1. Display a list of supported vRealize Automation reservation types by using the reservation service.
    curl --insecure -H "Accept:application/json" 
    -H "Authorization: Bearer $token" 
    https://$host/reservation-service/api/reservations/types
  2. Display a schema definition for a reservation.
    1. Display a schema definition for a vSphere reservation.
      curl --insecure -H "Accept:application/json" 
      -H "Authorization: Bearer $token" 
      https://$host/reservation-service/api/data-service/schema/Infrastructure.Reservation.Virtual.vSphere/default
    2. Display a schema definition for an Amazon reservation.
      curl --insecure -H "Accept:application/json" 
      -H "Authorization: Bearer $token" 
      https://$host/reservation-service/api/data-service/schema/Infrastructure.Reservation.Cloud.Amazon/default
    3. Display a schema definition for a vCloud Air reservation.
      curl --insecure -H "Accept:application/json" 
      -H "Authorization: Bearer $token" 
      https://$host/reservation-service/api/data-service/schema/Infrastructure.Reservation.Cloud.vCloudAir/default
  3. Get the business group ID for a vRealize Automation reservation by using the reservation service.
    curl --insecure -H "Accept:application/json" 
    -H "Authorization: Bearer $token" 
    https://$host/identity/api/tenants/qe/subtenants
  4. Obtain a compute resource for the vRealize Automation reservation by using the reservation service.

    Use the following command to get a compute resource for a vSphere reservation.

    curl --insecure -H "Accept:application/json" 
    -H "Authorization: Bearer $token" 
    https://$host/reservation-service/api/data-service/schema/Infrastructure.Reservation.Virtual.vSphere/default/computeResource/values  -d “{}”
    Example: curl Command for an Amazon EC2 reservation

    Use the following command to get a compute resource for an Amazon reservation.

    curl --insecure -H "Accept:application/json" 
    -H "Authorization: Bearer $token" 
    https://$host/reservation-service/api/data-service/schema/Infrastructure.Reservation.Cloud.Amazon/default/computeResource/values  -d “{}”

    Use the following command to get a compute resource for a vCloud Air reservation.

    curl --insecure -H "Accept:application/json" 
    -H "Authorization: Bearer $token" 
    https://$host/reservation-service/api/data-service/schema/Infrastructure.Reservation.Cloud.vCloudAir/default/computeResource/values  -d “{}”
  5. Use the vRealize Automation REST API reservation service to get a resources schema for any supported reservation type, including a vSphere, Amazon, or vCloud Air reservation.
    1. Display information about available resources, such as storage and network information, for a vSphere reservation by using the reservation service.
      curl --insecure -H "Accept:application/json" 
      -H "Authorization: Bearer $token" 
      https://$host/reservation-service/api/data-service/schema/Infrastructure.Reservation.Virtual.vSphere/default/resourcePool/values  -d “{
        "text": "",
        "dependencyValues": {
          "entries": [{
            "key": "computeResource",
            "value": {
              "type": "entityRef",
              "componentId": null,
              "classId": "ComputeResource",
              "id": " cc254a84-95b8-434a-874d-bdfef8e8ad2c "
            }
          }]
        }
      }
    2. Display resource schema, such as storage and network information, for an Amazon reservation by using the data and schema service.
      curl --insecure -H "Accept:application/json" 
      -H "Authorization: Bearer $token" 
      https://$host/reservation-service/api/data-service/schema/Infrastructure.Reservation.Cloud.Amazon/default/securityGroups/values  -d “
      {
        "text": "",
        "dependencyValues": {
          "entries": [{
            "key": "computeResource",
            "value": {
              "type": "entityRef",
              "componentId": null,
              "classId": "ComputeResource",
              "id": "9d1a3b5a-7162-4a5a-85b7-ec1b2824f554"
            }
          }]
        }
      }
      ”
    3. Display information about available resources, such as storage and network information, for a vCloud Air reservation by using the reservation service.
      curl --insecure -H "Accept:application/json" 
      -H "Authorization: Bearer $token" 
      https://$host/reservation-service/api/data-service/schema/Infrastructure.Reservation.Cloud.vCloudAir/default/reservationStorages/values  -d “
  6. Use the vRealize Automation REST API to create any supported reservation type, including a vSphere, Amazon, or vCloud Air reservation.
    1. Create a vSphere reservation by using the vRealize Automation reservation service.
      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"
            }
      {
        "text": "",
        "dependencyValues": {
          "entries": [{
            "key": "computeResource",
            "value": {
              "type": "entityRef",
              "componentId": null,
              "classId": "ComputeResource",
              "id": "9d1a3b5a-7162-4a5a-85b7-ec1b2824f554"
            }
          }]
        }
      }"
      
          }]
        }
      }
      ”
    2. Create a vCloud Air reservation by using the vRealize Automation reservation service.
      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.vCloudAir",
        "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
                      }
                    }
                  ]
                }
              }
            }
          ]
        }
      } 
      “
    3. Create an Amazon reservation by using the vRealize Automation reservation service.
      curl --insecure -H "Accept:application/json" 
      -H "Authorization: Bearer $token" 
      https://$host/reservation-service/api/reservations -d “
      {
        "name": "TestEC2Reservation",
        "reservationTypeId": "Infrastructure.Reservation.Cloud.Amazon",
        "tenantId": "qe",
        "subTenantId": "a5d056be-3aa2-4fdd-ba1e-a3805f26f0e0",
        "enabled": true,
        "priority": 1,
        "reservationPolicyId": "34d2a612-718e-4814-96c5-225f7f5615a6",
        "alertPolicy": {
          "enabled": false,
          "frequencyReminder": 0,
          "emailBgMgr": true,
          "recipients": [
            
          ],
          "alerts": [
            {
              "alertPercentLevel": 80,
              "referenceResourceId": "machine",
              "id": "machine"
            }
          ]
        },
        "extensionData": {
          "entries": [
            {
              "key": "computeResource",
              "value": {
                "type": "entityRef",
                "componentId": null,
                "classId": "ComputeResource",
                "id": "9d1a3b5a-7162-4a5a-85b7-ec1b2824f554",
                "label": "EC2 841 Endpoint-us-east-1"
              }
            },
            {
              "key": "machineQuota",
              "value": {
                "type": "integer",
                "value": 0
              }
            },
            {
              "key": "securityGroups",
              "value": {
                "type": "multiple",
                "elementTypeId": "ENTITY_REFERENCE",
                "items": [
                  {
                    "type": "entityRef",
                    "componentId": null,
                    "classId": "AmazonSecurityGroup",
                    "id": "10",
                    "label": "default"
                  }
                ]
              }
            },
            {
              "key": "loadBalancers",
              "value": {
                "type": "multiple",
                "elementTypeId": "ENTITY_REFERENCE",
                "items": [
                  {
                    "type": "entityRef",
                    "componentId": null,
                    "classId": "ElasticLoadBalancer",
                    "id": "3",
                    "label": "test1"
                  }
                ]
              }
            },
            {
              "key": "locations",
              "value": {
                "type": "multiple",
                "elementTypeId": "ENTITY_REFERENCE",
                "items": [
                  {
                    "type": "entityRef",
                    "componentId": null,
                    "classId": "AvailabilityZone",
                    "id": "10",
                    "label": "us-east-1a"
                  }
                ]
              }
            },
            {
              "key": "keyPairs",
              "value": {
                "type": "string",
                "value": "Per Provisioning Group"
              }
            }
          ]
        }
      }”
  7. Use the reservation ID to verify that the reservation exists. Also use the ID to get information about the reservation in preparation for updating or deleting it.
    curl --insecure -H "Accept:application/json" 
    -H "Authorization: Bearer $token" 
    https://$host/reservation-service/api/reservations/94d74105-831a-4598-8f42-efd590fea15c