Syntax for Getting a Compute Resource for a Reservation
POST /api/data-service/schema/{schemaClassId}/default/{fieldId}/values creates a compute resource for a vRealize Automation reservation.
Input
Use the supported input parameters to control the command output.
Parameter | Description |
---|---|
URL | https://$vRA/reservation-service/api/data-service/schema/$schemaclassid/default/$fieldid/values |
Method |
Post |
$vRA |
Specifies the appliance name and fully qualified domain name, or IP address of the vRealize Automation server. |
$token |
Specifies a valid HTTP bearer token with necessary credentials. |
$schemaclassid |
Specifies the schema class ID. For a vSphere reservation, specify Infrastructure.Reservation.Virtual.vSphere as the $schemaclassid value. For an Amazon EC2 reservation, specify Infrastructure.Reservation.Cloud.Amazon as the the $schemaclassid value. For a vCloud reservation, specify Infrastructure.Reservation.Cloud.vCloud as the the $schemaclassid value. |
$fieldId | From the schema definition, specifies the
schemaclassid of the
compute resource field, which is is
computeResource.
Enter computeResource for the $fieldId value. |
HTTP body | Because the dependencies entry for this permissible value field is an empty string, provide an empty JSON string "{}" in the HTTP body. |
Output
The command output contains property names and values based on the command input parameters.
The values section contains an array of data rows, each of which represents one of the compute resource objects, returned in a pageable list. Each compute resource object contains the following information.
Property | Description | |
---|---|---|
underlyingValue | Contains a JSON string representing one
permissible value of field.
|
|
label | Contains the compute resource label. This value matches the underlyingValue.label. |
curl Command for a vSphere reservation
The following command retrieves a compute resource for a vSphere reservation.
curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$vRA/reservation-service/api/data-service/schema/Infrastructure.Reservation.Virtual.vSphere/default/computeResource/values -d “{}”
curl Command for an Amazon EC2 reservation
The following command retrieves a compute resource for an Amazon EC2 reservation.
curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$vRA/reservation-service/api/data-service/schema/Infrastructure.Reservation.Cloud.Amazon/default/computeResource/values -d “{}”
curl Command for a vCloud reservation
The following command retrieves a compute resource for a vCloud reservation.
curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$vRA/reservation-service/api/data-service/schema/Infrastructure.Reservation.Cloud.vCloud/default/computeResource/values -d “{}”
JSON Output for a vSphere Reservation
In this example, there are 4 available compute resources that you can use to create a vSphere reservation, for example cc254a84-95b8-434a-874d-bdfef8e8ad2c. Save a copy of the underlyingValue section of the compute resource that you want to an XML editor and use the section content later to create a reservation request.
The following JSON output is returned based on the command input.
{ "values": [{ "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "047e00f5-5424-4ed2-a751-4a334aeaff54", "label": "VC51-Cluster" }, "label": "VC51-Cluster" }, { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "a4349488-9a56-4906-83a5-7d8b33c9d435", "label": "NSX61-RC-ManagementCluster" }, "label": "NSX61-RC-ManagementCluster" }, { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "40b151ce-e409-4d2a-8dae-bb456139a660", "label": "NSX61-RC-ComputeClusterB" }, "label": "NSX61-RC-ComputeClusterB" }, { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "cc254a84-95b8-434a-874d-bdfef8e8ad2c", "label": "NSX61-RC-ComputeClusterA" }, "label": "NSX61-RC-ComputeClusterA" }] }
JSON Output for an Amazon Reservation
In this example, there are 3 available compute resources that you can use to create an Amazon EC2 reservation. Save a copy of the underlyingValue section of the compute resource that you want to an XML editor and use the section content later to create a reservation request.
{ "values": [ { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "fdfa4b95-9476-4c18-81c5-1c0e5cb1131f", "label": "EC2 841 Endpoint-us-west-1" }, "label": "EC2 841 Endpoint-us-west-1" }, { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "4e362590-b634-4269-9da4-548260148fa3", "label": "EC2 841 Endpoint-us-west-2" }, "label": "EC2 841 Endpoint-us-west-2" }, { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "9d1a3b5a-7162-4a5a-85b7-ec1b2824f554", "label": "EC2 841 Endpoint-us-east-1" }, "label": "EC2 841 Endpoint-us-east-1" } ] }
Output for a vCloud Reservation
In this example, there is 1 available compute resource that you can use to create a vCloud reservation. Save a copy of the underlyingValue section of the compute resource that you want to an XML editor and use the section content later to create a reservation request.
{ "values": [ { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "c527a0f5-b1ae-4b61-8145-ad9d5c434dc7", "label": "Engineering Allocation VDC" }, "label": "Engineering Allocation VDC" } ] }